Adjusted group-aware clinical prediction metrics with Python API and CLI.
Project description
metrics-adjuster
metrics-adjuster computes conventional and adjusted group-aware metrics for
binary prediction models. It provides a typed Python API, a command-line
interface, deterministic synthetic demos, and self-contained HTML reports.
Installation
Install from PyPI (Python 3.11+):
python -m pip install metrics-adjuster
That one command installs both the metrics-adjuster CLI and the Python API.
Other setups:
- CLI only, without a project environment:
pipx install metrics-adjuster - uv project:
uv add metrics-adjuster - conda or mamba env: run the pip command above inside your activated environment
- pinned release:
python -m pip install "metrics-adjuster==1.0.2" - source checkout: see Contributing
Quick Example
metrics-adjuster demo --output-dir demo_outputs --report
For caller-provided CSV or Parquet data:
metrics-adjuster run \
--input cohort.csv \
--output-dir adjusted_metric_outputs \
--group-col group \
--ref-group ref \
--response-col outcome \
--risk-col risk \
--metrics aTPR,aPPV,aNB,aHR \
--report
The CLI writes one CSV per adjusted metric and, when --report is enabled, a
self-contained report.html.
Python API
from metrics_adjuster import ColumnSpec, MetricConfig, adjusted_metrics
from metrics_adjuster.synthetic import generate_synthetic_metrics_data
frame = generate_synthetic_metrics_data(n=600, seed=2026)
config = MetricConfig(
columns=ColumnSpec(group="group", response="outcome", risk="risk"),
ref_group="ref",
random_state=2026,
)
result = adjusted_metrics(frame, config)
print(result.metrics["aTPR"])
Documentation
License
metrics-adjuster is distributed under the GNU General Public License v3.0.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file metrics_adjuster-1.0.2.tar.gz.
File metadata
- Download URL: metrics_adjuster-1.0.2.tar.gz
- Upload date:
- Size: 32.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66054ceaba2a07b10c0e181c984000d91b6eb73af157744e910d32a6d8f63662
|
|
| MD5 |
a5fe6e4c6a02340eb0972346877424b8
|
|
| BLAKE2b-256 |
351201995d321f5ba3b45946755e9b9373d3413a51946df25718dbe8c51ba7b2
|
File details
Details for the file metrics_adjuster-1.0.2-py3-none-any.whl.
File metadata
- Download URL: metrics_adjuster-1.0.2-py3-none-any.whl
- Upload date:
- Size: 21.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd8915fc21e5cbd5907ff9d5774d8a33c0d7d6e3dba8b4dabb6dae551b78c6b7
|
|
| MD5 |
cf6ec9fedef3df9e05c176128c6643dd
|
|
| BLAKE2b-256 |
5aba582783cd5bfa27e61201e77fce3f1e00b0d51094d8db30d7df4ecc668dd8
|