A package for calibration on deep learning models for classification tasks.
Project description
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 |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
calibrator-0.0.13.tar.gz
(10.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file calibrator-0.0.13.tar.gz.
File metadata
- Download URL: calibrator-0.0.13.tar.gz
- Upload date:
- Size: 10.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
efd85ad0a2336abeca9870200e9925b53c3c85de1555df84c47745fed8578636
|
|
| MD5 |
c41b50a9292b69c9657d13836a33c8dc
|
|
| BLAKE2b-256 |
af1f417d52cfab8d0958173983955af9596892debc028e3fd2ea30dc99039115
|
File details
Details for the file calibrator-0.0.13-py3-none-any.whl.
File metadata
- Download URL: calibrator-0.0.13-py3-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f1d8f3da1ffce3503b42afa970c76a5d0b9cbbf9b407ee386e3aca40039ca5b9
|
|
| MD5 |
a0c5ea76fc47c1a0a72c1366c82361b1
|
|
| BLAKE2b-256 |
7cd31f4aca9d693e28801b197815cea628cbcb261777e867047c1454a089a154
|