Python library for fitting linear-spine based logistic regression for calibration.
Project description
Splinator 📈
Probablistic Calibration with Regression Splines
scikit-learn compatible
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
- 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.
Examples
comparison | notebook |
---|---|
scikit-learn's sigmoid and isotonic regression | |
pyGAM’s spline model |
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)
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
splinator-0.2.0.tar.gz
(13.9 kB
view hashes)
Built Distribution
splinator-0.2.0-py3-none-any.whl
(10.0 kB
view hashes)
Close
Hashes for splinator-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 52670b0ab8f40847d3f1abec625005e7e121efd65fae4b3af5fe1919ee36e8d2 |
|
MD5 | 0dea71c33e6cb8e5e2fe0d3c50aac9ef |
|
BLAKE2b-256 | 21751d5d9bf6d7873ac25df91bd073c64bfb30928510c785e43cd629441c6c02 |