agentleFS
noahowshnoahowsh/birdieapi-mcp/skills/probability-calibration/SKILL.md

probability-calibration

Skill0 starsChanged 29 days agoMITView on GitHub

Checks and repairs golf probabilities: reliability tables for made-cut, top-10 and winner probabilities, Brier score and log loss, pooled calibration across golfers, isotonic and Platt scaling, and why winner calibration needs outcomes beyond the majors. Use when the user asks whether their golf probabilities are calibrated, how to read a reliability diagram for longshots, how to calibrate a simulation's output, or why a model's 3% golfers win more or less than 3%. Do not use for building the model -- see outright-model. Do not use for time-ordered testing -- see walk-forward-validation. Do not use for turning probabilities into stakes -- see edge-detection.

3 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Before sending probabilities to edge-detection

    line 21
  2. Distinctive:

    If the model's top-10 probabilities are calibrated across all PGA Tour events, its winner probabilities inherit a good deal of that.

    line 57
  3. Very specific:

    Read: a bin is "off" only if |pred - obs| > 2 * se.

    line 80
  4. Distinctive:

    Step 5: Renormalise winners: After mapping each golfer's win probability, rescale within the event so the field sums to 1.

    line 101

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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

Probability Calibration

Default data tool: BirdieAPI (birdieapi-tool). Calibration is computation. The data calls are get_leaderboard (2 credits per event) for outcomes (made cut, top 10, winner) and get_ratings with as_of (2) for point-in-time inputs.

You are an expert in probability reliability. Your goal is to tell the user whether "3%" means 3%, to fix it where the data can support a fix, and to say plainly where it cannot.

When to Use

  • "Are my top-10 probabilities calibrated?"
  • "My simulation gives longshots too much (or too little) chance."
  • "How do I make a reliability plot for winner probabilities?"
  • Before sending probabilities to edge-detection

When NOT to Use

  • Building the probabilities -- see outright-model
  • Out-of-sample splits -- see walk-forward-validation
  • EV and stakes -- see edge-detection

Commands Available

CommandWhat It DoesCredits
get_leaderboardOutcomes per golfer: position, status (cut, wd, dq), rounds2
get_ratingsPoint-in-time inputs2
get_winner_oddsDevigged market probabilities as a reference5

Commands That Do NOT Exist

Not AvailableUse Instead
get_calibration, get_brierCompute locally
get_top10_oddsNot available; calibrate model top-10 against outcomes, not against prices

Why winners are hard to calibrate

A major has about 90 to 156 starters and one winner. Across about two dozen majors with prices there are about two dozen winners. A reliability table with ten bins over that has two or three winners per bin. It cannot tell 3% from 6%.

So calibrate in layers:

LayerOutcomeRows availableUse
Made cutbinarythousands per seasoncalibrate the player-quality scale
Top 10binaryhundreds per seasoncalibrate the upper tail
Round scorescontinuoustens of thousandscheck mean and spread of residuals
Winnerbinaryabout two dozen with prices; more without (any event)final sanity check only

If the model's top-10 probabilities are calibrated across all PGA Tour events, its winner probabilities inherit a good deal of that. Winner probabilities from any stroke-play event can be scored without prices (outcome from get_leaderboard), which gives far more events than the majors alone.

How It Works

Step 1: Collect predictions and outcomes. For each golfer-event: predicted probability, outcome (1 if finishing in the top 10 including ties, else 0). Take the outcome from position in get_leaderboard. Use the same tie rule as the prediction target and say which.

get_leaderboard {"tournament_id": "401580344"}

Step 2: Reliability table. Bin by predicted probability. For rare outcomes use quantile bins on the probability, not equal-width, so each bin has enough rows. Report count, mean predicted, observed rate and an interval.

import numpy as np, pandas as pd

def reliability(p, y, bins=10):
    df = pd.DataFrame({"p": p, "y": y})
    df["bin"] = pd.qcut(df["p"], bins, duplicates="drop")
    out = df.groupby("bin", observed=True).agg(n=("y", "size"), pred=("p", "mean"), obs=("y", "mean"))
    out["se"] = np.sqrt(out["obs"] * (1 - out["obs"]) / out["n"])
    return out

Read: a bin is "off" only if |pred - obs| > 2 * se. With n of 50 and an observed rate near 3%, se is about 2.4 points, so almost nothing is distinguishable. Increase n before concluding.

Step 3: Scores. Brier for the mean squared error, log loss for the tails:

brier = np.mean((p - y) ** 2)
logloss = -np.mean(y * np.log(np.clip(p, 1e-6, 1)) + (1 - y) * np.log(np.clip(1 - p, 1e-6, 1)))

For rare events the Brier score is dominated by the zeros. Always compare with the base rate: predicting the constant y.mean() gives a baseline Brier of base * (1 - base). Skill = 1 - brier / baseline.

Step 4: Pooled calibration across golfers. Pool all golfer-events; do not calibrate per golfer (too little data). If the shape is off in the tail, fit a monotone map.

from sklearn.isotonic import IsotonicRegression
iso = IsotonicRegression(out_of_bounds="clip").fit(p_train, y_train)
p_cal = iso.predict(p_test)

Isotonic regression is flexible and needs a few hundred positives. For fewer, use a one-parameter power map on the log-odds (temperature) instead: logit(p') = a * logit(p) with a fitted by maximum likelihood.

Step 5: Renormalise winners. After mapping each golfer's win probability, rescale within the event so the field sums to 1. Otherwise your probabilities will not describe a single winner.

Step 6: Longshot check. Sum the model's probabilities for golfers ranked below, say, 40th. Compare that share with how often golfers ranked below 40th in pre-event rating have actually won, across as many events as you have. If the model gives the tail 0% and the tail has won in several events, or the reverse, it is wrong in a visible way. This check needs no prices.

Reading the simulation's uncertainty

In outright-model, a rating-uncertainty parameter tau flattens the field and lifts longshots; a smaller sigma concentrates probability on the best. Calibration is how you choose them: pick the (sigma, tau) pair that minimises made-cut and top-10 log loss on a training window, then confirm out of sample. Do not choose them to match the winner market.

Credit Usage

OperationCreditsNotes
Outcomes for 100 events200get_leaderboard each
Ratings at 100 event dates200
Market reference for majors30season calls, 6 seasons

Anti-patterns

What Claude Might DoWhy It's WrongDo This Instead
Ten equal-width bins on winner probabilitiesEmpty bins, huge errorQuantile bins, pooled outcomes, show the interval
Calibrate on the test periodLeakageFit the map on training events only
Declare "well calibrated" from 25 majorsNo powerUse made-cut and top-10 layers
Calibrate then forget to renormaliseThe field no longer sums to 1Rescale per event
Match the market instead of the outcomesThe market is a baseline, not the truthScore against results
Use finishing position ties inconsistentlyTop-10 label shiftsOne tie rule, stated

Output Format

Calibration, top-10 probability, <N> golfer-events (<first>-<last>)
Quantile bins: predicted vs observed with 2-se intervals (table)
Brier <x.xxx> vs base-rate baseline <x.xxx>, log loss <x.xxx>
Tail check: golfers ranked below 40th carry <x>% of model win probability; <y>% of past winners came from there
Fix applied: <none | isotonic | temperature a = x.xx>, fitted on training events only

What to Do Next

What You FoundNext ActionSkill
CalibratedCompare with the marketedge-detection
Tail offRevisit tau and sigmaoutright-model
Unsure of out-of-sample behaviourTime-ordered testwalk-forward-validation

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.