Kamran Imam All free guides
Workflows

Build a Sports Prediction Model With AI

A free guide by Kamran ImamInstagram · TikTok · YouTube

20,000Sims per match
1 fileSingle Python script

World Cup 2026 · Model v2.1

Simulations per match

20,000

Negative-binomial goals model · Elo ensemble

Outputs per matchW/D/L · Top-5 scores · O2.5 · BTTS
Data sourcesFBref · FotMob · eloratings
Sources required per stat2
Built withClaude Fable 5

How the model reads a match

Spain 56.1% · Argentina 43.9%

A probability distribution, not a lock — strong enough to state out loud, weak enough to lose.

Probabilities, not promises — that’s the point

By the end of this you’ll have a working prediction model — the same architecture I use to post match predictions on my page. I’m an engineer; I built it with Claude, and you can too. This is statistics for education and entertainment — not betting advice. A 60% favorite still loses 40% of the time.

1. Get the engine (2 minutes)

Have Claude build the model from scratch. Paste this cold:

Build me a single-file Python sports prediction model. Requirements: each team's expected goals estimated from recent matches (blend xG 60% with actual goals 40%), normalize each match by opponent strength, apply Bayesian shrinkage toward the league average (prior strength 4). Convert to a full scoreline probability grid using a negative binomial distribution (dispersion 10) with the Dixon-Coles low-score correction (rho -0.10). Blend with a second estimate from Elo-style ratings (form 35%, ratings 65%). Run 20,000 parameter simulations that jitter the uncertain inputs and solve each grid exactly. Output: win/draw/loss, top 5 scorelines, over 2.5, both-teams-to-score. If anything is ambiguous, ask me instead of guessing.

2. Feed it real data (10 minutes per match)

The model is only as good as its inputs. Paste this into Claude with web search on:

For [TEAM A] vs [TEAM B] on [DATE], find: each team's last 7 matches with goals for/against and xG for/against per match (FBref or FotMob), each opponent's approximate Elo rating (eloratings.net), current Elo for both teams, confirmed injuries or suspensions to starting attackers, and the venue. Flag any number you estimated rather than found. Cite sources for every stat.

That last line matters — a single source’s typo can wreck a prediction. Two sources or it doesn’t ship.

3. Run it and read it honestly (1 minute)

Run the script, then resist the urge to round 56% up to “lock.” The model’s real output is a distribution: a 56–44 edge is strong enough to state but weak enough to lose. When your model says coin flip, say coin flip.

4. Backtest before you believe (30 minutes, once)

Before trusting any tweak, test it. Paste this with your results:

Here are my model's predictions and the actual results for [N] past matches. Compute the log-loss of my probabilities. Then re-run with [PROPOSED CHANGE] and tell me: does it improve log-loss, in how many individual games, and is the difference statistically significant with a paired t-test? If it isn't significant, tell me to keep the model unchanged.

Most “improvements” fail this test. If a change doesn’t beat log-loss with statistical significance, don’t ship it — otherwise you’re just curve-fitting your regrets.

Mistakes to avoid

One honest limitation: the model can’t see tactics, matchups, or morning lineup news unless you feed them in. It can rate a match a near-coin-flip and still be blindsided by a chaotic result — like England’s 6–4 win over France in the third-place match — that it flagged but couldn’t quantify.

Disclaimer

This guide, the model, and every prediction on this site are for educational and entertainment purposes only. Nothing here is betting, financial, or professional advice. A model outputs probabilities, not promises — past results don’t guarantee future performance, and I accept no liability for decisions made or losses incurred using this material. The code is provided as-is, without warranty of any kind. If you choose to gamble, you do so at your own risk, subject to the laws of your jurisdiction, and only if you’re of legal age. If gambling ever stops being fun, help is available — in the US, call or text 1-800-GAMBLER.

Related: Build with Fable 5 · Pick the right Claude model

Found this useful? Follow along for new guides.

New breakdowns drop every week across TikTok, Instagram, and YouTube.

← All free guides