About & methodology · mlbaseballytics@gmail.com · Not betting advice. 21+. · If you need help, call 1-800-GAMBLER

About Machine Learning Baseball Analytics

What this is, how it works, and what it can't do.

I'm a life-long baseball fan who works with data for a living, and I was looking for an interesting side project while working to improve my coding, engineering and modeling skills. I wanted to see if I could build a reliable prediction pipeline to inform potential outcomes in the sport I love.

Four questions, asked about every hitter in every game: will he homer, get a hit, pick up two or more total bases, or draw a walk? The answer comes back as a percentage for each player.

Where the numbers come from & modeling

Everything starts with pitch-level tracking data: the same public Statcast feed you see cited on broadcasts, with some derived metrics of my own, based on my judgment as a fan and a data person. For each hitter and pitcher, I keep rolling windows of stats going back anywhere from one game to a hundred, because recent hot streaks and longer-term history can both inform outcomes.

On top of those stats sits the context that actually moves a baseball: who's pitching and which hand he throws with, how the batter has handled that kind of pitch before, the ballpark, and the weather at first pitch — temperature, wind along the line to center field, and air density, which is the real reason balls carry in Denver.

That gets fed to gradient-boosted decision trees, with one model per outcome, retrained as the season moves. Choosing the right features and tuning the models took a long time, and I did it with real modeling rigor.

One piece of that is worth spelling out, because it shapes what the numbers are for. The models are trained and scored a slate at a time, not on a shuffled pile of rows. What the tuning actually rewards is how the top few picks on a given day perform against the rest of that same day's games — measured against that day's own base rate, so a quiet Tuesday isn't graded on the same curve as a hitter's park in August, and averaged across a few different cutoffs so it isn't tuned to one arbitrary "top N."

The point is that the percentages are built to be compared against each other within a night's games. Being right on average and picking the best few out of tonight's slate are different problems, and this is set up for the second one.

Why the percentage means what it says

A model can rank players well and still hand you meaningless numbers. If it says 20% and the thing happens 35% of the time, the ranking might be fine but the number is useless.

So every model goes through a calibration step before its output is shown. The goal is boring and specific: when it says 20%, that should happen about one time in five. The Model Performance page shows whether it's holding up, bucket by bucket, and I'd rather you check it than take my word.

How I know if it's working

Two main performance metrics:

The first is a backtest on games held out of training: the model never saw these slates while it was being built, so grading it there is fair. It's still history being re-scored, though, and history is a generous examiner.

The second is the one I actually trust: every prediction is written down and stored before the games are played. Nothing gets revised afterwards. The live section on the Performance page counts only those, so it can't flatter itself. It's also the slowest to fill, which is why it says how many days are behind it. A good week proves very little, and I'd rather show you the sample size than a confident number.

What this doesn't do

It doesn't beat the market by default. Sportsbooks price these props well. Where the model disagrees with a line, the honest reading is "worth a look," not "free money". Generally, the margin built into the price means small edges are noise.

It doesn't know things it can't see. A hitter playing through a sore wrist, a manager planning to rest someone in the sixth, a bullpen game nobody announced — none of that reaches the data in time.

It isn't advice, and I don't place your bets. There's no account linked here and nothing is automated. If you act on something, that's your call and your money.

And baseball is baseball. The best hitter alive fails most times up. A good model shifts the odds a little; it doesn't tell you what happens tonight.

Get in touch

Found something that looks wrong? Numbers that don't add up, a player who shouldn't be on the list, a page that makes no sense? I'd genuinely like to hear it. I'd also love to hear suggestions, or what's working.

mlbaseballytics@gmail.com

If betting stops being fun, take a break. In the US, 1-800-GAMBLER is there.