Venn-ABERS calibration package
Project description
Venn-ABERS calibration
This library contains the Python implementation of Venn-ABERS calibration for binary and multiclass classification problems.
Installation
pip install venn-abers
The method can be applied on top of an underlying scikit-learn algorithm.
Example Usage
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 for a simple example in the binary classification setting.
- multiclass_classification.ipynb for the multiclass setting.
- 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
venn-abers-1.4.3.tar.gz
(12.4 kB
view details)
File details
Details for the file venn-abers-1.4.3.tar.gz
.
File metadata
- Download URL: venn-abers-1.4.3.tar.gz
- Upload date:
- Size: 12.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b10a752b50ce71fd08e2d51e36ce10e411864995e9a8692f4ce7212ebf90838 |
|
MD5 | 26382f709adaab8f495061da3803e18c |
|
BLAKE2b-256 | 4ae65861c341d007f0347f3e88c9109135795a96eec34f802aa68b13016492cf |