Skip to main content

Venn-ABERS calibration package

Project description

python jupyter License: MIT scikit-learn

venn-abers

This library contains the Python implementation of Venn-ABERS calibration for binary and multiclass classification problems.

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

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 code examples are in the examples folder:

  • examples/simple_classification.ipynb for a simple example in the binary classification setting.
  • examples/multiclass_classification.ipynb for the multiclass (more than 2 classes) setting.
  • examples/comparison_with_existing.py for the comparison with an existing 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) Pages 829–838 (arxiv version https://arxiv.org/abs/1211.0025)
  • Manokhin, Valery. "Multi-class probabilistic classification using inductive and cross Venn–Abers predictors." In Conformal and Probabilistic Prediction and Applications, pp. 228-240. PMLR, 2017.

Project details


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-0.2.tar.gz (9.5 kB view details)

Uploaded Source

File details

Details for the file venn-abers-0.2.tar.gz.

File metadata

  • Download URL: venn-abers-0.2.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for venn-abers-0.2.tar.gz
Algorithm Hash digest
SHA256 bc6a846d90c87edfdc108ac8abf5be364e5ed2db26a3423a479285f33a5a276d
MD5 e65b1f52e7553911b57e2febe66e7cb4
BLAKE2b-256 4a8b535c6a0b2d2ef22d13d50105637f9d6f731edddd3c94dfc158bdb211b391

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page