Cal-PIT
Full Documentation
Full documentation for the project is available on Read the Docs
Overview
calpit diagnoses and recalibrates conditional density estimates (CDEs). It learns how the probability integral transform (PIT) of the CDEs varies with the features, which gives local P-P plots that show where the CDEs are miscalibrated, and a recalibration of the CDEs themselves.
- CDEs can be densities on a grid, quantiles, samples or qp ensembles.
- Cal-PIT can be learned by any PyTorch network, trained with PyTorch Lightning, or by any scikit-learn classifier.
CalPITfollows the scikit-learn API, and every piece of the training is importable for hand-written training loops.
Basic Usage
import calpit
recalibrator = calpit.CalPIT().fit(x_calib, y_calib, calpit.GridCDE(pdf_calib, y_grid))
local = recalibrator.diagnose(x_test) # Local P-P curves and their distance from the diagonal.
cde_new = recalibrator.transform(x_test, calpit.GridCDE(pdf_test, y_grid)) # Recalibrated CDEs.
See the user guide for quantile, sample and qp CDEs, scikit-learn models and hand-written training loops.
Installation
pip install 'calpit[torch]'
The core needs only NumPy and SciPy; models and file formats come with extras:
| Extra | Installs | Needed for |
|---|---|---|
torch |
torch, lightning, spline-basis |
PyTorch models, including the default calpit.nn.IsplineNN |
sklearn |
scikit-learn |
scikit-learn models |
qp |
qp-prob |
calpit.qp_io |
hdf5 |
h5py |
calpit.nn.PhotometryDataset |
plot |
matplotlib |
calpit.utils.plot_pit, calpit.diagnostics.plot_local_pp |
all |
all of the above |
calpit needs Python 3.11 or later.
To install the latest version of the code from Github, you can run the following command:
pip install git+https://github.com/lee-group-cmu/Cal-PIT
If you would like to install the package for development purposes, you can clone the repository and install the package in editable mode:
>> git clone https://github.com/lee-group-cmu/Cal-PIT.git
>> cd Cal-PIT
>> pip install -e '.[dev]'
Metadata
Release files for calpit 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 | Actions |
|---|---|---|---|---|
| calpit-0.2.0.tar.gz | 71.0 kB | With provenance | Details for calpit-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| calpit-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for calpit-0.2.0-py3-none-any.whl |
Total release size: 117.3 kB
Release files / calpit-0.2.0.tar.gz
| Download URL | calpit-0.2.0.tar.gz |
|---|---|
| Size | 71.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c7eb5c0f521f0693b4c92e7c4212a8ec990fb7ef3f6958965ec53b70a0b06c6b
|
|
BLAKE2b-256 checksum How to use checksums |
9313c3b10e1eec1f1a18602f63e66eede9a6344c500c403e8dc476ec04bbf524
|
| 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 Oct 9, 2026.
Transparency logRelease files / calpit-0.2.0-py3-none-any.whl
| Download URL | calpit-0.2.0-py3-none-any.whl |
|---|---|
| Size | 46.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
240e409cb0d439e4ca949713d578c173e90937ee4a71194c0008a7d2182c21b0
|
|
BLAKE2b-256 checksum How to use checksums |
308c5bebe22132a06d624525370b8afdfdef84208e29663a092c15b94cb6f526
|
| 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 Oct 9, 2026.
Transparency logSecurity for calpit 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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for calpit-0.2.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 Oct 9, 2026.
Transparency logA 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.