/splinator

Splinator: probabilistic calibration with regression splines

Primary LanguagePythonBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

Splinator 📈

Probablistic Calibration with Regression Splines

scikit-learn compatible

pdm-managed Documentation Status Build

Installation

pip install splinator

Algorithm

Supported models:

  • Linear Spline Logistic Regression

Supported metrics:

  • Spiegelhalter’s z statistic
  • Expected Calibration Error (ECE)

[1] You can find more information in the Linear Spline Logistic Regression.

[2] Additional readings

Examples

comparison notebook
scikit-learn's sigmoid and isotonic regression colab1
pyGAM’s spline model colab2

Development

The dependencies are managed by pdm

To run tests, run pdm run -v pytest tests

Example Usage

from splinator.estimators import LinearSplineLogisticRegression
import numpy as np

# random synthetic dataset
n_samples = 100
rng = np.random.RandomState(0)
X = rng.normal(loc=100, size=(n_samples, 2))
y = np.random.randint(2, size=n_samples)

lslr = LinearSplineLogisticRegression(n_knots=10)
lslr.fit(X, y)