Probablistic Calibration with Regression Splines
scikit-learn compatible
pip install splinator
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
- Zhang, Jian, and Yiming Yang. Probabilistic score estimation with piecewise logistic regression. Proceedings of the twenty-first international conference on Machine learning. 2004.
- Guo, Chuan, et al. "On calibration of modern neural networks." International conference on machine learning. PMLR, 2017.
comparison | notebook |
---|---|
scikit-learn's sigmoid and isotonic regression | |
pyGAM’s spline model |
The dependencies are managed by pdm
To run tests, run pdm run -v pytest tests
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)