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(aggregation='consistency', num_samples=1000, noise_type='gaussian')
eps_opt = calibrator.fit(val_logits, val_labels, verbose=True)
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.10.tar.gz
(9.7 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.10.tar.gz.
File metadata
- Download URL: calibrator-0.0.10.tar.gz
- Upload date:
- Size: 9.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
61abede6b5a841d93775152ecfba033fab4c8d39b307a5faf0cc61237a0f0baa
|
|
| MD5 |
e0b16a692506848f65e57dc3a621e651
|
|
| BLAKE2b-256 |
c46e9414b2d049c5b33d12c2c0659fed537f1421a1d49226aa4da2c8f8165324
|
File details
Details for the file calibrator-0.0.10-py3-none-any.whl.
File metadata
- Download URL: calibrator-0.0.10-py3-none-any.whl
- Upload date:
- Size: 10.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 |
90401be88c3af74be3826022a5721b7f2efc683bb39434fc286695368cf2999b
|
|
| MD5 |
94721106e8d890718eb98c8ffc1a440d
|
|
| BLAKE2b-256 |
127677c669dd84e54e03b227fe26c36c43c8937d6d0985bf7d8018fddc38da8f
|