Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REFACTOR: restucture the MapieQuantileRegressor Fit - Split the fit into prefit_estimators, fit_estimators and conformalize #565

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
d592283
v1 branch - initial commit (made of a bunch of wip commits squashed t…
Oct 9, 2024
085273b
DOC: reorganize documentation, add migration_guide in doc in .rst for…
Valentin-Laurent Nov 21, 2024
434e420
DOC: add groups in .conformalize for CrossConformalRegression, improv…
Valentin-Laurent Nov 21, 2024
47ea0cf
TEST & DOC : add integration tests for CrossConformalRegressor, finis…
Valentin-Laurent Nov 27, 2024
4b3b02b
DOC: add decision trees (#546)
Valentin-Laurent Nov 29, 2024
b2ad363
REFACTOR & ENH: Split .fit into .fit_single_estimator and fit_multi_e…
jawadhussein462 Dec 2, 2024
96f5da0
REFACTOR: make SplitConformalRegressor attributes private, improve v1…
Valentin-Laurent Dec 2, 2024
f4d7add
CHORE: add -k option to launch specific v1 integration tests from MAK…
Valentin-Laurent Dec 3, 2024
974e83a
ENH: implement checks for CrossConformalRegression, make utils.py non…
Valentin-Laurent Dec 4, 2024
9508c3e
TESTS: fix and improve v1 integration tests
Valentin-Laurent Dec 4, 2024
f892303
FIX: back-end edge case making v1 tests fail
Valentin-Laurent Dec 4, 2024
ca1833d
ENH: fix and finish CrossConformalRegressor implementation
Valentin-Laurent Dec 4, 2024
370ca6d
ENH: remove optimize_beta warning in back-end (optimize_beta has been…
Valentin-Laurent Dec 4, 2024
cd00088
DOCS: Add MAPIE v1 docstrings to the DOC (#554)
jawadhussein462 Dec 6, 2024
dbffafa
CHORE: set-up mypy for v1 code, add it to CI, fix existing warnings
Valentin-Laurent Dec 5, 2024
c979c23
CHORE: set-up mypy for v1 code, add it to CI, fix existing warnings
Valentin-Laurent Dec 5, 2024
6e078f4
CHORE: remove type check v1 from CI
Valentin-Laurent Dec 6, 2024
0c49868
TEST: add integration test for JackknifeAfterBootstrapRegressor (#556)
jawadhussein462 Dec 9, 2024
47cd981
FIX: correct warnings and error messages to match the v1 API
Valentin-Laurent Dec 9, 2024
0cbc31a
Merge pull request #558 from scikit-learn-contrib/v1-update-parameter…
jawadhussein462 Dec 12, 2024
f1b0707
ENH: implement JackknifeAfterBootstrap regressor, fix integration tes…
Valentin-Laurent Dec 12, 2024
bd243a8
REFACTOR: restucture the MapieQuantileRegressor Fit - Split the fit i…
qroa Dec 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ var/
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
# Tests / coverage reports
htmlcov/
.tox/
.coverage
Expand All @@ -59,6 +59,7 @@ nosetests.xml
coverage.xml
*,cover
.hypothesis/
mapie_v1/integration_tests/mapie_v0_package

# Translations
*.mo
Expand Down
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
.PHONY: tests doc build

mapie_v0_folder_name = mapie_v0_package

lint:
flake8 . --exclude=doc

type-check:
mypy mapie

v1-type-check:
mypy mapie_v1 --exclude $(mapie_v0_folder_name)

tests:
pytest -vs --doctest-modules mapie

integration-tests-v1:
@pip install mapie --no-dependencies --target=./mapie_v1/integration_tests/$(mapie_v0_folder_name) >/dev/null 2>&1
@mv ./mapie_v1/integration_tests/$(mapie_v0_folder_name)/mapie ./mapie_v1/integration_tests/$(mapie_v0_folder_name)/mapiev0
@- export PYTHONPATH="${PYTHONPATH}:./mapie_v1/integration_tests/$(mapie_v0_folder_name)"; pytest -vs mapie_v1/integration_tests/tests -k $(pattern)
@mv ./mapie_v1/integration_tests/$(mapie_v0_folder_name)/mapiev0 ./mapie_v1/integration_tests/$(mapie_v0_folder_name)/mapie

coverage:
pytest -vs \
--doctest-modules \
Expand Down
111 changes: 60 additions & 51 deletions doc/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,28 @@
MAPIE API
#########

.. currentmodule:: mapie
Regression V1 (from mapie_v1)
=============================

Regression
==========
.. autosummary::
:toctree: generated/
:template: class.rst

mapie_v1.regression.SplitConformalRegressor
mapie_v1.regression.CrossConformalRegressor
mapie_v1.regression.JackknifeAfterBootstrapRegressor
mapie_v1.regression.ConformalizedQuantileRegressor

Regression (from mapie)
=======================

.. autosummary::
:toctree: generated/
:template: class.rst

regression.MapieRegressor
regression.MapieQuantileRegressor
regression.MapieTimeSeriesRegressor
mapie.regression.MapieRegressor
mapie.regression.MapieQuantileRegressor
mapie.regression.MapieTimeSeriesRegressor

Classification
==============
Expand All @@ -22,7 +32,7 @@ Classification
:toctree: generated/
:template: class.rst

classification.MapieClassifier
mapie.classification.MapieClassifier

Multi-Label Classification
==========================
Expand All @@ -31,7 +41,7 @@ Multi-Label Classification
:toctree: generated/
:template: class.rst

multi_label_classification.MapieMultiLabelClassifier
mapie.multi_label_classification.MapieMultiLabelClassifier

Calibration
===========
Expand All @@ -40,64 +50,64 @@ Calibration
:toctree: generated/
:template: class.rst

calibration.MapieCalibrator
mapie.calibration.MapieCalibrator

Metrics
=======

.. autosummary::
:toctree: generated/
:template: function.rst
metrics.classification_coverage_score
metrics.classification_coverage_score_v2
metrics.classification_mean_width_score
metrics.classification_ssc
metrics.classification_ssc_score
metrics.cumulative_differences
metrics.expected_calibration_error
metrics.hsic
metrics.kolmogorov_smirnov_cdf
metrics.kolmogorov_smirnov_p_value
metrics.kolmogorov_smirnov_statistic
metrics.kuiper_cdf
metrics.kuiper_p_value
metrics.kuiper_statistic
metrics.length_scale
metrics.regression_coverage_score
metrics.regression_coverage_score_v2
metrics.regression_mean_width_score
metrics.regression_ssc
metrics.regression_ssc_score
metrics.spiegelhalter_p_value
metrics.spiegelhalter_statistic
metrics.top_label_ece

Conformity scores (regression)

mapie.metrics.classification_coverage_score
mapie.metrics.classification_coverage_score_v2
mapie.metrics.classification_mean_width_score
mapie.metrics.classification_ssc
mapie.metrics.classification_ssc_score
mapie.metrics.cumulative_differences
mapie.metrics.expected_calibration_error
mapie.metrics.hsic
mapie.metrics.kolmogorov_smirnov_cdf
mapie.metrics.kolmogorov_smirnov_p_value
mapie.metrics.kolmogorov_smirnov_statistic
mapie.metrics.kuiper_cdf
mapie.metrics.kuiper_p_value
mapie.metrics.kuiper_statistic
mapie.metrics.length_scale
mapie.metrics.regression_coverage_score
mapie.metrics.regression_coverage_score_v2
mapie.metrics.regression_mean_width_score
mapie.metrics.regression_ssc
mapie.metrics.regression_ssc_score
mapie.metrics.spiegelhalter_p_value
mapie.metrics.spiegelhalter_statistic
mapie.metrics.top_label_ece

Conformity Scores (Regression)
==============================

.. autosummary::
:toctree: generated/
:template: class.rst

conformity_scores.BaseRegressionScore
conformity_scores.AbsoluteConformityScore
conformity_scores.GammaConformityScore
conformity_scores.ResidualNormalisedScore
mapie.conformity_scores.BaseRegressionScore
mapie.conformity_scores.AbsoluteConformityScore
mapie.conformity_scores.GammaConformityScore
mapie.conformity_scores.ResidualNormalisedScore

Conformity scores (classification)
Conformity Scores (Classification)
==================================

.. autosummary::
:toctree: generated/
:template: class.rst

conformity_scores.BaseClassificationScore
conformity_scores.NaiveConformityScore
conformity_scores.LACConformityScore
conformity_scores.APSConformityScore
conformity_scores.RAPSConformityScore
conformity_scores.TopKConformityScore
mapie.conformity_scores.BaseClassificationScore
mapie.conformity_scores.NaiveConformityScore
mapie.conformity_scores.LACConformityScore
mapie.conformity_scores.APSConformityScore
mapie.conformity_scores.RAPSConformityScore
mapie.conformity_scores.TopKConformityScore

Resampling
==========
Expand All @@ -106,15 +116,14 @@ Resampling
:toctree: generated/
:template: class.rst

subsample.BlockBootstrap
subsample.Subsample

mapie.subsample.BlockBootstrap
mapie.subsample.Subsample

Mondrian
==========
========

.. autosummary::
:toctree: generated/
:template: class.rst

mondrian.MondrianCP
mapie.mondrian.MondrianCP
20 changes: 20 additions & 0 deletions doc/choosing_the_right_algorithm.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
############################################
Choosing the right algorithm
############################################

Following are simple decision trees to help you you getting started quickly with MAPIE.

Reality is of course a bit more complex, so feel free to browse the documentation for nuanced explanations.


1. Regression
==================================

.. image:: images/decision_tree_regression.png
:align: center

2. Classification
=====================

.. image:: images/decision_tree_classification.png
:align: center
10 changes: 10 additions & 0 deletions doc/choosing_the_right_algorithm_classification.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
############################################
Choosing the right algorithm
############################################

Following is a simple decision tree to help you you getting started quickly with MAPIE.

Reality is of course a bit more complex, so feel free to browse the documentation for nuanced explanations.

.. image:: images/decision_tree_classification.png
:align: center
10 changes: 10 additions & 0 deletions doc/choosing_the_right_algorithm_regression.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
############################################
Choosing the right algorithm
############################################

Following is a simple decision trees to help you you getting started quickly with MAPIE.

Reality is of course a bit more complex, so feel free to browse the documentation for nuanced explanations.

.. image:: images/decision_tree_regression.png
:align: center
4 changes: 3 additions & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
# html_theme_options = {}
html_theme_options = {
'collapse_navigation': False,
}

# Add any paths that contain custom themes here, relative to this directory.
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
Expand Down
Binary file added doc/images/decision_tree_classification.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/decision_tree_regression.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/images/quickstart_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 10 additions & 39 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,43 +7,21 @@

quick_start
split_cross_conformal
choosing_the_right_algorithm
v1_migration_guide

.. toctree::
:maxdepth: 2
:hidden:
:caption: REGRESSION
:caption: Measure predictions uncertainty

theoretical_description_regression
theoretical_description_conformity_scores
examples_regression/4-tutorials/plot_main-tutorial-regression
examples_regression/4-tutorials/plot_cqr_tutorial
examples_regression/4-tutorials/plot_ts-tutorial
examples_regression/index
notebooks_regression
index_regression
index_classification

.. toctree::
:maxdepth: 2
:hidden:
:caption: CLASSIFICATION

theoretical_description_classification
examples_classification/4-tutorials/plot_main-tutorial-classification
examples_classification/4-tutorials/plot_crossconformal
examples_classification/index
notebooks_classification

.. toctree::
:maxdepth: 2
:hidden:
:caption: BINARY CLASSIFICATION

theoretical_description_binary_classification
examples_classification/4-tutorials/plot_main-tutorial-binary-classification

.. toctree::
:maxdepth: 2
:hidden:
:caption: MULTI-LABEL CLASSIFICATION
:caption: Control prediction errors

theoretical_description_multilabel_classification
examples_multilabel_classification/1-quickstart/plot_tutorial_multilabel_classification
Expand All @@ -52,15 +30,7 @@
.. toctree::
:maxdepth: 2
:hidden:
:caption: MONDRIAN

theoretical_description_mondrian
examples_mondrian/1-quickstart/plot_main-tutorial-mondrian-regression

.. toctree::
:maxdepth: 2
:hidden:
:caption: CALIBRATION
:caption: Calibrate multi-class predictions

theoretical_description_calibration
examples_calibration/index
Expand All @@ -69,9 +39,10 @@
.. toctree::
:maxdepth: 2
:hidden:
:caption: METRICS
:caption: Question & Answers

theoretical_description_metrics
Metrics: how to measure conformal prediction performance? <theoretical_description_metrics>
index_mondrian

.. toctree::
:maxdepth: 2
Expand Down
8 changes: 8 additions & 0 deletions doc/index_binary_classification.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
The binary classification case
================================

.. toctree::
:maxdepth: 2

examples_classification/4-tutorials/plot_main-tutorial-binary-classification
theoretical_description_binary_classification
13 changes: 13 additions & 0 deletions doc/index_classification.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Prediction sets (classification)
================================

.. toctree::
:maxdepth: 2

choosing_the_right_algorithm_classification
examples_classification/4-tutorials/plot_main-tutorial-classification
examples_classification/4-tutorials/plot_crossconformal
examples_classification/index
notebooks_classification
theoretical_description_classification
index_binary_classification
8 changes: 8 additions & 0 deletions doc/index_mondrian.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Mondrian: how to use prior knowledge on groups when measuring uncertainty?
==============================================================================

.. toctree::
:maxdepth: 2

theoretical_description_mondrian
examples_mondrian/1-quickstart/plot_main-tutorial-mondrian-regression
Loading
Loading