RSSAmplifier

Blog

Running on Numbers

Machine Learning and Baseball Analytics

runningonnumbers.comRSS feed ↗18 posts

Latest posts

One More Step, Infinitely

The final miles of a race bring agony. Lungs burn, calves cramp, and throats run dry. Legs beg for an end to the misery, yet the finish line remains miles away. Every mile measures the same; the final three stretch time. As the distance closes, the fighting spirit wanes. Even the most optimistic starter sours into a shriveled pessimist. Here, the race ignores physical fitness; mental fortitude…

The Barrel Ledger: Projecting Barrels for 2025

Introduction Somewhere in Arizona and Florida, a groundskeeper wakes up every morning to tend to the fields, ensuring that the grass is perfectly manicured and the dirt is just right. When dawn turns to day, that field becomes a stage. Every swing, throw, and catch is meticulously recorded, added to the annals of baseball history. As winter gives way to spring, the baseball world is abuzz with…

The $240 Million Man: Projecting Kyle Tucker’s 2026 in Blue

Introduction The Los Angeles Dodgers once again dominated the headlines in January 2026, securing superstar outfielder Kyle Tucker with a massive four-year, $240 million contract. After a brief but productive stint with the Chicago Cubs in 2025, Tucker joins a Dodgers lineup that is already arguably the most feared in baseball. The Dodgers starting lineup can look like: 1. Ohtani, 2. Betts, 3.…

Query, Visualize, and Analyze with Mode

Preface The best way to learn something is to teach it. In this post, I will introduce you to Mode, a data analytics platform that simplifies the process of analyzing and visualizing data. Whether you’re a data scientist, analyst, or business user, Mode provides a collaborative environment to work with data efficiently. Typically, a user connects Mode to a database like Google BigQuery, Amazon…

Reflections on Running and Research

UCSC-UCI Social at NeurIPS 2025 The first week of December was a whirlwind. I kicked it off by attending NeurIPS. As someone doing reinforcement learning (RL) research, I was blown away by the amount of attention the field garnered. From applications in autonomous driving to continual learning, RL has re-emerged as the critical tool to navigate complex tasks where supervised learning falls short.…

Weekly Mileage Planner

How does this work? The mileage planner uses the Largest Remainder Method to efficiently manage and prioritize daily mileage allocations. It starts by calculating the base mileage for each day, then applies adjustments based on the selected day types (Easy, Workout) and distribution settings. To ensure integer mileages, it rounds down the calculated values and distributes the remaining “remainder”…

Barrels Are All You Need

In order to buy runs, you need to buy barrels. People who run ball clubs, they think in terms of buying players. Your goal shouldn’t be to buy players, your goal should be to buy wins. And in order to buy wins, you need to buy runs. - Peter Brand (Jonah Hill portraying Paul DePodesta), Moneyball (2011) In order to buy runs, you need to buy barrels. Barrels are a highly sought after batted ball…

Visualizing MLB Realignment with Graph Theory

Introduction In this article, we chime in on the current discourse surrounding MLB expansion and realignment. Recently, Rob Manfred mentioned the possibility of adding two more teams to the league. Across social media, fans have expressed their opinions on the matter. I want to explore how graph theory can help visualize the current MLB schedule and how it might change with expansion and…

Principal Component Analysis Explained: A Practical Example with MLB Data in Python

Introduction Principal component analysis (PCA) applied to Pete Crow-Armstrong. I am willing to bet that every data scientist in an MLB organization has thought of this pun at least once. For good reason: PCA is a powerful tool for dimensionality reduction and feature extraction. In this post, I will walk through the steps of performing PCA on a dataset of Pete Crow-Armstrong’s game-by-game…

K-Nearest Neighbors

Introduction Pitch tunneling is the art of deception. It’s a pitcher’s ability to make multiple, distinct pitches look identical as they leave the hand. From the batter’s perspective, two pitches can travel through the same “tunnel” partway to the plate before diverging. What looked like a hittable fastball suddenly drops off the table - a devastating curveball for a swinging strike. Effective…

K-Means Clustering

Introduction: The Problem of “Player Comps” “Who does this guy remind you of?” For decades, player comparisons—or “comps”—have been a cornerstone of how we talk about baseball. We’ve relied on simple, useful archetypes: the “power hitter,” the “contact hitter,” the “speedster,” the “ace.” While handy, these labels have always been oversimplified. Take a modern star like Juan Soto. Is he just a…

Same wOBA, Different Story

Introduction: The Beauty of Baseball’s Numbers Manny Machado, Juan Soto, and Eugenio Suarez are three all-star caliber baseball players. The trio consistently set baseball discourse ablaze. But there’s one question in baseball circles that has been debated for years: “Who is better?” Difference between .300 and .275 hitter is one hit every two weeks. If you see both 15 games a year, there’s a 40%…

Support Vector Machine

Introduction In a previous article , we introduced logistic regression and applied it to a binary classification problem. In our implementation, we used a 50/50 split to determine the threshold for classification. This is a linear line, separating the two classes. However, this approach may lead to overfitting, especially if the data is not linearly separable. What if there were a way to find a…

Swing Fast: Predicting Barrel Rate with Fast Swing Rate

Introduction In this article, we will explore the relationship between swing speed and barrel rate in Major League Baseball (MLB) players. Barrel rate is a key metric that measures the percentage of batted balls that are classified as “barrels,” which are hits with a high probability of resulting in extra-base hits. According to MLB, batted-ball events classified as Barrels had lead to a “minium…

Logistic Regression

Introduction Last article , we introduced linear regression and applied it to predict MLB teams’ runs scored given OPS. Linear regression is great at predicting numerical values. For example, it can predict runs scored given OPS. However, what happens if we want to move away from predicting continuous values and do binary classification? How can we predict whether a batter’s swing mechanics will…

Linear Regression

Introduction Linear Regression—long before transformers and LLMs, it served as one of the first tools in the machine learning toolbox. Despite the rise of complex models, its role in modern statistical analysis remains essential and unshaken. Rregression models measure the statistical relationship of an dependent variable ( ), and a series of other variables ( ). They are widely used for…

Lucky and Unlucky Hitters

There is no denying that baseball has an element of luck. Sometimes the hardest hit balls find a glove, and sometimes a blooper falls in for a hit. We can try to quantify this luck by looking at the difference between a player’s actual stats and their expected stats. Expected Batting Average (xBA) First let’s take a look at expected batting average (xBA) . We grab the latest expected statistics…

State of the Dodgers: Dominant Start or Warning Signs Under the Surface? (Mid May 2025 Check-in)

Code import pandas as pd import plotly.express as px from helper import process_baseball_data import plotly.graph_objects as go REFERENCE_YEAR = 2025 The Dodgers, defending World Series champs, entered 2025 with sky-high expectations. How are they measuring up about 33 games in? As of early May, they boast a stellar 27-14 (.659) record, sitting atop the NL West with a 1-game lead over the Padres.…