Skip to main content

Calibration

a python package for calibrating the deep learning models

Install

pip install calibrator

Use case

from calibrator import LocalCalibrator
import torch

val_logits = torch.randn(1000, 10)
val_labels = torch.randint(0, 10, (1000,))
test_logits = torch.randn(1000, 10)

calibrator = LocalCalibrator()
eps_opt = calibrator.fit(val_logits, val_labels)
calibrated_probability = calibrator.calibrate(test_logits)

Benchmarking

Datasets Method Method Description ECE ACE MCE CECE PIECE
CIFAR-10
CIFAR-100
ImageNet-1K

Package Information

Post-Hoc Calibration methods

Calibration methods Description Paper Source Code Status
Temperature Scaling (TS) ICML 2017 paper code ✅ Implemented
Parameterized Temperature Scaling (PTS) ECCV 2022 paper code 🔜 Pending
Ensemble Temperature Scaling (ETS) ICML 2020 paper code 🔜 Pending
Class-based Temperature Scaling (CTS) EUSIPCO 2021 paper unavailable 🔜 Pending
Group Calibration with Temperature Scaling (GCTS) NeurIPS 2023 paper code 🔜 Pending
Proximity-informed Calibration (PROCAL) NeurIPS 2023 paper code 🔜 Pending
Isotonic Regression
Histogram Binning
Platt Scaling
Bayesian Binning into Quantiles (BBQ) AAAI 2015 paper 🔜 Pending
BetaCal
Scaling-Binning Calibrator NeuIPS 2019 paper code 🔜 Pending
Dirichlet calibration NeurIPS 2019 paper code 🔜 Pending

Train-time Calibration Methods

Calibration Losses Description Paper Source Code Status
Focal Loss
Dual Focal Loss
Adaptive Focal Loss

Metrics

Metrics Description Paper Source Code Status
Expected Calibration Error (ECE) AAAI 2015 paper code ✅ Implemented
Maximum Calibration Error (MCE) AAAI 2015 paper code 🔜 Pending
Adaptive Calibration Error (ACE) CVPRW 2019 paper code ✅ Implemented
Classwise Expected Calibration Error (CECE) NeurIPS 2019 paper code ✅ Implemented
Negative Log Likelihood (NLL)
Accuracy
Proximity-informed Expected Calibration Error (PIECE) NeurIPS 2023 paper code 🔜 Pending

Pre-trained Model Weights

Datasets Description Paper Source Code Status
CIFAR-10
CIFAR-100
ImageNet
ImageNet-100
ImageNet-1000

Pre-calculated Logits

Datasets Description Paper Source Code Status
CIFAR-10
CIFAR-100
ImageNet
ImageNet-100
ImageNet-1000

Release files for calibrator 0.0.13

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

Source distribution (sdist)

Source distribution for calibrator 0.0.13
File Size Uploaded
calibrator-0.0.13.tar.gz 10.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for calibrator 0.0.13
File Interpreter ABI Platform
calibrator-0.0.13-py3-none-any.whl Python 3 none any Details

Total release size: 21.9 kB

Release files / calibrator-0.0.13.tar.gz

Download URL calibrator-0.0.13.tar.gz
Size 10.1 kB
Tags Source
SHA-256 checksum
How to use checksums
efd85ad0a2336abeca9870200e9925b53c3c85de1555df84c47745fed8578636
BLAKE2b-256 checksum
How to use checksums
af1f417d52cfab8d0958173983955af9596892debc028e3fd2ea30dc99039115
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.20

Release files / calibrator-0.0.13-py3-none-any.whl

Download URL calibrator-0.0.13-py3-none-any.whl
Size 11.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f1d8f3da1ffce3503b42afa970c76a5d0b9cbbf9b407ee386e3aca40039ca5b9
BLAKE2b-256 checksum
How to use checksums
7cd31f4aca9d693e28801b197815cea628cbcb261777e867047c1454a089a154
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.20

Release history Release notifications | RSS feed

This release

0.0.13 This release

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

1 release file

0.0.6

1 release file

0.0.5

2 release files

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

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