# gpleiss/temperature_scaling

A simple way to calibrate your neural network.

Repository: https://github.com/gpleiss/temperature_scaling
Canonical: https://ross.abutalabs.com/products/temperature_scaling
Language: Python
License: MIT
License Family: permissive
Topics: deep-learning, calibration
Last push: 2025-07-26T03:46:19+00:00

## Health v2 (maintenance only)
Score: 47/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 33, release rhythm 35, longevity 100
- inputs: {"age_days": 3317, "days_push": 403, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1175, forks 164 (observed 2026-08-28T04:03:52.411091+00:00)

## What it is
A small PyTorch module implementing temperature scaling, a post-processing technique that calibrates the overconfident probability outputs of trained neural networks. It learns a scalar temperature parameter on a validation set to minimize negative log-likelihood.

## Use cases
- calibrate neural network confidence scores
- fix overconfident softmax probabilities in pytorch
- implement temperature scaling for a trained classifier
- reduce expected calibration error of a model
- make model probabilities match true accuracy

## When to choose
- you need a minimal, copy-paste implementation of temperature scaling for a PyTorch model
- you want to reproduce the 'On Calibration of Modern Neural Networks' paper
- you're okay maintaining the code yourself since it's a single small module

## When to avoid
- you need a maintained, packaged calibration library (the repo is explicitly unmaintained and targets PyTorch 0.3)
- you need calibration methods beyond temperature scaling
- you're not using PyTorch

## Facets
- artifact type: library
- maturity: abandoned
- function: machine-learning, deep-learning
- domain: deep-learning, machine-learning
- platform: python
- tags: temperature-scaling, model-calibration, pytorch, confidence-calibration, post-processing

## Member repositories
- gpleiss/temperature_scaling (main) score 47

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:03:52.411091+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T06:27:05.686238+00:00, confidence not recorded.
  - readme: https://github.com/gpleiss/temperature_scaling (fetched 2026-08-28T04:03:52.411091+00:00, sha e252e7ef79bb)
- Data as of 2026-08-30T08:39:29.467469+00:00.
