|
38 | 38 |
|
39 | 39 | # Calculate coverage scores |
40 | 40 | coverage_score_sym = regression_coverage_score( |
41 | | -y, y_pis_sym[:, 0], y_pis_sym[:, 1] |
| 41 | + y, y_pis_sym[:, 0], y_pis_sym[:, 1] |
42 | 42 | ) |
43 | 43 | coverage_score_asym = regression_coverage_score( |
44 | | -y, y_pis_asym[:, 0], y_pis_asym[:, 1] |
| 44 | + y, y_pis_asym[:, 0], y_pis_asym[:, 1] |
45 | 45 | ) |
46 | 46 |
|
47 | 47 | # Sort the values for plotting |
|
68 | 68 | plt.plot(X_sorted, y_pis_sym_sorted[:, 0], color="C1", ls="--") |
69 | 69 | plt.plot(X_sorted, y_pis_sym_sorted[:, 1], color="C1", ls="--") |
70 | 70 | plt.fill_between( |
71 | | -X_sorted.ravel(), |
72 | | -y_pis_sym_sorted[:, 0].ravel(), |
73 | | -y_pis_sym_sorted[:, 1].ravel(), |
74 | | -alpha=0.2, |
| 71 | + X_sorted.ravel(), |
| 72 | + y_pis_sym_sorted[:, 0].ravel(), |
| 73 | + y_pis_sym_sorted[:, 1].ravel(), |
| 74 | + alpha=0.2, |
75 | 75 | ) |
76 | 76 | plt.title( |
77 | | -f"Symmetric Intervals\n" |
78 | | -f"Target and effective coverages for " |
79 | | -f"alpha={alpha:.2f}: ({1-alpha:.3f}, {coverage_score_sym:.3f})" |
| 77 | + f"Symmetric Intervals\n" |
| 78 | + f"Target and effective coverages for " |
| 79 | + f"alpha={alpha:.2f}: ({1-alpha:.3f}, {coverage_score_sym:.3f})" |
80 | 80 | ) |
81 | 81 |
|
82 | 82 | # Plot asymmetric prediction intervals |
|
88 | 88 | plt.plot(X_sorted, y_pis_asym_sorted[:, 0], color="C2", ls="--") |
89 | 89 | plt.plot(X_sorted, y_pis_asym_sorted[:, 1], color="C2", ls="--") |
90 | 90 | plt.fill_between( |
91 | | -X_sorted.ravel(), |
92 | | -y_pis_asym_sorted[:, 0].ravel(), |
93 | | -y_pis_asym_sorted[:, 1].ravel(), |
94 | | -alpha=0.2, |
| 91 | + X_sorted.ravel(), |
| 92 | + y_pis_asym_sorted[:, 0].ravel(), |
| 93 | + y_pis_asym_sorted[:, 1].ravel(), |
| 94 | + alpha=0.2, |
95 | 95 | ) |
96 | 96 | plt.title( |
97 | | -f"Asymmetric Intervals\n" |
98 | | -f"Target and effective coverages for " |
99 | | -f"alpha={alpha:.2f}: ({1-alpha:.3f}, {coverage_score_asym:.3f})" |
| 97 | + f"Asymmetric Intervals\n" |
| 98 | + f"Target and effective coverages for " |
| 99 | + f"alpha={alpha:.2f}: ({1-alpha:.3f}, {coverage_score_asym:.3f})" |
100 | 100 | ) |
101 | 101 | plt.tight_layout() |
102 | 102 | plt.show() |
|
0 commit comments