Strokes vs the field: how predictive is a player's last 12 months?
Build a golfer's rating from strokes versus the field over the last 12 months, test it on 2025 PGA Tour events, and compare it with winner prices at the four majors.
Every script run against the live API on December 5, 2026. One full run: 402 credits.
Strokes versus the field is the standard way to say how well a golfer is playing: the field's average score on the same course that round minus his own. This tutorial asks how far that number, averaged over the last year, goes in predicting the next tournament. It uses the BirdieAPI Python client to pull three seasons of PGA Tour rounds, builds a decayed rating, picks the settings on 2024 and scores 2025, a season it never saw, by rank correlation and by a top-10 probability.
Then it compares the rating with the field-strength adjusted rating the API serves (get_ratings, as of the day before each event) and, for the eight majors of 2024 and 2025, a win probability from the rating with the winner prices from get_winner_odds, margin removed. The results are modest, and they are reported that way: form is a real but loose guide, decay does not help, and at the majors the model and the market are too close to separate.
The data is PGA Tour stroke-play events from September 2022 to December 2025: 147 events and 56,934 rounds. One full run costs 402 credits: 3 for the season lists, 294 for 147 get_leaderboard calls, 5 for one get_player_results call, 90 for 45 get_ratings calls and 10 for two get_winner_odds calls. That fits inside the 500 free credits. Every script waits 1.1 seconds between calls to stay under the 60 requests a minute limit.
1. Install the client and set your key
The client has no required dependencies. This tutorial uses pandas and NumPy, which the pandas extra installs. It needs Python 3.9 or newer, and the client reads your key from BIRDIEAPI_API_KEY.
pip install "birdieapi[pandas]"
export BIRDIEAPI_API_KEY=your_key_here2. Pull every round of three seasons, with strokes versus the field
Strokes versus the field (vs_field) is the field's average score on the same course that round minus the player's score, so positive is better. A player's form is the average of it over his recent rounds. The cheapest way to get it for everyone is get_leaderboard: one tournament's whole field, every round of every player with its vs_field, for 2 credits. The alternative, get_player_results, is 5 credits for up to 50 tournaments of one player and would need a call per player (step 3 shows what it returns). A season has about 47 stroke-play events, so 2 credits each is far cheaper than asking for 1,200 players one at a time.
The script reads three seasons of tournaments (2023 starts in September 2022, so every 2024 event has a full year of history behind it), keeps the stroke-play events that finished, and drops amateurs and disqualifications. Team, match-play and Stableford events score rounds differently and are left out. It saves the rounds, so every later step costs nothing until step 7.
import time
import pandas as pd
from birdieapi import Client
client = Client() # reads BIRDIEAPI_API_KEY
events, rows, spent, calls = [], [], 0, 0
for season in (2023, 2024, 2025):
page = client.get_leaders if False else None
tours = client.list_tournaments(season=season, limit=200)["tournaments"]
spent += client.last_credits_used
calls += 1
for t in tours:
# Stroke play with a result only: no cancelled events, no team or match-play formats (their rounds are not comparable).
if t["status"] != "final" or t["scoring_system"] != "Medal":
continue
lb = client.get_leaderboard(tournament_id=t["tournament_id"])
spent += client.last_credits_used
calls += 1
time.sleep(1.1) # the limit is 60 requests a minute
events.append({"tournament_id": t["tournament_id"], "name": t["name"], "season": t["season"], "start_date": t["start_date"], "major": t["major"]})
for p in lb["players"]:
if p["amateur"] or p["status"] == "dq":
continue
base = {"tournament_id": t["tournament_id"], "player_id": p["player_id"], "name": p["name"], "status": p["status"], "position": p["position"]}
for r in p["rounds"] or []:
rows.append({**base, "round": r["round"], "strokes": r["strokes"], "vs_field": r["vs_field"]})
events = pd.DataFrame(events)
rounds = pd.DataFrame(rows)
events.to_csv("events.csv", index=False)
rounds.to_csv("rounds.csv", index=False)
print(len(events), "stroke-play events,", len(rounds), "player rounds from", calls, "calls,", spent, "credits")
print(events.groupby(events["start_date"].str[:4]).size().to_dict(), "events by calendar year")
print(rounds["player_id"].nunique(), "players;", rounds.groupby("round").size().to_dict(), "rounds by round number")
print(rounds["vs_field"].describe().round(2).to_dict())Output
147 stroke-play events, 56934 player rounds from 150 calls, 297 credits
{'2022': 10, '2023': 44, '2024': 47, '2025': 46} events by calendar year
1215 players; {1: 18103, 2: 18016, 3: 10640, 4: 10175} rounds by round number
{'count': 56665.0, 'mean': 0.01, 'std': 2.88, 'min': -21.22, '25%': -1.78, '50%': 0.15, '75%': 1.95, 'max': 10.89}That is 147 events and 56,934 rounds for 297 credits. Three 2025 events have another scoring format (a team event, a match-play event and a Stableford event) and are left out, and 269 rounds carry no field average, which the form code drops. The 2025 season here runs from January to December, as the tool's season argument defines it.
3. What get_player_results returns, and why we did not use it
For comparison, one player's whole 2025 through get_player_results is one 5 credit call. It returns each tournament with every round's vs_field and adj_vs_field, which also accounts for how strong the field was. The script puts his latest event next to the same rounds from get_leaderboard.
import pandas as pd
from birdieapi import Client
client = Client() # reads BIRDIEAPI_API_KEY
res = client.get_player_results(player_id="9478", season=2025, limit=50) # Scottie Scheffler's 2025
print(res["count"], "events for the player, credits used:", client.last_credits_used)
last = res["results"][0]
print(last["name"], last["start_date"], "finish", last["position_display"])
print(pd.DataFrame(last["rounds"]).to_string(index=False))
rounds = pd.read_csv("rounds.csv", dtype={"tournament_id": str, "player_id": str})
same = rounds[(rounds["tournament_id"] == last["tournament_id"]) & (rounds["player_id"] == "9478")][["round", "strokes", "vs_field"]]
print("the same rounds from get_leaderboard:")
print(same.to_string(index=False))Output
21 events for the player, credits used: 5
Hero World Challenge 2025-12-04 finish T4
round strokes to_par course_id field_avg vs_field adj_vs_field
1 66 -6 10697 69.05 3.05 4.46
2 69 -3 10697 68.95 -0.05 1.36
3 65 -7 10697 69.15 4.15 5.56
4 68 -4 10697 68.55 0.55 1.96
the same rounds from get_leaderboard:
round strokes vs_field
1 66 3.05
2 69 -0.05
3 65 4.15
4 68 0.55The vs_field numbers are identical, so the two routes agree; adj_vs_field is the extra column. We use vs_field from the leaderboards so that the form rating is plain enough to rebuild by hand, and compare it with the served field-adjusted rating in step 7. The call for 21 events is cheap for one player and expensive for a field.
4. Build the form rating and choose its settings on 2024
A player's rating going into an event is the weighted average of his vs_field over his rounds in the 365 days before it. Each round has a weight of 0.5 ** (age / half_life), so a smaller half-life leans harder on recent rounds, and the total is shrunk toward 0 (an average player) by prior rounds' worth of weight, so a golfer with few rounds is pulled to the middle. half_life=0 means no decay: every round in the year counts the same. A round is dated by its event's first day plus the round number minus one.
Save this as form.py. field_table builds one row per player in an event: his rating going in, the rounds behind it, and his finish as a share of the field (0 is first, 1 is last). Players who missed the cut share the bottom of the order, and withdrawals are left out because they have no finish to predict.
import numpy as np
import pandas as pd
events = pd.read_csv("events.csv", dtype={"tournament_id": str}).sort_values(["start_date", "tournament_id"]).reset_index(drop=True)
rounds = pd.read_csv("rounds.csv", dtype={"tournament_id": str, "player_id": str})
rounds = rounds.dropna(subset=["vs_field"]) # a few rounds are held without a field average
rounds = rounds.merge(events[["tournament_id", "start_date"]], on="tournament_id")
# Round 1 is played on the start date, round 2 the next day, and so on. Day numbers are what the decay is measured in.
rounds["day"] = (pd.to_datetime(rounds["start_date"]) - pd.Timestamp("2020-01-01")).dt.days + rounds["round"] - 1
events["day"] = (pd.to_datetime(events["start_date"]) - pd.Timestamp("2020-01-01")).dt.days
by_player = {pid: g.sort_values("day") for pid, g in rounds.groupby("player_id")}
def form(pid, day, half_life=90, window=365, prior=10):
"""A player's decayed strokes-versus-field average over the rounds before `day`.
Weight 0.5 ** (age / half_life) for rounds up to `window` days old, shrunk toward 0 (the field average) by `prior` rounds' worth of weight.
Returns (rating, rounds in the window)."""
g = by_player.get(pid)
if g is None:
return 0.0, 0
age = day - g["day"].to_numpy()
keep = (age > 0) & (age <= window)
if not keep.any():
return 0.0, 0
w = 0.5 ** (age[keep] / half_life) if half_life else np.ones(keep.sum())
return float((w * g["vs_field"].to_numpy()[keep]).sum() / (w.sum() + prior)), int(keep.sum())
def field_table(tid, **kw):
"""One row per player in an event: his rating going in, the rounds behind it, and where he finished (0 is first, 1 is last)."""
e = events[events["tournament_id"] == tid].iloc[0]
g = rounds[rounds["tournament_id"] == tid].drop_duplicates("player_id")
g = g[g["status"] != "wd"] # a withdrawal has no finish to predict
n = len(g)
fin = g[g["status"] == "finished"]
# Missed cuts share the bottom of the order: each gets the middle rank of the places after the last finisher.
rank = np.where(g["status"] == "finished", g["position"].fillna(n), (len(fin) + n + 1) / 2)
out = pd.DataFrame({"tournament_id": tid, "player_id": g["player_id"].to_numpy(), "rank": rank, "n": n, "finished": (g["status"] == "finished").to_numpy()})
rr = [form(p, e["day"], **kw) for p in out["player_id"]]
out["rating"], out["rounds_behind"] = [r[0] for r in rr], [r[1] for r in rr]
out["pct"] = (out["rank"] - 0.5) / n # 0 is first, 1 is last
out["top10"] = (out["rank"] <= 10).astype(int)
return out
def spearman(x, y):
return float(pd.Series(x).rank().corr(pd.Series(y).rank()))
def last_event(pid, day):
"""The average strokes versus the field of his most recent event before `day`, or 0 if he has none in the last year."""
g = by_player.get(pid)
if g is None:
return 0.0, 0
g = g[(g["day"] < day) & (g["day"] >= day - 365)]
if g.empty:
return 0.0, 0
last = g[g["tournament_id"] == g.iloc[-1]["tournament_id"]]
return float(last["vs_field"].mean()), len(g)5. Choose the decay on 2024 events
Two settings need a value: the half-life and the prior. The script tries 15 pairs and scores each on the 2024 events only, by the average Spearman correlation between the rating and the finish (1 would be a perfect order, 0 no relation). The 2025 events are not touched until the settings are fixed.
import itertools
import numpy as np
import pandas as pd
from form import events, field_table, spearman
# Choose the half-life and the prior on 2024 events only. 2025 is not touched until they are fixed.
tune = events[events["start_date"].between("2024-01-01", "2024-12-31")]
rows = []
for half_life, prior in itertools.product([0, 30, 60, 90, 180], [0, 10, 30]):
rhos = []
for tid in tune["tournament_id"]:
t = field_table(tid, half_life=half_life, prior=prior)
t = t[t["rounds_behind"] > 0] # a player with no rounds in the last year has no rating to rank
if len(t) > 20:
rhos.append(spearman(t["rating"], -t["pct"]))
rows.append((half_life or "equal", prior, np.mean(rhos), len(rhos)))
g = pd.DataFrame(rows, columns=["half_life_days", "prior_rounds", "mean_spearman", "events"]).sort_values("mean_spearman", ascending=False)
print("2024 events scored:", int(g["events"].iloc[0]))
print(g.pivot(index="half_life_days", columns="prior_rounds", values="mean_spearman").round(4).to_string())
best = g.iloc[0]
print("best:", best["half_life_days"], "half-life, prior", int(best["prior_rounds"]), "->", round(float(best["mean_spearman"]), 4))Output
2024 events scored: 46
prior_rounds 0 10 30
half_life_days
30 0.2366 0.2143 0.2105
60 0.2584 0.2430 0.2401
90 0.2705 0.2597 0.2574
180 0.2791 0.2748 0.2725
equal 0.2810 0.2819 0.2808
best: equal half-life, prior 10 -> 0.2819The result runs against the idea of recent form. The more weight the recent rounds get, the worse the order: 0.2597 at a 90-day half-life, 0.2748 at 180 days and 0.2819 with no decay at all. A year of rounds counted equally ranks a field better than a rating that forgets quickly, at least on 2024. The prior hardly matters (0.2808 to 0.2819), so we keep 10 rounds. This is a long window, one tour and one season, so do not read it as a law; it says that over a year the extra rounds help more than the recency does.
6. Score 2025: does the last 12 months predict the next event?
The script fixes the settings and walks through the 2025 events, scoring three things for each event on the players with at least one round in the window: the Spearman correlation of the rating with the finish, how often the ten highest-rated players finished in the top 10, and the log loss and Brier score of a top-10 probability. The top-10 probability is sigmoid(logit(base) + b * z), where z is a player's rating minus the field average and b is fitted on 2024. The base rate is about 10 over the field size; ties at 10th place put a few more players in the top 10, so the script measures that ratio on 2024 and gives every model the same base.
It compares four: the base rate alone, a rating from the last event only, the 12 month rating, and the 12 month rating with a 90 day half-life. The last block splits the 2025 players by how many rounds stand behind their rating and shows, for each group, the correlation of rating (minus the field average) with finish, pooled over players.
import numpy as np
import pandas as pd
from form import events, field_table, form, last_event, rounds, spearman
SETTINGS = {"Last 12 months, equal weight": dict(half_life=0, prior=10), "Decayed, 90-day half-life": dict(half_life=90, prior=10)}
def build(span, **kw):
out = []
for tid in events[events["start_date"].between(*span)]["tournament_id"]:
t = field_table(tid, **kw)
t = t[t["rounds_behind"] > 0].copy()
if len(t) > 20:
t["z"] = t["rating"] - t["rating"].mean() # strokes better or worse than the field average
out.append(t)
return pd.concat(out)
def logit(p):
return np.log(p / (1 - p))
# Ties at 10th place put more than ten players in the top 10, so the chance of a top 10 is a little above 10 / n.
# The ratio of the two is measured on 2024 and used for every model, so each one starts from the same fair base rate.
t24 = build(("2024-01-01", "2024-12-31"), half_life=0, prior=10)
RATIO = float(t24["top10"].mean() / (10 / t24["n"]).mean())
def base(t):
return np.clip(RATIO * 10 / t["n"], 1e-6, 0.99)
def fit_slope(t):
"""The one number that turns a rating gap into a top-10 chance, fitted on 2024: p = sigmoid(logit(base) + b * z)."""
best = None
for b in np.arange(0.0, 2.01, 0.05):
p = 1 / (1 + np.exp(-(logit(base(t)) + b * t["z"])))
ll = -np.mean(t["top10"] * np.log(p) + (1 - t["top10"]) * np.log(1 - p))
best = min(best or (9, 0), (ll, b))
return best[1]
def score(t, b):
p = np.clip(1 / (1 + np.exp(-(logit(base(t)) + b * t["z"]))), 1e-6, 1 - 1e-6)
y = t["top10"].to_numpy()
rho = [spearman(g["rating"], -g["pct"]) for _, g in t.groupby("tournament_id")]
top = t.assign(r=t.groupby("tournament_id")["rating"].rank(ascending=False, method="first")).query("r <= 10")
return {"spearman": np.mean(rho), "log_loss": -np.mean(y * np.log(p) + (1 - y) * np.log(1 - p)), "brier": np.mean((p - y) ** 2), "top10_hits": top["top10"].mean(), "events": len(rho)}
rows = []
base_t = build(("2025-01-01", "2025-12-31"), half_life=0, prior=10)
p0 = base(base_t)
y = base_t["top10"].to_numpy()
print("share of 2025 players finishing in the top 10, ties included:", round(float(y.mean()), 4), "| the plain 10 / n:", round(float((10 / base_t["n"]).mean()), 4), "| ratio from 2024:", round(RATIO, 3))
rows.append(("Field size only", 0.0, -np.mean(y * np.log(p0) + (1 - y) * np.log(1 - p0)), np.mean((p0 - y) ** 2), float(p0.mean())))
for name, kw in SETTINGS.items():
b = fit_slope(build(("2024-01-01", "2024-12-31"), **kw))
s = score(build(("2025-01-01", "2025-12-31"), **kw), b)
rows.append((name, s["spearman"], s["log_loss"], s["brier"], s["top10_hits"]))
print(name, "- slope fitted on 2024:", round(float(b), 2), "| events:", s["events"])
# The simplest rival: how he did at his last event, and nothing else.
lt = build(("2025-01-01", "2025-12-31"), half_life=0, prior=10)
lt["rating"] = [last_event(p, events.set_index("tournament_id").loc[t, "day"])[0] for p, t in zip(lt["player_id"], lt["tournament_id"])]
lt["z"] = lt["rating"] - lt.groupby("tournament_id")["rating"].transform("mean")
tune = build(("2024-01-01", "2024-12-31"), half_life=0, prior=10)
tune["rating"] = [last_event(p, events.set_index("tournament_id").loc[t, "day"])[0] for p, t in zip(tune["player_id"], tune["tournament_id"])]
tune["z"] = tune["rating"] - tune.groupby("tournament_id")["rating"].transform("mean")
s = score(lt, fit_slope(tune))
rows.insert(1, ("Last event only", s["spearman"], s["log_loss"], s["brier"], s["top10_hits"]))
table = pd.DataFrame(rows, columns=["model", "spearman", "log_loss", "brier", "top10_hit_rate"])
print(table.round(4).to_string(index=False))
t = build(("2025-01-01", "2025-12-31"), half_life=0, prior=10)
print("2025 players scored:", len(t), "in", t["tournament_id"].nunique(), "events; median rounds behind a rating:", int(t["rounds_behind"].median()))
t["bucket"] = pd.cut(t["rounds_behind"], [0, 19, 59, 1000], labels=["1-19 rounds", "20-59", "60+"])
t["z"] = t["rating"] - t.groupby("tournament_id")["rating"].transform("mean")
print(t.groupby("bucket", observed=True).apply(lambda g: pd.Series({"players": len(g), "corr_z_vs_finish": float(np.corrcoef(g["z"], -g["pct"])[0, 1])})).round(3).to_string())
table.to_csv("score_table.csv", index=False)Output
share of 2025 players finishing in the top 10, ties included: 0.0978 | the plain 10 / n: 0.0834 | ratio from 2024: 1.197
Last 12 months, equal weight - slope fitted on 2024: 1.35 | events: 45
Decayed, 90-day half-life - slope fitted on 2024: 1.45 | events: 45
model spearman log_loss brier top10_hit_rate
Field size only 0.0000 0.3150 0.0871 0.0999
Last event only 0.1656 0.3103 0.0862 0.1933
Last 12 months, equal weight 0.2721 0.2987 0.0835 0.2222
Decayed, 90-day half-life 0.2593 0.2989 0.0833 0.2311
2025 players scored: 5183 in 45 events; median rounds behind a rating: 73
players corr_z_vs_finish
bucket
1-19 rounds 772.0 0.251
20-59 1104.0 0.192
60+ 3307.0 0.249From the output above. Lower is better. The axis starts at 0.28, so the gaps look larger than they are.
A year of rounds is a real but moderate predictor. The average Spearman correlation is 0.272, and the ten highest-rated players in a field finished in the top 10 22.2% of the time, against about 10% for a random ten. The top-10 log loss falls from 0.3150 (the base rate) to 0.2987. The decayed rating is the same on log loss (0.2989) and a little worse on Spearman (0.2593), as step 5 suggested. The last event alone is much weaker (0.1656 Spearman): one tournament is mostly noise.
The split by sample size is flat. Players with 20 to 59 rounds behind their rating are not predicted better than those with 60 or more (0.192 against 0.249), and players with fewer than 20 are no worse (0.251), so the shrinkage already does most of the work for thin samples. Golf is a high-variance sport: even the correct order of a field is only a loose guide to who finishes where on one weekend.
7. Compare with the served rating
get_ratings returns our own strokes-versus-field rating: the same idea, field-strength adjusted and weighted toward recent rounds, for every player active in the past year. With as_of it returns the ratings as they stood on a past date, so it can be tested fairly. The script calls it once per 2025 event, for the day before the first round, and scores both ratings on the players both lists hold. It is 2 credits a call and 45 calls. Set min_rounds=1 so thin samples are not left out, and limit=500, the most one call returns.
import time
import numpy as np
import pandas as pd
from birdieapi import Client
from form import events, field_table, spearman
client = Client() # reads BIRDIEAPI_API_KEY
rows, spent, covered = [], 0, []
for _, e in events[events["start_date"].between("2025-01-01", "2025-12-31")].iterrows():
mine = field_table(e["tournament_id"], half_life=0, prior=10)
mine = mine[mine["rounds_behind"] > 0]
if len(mine) <= 20:
continue
day_before = (pd.Timestamp(e["start_date"]) - pd.Timedelta(days=1)).strftime("%Y-%m-%d")
served = pd.DataFrame(client.get_ratings(as_of=day_before, limit=500, min_rounds=1)["ratings"])
spent += client.last_credits_used
time.sleep(1.1) # the limit is 60 requests a minute
served["player_id"] = served["player_id"].astype(str)
both = mine.merge(served[["player_id", "rating"]].rename(columns={"rating": "served"}), on="player_id")
covered.append(len(both) / len(mine))
if len(both) > 20:
top = lambda col: both.assign(r=both[col].rank(ascending=False, method="first")).query("r <= 10")["top10"].mean()
rows.append((spearman(both["rating"], -both["pct"]), spearman(both["served"], -both["pct"]), top("rating"), top("served")))
r = pd.DataFrame(rows, columns=["own_spearman", "served_spearman", "own_top10", "served_top10"])
print(len(r), "events,", spent, "credits; the served list covers", round(100 * float(np.mean(covered))), "% of the rated field on average")
print(r.mean().round(4).to_string())
print("events where the served rating ranks better:", int((r["served_spearman"] > r["own_spearman"]).sum()), "of", len(r))
r.to_csv("served_vs_own.csv", index=False)Output
45 events, 90 credits; the served list covers 92 % of the rated field on average
own_spearman 0.2332
served_spearman 0.2856
own_top10 0.2222
served_top10 0.2400
events where the served rating ranks better: 35 of 45The served rating orders the fields better: an average Spearman of 0.2856 against 0.2332 for ours on the same players, and a better order in 35 of 45 events. It is field-strength adjusted and decay-weighted, which our plain average is not, and a round in a weak field counts for less in it. The top-10 hit rate is close (24.0% against 22.2%). The step 5 result about decay was on our own unadjusted average. The served rating differs from ours in two ways, the field adjustment and its own weighting, and this comparison does not separate them. A top-10 hit rate over 45 events moves by a point or two by chance, so only the Spearman gap is worth noting.
8. The four majors: the model against the winner prices
get_winner_odds returns the pre-tournament winner prices of the four men's majors, by sportsbook, with each book's opening and latest price before the first round as an implied probability. With season it covers all four majors of a year for 5 credits; with limit=200 it returns up to 200 golfers each. For past majors the latest snapshot can be up to a week before the first tee time. Implied probabilities carry the book's margin, so the script divides each book's prices by that book's total, then averages the books.
The rating becomes a win probability with a softmax over the field, exp(beta * rating), and beta is fitted on the 43 non-major 2024 events by the average log probability the model gave the winner. The market and the model are both restricted to the players who teed it up and renormalised, so that neither is penalised for golfers who withdrew; that uses hindsight about the field, but it is the same for both. Eight majors (2024 and 2025) are scored.
import numpy as np
import pandas as pd
from birdieapi import Client
from form import events, field_table, rounds
client = Client() # reads BIRDIEAPI_API_KEY
def softmax(r, beta):
e = np.exp(beta * (r - r.max()))
return e / e.sum()
def winner(t):
return t["player_id"].to_numpy() == rounds[(rounds["tournament_id"] == t["tournament_id"].iloc[0]) & (rounds["position"] == 1)]["player_id"].iloc[0]
# One slope for the whole field: pick beta on the 2024 events that are not majors, by the average log probability the model gave the winner.
fit = []
for tid in events[events["start_date"].between("2024-01-01", "2024-12-31") & ~events["major"]]["tournament_id"]:
t = field_table(tid, half_life=0, prior=10)
if winner(t).any():
fit.append((t["rating"].to_numpy(), winner(t)))
betas = np.arange(0.0, 4.01, 0.1)
ll = [np.mean([np.log(softmax(r, b)[w][0]) for r, w in fit]) for b in betas]
beta = float(betas[int(np.argmax(ll))])
print("beta", round(beta, 2), "fitted on", len(fit), "non-major 2024 events; mean log probability of the winner", round(float(max(ll)), 3))
# The market: each book's latest price before the first round, as an implied probability, with that book's margin taken out
# (divide by the book's total over every golfer it priced), then averaged over books.
rows, spent = [], 0
for season in (2024, 2025):
odds = client.get_winner_odds(season=season, limit=200)
spent += client.last_credits_used
for tour in odds["tournaments"]:
per_book = {}
for g in tour["golfers"]:
for b in g["books"]:
if b.get("latest_pregame"):
per_book.setdefault(b["bookmaker"], {})[g["player_id"]] = b["latest_pregame"]["implied_prob"]
fair = {bk: pd.Series(p) / sum(p.values()) for bk, p in per_book.items()}
mkt = pd.DataFrame(fair).mean(axis=1, skipna=True)
t = field_table(tour["tournament_id"], half_life=0, prior=10)
t["p_model"] = softmax(t["rating"].to_numpy(), beta)
t["p_market"] = t["player_id"].map(mkt).fillna(0.0005) # a golfer no book priced: a long shot
t["p_market"] /= t["p_market"].sum() # only the golfers who teed it up, renormalised
t["p_uniform"] = 1 / len(t)
t["won"] = winner(t)
t["tournament"] = tour["name"]
t["season"] = season
t["books"] = len(per_book)
rows.append(t)
d = pd.concat(rows)
d.to_csv("majors_compare.csv", index=False)
print(len(rows), "majors,", len(d), "player entries,", spent, "credits")
def summary(g):
w = g[g["won"]].iloc[0]
out = {"field": len(g)}
for k in ("p_uniform", "p_model", "p_market"):
out[k + "_winner"] = round(float(w[k]), 4)
out[k + "_rank"] = int((g[k] > w[k]).sum() + 1)
return pd.Series(out)
per = d.groupby(["season", "tournament"], sort=False).apply(summary)
print(per[["field", "p_model_winner", "p_model_rank", "p_market_winner", "p_market_rank"]].to_string())
ww = d[d["won"]]
tot = {k: {"log_score_winner": float(-np.log(ww[k]).mean()), "brier_per_major": float(((d[k] - d["won"].astype(float)) ** 2).sum() / len(rows))} for k in ("p_uniform", "p_model", "p_market")}
print(pd.DataFrame(tot).T.round(4).to_string())
diff = np.log(ww["p_model"].to_numpy()) - np.log(ww["p_market"].to_numpy()) # positive: the model gave the winner more probability
print("per-major log score difference (model minus market):", np.round(diff, 2).tolist())
print("mean", round(float(diff.mean()), 3), "standard error", round(float(diff.std(ddof=1) / np.sqrt(len(diff))), 3), "- the model was ahead in", int((diff > 0).sum()), "of", len(diff))Output
beta 1.8 fitted on 43 non-major 2024 events; mean log probability of the winner -4.259
8 majors, 1083 player entries, 10 credits
field p_model_winner p_model_rank p_market_winner p_market_rank
season tournament
2024 Masters Tournament 88.0 0.1377 1.0 0.1384 1.0
PGA Championship 153.0 0.0411 3.0 0.0357 6.0
U.S. Open 150.0 0.0215 6.0 0.0330 5.0
The Open 150.0 0.0638 2.0 0.0403 4.0
2025 Masters Tournament 92.0 0.0422 4.0 0.0954 2.0
PGA Championship 155.0 0.1150 1.0 0.1215 1.0
U.S. Open 144.0 0.0154 12.0 0.0052 43.0
The Open 151.0 0.1539 1.0 0.1124 1.0
log_score_winner brier_per_major
p_uniform 4.8852 0.9922
p_model 2.8921 0.8851
p_market 2.9802 0.8916
per-major log score difference (model minus market): [-0.0, 0.14, -0.43, 0.46, -0.82, -0.05, 1.09, 0.31]
mean 0.088 standard error 0.203 - the model was ahead in 4 of 8From the output above: the average of minus the log of the probability each source gave the winner. Lower is better. The axis starts at 2.
Here the market does not win. The form model gave the winner an average log score of 2.892 against 2.980 for the market, and a Brier score of 0.8851 against 0.8916 per major. Both are far ahead of treating every golfer alike (4.885). Do not read this as the model being better. It was ahead in 4 of 8 majors, the mean difference of 0.088 has a standard error of 0.203, and one event, the 2025 U.S. Open, where the market rated the winner 43rd of the field and the model 12th, contributes more than the whole difference: without it, the model is behind on the other seven. Eight tournaments with one winner each cannot separate two sources this close.
What the result does say is that a year of strokes versus the field, with no course, weather or injury information, gives probabilities in the same range as the winner prices of the biggest events. That is a statement about a model's accuracy against a reference, not an invitation to act on a number; the prices here are market information and nothing on this page works out a stake or recommends a golfer.
9. Fitting it into the free plan
The whole tutorial costs 402 credits, which fits inside the 500 free credits: 3 season lists, 147 leaderboards at 2 credits (294), the 5 credit player lookup, 45 get_ratings calls (90) and 2 get_winner_odds calls (10). To cut it further, skip step 7 (90 credits, 312 left) or drop the 2023 season from g1_pull.py and start the tuning on 2025 events (about 100 credits less); the form rating needs a year of history, so the first events of the first season you test would have fewer rounds behind them.
For the other tours, every call takes league: lpga, liv, dpwt or kornferry. Round scores for the LPGA, the DP World Tour and LIV have gaps in some years, so check get_leaderboard counts before trusting a season.
10. What this model leaves out
A decayed average of strokes versus the field is the floor. Read its limits before extending it.
- No course fit.
get_course_historyreturns one player's results at one tournament over the years, and some courses reward some games. The model treats every course the same. - No strength of field in the rating. The served
adj_vs_fielddoes account for it, and step 7 shows it ranks better. - No schedule effects. A player coming off a long layoff has a year of old rounds behind him.
- No weather or conditions.
vs_fieldremoves the field's average, so a bad draw on a windy day is partly corrected, but a rating cannot see this week's. - The finishing order is noisy. Ties, cuts and playoffs all shape the target. Use a different target, such as score against the field over the four rounds, to test a change.
Change the window or the half-life grid in step 5, rebuild form.py, and score each change on 2025 events with settings chosen on 2024.
Tools and credits
- list_tournaments: 3 calls, 3 credits (seasons 2023, 2024 and 2025).
- get_leaderboard: 147 calls, 294 credits (every finished stroke-play event).
- get_player_results: 1 call, 5 credits (one player's 2025, for comparison).
- get_ratings: 45 calls, 90 credits (one call a 2025 event, as_of the day before).
- get_winner_odds: 2 calls, 10 credits (seasons 2024 and 2025, all four majors each).
One full run: 402 credits.
What you can do with the data
You may store these rows, train models and backtest on them, and build products that show your users what you derive. You may not redistribute the rows, or sportsbook prices as a raw feed, as a dataset or API of its own. The prices here are market information used to score a model, not a recommendation, and nothing on this page works out a stake or sends you to a sportsbook.
Details: data timing and rights.
What to do next
Start with 500 free credits every month
No card. pip install birdieapi, REST or MCP.