Skip to main content

CI License BSD3 Python3.12 pypi codecov DOI

Dirichlet Calibration Python implementation

This is a Python implementation of the Dirichlet Calibration presented in Beyond temperature scaling: Obtaining well-calibrated multi-class probabilities with Dirichlet calibration at NeurIPS 2019. The original version used Python 3.8 and reached version 0.4.2. The code started using Python 3.12 from version 0.5.0, you can see the other version in the GitHub history, tags, or in Pypi.

Installation

# Clone the repository
git clone git@github.com:dirichletcal/dirichlet_python.git
# Go into the folder
cd dirichlet_python
# Create a new virtual environment with Python3
python3.12 -m venv venv
# Load the generated virtual environment
source venv/bin/activate
# Upgrade pip
pip install --upgrade pip
# Install all the dependencies
pip install -r requirements.txt
pip install --upgrade jaxlib

Unittest

python -m unittest discover dirichletcal

Cite

If you use this code in a publication please cite the following paper

@inproceedings{kull2019dircal,
  title={Beyond temperature scaling: Obtaining well-calibrated multi-class probabilities with Dirichlet calibration},
  author={Kull, Meelis and Nieto, Miquel Perello and K{\"a}ngsepp, Markus and Silva Filho, Telmo and Song, Hao and Flach, Peter},
  booktitle={Advances in Neural Information Processing Systems},
  pages={12295--12305},
  year={2019}
}

Examples

You can find some examples on how to use this package in the folder examples

Pypi

To push a new version to Pypi first build the package

python3.12 setup.py sdist

And then upload to Pypi with twine

twine upload dist/*

It may require user and password if these are not set in your home directory a file .pypirc

[pypi]
username = __token__
password = pypi-yourtoken

Metadata

Release files for dirichletcal 0.5.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dirichletcal 0.5.3
File Size Uploaded
dirichletcal-0.5.3.tar.gz 12.7 kB Details

Release files / dirichletcal-0.5.3.tar.gz

Download URL dirichletcal-0.5.3.tar.gz
Size 12.7 kB
Tags Source
SHA-256 checksum
How to use checksums
778a4f6d6994c4e3321379099056a2ab73f28a14b3d8ab1a3cdf20d54fdd67c2
BLAKE2b-256 checksum
How to use checksums
a14c8f07384757c60a97675fa0b9905057e0df298fd971137f6fbe367809ab7b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.11
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page