Metadata-Version: 2.4
Name: metrics-adjuster
Version: 1.0.2
Summary: Adjusted group-aware clinical prediction metrics with Python API and CLI.
Project-URL: Homepage, https://github.com/SaehwanPark/metrics-adjuster
Project-URL: Repository, https://github.com/SaehwanPark/metrics-adjuster
Project-URL: Issues, https://github.com/SaehwanPark/metrics-adjuster/issues
Author: Saehwan Park
License-Expression: GPL-3.0-only
License-File: LICENSE
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering
Classifier: Typing :: Typed
Requires-Python: >=3.11
Requires-Dist: matplotlib>=3.10.9
Requires-Dist: numpy>=1.26
Requires-Dist: pandas>=2.1
Requires-Dist: pyarrow>=24.0.0
Requires-Dist: pydantic>=2.6
Requires-Dist: pyyaml>=6.0.3
Provides-Extra: dev
Requires-Dist: mypy>=1.10; extra == 'dev'
Requires-Dist: pandas-stubs>=2.1; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.5; extra == 'dev'
Requires-Dist: types-pyyaml>=6.0.12.20260518; extra == 'dev'
Description-Content-Type: text/markdown

# 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](https://pypi.org/project/metrics-adjuster/) (Python 3.11+):

```bash
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](https://github.com/SaehwanPark/metrics-adjuster/blob/main/CONTRIBUTING.md)

## Quick Example

```bash
metrics-adjuster demo --output-dir demo_outputs --report
```

For caller-provided CSV or Parquet data:

```bash
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

```python
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

- [Quickstart](https://github.com/SaehwanPark/metrics-adjuster/blob/main/QUICKSTART.md)
- [API manual](https://github.com/SaehwanPark/metrics-adjuster/blob/main/docs/API_MANUAL.md)
- [CLI manual](https://github.com/SaehwanPark/metrics-adjuster/blob/main/docs/CLI_MANUAL.md)
- [Contributing](https://github.com/SaehwanPark/metrics-adjuster/blob/main/CONTRIBUTING.md)

## License

`metrics-adjuster` is distributed under the GNU General Public License v3.0.
