splinator


Namesplinator JSON
Version 0.2.0 PyPI version JSON
download
home_page
SummaryPython library for fitting linear-spine based logistic regression for calibration.
upload_time2023-07-31 07:47:27
maintainer
docs_urlNone
author
requires_python<4.0,>=3.7.1
licenseBSD-3-Clause
keywords calibration logistic spline regression
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Splinator 📈

**Probablistic Calibration with Regression Splines**

[scikit-learn](https://scikit-learn.org) compatible

[![pdm-managed](https://img.shields.io/badge/pdm-managed-blueviolet)](https://pdm.fming.dev)
[![Documentation Status](https://readthedocs.org/projects/splinator/badge/?version=latest)](https://splinator.readthedocs.io/en/latest/)
[![Build](https://img.shields.io/github/actions/workflow/status/affirm/splinator/.github/workflows/python-package.yml)](https://github.com/affirm/splinator/actions)

## 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](https://github.com/Affirm/splinator/wiki/Linear-Spline-Logistic-Regression).

\[2\] Additional readings

- Zhang, Jian, and Yiming Yang. [Probabilistic score estimation with
    piecewise logistic
    regression](https://pal.sri.com/wp-content/uploads/publications/radar/2004/icml04zhang.pdf).
    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 | [![colab1](https://colab.research.google.com/assets/colab-badge.svg)](https://github.com/Affirm/splinator/blob/main/examples/calibrator_model_comparison.ipynb)    |
| pyGAM’s spline model                           | [![colab2](https://colab.research.google.com/assets/colab-badge.svg)](https://githubtocolab.com/Affirm/splinator/blob/main/examples/spline_model_comparison.ipynb) |

## Development

The dependencies are managed by [pdm](https://pdm.fming.dev/latest/)

To run tests, run `pdm run -v pytest tests`

## Example Usage

``` python
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)
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "splinator",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "<4.0,>=3.7.1",
    "maintainer_email": "",
    "keywords": "calibration logistic spline regression",
    "author": "",
    "author_email": "Jiarui Xu <jiarui.xu@affirm.com>",
    "download_url": "https://files.pythonhosted.org/packages/65/18/93b83d9923e1b3c352d589faf3cafad5641f7ea6f4d5400be37efe70ecbd/splinator-0.2.0.tar.gz",
    "platform": null,
    "description": "# Splinator \ud83d\udcc8\n\n**Probablistic Calibration with Regression Splines**\n\n[scikit-learn](https://scikit-learn.org) compatible\n\n[![pdm-managed](https://img.shields.io/badge/pdm-managed-blueviolet)](https://pdm.fming.dev)\n[![Documentation Status](https://readthedocs.org/projects/splinator/badge/?version=latest)](https://splinator.readthedocs.io/en/latest/)\n[![Build](https://img.shields.io/github/actions/workflow/status/affirm/splinator/.github/workflows/python-package.yml)](https://github.com/affirm/splinator/actions)\n\n## Installation\n\n`pip install splinator`\n\n## Algorithm\n\nSupported models:\n\n- Linear Spline Logistic Regression\n\nSupported metrics:\n\n- Spiegelhalter\u2019s z statistic\n- Expected Calibration Error (ECE)\n\n\\[1\\] You can find more information in the [Linear Spline Logistic\nRegression](https://github.com/Affirm/splinator/wiki/Linear-Spline-Logistic-Regression).\n\n\\[2\\] Additional readings\n\n- Zhang, Jian, and Yiming Yang. [Probabilistic score estimation with\n    piecewise logistic\n    regression](https://pal.sri.com/wp-content/uploads/publications/radar/2004/icml04zhang.pdf).\n    Proceedings of the twenty-first international conference on Machine\n    learning. 2004.\n- Guo, Chuan, et al. \"On calibration of modern neural networks.\" International conference on machine learning. PMLR, 2017.\n\n\n## Examples\n\n| comparison                                     | notebook                                                                                                                                                           |\n|------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| scikit-learn's sigmoid and isotonic regression | [![colab1](https://colab.research.google.com/assets/colab-badge.svg)](https://github.com/Affirm/splinator/blob/main/examples/calibrator_model_comparison.ipynb)    |\n| pyGAM\u2019s spline model                           | [![colab2](https://colab.research.google.com/assets/colab-badge.svg)](https://githubtocolab.com/Affirm/splinator/blob/main/examples/spline_model_comparison.ipynb) |\n\n## Development\n\nThe dependencies are managed by [pdm](https://pdm.fming.dev/latest/)\n\nTo run tests, run `pdm run -v pytest tests`\n\n## Example Usage\n\n``` python\nfrom splinator.estimators import LinearSplineLogisticRegression\nimport numpy as np\n\n# random synthetic dataset\nn_samples = 100\nrng = np.random.RandomState(0)\nX = rng.normal(loc=100, size=(n_samples, 2))\ny = np.random.randint(2, size=n_samples)\n\nlslr = LinearSplineLogisticRegression(n_knots=10)\nlslr.fit(X, y)\n```\n",
    "bugtrack_url": null,
    "license": "BSD-3-Clause",
    "summary": "Python library for fitting linear-spine based logistic regression for calibration.",
    "version": "0.2.0",
    "project_urls": null,
    "split_keywords": [
        "calibration",
        "logistic",
        "spline",
        "regression"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "21751d5d9bf6d7873ac25df91bd073c64bfb30928510c785e43cd629441c6c02",
                "md5": "0dea71c33e6cb8e5e2fe0d3c50aac9ef",
                "sha256": "52670b0ab8f40847d3f1abec625005e7e121efd65fae4b3af5fe1919ee36e8d2"
            },
            "downloads": -1,
            "filename": "splinator-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0dea71c33e6cb8e5e2fe0d3c50aac9ef",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.7.1",
            "size": 9988,
            "upload_time": "2023-07-31T07:47:25",
            "upload_time_iso_8601": "2023-07-31T07:47:25.977175Z",
            "url": "https://files.pythonhosted.org/packages/21/75/1d5d9bf6d7873ac25df91bd073c64bfb30928510c785e43cd629441c6c02/splinator-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "651893b83d9923e1b3c352d589faf3cafad5641f7ea6f4d5400be37efe70ecbd",
                "md5": "aa114a003d3bcaf44a196e5fe6253d8c",
                "sha256": "dc0fabd7e4a57eb7bffebf3c16901e8f5e400aa1b4c1a3b40b2830a4d4cb7caf"
            },
            "downloads": -1,
            "filename": "splinator-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "aa114a003d3bcaf44a196e5fe6253d8c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.7.1",
            "size": 13929,
            "upload_time": "2023-07-31T07:47:27",
            "upload_time_iso_8601": "2023-07-31T07:47:27.628152Z",
            "url": "https://files.pythonhosted.org/packages/65/18/93b83d9923e1b3c352d589faf3cafad5641f7ea6f4d5400be37efe70ecbd/splinator-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-31 07:47:27",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "splinator"
}
        
Elapsed time: 0.09507s