@@ -51,6 +51,7 @@ class that block bootstraps the training set.
51
51
from sklearn .ensemble import RandomForestRegressor
52
52
from sklearn .model_selection import RandomizedSearchCV , TimeSeriesSplit
53
53
54
+ from mapie .conformity_scores import AbsoluteConformityScore
54
55
from mapie .metrics import (regression_coverage_score ,
55
56
regression_mean_width_score )
56
57
from mapie .subsample import BlockBootstrap
@@ -187,8 +188,10 @@ class that block bootstraps the training set.
187
188
cv_mapiets = BlockBootstrap (
188
189
n_resamplings = 10 , n_blocks = 10 , overlapping = False , random_state = 59
189
190
)
191
+ cs = AbsoluteConformityScore (sym = False )
190
192
mapie_enbpi = MapieTimeSeriesRegressor (
191
- model , method = "enbpi" , cv = cv_mapiets , agg_function = "mean" , n_jobs = - 1
193
+ model , method = "enbpi" , cv = cv_mapiets , conformity_score = cs ,
194
+ agg_function = "mean" , n_jobs = - 1
192
195
)
193
196
194
197
##############################################################################
@@ -216,8 +219,6 @@ class that block bootstraps the training set.
216
219
y_pred_pfit = np .zeros (y_pred_npfit .shape )
217
220
y_pis_pfit = np .zeros (y_pis_npfit .shape )
218
221
conformity_scores_pfit = []
219
- lower_quantiles_pfit = []
220
- higher_quantiles_pfit = []
221
222
y_pred_pfit [:gap ], y_pis_pfit [:gap , :, :] = mapie_enbpi .predict (
222
223
X_test .iloc [:gap , :], alpha = alpha , ensemble = True , optimize_beta = True
223
224
)
@@ -236,8 +237,6 @@ class that block bootstraps the training set.
236
237
optimize_beta = True
237
238
)
238
239
conformity_scores_pfit .append (mapie_enbpi .conformity_scores_ )
239
- lower_quantiles_pfit .append (mapie_enbpi .lower_quantiles_ )
240
- higher_quantiles_pfit .append (mapie_enbpi .higher_quantiles_ )
241
240
coverage_pfit = regression_coverage_score (
242
241
y_test , y_pis_pfit [:, 0 , 0 ], y_pis_pfit [:, 1 , 0 ]
243
242
)
0 commit comments