Skip to main content

Python library for fitting linear-spine based logistic regression for calibration.

Project description

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)

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

splinator-0.2.0.tar.gz (13.9 kB view hashes)

Uploaded Source

Built Distribution

splinator-0.2.0-py3-none-any.whl (10.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page