[![python](https://img.shields.io/badge/Python-3.11-3776AB.svg?style=flat&logo=python&logoColor=white)](https://www.python.org)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
![Static Badge](https://img.shields.io/badge/Probabilistic_Calibration-blue)
![GitHub Repo stars](https://img.shields.io/github/stars/ip200/venn-abers)
# Venn-ABERS calibration
This library contains the Python implementation of Venn-ABERS calibration for binary and multiclass classification problems.
### Installation
```commandline
pip install venn-abers
```
The method can be applied on top of an underlying scikit-learn algorithm.
### Example Usage
```python
from sklearn.datasets import make_classification
from sklearn.model_selection import train_test_split
from sklearn.naive_bayes import GaussianNB
from venn_abers import VennAbersCalibrator
X, y = make_classification(n_samples=1000, n_classes=3, n_informative=10)
X_train, X_test, y_train, y_test = train_test_split(X, y)
clf = GaussianNB()
# Define Venn-ABERS calibrator
va = VennAbersCalibrator(estimator=clf, inductive=True, cal_size=0.2, random_state=101)
# Fit on the training set
va.fit(X_train, y_train)
# Generate probabilities and class predictions on the test set
p_prime = va.predict_proba(X_test)
y_pred = va.predict(X_test)
```
### Examples
Further examples can be found in the github repository https://github.com/ip200/venn-abers in the `examples` folder:
- [simple_classification.ipynb](https://github.com/ip200/venn-abers/blob/main/examples/simple_classification.ipynb) for a simple example in the binary classification setting.
- [multiclass_classification.ipynb](https://github.com/ip200/venn-abers/blob/main/examples/multiclass_classification.ipynb) for the multiclass setting.
- [comparison_with_existing.ipynb](https://github.com/ip200/venn-abers/blob/main/examples/comparison_with_existing.ipynb) for the comparison with a previous github implementation
### Citation
If you find this library useful please consider citing:
- Vovk, Vladimir, Ivan Petej and Valentina Fedorova. "Large-scale probabilistic predictors with and without guarantees of validity." Advances in Neural Information Processing Systems 28 (2015) (arxiv version https://arxiv.org/pdf/1511.00213.pdf)
- Vovk, Vladimir, Ivan Petej. "Venn-Abers predictors". Proceedings of the Thirtieth Conference on Uncertainty in Artificial Intelligence (2014) (arxiv version https://arxiv.org/abs/1211.0025)
- Manokhin, Valery. "Multi-class probabilistic classification using inductive and cross Venn–Abers predictors." Conformal and Probabilistic Prediction and Applications, PMLR, 2017.
Raw data
{
"_id": null,
"home_page": "https://github.com/ip200/venn-abers",
"name": "venn-abers",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "Probabilistic classification, calibration",
"author": "Ivan Petej",
"author_email": "ivan@algorhythmic.ai",
"download_url": "https://files.pythonhosted.org/packages/45/67/e817f015981fd6d6e6a7e4ee0c77d81228edce22de1d147633f598643b81/venn-abers-1.4.6.tar.gz",
"platform": null,
"description": "[![python](https://img.shields.io/badge/Python-3.11-3776AB.svg?style=flat&logo=python&logoColor=white)](https://www.python.org)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n![Static Badge](https://img.shields.io/badge/Probabilistic_Calibration-blue)\n![GitHub Repo stars](https://img.shields.io/github/stars/ip200/venn-abers)\n\n\n\n\n# Venn-ABERS calibration\nThis library contains the Python implementation of Venn-ABERS calibration for binary and multiclass classification problems.\n\n### Installation\n```commandline\npip install venn-abers\n```\nThe method can be applied on top of an underlying scikit-learn algorithm.\n### Example Usage\n```python\nfrom sklearn.datasets import make_classification\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.naive_bayes import GaussianNB\n\nfrom venn_abers import VennAbersCalibrator\n\nX, y = make_classification(n_samples=1000, n_classes=3, n_informative=10)\nX_train, X_test, y_train, y_test = train_test_split(X, y)\n\nclf = GaussianNB()\n\n# Define Venn-ABERS calibrator\nva = VennAbersCalibrator(estimator=clf, inductive=True, cal_size=0.2, random_state=101)\n\n# Fit on the training set\nva.fit(X_train, y_train)\n\n# Generate probabilities and class predictions on the test set\np_prime = va.predict_proba(X_test)\ny_pred = va.predict(X_test)\n```\n\n\n### Examples\nFurther examples can be found in the github repository https://github.com/ip200/venn-abers in the `examples` folder:\n\n- [simple_classification.ipynb](https://github.com/ip200/venn-abers/blob/main/examples/simple_classification.ipynb) for a simple example in the binary classification setting.\n- [multiclass_classification.ipynb](https://github.com/ip200/venn-abers/blob/main/examples/multiclass_classification.ipynb) for the multiclass setting.\n- [comparison_with_existing.ipynb](https://github.com/ip200/venn-abers/blob/main/examples/comparison_with_existing.ipynb) for the comparison with a previous github implementation\n\n\n### Citation\nIf you find this library useful please consider citing:\n\n- Vovk, Vladimir, Ivan Petej and Valentina Fedorova. \"Large-scale probabilistic predictors with and without guarantees of validity.\" Advances in Neural Information Processing Systems 28 (2015) (arxiv version https://arxiv.org/pdf/1511.00213.pdf)\n- Vovk, Vladimir, Ivan Petej. \"Venn-Abers predictors\". Proceedings of the Thirtieth Conference on Uncertainty in Artificial Intelligence (2014) (arxiv version https://arxiv.org/abs/1211.0025)\n- Manokhin, Valery. \"Multi-class probabilistic classification using inductive and cross Venn\u2013Abers predictors.\" Conformal and Probabilistic Prediction and Applications, PMLR, 2017.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Venn-ABERS calibration package",
"version": "1.4.6",
"project_urls": {
"Download": "https://github.com/ip200/venn-abers/archive/refs/tags/v1_4_6.tar.gz",
"Homepage": "https://github.com/ip200/venn-abers"
},
"split_keywords": [
"probabilistic classification",
" calibration"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "4567e817f015981fd6d6e6a7e4ee0c77d81228edce22de1d147633f598643b81",
"md5": "9c3f933b587e5cf9a351f4552bb637de",
"sha256": "358fce6de61e9990b90fa384437a90244598e8d3442b7132d4bba428b0d07f7d"
},
"downloads": -1,
"filename": "venn-abers-1.4.6.tar.gz",
"has_sig": false,
"md5_digest": "9c3f933b587e5cf9a351f4552bb637de",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 12842,
"upload_time": "2024-09-10T21:39:22",
"upload_time_iso_8601": "2024-09-10T21:39:22.052350Z",
"url": "https://files.pythonhosted.org/packages/45/67/e817f015981fd6d6e6a7e4ee0c77d81228edce22de1d147633f598643b81/venn-abers-1.4.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-10 21:39:22",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ip200",
"github_project": "venn-abers",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "venn-abers"
}