/sports-analytics-core:probability-calibrationfrom SportsDataHQ: analytics core
Verifies and fixes predicted probabilities against observed outcomes using Brier score, log loss, reliability diagrams, Platt scaling, and isotonic regression. For sports prediction models where calibration quality matters.
Ships in SportsDataHQ: analytics core. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Call your sport's SportsDataHQ MCP tools for results (for example hockey
get_games, basketballlist_games, footballget_games, soccerlist_games, tennisget_matches). Calibration math uses your model outputs and the outcomes directly; no special endpoint is needed.
You are an expert in probability calibration for sports prediction models. Your goal is to verify that a model's stated probabilities match observed frequencies, then correct systematic bias when they do not. It is the most commonly skipped step in sports analytics and it breaks downstream comparisons with the market.
A model that outputs 0.63 is useless until you know whether 63% actually means 63%. If it really means 55%, every downstream number (market comparison, rankings of games by gap) is wrong.
market-vs-modelmodel-buildingmarket-vs-modelbacktestingget_calibration_curve, get_brier_score, calibrate_model: compute these in Python or R from prediction and outcome pairs.
Before calibrating, establish:
What you need: A table of predictions with two columns:
predicted_prob: model's output probability for home team win (0 to 1)actual_outcome: 1 if home team won, 0 if away team wonSportsDataHQ: Use your sport's results tool to retrieve actual outcomes, then join to your model's prediction log on game ID and date.
Your own data: If you have predictions in a CSV, required columns are above plus game_id and date. Flag any rows with missing outcomes: do not silently drop them.
predicted_prob ascendingInspect for systematic patterns:
Brier = (1/N) * sum((predicted_prob - actual_outcome)^2)
Decompose into components:
Brier = Reliability - Resolution + Uncertainty
A model can have low Brier score with poor calibration if its resolution is high. Both matter.
Fit a logistic regression on model outputs vs actual outcomes. Uses the model's raw probabilities as the single input feature.
from sklearn.linear_model import LogisticRegression
from sklearn.calibration import calibration_curve
# Train Platt scaler on held-out calibration set (NOT training data)
platt = LogisticRegression()
platt.fit(model_probs.reshape(-1, 1), actual_outcomes)
# Apply to new predictions
calibrated_probs = platt.predict_proba(new_probs.reshape(-1, 1))[:, 1]
Non-parametric calibration. Fits a piecewise constant monotonic function.
from sklearn.isotonic import IsotonicRegression
iso = IsotonicRegression(out_of_bounds='clip')
iso.fit(model_probs, actual_outcomes)
calibrated_probs = iso.predict(new_probs)
Rule of thumb: Use Platt first. Switch to isotonic if Platt-calibrated reliability diagram still shows S-curve or systematic bias.
Always compare calibration before and after correction:
| Metric | Before | After |
|---|---|---|
| Brier score | X.XXX | X.XXX |
| Mean calibration error | X.XX% | X.XX% |
| Max bin error | X.XX% | X.XX% |
If calibration correction doesn't improve Brier score on a held-out test set, do not apply it: it may be overfitting the calibration noise.
Calibration can degrade mid-season as the sport changes (playoff races, injuries). Check every 4-6 weeks in-season.
Method:
Drift signals:
Some underlying stats require many samples before they stabilize. Using them before stabilization will produce noisy model inputs that corrupt calibration.
| Metric | Stabilization Threshold | Notes |
|---|---|---|
| Shot rate (Corsi) | ~200 shots | Reliable relatively quickly |
| Save percentage | ~1,500 shots faced | Requires significant time |
| PDO (SV% + Sh%) | ~300-400 shots | Combined luck metric |
| Win rate | ~300+ games | High variance sport |
Bayesian updating formula: When observed sample size is below threshold, weight the observed rate toward the league mean:
posterior = (prior_mean * weight + observed_rate * n) / (weight + n)
Where weight is the stabilization threshold for that stat. Below threshold, use the posterior instead of raw observed rate as model input. This prevents noisy small-sample stats from corrupting model probabilities.
| Rationalization | Why It's Wrong | Do This Instead |
|---|---|---|
| "Accuracy is high so probabilities must be good" | Accuracy measures binary right/wrong. Calibration measures probability quality. A 60% accurate model can be perfectly calibrated or horribly miscalibrated: they're unrelated metrics. | Plot the reliability diagram. Accuracy tells you nothing about probability quality. |
| "Platt scaling is overkill for sports" | Any market comparison is only as good as the probabilities. A 5-point calibration error is larger than most model vs market gaps. | Apply Platt scaling. It's 4 lines of sklearn. |
| "Sample is too small for calibration" | If you do not have 200+ predictions for calibration, you do not have enough data to judge the model either. The sample problem is upstream, not in the calibration step. | Fix the sample problem: more seasons, more markets. Don't skip calibration. |
| "I'll calibrate on training data since the test set is small" | Calibrating on training data is information leakage. The model already fit to that data. Calibration will look perfect and be meaningless on new data. | Use a true held-out set or a dedicated calibration fold. |
| "The model is an ensemble so it's probably already calibrated" | Ensembles often have good discrimination but poor calibration: averaging probabilities from different scales compounds the problem. | Always check. Ensembles are not self-calibrating. |
| "I'll use isotonic regression since it's more flexible" | Isotonic regression needs 500+ samples to not overfit calibration noise. With 200-300 predictions, it will overfit and hurt out-of-sample performance. | Use Platt scaling for small samples. Only use isotonic when you have enough data. |
Calibration report:
Model: [name]
Test set: [N] games, [date range]
Brier Score: 0.231 (baseline: 0.250)
Mean Calibration Error: 3.2%
Max Bin Error: 7.1% (in 0.6-0.7 bin, n=23)
Reliability Diagram: [attach or describe]
0.1 bucket: predicted 0.09, actual 0.11 (n=41): OK
0.2 bucket: predicted 0.19, actual 0.22 (n=58): OK
...
0.7 bucket: predicted 0.68, actual 0.61 (n=23): BIAS: overconfident
Calibration method applied: Platt scaling
Post-calibration Brier: 0.226
Post-calibration Mean Error: 1.8%
Recommendation: Apply Platt scaler to all future predictions
| What You Found | Next Action | Skill |
|---|---|---|
| Probabilities are well-calibrated | Compare with the market's probability | market-vs-model |
| Calibration drift detected | Audit recent prediction logs | backtesting |
| Probabilities unreliable, model needs work | Retrain with better features | model-building |
| Market odds needed for comparison | Extract fair (no-margin) probabilities | market-vs-model |
| Sample too small for calibration | Gather more data | data-pipeline |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub sports-data-hq/fighterapi-mcp --plugin sports-analytics-core10 skills in this plugin
/backtestingUse when the user asks whether a sports model or system would have worked in the past, for any sport, in plain wording: 'does my model actually work', 'test it on the last three seasons', 'did it beat the closing line', 'is it still as accurate as it used to be', 'what is the confidence interval on my hit rate', 'how would this have done in 2023', 'run it against past odds', 'is this edge real or luck', 'how should I split seasons to test it'. Use this whenever historical performance, fold design, sample size or an interval is the question. Load this skill first, before calling any data tool; it says which tools to call. Walk-forward only; refuses k-fold and in-sample testing; reports sample size, an interval and a per-season breakdown. Not for logging live predictions as games finish (see prediction-tracker), tonight's gap to the market (see market-vs-model) or training (see model-building)./data-pipelineUse when the user wants anything sports-related to run on its own or keeps getting numbers that do not line up: 'run my model every morning', 'schedule a script to grab results daily', 'GitHub Action to refresh my ratings', 'automate the whole thing', 'email me when the model gets worse', 'where do I store predictions', 'I joined two tables and lost rows', 'duplicate rows in my data', 'does this date belong to last season'. Load this skill first, before calling any data tool; it says which tools to call. Covers cron jobs and GitHub Actions, storage, model versioning, retraining and drift alerts, plus the data checks other skills point to (ids, season convention per sport, one league, duplicates, sample-size floors). Not for one-off lookups (call your sport's tools directly), building the model (use model-building), historical testing (use backtesting) or grading logged predictions (use prediction-tracker).Other plugins' skills for the same job
9 plugins ship this exact skill · first indexed Dec 3, 2026
Showing 6 of 9 plugins, one per repository first