Skip to content

Commit 8661f7e

Browse files
authored
Merge pull request #180 from scikit-learn-contrib/doc_enbpi
Doc enbpi
2 parents bd63980 + ac6fa51 commit 8661f7e

File tree

5 files changed

+66
-5
lines changed

5 files changed

+66
-5
lines changed

HISTORY.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ History
77
* Relax and fix typing
88
* Add Split Conformal Quantile Regression
99
* Add EnbPI method for Time Series Regression
10+
* Add EnbPI Documentation
1011

1112
0.3.2 (2022-03-11)
1213
------------------

README.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,9 @@ International Conference on Learning Representations 2021.
247247
[6] Yaniv Romano, Evan Patterson, Emmanuel J. Candès.
248248
"Conformalized Quantile Regression." Advances in neural information processing systems 32 (2019).
249249

250-
[7] Chen Xu, Yao Xie.
251-
"Conformal prediction for dynamic time-series"
252-
https://arxiv.org/abs/2010.09107
250+
[7] Chen Xu and Yao Xie.
251+
"Conformal Prediction Interval for Dynamic Time-Series."
252+
International Conference on Machine Learning (ICML, 2021).
253253

254254

255255
📝 License

doc/images/comp-methods.csv

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@
1010
**CV-minmax**,:math:`\geq 1-\alpha`,:math:`> 1-\alpha`,:math:`K`,:math:`K \times n_{test}`
1111
**Jackknife-aB+**,:math:`\geq 1-2\alpha`,:math:`\gtrsim 1-\alpha`,:math:`K`,:math:`K \times n_{test}`
1212
**Jackknife-aB-minmax**,:math:`\geq 1-\alpha`,:math:`> 1-\alpha`,:math:`K`,:math:`K \times n_{test}`
13-
**Conformalized quantile regressor**,:math:`\geq 1-\alpha`,:math:`\gtrsim 1-\alpha`,:math:`3`,:math:`3 \times n_{test}`
13+
**Conformalized quantile regressor**,:math:`\geq 1-\alpha`,:math:`\gtrsim 1-\alpha`,:math:`3`,:math:`3 \times n_{test}`
14+
**EnbPI**,:math:`\geq 1-\alpha` (asymptotic),:math:`\gtrsim 1-\alpha`,:math:`K`,:math:`K \times n_{test}`

doc/images/quickstart_1.png

0 Bytes
Loading

doc/theoretical_description_regression.rst

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,58 @@ Note that this means that using the split method will require to run three separ
241241
to estimate the prediction intervals.
242242

243243

244+
9. The ensemble batch prediction intervals (EnbPI) method
245+
=========================================================
246+
247+
The coverage guarantee offered by the various resampling methods based on the
248+
jackknife strategy, and implemented in MAPIE, are only valid under the "exchangeability
249+
hypothesis". It means that the probability law of data should not change up to
250+
reordering.
251+
This hypothesis is not revelant in many cases, notably for dynamical times series.
252+
That is why a specific class is needed, namely
253+
:class:`mapie.time_series_regression.MapieTimeSeriesRegressor`.
254+
255+
Its implementation looks like the jackknife+-after-bootstrap method. The
256+
leave-one-out (LOO) estimators are approximated thanks to a few boostraps.
257+
However the confidence intervals are like those of the jackknife method.
258+
259+
.. math::
260+
\hat{C}_{n, \alpha}^{\rm EnbPI}(X_{n+1}) = [\hat{\mu}_{agg}(X_{n+1}) + \hat{q}_{n, \beta}\{ R_i^{\rm LOO} \}, \hat{\mu}_{agg}(X_{n+1}) + \hat{q}_{n, (1 - \alpha + \beta)}\{ R_i^{\rm LOO} \}]
261+
where :math:`\hat{\mu}_{agg}(X_{n+1})` is the aggregation of the predictions of
262+
the LOO estimators (mean or median), and
263+
:math:`R_i^{\rm LOO} = |Y_i - \hat{\mu}_{-i}(X_{i})|`
264+
is the residual of the LOO estimator :math:`\hat{\mu}_{-i}` at :math:`X_{i}`.
265+
266+
The residuals are no longer considered in absolute values but in relative
267+
values and the width of the confidence intervals are minimized, up to a given gap
268+
between the quantiles' level, optimizing the parameter :math:`\beta`.
269+
270+
Moreover, the residuals are updated during the prediction, each time new observations
271+
are available. So that the deterioration of predictions, or the increase of
272+
noise level, can be dynamically taken into account.
273+
274+
Finally, the coverage guarantee is no longer absolute but asymptotic up to two
275+
hypotheses:
276+
277+
1. Errors are short-term independent and identically distributed (i.i.d)
278+
279+
2. Estimation quality: there exists a real sequence :math:`(\delta_T)_{T > 0}`
280+
that converges to zero such that
281+
282+
.. math::
283+
\frac{1}{T}\sum_1^T(\hat{\mu}_{-t}(x_t) - \mu(x_t))^2 < \delta_T^2
284+
285+
The coverage level depends on the size of the training set and on
286+
:math:`(\delta_T)_{T > 0}`.
287+
288+
Be careful: the bigger the training set, the better the covering guarantee
289+
for the point following the training set. However, if the residuals are
290+
updated gradually, but the model is not refitted, the bigger the training set
291+
is, the slower the update of the residuals is effective. Therefore there is a
292+
compromise to take on the number of training samples to fit the model and
293+
update the prediction intervals.
294+
295+
244296
Key takeaways
245297
=============
246298

@@ -266,6 +318,9 @@ Key takeaways
266318
theoretical and practical coverages due to the larger widths of the prediction intervals.
267319
It is therefore advised to use them when conservative estimates are needed.
268320

321+
- If the "exchangeability hypothesis" is not valid, typically for time series,
322+
use EnbPI, and update the residuals each time new observations are available.
323+
269324
The table below summarizes the key features of each method by focusing on the obtained coverages and the
270325
computational cost. :math:`n`, :math:`n_{\rm test}`, and :math:`K` are the number of training samples,
271326
test samples, and cross-validated folds, respectively.
@@ -288,4 +343,8 @@ References
288343
34th Conference on Neural Information Processing Systems (NeurIPS 2020).
289344

290345
[3] Yaniv Romano, Evan Patterson, Emmanuel J. Candès.
291-
"Conformalized Quantile Regression." Advances in neural information processing systems 32 (2019).
346+
"Conformalized Quantile Regression." Advances in neural information processing systems 32 (2019).
347+
348+
[7] Chen Xu and Yao Xie.
349+
"Conformal Prediction Interval for Dynamic Time-Series."
350+
International Conference on Machine Learning (ICML, 2021).

0 commit comments

Comments
 (0)