Abstract
MAPIE (Model Agnostic Prediction Interval Estimator) is a scikit-learn-compatible Python library that implements rigorous uncertainty quantification (UQ) for machine learning models. By utilizing conformal prediction, MAPIE generates prediction intervals with mathematically guaranteed coverage, independent of the underlying data distribution. This paper outlines the library's methodology, its application to regression, classification, and time-series data, and demonstrates its effectiveness through empirical benchmarks.
Introduction
Modern machine learning models often operate as "black boxes," providing point estimates without associated confidence measures. In critical domains such as medicine, finance, and autonomous systems, the absence of uncertainty quantification poses significant risks. While Bayesian methods and Quantile Regression offer solutions, they frequently rely on specific architectures or distributional assumptions. MAPIE addresses these limitations by providing a distribution-free UQ framework that is model-agnostic, theoretically grounded, and standardized via the scikit-learn API.
Methodology
The foundation of MAPIE is Conformal Prediction (CP), which utilizes "conformity scores" to quantify how well new observations align with training data.
Regression and Time Series
For regression, MAPIE implements data-efficient variations such as Jackknife+, CV+, and Jackknife+-after-Bootstrap. These methods leverage resampling to estimate residuals without requiring a dedicated calibration set. In time-series contexts, where the assumption of exchangeability is violated, MAPIE employs Ensemble Batch Prediction Intervals (EnbPI). EnbPI adapts to "concept drift" by dynamically updating residuals as new data is observed.
Classification
For classification tasks, the library provides methods like LABEL, Adaptive Prediction Sets (APS), and Top-K. These techniques produce prediction sets rather than single labels, ensuring that the true class is included within the set with a user-specified probability.
Experimental Evaluation
The library's performance was evaluated using two primary datasets:
- Victoria Electricity Demand: A time-series dataset featuring a simulated "change point" (a 2GW drop) to test adaptive UQ.
- CIFAR10: A benchmark image classification dataset used to assess the reliability of prediction sets.
Results and Discussion
Adaptive Time-Series Forecasting
A key strength of MAPIE is its ability to handle non-stationary data. In the electricity demand experiment, the model encountered a sudden regime shift. By updating residuals during inference, MAPIE's EnbPI implementation successfully expanded its prediction intervals to encompass the new data distribution, signaling increased uncertainty to the user.
Reliable Classification Sets
On the CIFAR10 dataset, MAPIE's conformal methods achieved the target marginal coverage exactly, contrasting with "naive" softmax-based uncertainty which often proved overconfident. Evaluation of different methods revealed trade-offs between set size and the frequency of empty prediction sets. The APS method was found to be particularly robust, avoiding empty sets while maintaining coverage.
Conclusion and Future Work
MAPIE provides a robust, easy-to-use framework for adding rigorous uncertainty quantification to existing machine learning pipelines. While current versions assume constant interval widths (homoscedasticity) and exhibit a slight lag in time-series adaptation, future developments aim to incorporate Conformalized Quantile Regression (CQR) for heteroscedastic noise and extend support to tasks like image segmentation and object detection.
Summary updated