Introduction
The cir-model library implements the Centered Isotonic Regression (CIR) model.[1] CIR is a variant of Isotonic Regression (IR), which is a nonparametric regression model which only assumes that the data generating function is monotonically increasing or decreasing. The function can take any monotonic form that minimizes the sum of squared errors. scikit-learn has implemented Isotonic Regression as IsotonicRegression.[2]
In some scenarios, the assumption of monotonicity is too weak. IR can result in a function that has constant, non-decreasing intervals. In some applications, like dose-response curve fitting or in cumululative distribution function estimation, it can be safe to make the additional assumption of strict monotonicity: at any point the function should be increasing, not just non-decreasing (or vice versa: decreasing, not just non-increasing). This additional requirement results in a function with the desirable property that the inverse function is a unique mapping, because there are no longer ranges of constant intervals.
Centered Isotonic Regression (CIR) is similar to IR, but with the additional assumption of strict monotonicity. The algorithm is described in detail in [1]. The plot below shows a comparison of IR (in blue) and CIR (in red) fitted to the same datapoints (in green).
This Python library, cir-model, implements CenteredIsotonicRegression in line with the algorithm in [1]. cir-model uses the IsotonicRegression implementation of scikit-learn. Therefore, CenteredIsotonicRegression takes the same parameters as IsotonicRegression and is completely compatible with scikit-learn. You can use it for example in scikit-learn pipelines.
You can install cir-model using pip:
pip install -U cir-model
Examples
To fit a CIR model:
>>> from cir_model import CenteredIsotonicRegression
>>> x = [1, 2, 3, 4]
>>> y = [1, 37, 42, 5]
>>> model = CenteredIsotonicRegression().fit(x, y)
>>> model.transform(x)
array([ 1. , 14.5, 28. , 28. ])
Finding the inverse of the CIR model above, for example for the value x for which y=25:
>>> from scipy import optimize
>>> optimize.newton(lambda x: model.transform([x]) - 25, 2)
array([2.77777778])
References
- Centered Isotonic Regression: Point and Interval Estimation for Dose-Response Studies, Assaf P. Oron & Nancy Flournoy, Statistics in Biopharmaceutical Research, Volume 9, Issue 3, 258-267, 2017
- Scikit-learn: Machine Learning in Python, Fabian Pedregosa et al., JMLR 12, 2825-2830, 2011
Metadata
Release files for cir-model 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| cir-model-0.2.0.tar.gz | 5.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cir_model-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.0 kB
Release files / cir-model-0.2.0.tar.gz
| Download URL | cir-model-0.2.0.tar.gz |
|---|---|
| Size | 5.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3ed5274ef952361945e444beb35e386707bc367e632a949cf6ddce65258a0aa2
|
|
BLAKE2b-256 checksum How to use checksums |
409e595c5c70dd0a1382083df9e484a430288fdbaf3ff016d659037002540050
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.12
|
Release files / cir_model-0.2.0-py3-none-any.whl
| Download URL | cir_model-0.2.0-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fb3f24b580f66156b43d26d1cf8d0f8e95439d554246fb32334b4bd4e44327e9
|
|
BLAKE2b-256 checksum How to use checksums |
7488dcbe29ae755d01c507e6fbd91cd19089ec5243ddaeb29caa71c40089c86c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.12
|
Security for cir-model 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.