Skip to main content

isodistrreg: Python bindings

Python bindings for Isotonic Distributional Regression (IDR) and Survival-IDR (S-IDR), built with PyO3 and maturin. See the main README for background.

Installation

pip install isodistrreg

Pre-built wheels are provided for Linux, macOS, and Windows on CPython 3.13+. On other platforms pip builds from the source distribution, which requires a Rust toolchain.

The scikit-learn–compatible estimator is available through an optional extra:

pip install "isodistrreg[scikit-learn]"

Examples

We use numpy to set up a toy problem, but plain python lists can also be used.

Precision

CDF outputs (cdf, cdf_at, cdf_grid) are always np.float32. Covariates and thresholds are stored at the dtype of the input arrays passed to IDR(...): float32 inputs stay float32, float64 inputs stay float64, and .X / .thresholds return zero-copy views at the storage dtype. See the docstring on IDR.cdf and IDR.from_cdfs in _core.pyi for the full rules.

Example 1: Covariate 1-dimensional, outcome censored

import numpy as np
# we visualize with matplotlib
from matplotlib import pyplot as plt
from isodistrreg import IDR

# Generate an instance of increasing conditional CDFs with censoring, and a one-dimensional covariate
n = 500
rng = np.random.default_rng(seed=123)
x = rng.uniform(size=n)
y = x + rng.uniform(size=n)
c = x + rng.uniform(size=n)

t = np.minimum(y, c)
d = y <= c

# Fit the IDR / S-IDR model, censoring is indicated by "False"
fit = IDR(t, x, d)

# Sorted and deduplicated covariates and thresholds are available
sorted_x = fit.X
sorted_y = fit.thresholds

# Estimate and plot the complete distributional estimate
cdf_for_each_x = fit.cdf(sorted_x)
def plot_cdfs_nicely(cdfs, centers, times):
    """Plot a picture with the right scale; plt.imshow is simpler, but spacing along the axis is not to scale"""
    plt.pcolormesh(
        [centers[0] - (centers[1] - centers[0]) / 2]
            + list((centers[1:] + centers[:-1]) / 2)
            + [centers[-1] + (centers[-1] - centers[-2]) / 2],
        list(times) + [times[-1] + (times[-1] - times[0]) / len(times)],
        cdfs.T,
        vmin=0.0,
        vmax=1.0,
    )
plot_cdfs_nicely(cdf_for_each_x, sorted_x, sorted_y)
plt.colorbar()

# Estimate and plot the mean
mean_for_each_x = fit.predict(sorted_x)
# Due to censoring, the estimated sub-CDF may not always have a mean
plt.plot(sorted_x, sorted_x + 0.5, color="lightblue", label="true mean")
plt.plot(sorted_x, mean_for_each_x, color="red", label="mean")

# Estimate and plot quantiles
probabilities = np.array([0.2, 0.8])
quantiles = fit.quantile(sorted_x[:, np.newaxis], probabilities)
plt.plot(sorted_x, quantiles, label=[f"{p} quantile" for p in probabilities])

plt.legend(loc="lower right")
plt.show()

Example 2: Covariate 3-dimensional

import numpy as np
from isodistrreg import IDR

## toy data (3-dimensional covariate)
X = np.column_stack([np.arange(1, 5)] * 3)
y = np.array([1, 0, 2, 2])

## fit
idr_fit = IDR(X = X, y = y)

## get CDF for new x at all relevant thresholds
new_x = np.array([[1, 1, 1], [1.5, 1.5, 1.5]])
idr_fit.cdf(new_x) # (one CDF per row = per x)

## broadcasting
idr_fit.cdf_at(new_x, 0) # (evaluate CDF at 0 for all covariates)
idr_fit.cdf_at(new_x, [0,1]) # (evaluate CDF for x1 at 0, x2 at 1)
idr_fit.cdf_at(new_x, np.column_stack([[1, 2, 3], [0, 1, 2]])) # (CDF at 1,2,3 for x1, and 0,1,2 for x2)

## same for quantiles
idr_fit.quantile(new_x, 0.5)
idr_fit.quantile(new_x, [0.25, 0.5])
idr_fit.quantile(new_x, np.column_stack([[0.25, 0.5, 0.75], [0.1, 0.2, 0.3]]))

# Fast grid evaluation for 1-dimensional covariate
X = np.arange(5)
y = np.arange(5)
idr_fit = IDR(X = X, y = y)
idr_fit.cdf_grid(X, y) # (CDF at all covariate-threshold-combinations)

References

Henzi, A., Ziegel, J. and Gneiting, T. (2021). Isotonic distributional regression. J R Stat Soc Series B, 83: 963–993. https://doi.org/10.1111/rssb.12450

Henzi, A., Moesching, A. and Duembgen, L. (2022). Accelerating the Pool-Adjacent-Violators Algorithm for Isotonic Distributional Regression. Methodol Comput Appl Probab. https://doi.org/10.1007/s11009-022-09937-2

Bladt, M., Henzi, A., van den Heuvel, B. and Ziegel, J. (2026). Survival Isotonic Distributional Regression. arXiv preprint arXiv:2608.02914. https://arxiv.org/abs/2608.02914

Metadata

Release files for isodistrreg 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for isodistrreg 0.6.0
File Size Uploaded Provenance Actions
isodistrreg-0.6.0.tar.gz 345.1 kB With provenance Details for isodistrreg-0.6.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for isodistrreg 0.6.0
File Actions
isodistrreg-0.6.0-cp313-abi3-win_amd64.whl CPython 3.13 abi3 Windows x86-64 Details for isodistrreg-0.6.0-cp313-abi3-win_amd64.whl
isodistrreg-0.6.0-cp313-abi3-manylinux_2_34_x86_64.whl CPython 3.13 abi3 Linux glibc 2.34+ x86-64 Details for isodistrreg-0.6.0-cp313-abi3-manylinux_2_34_x86_64.whl
isodistrreg-0.6.0-cp313-abi3-manylinux_2_34_aarch64.whl CPython 3.13 abi3 Linux glibc 2.34+ ARM64 Details for isodistrreg-0.6.0-cp313-abi3-manylinux_2_34_aarch64.whl
isodistrreg-0.6.0-cp313-abi3-macosx_11_0_arm64.whl CPython 3.13 abi3 macOS 11.0+ ARM64 Details for isodistrreg-0.6.0-cp313-abi3-macosx_11_0_arm64.whl
isodistrreg-0.6.0-cp313-abi3-macosx_10_12_x86_64.whl CPython 3.13 abi3 macOS 10.12+ x86-64 Details for isodistrreg-0.6.0-cp313-abi3-macosx_10_12_x86_64.whl

Total release size: 9.7 MB

Release files / isodistrreg-0.6.0.tar.gz

Download URL isodistrreg-0.6.0.tar.gz
Size 345.1 kB
Tags Source
SHA-256 checksum
How to use checksums
0ba1bdcbe4302b253eb0264373f6ad0b91ee483877021db411951fdcb97db0ec
BLAKE2b-256 checksum
How to use checksums
d4d5333f31ebe3d672f07b8bbb5b9c615bfd91fa8a96078838575bf847cf0d1d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 21, 2026.

Transparency log

Release files / isodistrreg-0.6.0-cp313-abi3-win_amd64.whl

Download URL isodistrreg-0.6.0-cp313-abi3-win_amd64.whl
Size 2.0 MB
Tags CPython 3.13 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
086ba4e071009b14d259b3f5d2b57758fbba456cfab5d2c2595a00d97e468172
BLAKE2b-256 checksum
How to use checksums
7463043086dec5d38b2df5bf5b6745cb9dd8dfa216f04093515a9d83b360163d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 21, 2026.

Transparency log

Release files / isodistrreg-0.6.0-cp313-abi3-manylinux_2_34_x86_64.whl

Download URL isodistrreg-0.6.0-cp313-abi3-manylinux_2_34_x86_64.whl
Size 2.1 MB
Tags CPython 3.13 Linux glibc 2.34+ x86-64 abi3
SHA-256 checksum
How to use checksums
b67e1dfe3517cdb17263acd995ba3b74aad444fbf3f61e84c9ed8f4056a5c71b
BLAKE2b-256 checksum
How to use checksums
2089c868bdeb1d83c7753da34389e2afdc16726ef1ea3a1e2efbfe7b33c50cca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 21, 2026.

Transparency log

Release files / isodistrreg-0.6.0-cp313-abi3-manylinux_2_34_aarch64.whl

Download URL isodistrreg-0.6.0-cp313-abi3-manylinux_2_34_aarch64.whl
Size 1.8 MB
Tags CPython 3.13 Linux glibc 2.34+ ARM64 abi3
SHA-256 checksum
How to use checksums
64125d014d93c6ab890cb9963ed2ac0c7fca29daafa80e0507af318662c0b7a5
BLAKE2b-256 checksum
How to use checksums
6e5b2e04d175a3f6e6188c18e21341ca21cbd439a4df5402d8878876957f49f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 21, 2026.

Transparency log

Release files / isodistrreg-0.6.0-cp313-abi3-macosx_11_0_arm64.whl

Download URL isodistrreg-0.6.0-cp313-abi3-macosx_11_0_arm64.whl
Size 1.6 MB
Tags CPython 3.13 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
33560d304d1dd5900e1925e328683083694069a11f33aada7b568c8e2ea24508
BLAKE2b-256 checksum
How to use checksums
e72f42838e94ad105609f6a61f48de9f0d03673106ec51dd7de2c7a7037438c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 21, 2026.

Transparency log

Release files / isodistrreg-0.6.0-cp313-abi3-macosx_10_12_x86_64.whl

Download URL isodistrreg-0.6.0-cp313-abi3-macosx_10_12_x86_64.whl
Size 1.8 MB
Tags CPython 3.13 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
a2e9742a44d59950a37a4b6678d37a1718251962050c9bdd5f1a87aee2ddc415
BLAKE2b-256 checksum
How to use checksums
a15adc5308817fdaf4f13d7a5b120c2174c88c7eed7e73b80ac04a93a08862d9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 21, 2026.

Transparency log

Security for isodistrreg 0.6.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.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for isodistrreg-0.6.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 21, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.6.0 This release

6 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page