agentleFS
WalrusQuantWalrusQuant/sports-analytic-skills/skills/calibration-check/SKILL.md

calibration-check

Skill54 starsChanged 7 days agoMITView on GitHub

Evaluate whether sports-model probabilities match observed frequencies. Use for Brier score, log loss, reliability bins, ECE, segment checks, and recalibration decisions.

  • Installs packages

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

14 rules. About 0 are common, 14 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈14

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    After walk-forward evaluation of a probability model

    line 30
  2. Distinctive:

    Before writing results that quote probability levels

    line 31
  3. Distinctive:

    Do not use when:

    line 35
  4. Distinctive:

    Read calibration_metrics.md when interpreting ECE, Brier score, log loss, or sharpness.

    line 68
  5. Distinctive:

    If recalibrating, only with nested/train-proper methods — never fit isotonic on the final test fold and call it validated.

    line 83
  6. Distinctive:

    Write the calibration report into experiment log / results writeup.

    line 84
  7. Distinctive:

    Before issuing one, verify that predictions are genuinely held out and walk-forward, inspect uncertainty and populated-bin counts, compare …

    line 98
  8. Distinctive:

    No universal ECE cutoff establishes that probabilities are trustworthy.

    line 101
  9. Distinctive:

    Always report bin counts. Empty bins are not evidence.

    line 149
  10. Distinctive:

    After recalibration, re-report ECE/Brier on true forward folds.

    line 163
  11. Distinctive:

    Never evaluate calibration on training rows used to fit the same model without nested disclosure.

    line 169
  12. Distinctive:

    Never present raw scores as probabilities without checking calibration.

    line 170
  13. Distinctive:

    Never hide segment failures behind a pooled “looks fine.”

    line 171
  14. Distinctive:

    If sample per bin is tiny, say so — widen bins or reduce claim strength.

    line 172

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Calibration Check (Sports)

Overview

A model can rank teams well and still be miscalibrated. If the model says 30%, about 30% of those cases should hit.

This skill measures probability reliability for sports models and supports a human-reviewed verdict grounded in evaluation provenance, uncertainty, and segment stability.

Discrimination metrics (AUC, accuracy) do not replace calibration.


When to Use This Skill

Use when:

  • Model outputs win/event probabilities
  • User asks how confident / how reliable the probs are
  • After walk-forward evaluation of a probability model
  • Before writing results that quote probability levels
  • Comparing raw vs recalibrated probabilities
  • sport- and competition-specific probability artifacts

Do not use when:

NeedGo instead
Pure ranking tasks with no probabilistic interpretationranking/eval skills
Hard labels only with no probability outputsclassification metrics only
Designing splits from scratchvalidation-design
Feature legality reviewleakage-audit
Margin-only models without probsMAE/RMSE reporting

Installation

Compute calibration in the user's environment:

python -m pip install pandas numpy scikit-learn pyarrow

Accept the user's CSV, Parquet, or JSON prediction table. This repository does not ship a calibration program.


What to Measure

  1. Reliability / calibration curve — bin predicted prob vs observed rate
  2. Expected Calibration Error (ECE)
  3. Brier score (+ reliability/resolution decomposition when useful)
  4. Log-loss — discrimination + calibration together; not a substitute for ECE
  5. Segment calibration — by season, home/away, probability tail
  6. Sharpness — are probs informative, not all ~0.5?

Read calibration_metrics.md when interpreting ECE, Brier score, log loss, or sharpness. Read binning.md before choosing bin edges or minimum counts. Read recalibration.md before fitting Platt, isotonic, or another probability correction.


Workflow

  1. Confirm predictions come from time-safe / walk-forward folds.
  2. Validate probabilities in [0, 1]; account for every excluded row.
  3. Pre-declare binning (fixed-width or quantile).
  4. Compute curve, ECE, Brier, log-loss.
  5. Slice by season and by probability tails.
  6. Issue a verdict (table below).
  7. If recalibrating, only with nested/train-proper methods — never fit isotonic on the final test fold and call it validated.
  8. Write the calibration report into experiment log / results writeup.

Verdict Scale

VerdictMeaning
well-calibratedReliability acceptable for quoting probabilities
usable-with-caveatsSome miscalibration; disclose and/or recalibrate properly
poorly-calibratedProbability numbers not trustworthy as probabilities
invalid-evalLeakage/split issues block judgment

These verdicts belong to the full methodology, not to a single ECE threshold. Before issuing one, verify that predictions are genuinely held out and walk-forward, inspect uncertainty and populated-bin counts, compare seasons or folds, check decision-relevant segments, and document the prediction source. No universal ECE cutoff establishes that probabilities are trustworthy.


Run on Held-Out Prediction Artifacts

The input must contain one row per evaluated decision, a binary outcome, and a probability in [0, 1].

Preferred column names from baseline-models:

  • outcome: y_true
  • probability: p_pred (the same value may also be stored as logistic_probability)

For a symmetric team-game table, filter to one perspective per game (is_home == 1, or one row from games) before scoring. Do not double-count both sides of one event.

Report Brier score, log loss, ECE, reliability-bin counts, row accounting, and optional group metrics. A numeric summary cannot prove held-out provenance or turn a favorable pooled ECE into well-calibrated; apply the verdict scale above. Also report all-row, categorical-segment, probability-tail metrics, and sparse-bin counts.

predictions is the table from baseline-models (y_true, p_pred).

import numpy as np
from sklearn.metrics import brier_score_loss, log_loss

y = predictions["y_true"].to_numpy()
p = np.clip(predictions["p_pred"].to_numpy(), 1e-6, 1 - 1e-6)
bin_id = np.minimum(np.digitize(p, np.linspace(0, 1, 11)) - 1, 9)
ece, rows = 0.0, []
for b in range(10):
    m = bin_id == b
    n = int(m.sum())
    mean_p, obs = (float(p[m].mean()), float(y[m].mean())) if n else (None, None)
    ece += (n / len(y) * abs(obs - mean_p)) if n else 0.0
    rows.append({"bin": b, "n": n, "mean_p": mean_p, "obs_rate": obs})
print({"brier": float(brier_score_loss(y, p)), "log_loss": float(log_loss(y, p)), "ece": ece})
print(rows)

Binning Guidance

StrategyUse when
Equal-width (10 bins 0–1)default sports win probs
Quantile binsprobs clump in a narrow range
Tail focus (0–0.2, 0.8–1.0)decisions live in extremes

Always report bin counts. Empty bins are not evidence.


Recalibration Rules

Allowed

  • Platt scaling / isotonic fit inside training folds only, applied to test fold
  • Nested walk-forward recalibration

Not allowed

  • Fit isotonic on final test labels and call it validated
  • Hand-edit probabilities after seeing outcomes

After recalibration, re-report ECE/Brier on true forward folds.


Hard Constraints

  1. Never evaluate calibration on training rows used to fit the same model without nested disclosure.
  2. Never present raw scores as probabilities without checking calibration.
  3. Never hide segment failures behind a pooled “looks fine.”
  4. If sample per bin is tiny, say so — widen bins or reduce claim strength.
  5. Accuracy is not calibration.
  6. Leakage-invalid evaluations cannot be “well-calibrated.”

Anti-Patterns

  • “56% correct, so calibrated”
  • One reliability plot with no sample sizes
  • Holdout isotonic theater
  • Average prob ≈ base rate therefore calibrated (necessary, not sufficient)
  • Ignoring 0.05 and 0.95 tails
  • Quoting NBA/MLB percents without sport-specific calibration

Reporting Template

Calibration report
Sport/model:
Eval: walk-forward seasons …
n:
Brier:
ECE (bins=…):
Log-loss:
Notes by season:
Tail behavior:
Verdict: well-calibrated | usable-with-caveats | poorly-calibrated | invalid-eval
Actions:
Reproduce:

Output Contract

Done means:

  • Walk-forward probs used
  • ECE/Brier/log-loss reported
  • Bin counts or segment notes present
  • Verdict issued
  • Actions stated

Worked Example

Example finding: predictions near 0.70 occur in sparse bins and realize near 0.60. Label the tail unstable or overconfident according to its uncertainty; do not infer a durable defect from a handful of rows.


References

references/

FileContents
calibration_metrics.mdECE/Brier/log-loss definitions
binning.mdbin strategy notes
recalibration.mdallowed recalibration patterns

Related Skills

NeedSkill
Validation designvalidation-design
Predictive modelspredictive-modeling
Statistical modelsstatistical-modeling
Results writeupresults-reporting
Model cardmodel-card

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.