02Personal projectMay 2026 – now
MLB engine
Monte Carlo game model, walk‑forward backtest and calibration
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.
- 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.
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.
Calibration over 2,362 real games
Dots are what happened. Drag until the curve runs through them.
- Brier
- 0.2441
- Log loss
- 0.6811
- Uncorrected
- 0.2444
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.