{"id":13687557,"url":"https://github.com/scikit-learn-contrib/MAPIE","last_synced_at":"2025-05-01T12:34:33.026Z","repository":{"id":37037342,"uuid":"352931865","full_name":"scikit-learn-contrib/MAPIE","owner":"scikit-learn-contrib","description":"A scikit-learn-compatible module to estimate prediction intervals and control risks based on conformal predictions.","archived":false,"fork":false,"pushed_at":"2024-10-23T15:14:21.000Z","size":105621,"stargazers_count":1289,"open_issues_count":49,"forks_count":110,"subscribers_count":16,"default_branch":"master","last_synced_at":"2024-10-29T14:50:21.571Z","etag":null,"topics":["classification","confidence-intervals","conformal-prediction","data-science","python","regression","sklearn"],"latest_commit_sha":null,"homepage":"https://mapie.readthedocs.io/en/latest/","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/scikit-learn-contrib.png","metadata":{"files":{"readme":"README.rst","changelog":"HISTORY.rst","contributing":"CONTRIBUTING.rst","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.rst","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-30T08:47:08.000Z","updated_at":"2024-10-27T17:32:03.000Z","dependencies_parsed_at":"2023-09-23T05:40:26.207Z","dependency_job_id":"747bd1ce-9abe-463a-8910-38122098e981","html_url":"https://github.com/scikit-learn-contrib/MAPIE","commit_stats":{"total_commits":2525,"total_committers":49,"mean_commits":51.53061224489796,"dds":0.8708910891089109,"last_synced_commit":"da5f6395ef699b509e228c2d07e37391ec7a43ac"},"previous_names":[],"tags_count":33,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scikit-learn-contrib%2FMAPIE","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scikit-learn-contrib%2FMAPIE/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scikit-learn-contrib%2FMAPIE/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scikit-learn-contrib%2FMAPIE/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scikit-learn-contrib","download_url":"https://codeload.github.com/scikit-learn-contrib/MAPIE/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224099621,"owners_count":17255578,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["classification","confidence-intervals","conformal-prediction","data-science","python","regression","sklearn"],"created_at":"2024-08-02T15:00:56.530Z","updated_at":"2025-05-01T12:34:33.005Z","avatar_url":"https://github.com/scikit-learn-contrib.png","language":"Jupyter Notebook","readme":".. -*- mode: rst -*-\n\n|GitHubActions| |Codecov| |ReadTheDocs| |License| |PythonVersion| |PyPi| |Conda| |Release| |Commits| |DOI|\n\n.. |GitHubActions| image:: https://github.com/scikit-learn-contrib/MAPIE/actions/workflows/test.yml/badge.svg\n    :target: https://github.com/scikit-learn-contrib/MAPIE/actions\n\n.. |Codecov| image:: https://codecov.io/gh/scikit-learn-contrib/MAPIE/branch/master/graph/badge.svg?token=F2S6KYH4V1\n   :target: https://codecov.io/gh/scikit-learn-contrib/MAPIE\n\n.. |ReadTheDocs| image:: https://readthedocs.org/projects/mapie/badge/?version=stable\n    :target: https://mapie.readthedocs.io/en/stable/?badge=stable\n    :alt: Documentation Status\n\n.. |License| image:: https://img.shields.io/github/license/scikit-learn-contrib/MAPIE\n    :target: https://github.com/scikit-learn-contrib/MAPIE/blob/master/LICENSE\n\n.. |PythonVersion| image:: https://img.shields.io/pypi/pyversions/mapie\n    :target: https://pypi.org/project/mapie/\n\n.. |PyPi| image:: https://img.shields.io/pypi/v/mapie\n    :target: https://pypi.org/project/mapie/\n\n.. |Conda| image:: https://img.shields.io/conda/vn/conda-forge/mapie\n    :target: https://anaconda.org/conda-forge/mapie\n\n.. |Release| image:: https://img.shields.io/github/v/release/scikit-learn-contrib/mapie\n    :target: https://github.com/scikit-learn-contrib/MAPIE/releases\n\n.. |Commits| image:: https://img.shields.io/github/commits-since/scikit-learn-contrib/mapie/latest/master\n    :target: https://github.com/scikit-learn-contrib/MAPIE/commits/master\n\n.. |DOI| image:: https://img.shields.io/badge/10.48550/arXiv.2207.12274-B31B1B.svg\n    :target: https://arxiv.org/abs/2207.12274\n\n.. image:: https://github.com/scikit-learn-contrib/MAPIE/raw/master/doc/images/mapie_logo_nobg_cut.png\n    :width: 400\n    :align: center\n\n\n\nMAPIE - Model Agnostic Prediction Interval Estimator\n====================================================\n\n**MAPIE** is an open-source Python library for quantifying uncertainties and controlling the risks of machine learning models.\nIt is a scikit-learn-contrib project that allows you to:\n\n- Easily **compute conformal prediction intervals** (or prediction sets) with controlled (or guaranteed) marginal coverage rate\n  for regression [3,4,8], classification (binary and multi-class) [5-7] and time series [9].\n- Easily **control risks** of more complex tasks such as multi-label classification,\n  semantic segmentation in computer vision (probabilistic guarantees on recall, precision, ...) [10-12].\n- Easily **wrap any model (scikit-learn, tensorflow, pytorch, ...) with, if needed, a scikit-learn-compatible wrapper**\n  for the purposes just mentioned.\n\nHere's a quick instantiation of MAPIE models for regression and classification problems related to uncertainty quantification\n(more details in the Quickstart section):\n\n.. code:: python\n\n    # Uncertainty quantification for regression problem\n    from mapie.regression import MapieRegressor\n    mapie_regressor = MapieRegressor(estimator=regressor, method='plus', cv=5)\n\n.. code:: python\n\n    # Uncertainty quantification for classification problem\n    from mapie.classification import MapieClassifier\n    mapie_classifier = MapieClassifier(estimator=classifier, method='score', cv=5)\n\nImplemented methods in **MAPIE** respect three fundamental pillars:\n\n- They are **model and use case agnostic**, \n- They possess **theoretical guarantees** under minimal assumptions on the data and the model,\n- They are based on **peer-reviewed algorithms** and respect programming standards.\n\n**MAPIE** relies notably on the field of *Conformal Prediction* and *Distribution-Free Inference*.\n\n\n🔗 Requirements\n===============\n\n- **MAPIE** runs on Python 3.7+.\n- **MAPIE** stands on the shoulders of giants. Its only internal dependencies are `scikit-learn \u003chttps://scikit-learn.org/stable/\u003e`_ and `numpy=\u003e1.21 \u003chttps://numpy.org/\u003e`_.\n\n\n🛠 Installation\n===============\n\n**MAPIE** can be installed in different ways:\n\n.. code:: sh\n\n    $ pip install mapie  # installation via `pip`\n    $ conda install -c conda-forge mapie  # or via `conda`\n    $ pip install git+https://github.com/scikit-learn-contrib/MAPIE  # or directly from the github repository\n\n\n⚡ Quickstart\n=============\n\nHere we propose two basic uncertainty quantification problems for regression and classification tasks with scikit-learn.\n\nAs **MAPIE** is compatible with the standard scikit-learn API, you can see that with just these few lines of code:\n\n- How easy it is **to wrap your favorite scikit-learn-compatible model** around your model.\n- How easy it is **to follow the standard sequential** ``fit`` and ``predict`` process like any scikit-learn estimator.\n\n.. code:: python\n\n    # Uncertainty quantification for regression problem\n    import numpy as np\n    from sklearn.linear_model import LinearRegression\n    from sklearn.datasets import make_regression\n    from sklearn.model_selection import train_test_split\n\n    from mapie.regression import MapieRegressor\n\n\n    X, y = make_regression(n_samples=500, n_features=1)\n    X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.5)\n\n    regressor = LinearRegression()\n\n    mapie_regressor = MapieRegressor(estimator=regressor, method='plus', cv=5)\n\n    mapie_regressor = mapie_regressor.fit(X_train, y_train)\n    y_pred, y_pis = mapie_regressor.predict(X_test, alpha=[0.05, 0.32])\n\n.. code:: python\n\n    # Uncertainty quantification for classification problem\n    import numpy as np\n    from sklearn.linear_model import LogisticRegression\n    from sklearn.datasets import make_blobs\n    from sklearn.model_selection import train_test_split\n\n    from mapie.classification import MapieClassifier\n\n\n    X, y = make_blobs(n_samples=500, n_features=2, centers=3)\n    X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.5)\n\n    classifier = LogisticRegression()\n\n    mapie_classifier = MapieClassifier(estimator=classifier, method='score', cv=5)\n\n    mapie_classifier = mapie_classifier.fit(X_train, y_train)\n    y_pred, y_pis = mapie_classifier.predict(X_test, alpha=[0.05, 0.32])\n\n\n📘 Documentation\n================\n\nThe full documentation can be found `on this link \u003chttps://mapie.readthedocs.io/en/latest/\u003e`_.\n\n\n📝 Contributing\n===============\n\nYou are welcome to propose and contribute new ideas.\nWe encourage you to `open an issue \u003chttps://github.com/scikit-learn-contrib/MAPIE/issues\u003e`_ so that we can align on the work to be done.\nIt is generally a good idea to have a quick discussion before opening a pull request that is potentially out-of-scope.\nFor more information on the contribution process, please go `here \u003chttps://github.com/scikit-learn-contrib/MAPIE/blob/master/CONTRIBUTING.rst\u003e`_.\n\n\n🤝  Affiliations\n================\n\nMAPIE has been developed through a collaboration between Capgemini, Quantmetry, Michelin, ENS Paris-Saclay,\nand with the financial support from Région Ile de France and Confiance.ai.\n\n|Capgemini| |Quantmetry| |Michelin| |ENS| |Confiance.ai| |IledeFrance|\n\n.. |Capgemini| image:: https://www.capgemini.com/wp-content/themes/capgemini2020/assets/images/logo.svg\n    :height: 35px\n    :width: 140px\n    :target: https://www.capgemini.com/\n\n.. |Quantmetry| image:: https://www.quantmetry.com/wp-content/uploads/2020/08/08-Logo-quant-Texte-noir.svg\n    :height: 35px\n    :width: 140px\n    :target: https://www.quantmetry.com/\n\n.. |Michelin| image:: https://agngnconpm.cloudimg.io/v7/https://dgaddcosprod.blob.core.windows.net/corporate-production/attachments/cls05tqdd9e0o0tkdghwi9m7n-clooe1x0c3k3x0tlu4cxi6dpn-bibendum-salut.full.png\n    :height: 50px\n    :width: 45px\n    :target: https://www.michelin.com/en/\n\n.. |ENS| image:: https://www.ens.psl.eu/sites/default/files/logo_ens_psl_en_png.png\n    :height: 35px\n    :width: 140px\n    :target: https://ens-paris-saclay.fr/en/\n\n.. |Confiance.ai| image:: https://pbs.twimg.com/profile_images/1443838558549258264/EvWlv1Vq_400x400.jpg\n    :height: 45px\n    :width: 45px\n    :target: https://www.confiance.ai/\n\n.. |IledeFrance| image:: https://www.iledefrance.fr/sites/default/files/logo/2024-02/logoGagnerok.svg\n    :height: 35px\n    :width: 140px\n    :target: https://www.iledefrance.fr/\n\n\n🔍  References\n==============\n\n[1] Vovk, Vladimir, Alexander Gammerman, and Glenn Shafer. Algorithmic Learning in a Random World. Springer Nature, 2022.\n\n[2] Angelopoulos, Anastasios N., and Stephen Bates. \"Conformal prediction: A gentle introduction.\" Foundations and Trends® in Machine Learning 16.4 (2023): 494-591.\n\n[3] Rina Foygel Barber, Emmanuel J. Candès, Aaditya Ramdas, and Ryan J. Tibshirani. \"Predictive inference with the jackknife+.\" Ann. Statist., 49(1):486–507, (2021).\n\n[4] Kim, Byol, Chen Xu, and Rina Barber. \"Predictive inference is free with the jackknife+-after-bootstrap.\" Advances in Neural Information Processing Systems 33 (2020): 4138-4149.\n\n[5] Sadinle, Mauricio, Jing Lei, and Larry Wasserman. \"Least ambiguous set-valued classifiers with bounded error levels.\" Journal of the American Statistical Association 114.525 (2019): 223-234.\n\n[6] Romano, Yaniv, Matteo Sesia, and Emmanuel Candes. \"Classification with valid and adaptive coverage.\" Advances in Neural Information Processing Systems 33 (2020): 3581-3591.\n\n[7] Angelopoulos, Anastasios, et al. \"Uncertainty sets for image classifiers using conformal prediction.\" International Conference on Learning Representations (2021).\n\n[8] Romano, Yaniv, Evan Patterson, and Emmanuel Candes. \"Conformalized quantile regression.\" Advances in neural information processing systems 32 (2019).\n\n[9] Xu, Chen, and Yao Xie. \"Conformal prediction interval for dynamic time-series.\" International Conference on Machine Learning. PMLR, (2021).\n\n[10] Bates, Stephen, et al. \"Distribution-free, risk-controlling prediction sets.\" Journal of the ACM (JACM) 68.6 (2021): 1-34.\n\n[11] Angelopoulos, Anastasios N., Stephen, Bates, Adam, Fisch, Lihua, Lei, and Tal, Schuster. \"Conformal Risk Control.\" (2022).\n\n[12] Angelopoulos, Anastasios N., Stephen, Bates, Emmanuel J. Candès, et al. \"Learn Then Test: Calibrating Predictive Algorithms to Achieve Risk Control.\" (2022).\n\n\n📝 License\n==========\n\nMAPIE is free and open-source software licensed under the `license \u003chttps://github.com/scikit-learn-contrib/MAPIE/blob/master/LICENSE\u003e`_.\n\n\n📚 Citation\n===========\n\nIf you use MAPIE in your research, please cite using:\n\n.. code:: latex\n\n    @inproceedings{Cordier_Flexible_and_Systematic_2023,\n    author = {Cordier, Thibault and Blot, Vincent and Lacombe, Louis and Morzadec, Thomas and Capitaine, Arnaud and Brunel, Nicolas},\n    booktitle = {Conformal and Probabilistic Prediction with Applications},\n    title = {{Flexible and Systematic Uncertainty Estimation with Conformal Prediction via the MAPIE library}},\n    year = {2023}\n    }\n","funding_links":[],"categories":["Jupyter Notebook","其他_机器学习与深度学习","Python","Uncertainty quantification"],"sub_categories":["Others"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscikit-learn-contrib%2FMAPIE","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscikit-learn-contrib%2FMAPIE","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscikit-learn-contrib%2FMAPIE/lists"}