Skip to main content

Python code for Dirichlet calibration

Project description

CI License BSD3 Python3.8 pypi codecov

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.

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.8 -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.8 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

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

dirichletcal-0.3.dev4.tar.gz (12.6 kB view details)

Uploaded Source

File details

Details for the file dirichletcal-0.3.dev4.tar.gz.

File metadata

  • Download URL: dirichletcal-0.3.dev4.tar.gz
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5

File hashes

Hashes for dirichletcal-0.3.dev4.tar.gz
Algorithm Hash digest
SHA256 26c791c52e67085e5c0751aa59f94ea85cf87930d1a316540da3df0063c596a1
MD5 977d36bf52f90520b9415c6ef1057cea
BLAKE2b-256 fe118d51ecdb233cbdfbe2d66454fa35da8b66f83ba2b5ef928e40c6893b0625

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