Skip to main content

calzone: a python package for measuring calibration in probabilistic models

Docs

calzone is a comprehensive Python package for calculating and visualizing various metrics to assess the calibration of probabilistic models. To accurately assess the calibration of machine learning models, it is essential to have a comprehensive and reprensative dataset with sufficient coverage of the prediction space. The calibration metrics is not meaningful if the dataset is not representative of true intended population.

Features

  • Supports multiple calibration metrics including Spiegelhalter's Z-test, Expected Calibration Error (ECE), Maximum Calibration Error (MCE), Hosmer-Lemeshow test, Cox regression analysis, and Loess regression analysis
  • Provides tools for creating reliability diagrams and ROC curves
  • Offers both equal-space and equal-frequency binning options
  • Boostrapping for confidence intervals for each calibration metrics
  • Prevelance adjustment to account for prevalance change between enriched data and population data.
  • Multiclass extension by 1-vs-rest or top-class only

Installation

calzone package require installation of numpy, scipy, matplotlib and statsmodels.

You can install calzone using pip:

pip install -e "git+https://github.com/DIDSR/calzone.git#egg=calzone"

Alternatively, you can clone the repository and install it locally:

git clone https://github.com/DIDSR/calzone.git
cd calzone
pip install .

Usage

run python cal_metrics.py -h to see the help information and usage. To use the package in your Python code, please refer to the examples in the documentation pages.

A GUI is available by running python GUI_cal_metrics.py. Support for the GUI is experiment and requires additional dependencies (i.e., nicegui).

Documentation

For a detailed manual and API reference, please visit our documentation page.

Support

If you encounter any issues or have questions about the package, please open an issue request or contact the authors:

Disclaimer

This software and documentation (the "Software") were developed at the Food and Drug Administration (FDA) by employees of the Federal Government in the course of their official duties. Pursuant to Title 17, Section 105 of the United States Code, this work is not subject to copyright protection and is in the public domain. Permission is hereby granted, free of charge, to any person obtaining a copy of the Software, to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, or sell copies of the Software or derivatives, and to permit persons to whom the Software is furnished to do so. FDA assumes no responsibility whatsoever for use by other parties of the Software, its source code, documentation or compiled executables, and makes no guarantees, expressed or implied, about its quality, reliability, or any other characteristic. Further, use of this code in no way implies endorsement by the FDA or confers any advantage in regulatory decisions. Although this software can be redistributed and/or modified freely, we ask that any derivative works bear some notice that they are derived from it, and any modified versions bear some notice that they have been modified.

Metadata

Release files for calzone-tool 0.1.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 calzone-tool 0.1.0
File Size Uploaded
calzone_tool-0.1.0.tar.gz 18.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for calzone-tool 0.1.0
File Interpreter ABI Platform
calzone_tool-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 36.8 kB

Release files / calzone_tool-0.1.0.tar.gz

Download URL calzone_tool-0.1.0.tar.gz
Size 18.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a476e13f80f5cbcd2bf7c33265244584885f697f9a86405ff28a0153effe37ec
BLAKE2b-256 checksum
How to use checksums
08e47e5216ca6e53d986bbe3172a6b404d3974d568f6254b3da06277dd7dd9c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.11.5

Release files / calzone_tool-0.1.0-py3-none-any.whl

Download URL calzone_tool-0.1.0-py3-none-any.whl
Size 18.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a302de3ae91f84537dafdb485997e2aa651e414d69fd4399505ab5598e1e865b
BLAKE2b-256 checksum
How to use checksums
d0843ba8a4dd3d37713d2c5fceec57d48295f0550b8ba447a7455df52de93d59
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.11.5

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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