Skip to content

Commit f386fb4

Browse files
DOCS: Add MAPIE v1 docstrings to the DOC (#554)
* DOCS: Add MAPIE v1 regression docstrings to ReadTheDoc, fix warnings
1 parent 7897690 commit f386fb4

File tree

4 files changed

+97
-78
lines changed

4 files changed

+97
-78
lines changed

doc/api.rst

Lines changed: 60 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,28 @@
22
MAPIE API
33
#########
44

5-
.. currentmodule:: mapie
5+
Regression V1 (from mapie_v1)
6+
=============================
67

7-
Regression
8-
==========
8+
.. autosummary::
9+
:toctree: generated/
10+
:template: class.rst
11+
12+
mapie_v1.regression.SplitConformalRegressor
13+
mapie_v1.regression.CrossConformalRegressor
14+
mapie_v1.regression.JackknifeAfterBootstrapRegressor
15+
mapie_v1.regression.ConformalizedQuantileRegressor
16+
17+
Regression (from mapie)
18+
=======================
919

1020
.. autosummary::
1121
:toctree: generated/
1222
:template: class.rst
1323

14-
regression.MapieRegressor
15-
regression.MapieQuantileRegressor
16-
regression.MapieTimeSeriesRegressor
24+
mapie.regression.MapieRegressor
25+
mapie.regression.MapieQuantileRegressor
26+
mapie.regression.MapieTimeSeriesRegressor
1727

1828
Classification
1929
==============
@@ -22,7 +32,7 @@ Classification
2232
:toctree: generated/
2333
:template: class.rst
2434

25-
classification.MapieClassifier
35+
mapie.classification.MapieClassifier
2636

2737
Multi-Label Classification
2838
==========================
@@ -31,7 +41,7 @@ Multi-Label Classification
3141
:toctree: generated/
3242
:template: class.rst
3343

34-
multi_label_classification.MapieMultiLabelClassifier
44+
mapie.multi_label_classification.MapieMultiLabelClassifier
3545

3646
Calibration
3747
===========
@@ -40,64 +50,64 @@ Calibration
4050
:toctree: generated/
4151
:template: class.rst
4252

43-
calibration.MapieCalibrator
53+
mapie.calibration.MapieCalibrator
4454

4555
Metrics
4656
=======
4757

4858
.. autosummary::
4959
:toctree: generated/
5060
:template: function.rst
51-
52-
metrics.classification_coverage_score
53-
metrics.classification_coverage_score_v2
54-
metrics.classification_mean_width_score
55-
metrics.classification_ssc
56-
metrics.classification_ssc_score
57-
metrics.cumulative_differences
58-
metrics.expected_calibration_error
59-
metrics.hsic
60-
metrics.kolmogorov_smirnov_cdf
61-
metrics.kolmogorov_smirnov_p_value
62-
metrics.kolmogorov_smirnov_statistic
63-
metrics.kuiper_cdf
64-
metrics.kuiper_p_value
65-
metrics.kuiper_statistic
66-
metrics.length_scale
67-
metrics.regression_coverage_score
68-
metrics.regression_coverage_score_v2
69-
metrics.regression_mean_width_score
70-
metrics.regression_ssc
71-
metrics.regression_ssc_score
72-
metrics.spiegelhalter_p_value
73-
metrics.spiegelhalter_statistic
74-
metrics.top_label_ece
75-
76-
Conformity scores (regression)
61+
62+
mapie.metrics.classification_coverage_score
63+
mapie.metrics.classification_coverage_score_v2
64+
mapie.metrics.classification_mean_width_score
65+
mapie.metrics.classification_ssc
66+
mapie.metrics.classification_ssc_score
67+
mapie.metrics.cumulative_differences
68+
mapie.metrics.expected_calibration_error
69+
mapie.metrics.hsic
70+
mapie.metrics.kolmogorov_smirnov_cdf
71+
mapie.metrics.kolmogorov_smirnov_p_value
72+
mapie.metrics.kolmogorov_smirnov_statistic
73+
mapie.metrics.kuiper_cdf
74+
mapie.metrics.kuiper_p_value
75+
mapie.metrics.kuiper_statistic
76+
mapie.metrics.length_scale
77+
mapie.metrics.regression_coverage_score
78+
mapie.metrics.regression_coverage_score_v2
79+
mapie.metrics.regression_mean_width_score
80+
mapie.metrics.regression_ssc
81+
mapie.metrics.regression_ssc_score
82+
mapie.metrics.spiegelhalter_p_value
83+
mapie.metrics.spiegelhalter_statistic
84+
mapie.metrics.top_label_ece
85+
86+
Conformity Scores (Regression)
7787
==============================
7888

7989
.. autosummary::
8090
:toctree: generated/
8191
:template: class.rst
8292

83-
conformity_scores.BaseRegressionScore
84-
conformity_scores.AbsoluteConformityScore
85-
conformity_scores.GammaConformityScore
86-
conformity_scores.ResidualNormalisedScore
93+
mapie.conformity_scores.BaseRegressionScore
94+
mapie.conformity_scores.AbsoluteConformityScore
95+
mapie.conformity_scores.GammaConformityScore
96+
mapie.conformity_scores.ResidualNormalisedScore
8797

88-
Conformity scores (classification)
98+
Conformity Scores (Classification)
8999
==================================
90100

91101
.. autosummary::
92102
:toctree: generated/
93103
:template: class.rst
94104

95-
conformity_scores.BaseClassificationScore
96-
conformity_scores.NaiveConformityScore
97-
conformity_scores.LACConformityScore
98-
conformity_scores.APSConformityScore
99-
conformity_scores.RAPSConformityScore
100-
conformity_scores.TopKConformityScore
105+
mapie.conformity_scores.BaseClassificationScore
106+
mapie.conformity_scores.NaiveConformityScore
107+
mapie.conformity_scores.LACConformityScore
108+
mapie.conformity_scores.APSConformityScore
109+
mapie.conformity_scores.RAPSConformityScore
110+
mapie.conformity_scores.TopKConformityScore
101111

102112
Resampling
103113
==========
@@ -106,15 +116,14 @@ Resampling
106116
:toctree: generated/
107117
:template: class.rst
108118

109-
subsample.BlockBootstrap
110-
subsample.Subsample
111-
119+
mapie.subsample.BlockBootstrap
120+
mapie.subsample.Subsample
112121

113122
Mondrian
114-
==========
123+
========
115124

116125
.. autosummary::
117126
:toctree: generated/
118127
:template: class.rst
119128

120-
mondrian.MondrianCP
129+
mapie.mondrian.MondrianCP

mapie_v1/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from . import classification, regression
2+
from ._version import __version__
3+
4+
__all__ = [
5+
"regression",
6+
"classification",
7+
"__version__"
8+
]

mapie_v1/_version.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = "1.0.0"

mapie_v1/regression.py

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@
2222
class SplitConformalRegressor:
2323
"""
2424
A conformal regression model using split conformal prediction to generate
25-
prediction intervals with statistical guarantees. This method involves
26-
using a hold-out conformity set to determine prediction intervals around
27-
point predictions from a base regressor.
25+
prediction intervals.
26+
27+
This method involves using a hold-out conformity set to determine
28+
prediction intervals around point predictions from a base regressor.
2829
2930
Parameters
3031
----------
@@ -243,10 +244,11 @@ def predict(
243244
class CrossConformalRegressor:
244245
"""
245246
A conformal regression model using cross-conformal prediction to generate
246-
prediction intervals with statistical guarantees. This method involves
247-
computing conformity scoring across multiple folds in a cross-validation
248-
fashion to determine prediction intervals around point predictions from a
249-
base regressor.
247+
prediction intervals.
248+
249+
This method involves computing conformity scoring across multiple folds in
250+
a cross-validation fashion to determine prediction intervals around point
251+
predictions from a base regressor.
250252
251253
Parameters
252254
----------
@@ -272,20 +274,20 @@ class CrossConformalRegressor:
272274
The method used to compute prediction intervals. Options are:
273275
- "base": Based on the conformity scores from each fold.
274276
- "plus": Based on the conformity scores from each fold and
275-
the test set predictions.
277+
the test set predictions.
276278
- "minmax": Based on the conformity scores from each fold and
277-
the test set predictions, using the minimum and maximum among
278-
each fold models.
279+
the test set predictions, using the minimum and maximum among
280+
each fold models.
279281
280282
cv : Union[int, BaseCrossValidator], default=5
281283
The cross-validation strategy used to compute confomity scores.
282284
Valid options:
283285
- integer, to specify the number of folds
284286
- any ``sklearn.model_selection.BaseCrossValidator`` suitable for
285-
regression, or a custom cross-validator inheriting from it.
286-
Main variants in the cross conformal setting are:
287-
- ``sklearn.model_selection.KFold`` (vanilla cross conformal)
288-
- ``sklearn.model_selection.LeaveOneOut`` (jackknife)
287+
regression, or a custom cross-validator inheriting from it.
288+
Main variants in the cross conformal setting are:
289+
* ``sklearn.model_selection.KFold`` (vanilla cross conformal)
290+
* ``sklearn.model_selection.LeaveOneOut`` (jackknife)
289291
290292
n_jobs : Optional[int], default=None
291293
The number of jobs to run in parallel when applicable.
@@ -304,7 +306,7 @@ class CrossConformalRegressor:
304306
An array containing the prediction intervals with shape:
305307
- `(n_samples, 2)` if `confidence_level` is a single float
306308
- `(n_samples, 2, n_confidence_levels)` if `confidence_level`
307-
is a list of floats.
309+
is a list of floats.
308310
309311
Examples
310312
--------
@@ -492,7 +494,7 @@ def predict(
492494
Generates point predictions for the input data `X`:
493495
- using the model fitted on the entire dataset
494496
- or if aggregation_method is provided, aggregating predictions from
495-
the models fitted on each fold
497+
the models fitted on each fold
496498
497499
Parameters
498500
----------
@@ -524,9 +526,11 @@ def predict(
524526
class JackknifeAfterBootstrapRegressor:
525527
"""
526528
A conformal regression model using the jackknife-after-bootstrap approach
527-
to generate prediction intervals with statistical guarantees. This method
528-
combines bootstrap sampling with the jackknife technique to produce robust
529-
prediction intervals around point predictions from a base regressor.
529+
to generate prediction intervals.
530+
531+
This method combines bootstrap sampling with the jackknife technique
532+
to produce robust prediction intervals around point predictions from
533+
a base regressor.
530534
531535
Parameters
532536
----------
@@ -553,9 +557,9 @@ class JackknifeAfterBootstrapRegressor:
553557
The method used for jackknife-after-bootstrap prediction. Options are:
554558
- "base": Based on the conformity scores from each bootstrap sample.
555559
- "plus": Based on the conformity scores from each bootstrap sample and
556-
the testing prediction.
560+
the testing prediction.
557561
- "minmax": Based on the minimum and maximum conformity scores from
558-
each bootstrap sample.
562+
each bootstrap sample.
559563
560564
n_bootstraps : int, default=100
561565
The number of bootstrap resamples to generate for the
@@ -718,8 +722,9 @@ def predict(
718722
class ConformalizedQuantileRegressor:
719723
"""
720724
A conformal quantile regression model that generates prediction intervals
721-
with statistical guarantees using quantile regression as the base
722-
estimator. This approach provides prediction intervals by leveraging
725+
using quantile regression as the base estimator.
726+
727+
This approach provides prediction intervals by leveraging
723728
quantile predictions and applying conformal adjustments to ensure coverage.
724729
725730
Parameters
@@ -790,10 +795,6 @@ def __init__(
790795
estimator: RegressorMixin = QuantileRegressor(),
791796
confidence_level: Union[float, List[float]] = 0.9,
792797
conformity_score: Union[str, BaseRegressionScore] = "absolute",
793-
# n_jobs: Optional[int] = None
794-
# Not yet available in MapieQuantileRegressor
795-
# verbose: int = 0,
796-
# Idem
797798
random_state: Optional[Union[int, np.random.RandomState]] = None,
798799
) -> None:
799800
pass

0 commit comments

Comments
 (0)