Skip to main content

Operating profile plots: score histograms + TPR/FPR/accuracy vs threshold for binary classifiers.

Project description

opproplot

OPerating PROfile PLOT

Opproplot is an operating profile plot for binary classifiers: a single figure that shows score distributions by class plus TPR/FPR/Accuracy as you move the decision threshold. It makes threshold selection, ROC/PR intuition, and calibration discussion concrete in one view.

Docs: https://rollingstorms.github.io/opproplot

Opproplot hero

What is an Operating Profile Plot?

An Operating Profile Plot (Opproplot) is a unified visualization for binary classifiers that shows how a model behaves across every possible decision threshold. It combines:

  • a stacked histogram of predicted scores for positives vs. negatives
  • threshold-dependent performance metrics such as Recall (TPR) and False Positive Rate (FPR)
  • computed at the midpoint of each score bin, treating each as a candidate threshold

This creates a complete operating profile of the model in a single view — letting you see where the model is confident, where the classes overlap, and how performance changes as you move the threshold.

It is a compact, multidimensional readout of model behavior: score distribution by class plus operating curves (TPR/FPR/accuracy) on the same axis. Comparing profiles across models or datasets shows whether a model separates classes cleanly, where overlap drives errors, and how threshold choices shift business metrics.

Rather than switching between ROC curves, PR curves, histograms, and calibration plots, Opproplot places the score distribution and the operating characteristics on the same axis, making it easy to:

  • identify thresholds with optimal trade-offs
  • diagnose where errors occur in score space
  • communicate model quality in an interpretable, visual way

What it is: Opproplot visualizes the family of decision rules h_t(x) = 1{f(x) >= t} and their induced operating characteristics (TPR, FPR, Accuracy), alongside the empirical score distributions p(s | Y=1) and p(s | Y=0).

Why it matters: You see where positives and negatives sit in score space, how recall and false positives trade off at every cutoff, and where accuracy peaks—no context-switching between ROC curves, confusion matrices, and histograms.

When to use it: model validation, stakeholder reviews, threshold tuning for production alerting, class-imbalance checks, and calibration audits.

Installation

From the repo root:

pip install -e .

Quickstart

import numpy as np
from opproplot import operating_profile_plot

rng = np.random.default_rng(0)
y_true = rng.integers(0, 2, size=5000)
scores = rng.random(size=5000)

fig, ax_hist, ax_metric = operating_profile_plot(y_true, scores, bins=30)

The resulting operating profile lets you see where positives and negatives concentrate in score space, how recall and false positive rate trade off as you move the threshold, and where accuracy peaks. It is a single, interpretable view of all possible thresholds for a scoring model.

Opproplot simulated example

Detailed example (scikit-learn)

from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression

data = load_breast_cancer()
X_train, X_test, y_train, y_test = train_test_split(
    data.data, data.target, test_size=0.25, random_state=0, stratify=data.target
)

clf = LogisticRegression(max_iter=1000)
clf.fit(X_train, y_train)

y_score = clf.predict_proba(X_test)[:, 1]
operating_profile_plot(y_test, y_score, bins=30)

Opproplot breast cancer example

Project layout

  • Package code lives in src/opproplot.
  • Tests live in tests/.
  • Documentation for GitHub Pages lives in docs/ (see below).
  • Regenerate doc images with python scripts/generate_docs_images.py (requires numpy, matplotlib, scikit-learn).

Documentation site

Enable GitHub Pages with the docs/ folder as the root. The scaffold includes:

  • docs/index.md: landing page with value proposition and a hero plot.
  • docs/getting_started.md: install, notebook walkthrough, common models.
  • docs/theory.md: decision rules, distributions, and metric integrals.
  • docs/examples.md: real datasets and comparisons.
  • docs/api.md: core functions and parameters.
  • docs/roadmap.md: features and status.

Fill in each page as you iterate; the structure is ready to publish.

Testing

pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

opproplot-0.1.0.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

opproplot-0.1.0-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file opproplot-0.1.0.tar.gz.

File metadata

  • Download URL: opproplot-0.1.0.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for opproplot-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f0f972292f60f8db6335adaf54f29b036618204d4c51b12f0abb7daa492800d6
MD5 a38a8035ec237ff44f4f077ecda83c46
BLAKE2b-256 e6d170f9ce1f8ecd9d8fd84231fe3969270e8a37dccbf600467c8bab8c518cb4

See more details on using hashes here.

Provenance

The following attestation bundles were made for opproplot-0.1.0.tar.gz:

Publisher: publish.yml on rollingstorms/opproplot

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file opproplot-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: opproplot-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for opproplot-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 de320be35d6607b5c6d6686acc8e87b13cd0f983cc8f63796fe5f79523d5ea35
MD5 65676cfab7705a6d91f8d955c3893b16
BLAKE2b-256 537eafaa394e6bfbff9578f39e1e83d7780d6ba61e09456a3f6f759dcfe5b612

See more details on using hashes here.

Provenance

The following attestation bundles were made for opproplot-0.1.0-py3-none-any.whl:

Publisher: publish.yml on rollingstorms/opproplot

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page