Skip to content

MAPIE

The MAPIE pack catches removed MAPIE 0.x calls, broken conformal coverage guarantees, invalid arguments, duplicate model fits, and unseeded resampling on files that import MAPIE. Rules fire only on calls bound to mapie imports.

Rules Safe fix Unsafe fix Manual fix
14 1 6 7
Rule Severity Fix What it finds
removed-in-mapie error unsafe The MAPIE 0.x API was removed, so the import or the call raises on MAPIE 1.6.
deprecated-in-mapie warning safe MAPIE renamed or stopped reading these forms, and they warn.
Rule Severity Fix What it finds
aci-without-infinite-bounds warning none When TimeSeriesRegressor(method="aci") calls adapt_conformal_inference on a drifting series, consecutive misses can push the adaptive level to zero.
alpha-as-confidence-level error unsafe confidence_level is the share of rows to cover, which is 1 minus alpha, so confidence_level=0.1 makes intervals that cover about a tenth of the rows.
calibrate-on-training-rows error none Conformalizing on the training rows makes the model's errors look smaller than on new rows, so the intervals cover about half of what you asked for.
coverage-on-seen-rows error none Measuring coverage on rows the model was fitted or conformalized on makes the intervals look better than they are.
shuffled-time-series-split warning unsafe A shuffled split puts test rows between training rows in time, so a TimeSeriesRegressor looks better on them than on later rows.
Rule Severity Fix What it finds
prefit-estimator-not-fitted error unsafe These classes default to prefit=True, and an estimator built in the call is not fitted, so conformalize raises.
quantile-estimator-loss error unsafe A conformalized quantile regressor needs a model with the quantile loss, and fit raises without it.
predict-function-returns-labels error unsafe BinaryClassificationController needs a function that returns class probabilities, and predict returns labels, so calibrate raises IndexError.
risk-control-method error none Each risk takes only some control methods, and some methods need a confidence_level, so calibrate raises here.
Rule Severity Fix What it finds
predict-and-predict-interval warning none predict_interval already returns the point predictions as its first value, so calling predict too runs the model twice.
refit-per-confidence-level warning none Building one conformal object per confidence level fits the model once per level.
Rule Severity Fix What it finds
unseeded-resampling info none These MAPIE objects draw folds or samples with a new seed on every run, so the intervals change from run to run.