Python code for Dirichlet calibration
Project Links
Meta
Author: Miquel Perello Nieto and Hao Song
Requires Python: >=3.12
Classifiers
Programming Language
- Python :: 3
License
- OSI Approved :: MIT License
Operating System
- OS Independent
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
0.5.3
Jun 12, 2025
0.5.2
Aug 05, 2024
0.5.1
Aug 05, 2024
0.5.0
Aug 05, 2024
0.3.dev4
May 11, 2021
0.3.dev3
Apr 12, 2021
0.3.dev2
Apr 07, 2021
0.3.dev1
Apr 07, 2021
0.2.dev1
Sep 16, 2020
0.1.dev1
May 22, 2020