Probability calibration for Python

Make confidence
match reality.

Fit smooth, interpretable calibration curves with linear spline logistic regression—without leaving the scikit-learn workflow.

pip install splinator
View on PyPI
v0.3.0 Python 3.9+ BSD-3-Clause

Reliability curve

Predicted vs. observed

Interactive
Probability calibration reliability curve A fitted spline follows observed calibration points toward the ideal diagonal. 0 0.5 1.0 0 0.5 1.0 Predicted probability Observed frequency
Fitted spline Ideal calibration
1focused estimator
3monotonic modes
2optimization solvers
100%scikit-learn workflow
Why splines?

Flexible where it matters.
Constrained where it counts.

Sigmoid calibration can be too rigid. Isotonic calibration can be too jagged. Splinator gives you a smooth middle path.

01

Shape-aware calibration

Choose increasing, decreasing, or unconstrained curves. Linear constraints keep probability mappings sensible while preserving local flexibility.

02

Drop-in estimator

Familiar fit, predict, and transform methods make calibration easy to add to existing pipelines.

03

Built for control

Set the knot count or pass exact knot locations. Tune regularization and choose SLSQP or trust-constr optimization.

Quick start

From raw scores to calibrated probabilities.

Pass a score column, choose your knot count, and fit. Additional columns can travel alongside the calibrated score as unconstrained features.

  1. 1
    ConfigureChoose knots and monotonicity.
  2. 2
    FitOptimize regularized log loss.
  3. 3
    CalibrateReturn probabilities from 0 to 1.

calibrate.py

from splinator.estimators import (
    LinearSplineLogisticRegression,
)

calibrator = LinearSplineLogisticRegression(
    n_knots=10,
    monotonicity="increasing",
    C=100,
)

calibrator.fit(scores, outcomes)
probabilities = calibrator.predict(scores)
output array([0.071, 0.284, 0.813, 0.946])
Open source

Better probabilities
start with a better curve.

Splinator is maintained by contributors at Affirm and released under the BSD 3-Clause license.