Skip to content

02Personal projectMay 2026 – now

MLB engine

Monte Carlo game model, walk‑forward backtest and calibration

Calibration project

Brier 0.2441 over 2,362 games, walk‑forward

One game, 20,000 times

Los Angeles Angels at Chicago Cubs, 2026-04-01. Expected runs 4.57 and 5.14.

0%4%8%12%0510152025COMBINED RUNSENGINE (GAMMA-POISSON)PLAIN POISSON
Games
—
Home wins
—
Mean total
—

Runs come in clusters, so the engine's tail is fatter than Poisson's. Totals are never level at the end of a game, which is why odd totals stand taller. This runs a JavaScript port of the engine's simulate_game.

Fig. 00One game, simulated here. Your browser plays the game 20,000 times with a port of the engine's simulation loop.

This model prices every MLB game and then checks itself. If it says a team has a 60% chance, does that team win about 60% of the time? It has run on its own every morning since May 2026 through Windows scheduled tasks, and every prediction it has made is kept in a log.

It's a calibration project, not betting advice.

LEAGUE AVERAGE× OFFENCE × PITCHER × PARK× weather × umpire × home fieldEXPECTED RUNSλ home, λ awayGAMMA MULTIPLIERper game20,000 SIMSwith game rulesWIN PROBABILITYand run totalsLOGIT STRETCHa = 1.39PREDICTION LOGevery morningBACKTESTwalk-forwardLIGHTGBM LAYERoff
Fig. 01The pipeline. From league averages to a graded prediction log.

The model

Expected runs start from the league average and are scaled for team offence, the opposing pitcher, the park, weather, the umpire (capped at ±3%) and home field. Each factor is regressed toward a prior. Each game is then simulated 20,000 times.

Why not plain Poisson

Runs come in clusters, so a plain Poisson model underrates blowouts. Each simulated game draws a Gamma multiplier on the scoring rate, which makes the runs negative binomial. Game rules are in there too: no bottom of the ninth for a leading home team, walk-offs stop at one run, and extra innings start with a runner on second.

What the backtest showed

I graded 2,362 games of the 2026 season walk-forward, so each day only saw data from before it.

  • Brier score 0.2441. A coin flip scores 0.2500, and always picking home scores 0.2494.
  • Log loss 0.6811.
  • The model was underconfident: its underdogs won less often than it said and its favourites won more often. A fitted logit stretch fixes that.
  • It also caught totals running hot from double-counted summer heat.
0.2430.2450.2470.2490.251THE MODEL · 0.2441ALWAYS PICK HOME · 0.2494COIN FLIP · 0.2500BRIER SCORE · LOWER IS BETTER · AXIS ZOOMED
Fig. 02Against the baselines. 2,362 games, graded walk-forward. Lower is better, and the axis is zoomed.

Calibration over 2,362 real games

Dots are what happened. Drag until the curve runs through them.

20%20%40%40%60%60%80%80%MODEL SAYSHOME TEAM WON
a = 1.39 · as shipped
Brier
0.2441
Log loss
0.6811
Uncorrected
0.2444
Fig. 03Calibration. Every graded game from the walk-forward backtest. The slider is the logit stretch; 1.39 is the fitted value.

Keeping ML honest

A LightGBM layer can correct the simulation, but only if it beats it on games it hasn't seen. It hasn't done that yet, so it stays off.