Python library for fitting linear-spline 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 uv.
# Install uv (if not already installed)
curl -LsSf https://astral.sh/uv/install.sh | sh
# Create virtual environment and install dependencies
uv sync --dev
# Run tests
uv run pytest tests -v
# Run type checking
uv run mypy src/splinator
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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file splinator-0.3.0.tar.gz.
File metadata
- Download URL: splinator-0.3.0.tar.gz
- Upload date:
- Size: 398.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c0641b0d3279ef4ad696f3ef62d9d30c907d7cfb3d4b6b15ac246d997669d04
|
|
| MD5 |
65bf2abe397e377c19a4ea6d39d060da
|
|
| BLAKE2b-256 |
e006352e3e3130e9136da7558f8092b40ded47e94d385695e0a9ba830a2261d2
|
Provenance
The following attestation bundles were made for splinator-0.3.0.tar.gz:
Publisher:
publish.yml on Affirm/splinator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
splinator-0.3.0.tar.gz -
Subject digest:
9c0641b0d3279ef4ad696f3ef62d9d30c907d7cfb3d4b6b15ac246d997669d04 - Sigstore transparency entry: 786856849
- Sigstore integration time:
-
Permalink:
Affirm/splinator@1ea697b3794f57cbeb914bacf13017f8103b3972 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/Affirm
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1ea697b3794f57cbeb914bacf13017f8103b3972 -
Trigger Event:
release
-
Statement type:
File details
Details for the file splinator-0.3.0-py3-none-any.whl.
File metadata
- Download URL: splinator-0.3.0-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc80c05981cc6d6e3f8f0ce8b61ae43a9b679e64a256624f2e2222552f9daeaf
|
|
| MD5 |
ccd15f76c638313adb0715fb3773729c
|
|
| BLAKE2b-256 |
0a16c559c0e7a7e8c2e8bf73644358804b0be12a45c3fe6ed457658d019f1b7a
|
Provenance
The following attestation bundles were made for splinator-0.3.0-py3-none-any.whl:
Publisher:
publish.yml on Affirm/splinator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
splinator-0.3.0-py3-none-any.whl -
Subject digest:
dc80c05981cc6d6e3f8f0ce8b61ae43a9b679e64a256624f2e2222552f9daeaf - Sigstore transparency entry: 786856850
- Sigstore integration time:
-
Permalink:
Affirm/splinator@1ea697b3794f57cbeb914bacf13017f8103b3972 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/Affirm
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1ea697b3794f57cbeb914bacf13017f8103b3972 -
Trigger Event:
release
-
Statement type: