ML · Automation · Personal Project
Baseball
Oracle.

An ML model that predicts the winner of every MLB game. It's trained on every regular-season game since 2021 and scores 56.6% over 12,138 out-of-sample games, +3.6 pts over always picking the home team. There's no server: a GitHub Actions pipeline rebuilds the data, retrains the model, and publishes static predictions to GitHub Pages three times a day.

How It Works

From raw data
to a prediction.

Three times a day (morning, noon, and evening, to pick up newly announced starting pitchers), a scheduled GitHub Actions job grades finished games, rebuilds every feature, retrains, and publishes win probabilities for the day's games. No server, no manual steps.

01
📡
Collect
Results, probable starters, plate umpires, box scores, and game logs for every regular-season game since 2021 come from the MLB Stats API, with ballpark weather from Open-Meteo.
02
🧠
Train
Node.js builds 59 features per game using only what was known before first pitch: Marcel-style starting pitcher projections, lineup OPS vs. the starter's handedness, bullpen ERA and workload, weighted team form, rest and travel, park, weather, and umpires. Python then evaluates a regularized logistic regression, a random forest, and XGBoost walk-forward, and the lowest log loss wins.
03
⚾
Predict
A pure-JS inference engine scores today's games with Platt-calibrated win probabilities. It also produces exact per-game explanations, such as "Starting pitching → Dodgers +8.0 pts", that sum to the final prediction.

Key Architecture Decision

There is no backend at all. Python trains the model and exports it as JSON, and Node.js runs inference with a custom pure-JS engine (rfPredict.js), all inside a scheduled GitHub Actions job that commits fresh static files for GitHub Pages to serve. Nothing runs between updates, so there's nothing to host, scale, or pay for, and every prediction is versioned in git.

Python (train)
→
model.json
→
rfPredict.js
→
GitHub Pages
Model Performance

The numbers.

Walk-forward validation: each season is predicted by a model trained only on the seasons before it, the same way it runs in production.

56.6%
Out-of-Sample Accuracy
Over 12,138 games (2022–2026), +3.6 pts over always picking the home team
69%
High-Confidence Picks
Hit rate on games where the model is 65%+ confident
59
Model Features
Pitcher projections, lineup vs. handedness, bullpens, team form, rest and travel, park, weather, umpires

Catching My Own Data Leak

An earlier version scored 60.5% on its test season, which is too good for baseball. The cause was that the model used season-total stats, so each game could "see" performance from games that hadn't happened yet. Rebuilding every stat point-in-time dropped accuracy to an honest 55.3%. From there, each change was judged on the same 12,138 out-of-sample games: switching to a regularized logistic regression and adding Marcel-style pitcher projections raised it to 56.6%. XGBoost, a forest blend, and data augmentation were tried and dropped because their gains were within noise.

Features

Built to be
accountable.

Beyond the model, Baseball Oracle publishes its picks in the open and grades every one, so anyone can check how it's really doing.

🔮

Daily Predictions

Calibrated win probabilities for every game on the schedule, refreshed three times a day as starting pitchers are announced.

🧩

Explained Picks

Each prediction breaks down into plain-language factors, like starting pitching, bullpen, and form, showing exactly how many points each one moved the odds.

🔒

Public Track Record

Every pick is recorded before first pitch and never edited. A running chart and a filterable table grade each one against the final score and the always-home baseline.

📊

Model Transparency

Charts for season-by-season accuracy, calibration, confidence, and feature importance show how the model makes its calls.

Tech Stack

What it's
built with.

Languages
JavaScript (Node.js) Python HTML / CSS
Machine Learning
scikit-learn Logistic Regression (L2) XGBoost NumPy Platt Scaling Walk-Forward CV
Data & APIs
MLB Stats API Open-Meteo
Infrastructure
GitHub Actions (scheduled) GitHub Pages Static HTML + JSON