Skip to main content

Model Auditor

Evaluate fixed binary-model predictions across subgroups: discrimination, decision performance, probability calibration, and paired comparisons, with explicit statistical assumptions and reproducible results.

Documentation · PyPI · Issues

Installation

Requires Python 3.10 or later.

pip install model-auditor

Optional plotting and styled-table dependencies:

pip install 'model-auditor[plotting,styling]'

Quick start

import pandas as pd

from model_auditor import Auditor, InferenceConfig
from model_auditor.metrics import AUROC, Sensitivity, Specificity, nData

# Replace this small example with your own observations.
df = pd.DataFrame({
    "region": ["North", "North", "North", "South", "South", "South"],
    "risk_score": [0.9, 0.6, 0.2, 0.8, 0.4, 0.1],
    "outcome": [1, 0, 0, 1, 1, 0],
})

auditor = Auditor(data=df)
auditor.add_feature(name="region", label="Region")
auditor.add_score(name="risk_score", threshold=0.5)
auditor.add_outcome(name="outcome")
auditor.set_metrics([nData(), Sensitivity(), Specificity(), AUROC()])

results = auditor.evaluate_metrics(
    "risk_score", inference=InferenceConfig(random_state=42), cohort="held-out"
)
print(results.to_numeric_dataframe())

Results include original-sample estimates, denominators, exclusions, and interval diagnostics. Undefined metrics are NaN. IID rates use approximate Wilson intervals (rate_interval="exact" selects conservative binomial intervals); enrichment ORs use conditional exact intervals. Other metrics use diagnosed bootstrap intervals. Set n_bootstraps=None for descriptive estimates only.

Use compare_scores() for paired models, compare_groups() for reference-group metric contrasts, evaluate_calibration() for probability diagnostics, and add_intersection() for joint subgroups. InferenceConfig(resampling="cluster", cluster="patient_id", random_state=42) resamples whole subjects while retaining row-weighted estimates.

Intervals are pointwise and condition on fixed predictions and thresholds. Select models/thresholds on separate data; repeated observations require an appropriate sampling unit. Enrichment odds ratios describe confusion-group membership, not class-conditional error-rate disparities or causal fairness. Multiclass, survival, survey-weighted inference, and model-refitting validation are outside this package's current scope.

Learn more

The documentation website contains the guides, examples, metric definitions, API reference, and statistical conventions. Its source repository tracks the latest stable release; this checkout may contain unreleased changes.

For work on the library itself, see CONTRIBUTING.md. Agent instructions are in AGENTS.md.

Metadata

Release files for model-auditor 0.1.16

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

Source distribution (sdist)

Source distribution for model-auditor 0.1.16
File Size Uploaded Provenance
model_auditor-0.1.16.tar.gz 92.8 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for model-auditor 0.1.16
File Interpreter ABI Platform
model_auditor-0.1.16-py3-none-any.whl Python 3 none any Details

Total release size: 147.6 kB

Release files / model_auditor-0.1.16.tar.gz

Download URL model_auditor-0.1.16.tar.gz
Size 92.8 kB
Tags Source
SHA-256 checksum
How to use checksums
b4e0ca8fa63475377c2ff28164237366783ea83ed190f5ae770631eda47374e2
BLAKE2b-256 checksum
How to use checksums
a4a0e41c012a8104714f870d11600d288d0166339f96465eb97435a86f718196
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 Sep 5, 2026.

Transparency log

Release files / model_auditor-0.1.16-py3-none-any.whl

Download URL model_auditor-0.1.16-py3-none-any.whl
Size 54.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
50295585b844111821d6542947eb9835416a4303dbecd96a50116ec9bef7dd29
BLAKE2b-256 checksum
How to use checksums
fa5b30ef25957e8a3b6545e1389705099a65699c3749e54ed090bd15a4af9808
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 Sep 5, 2026.

Transparency log

Security for model-auditor 0.1.16

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 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for model_auditor-0.1.16.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 Sep 5, 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.

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