I vibe-coded a weekly mileage planner for running. As an avid runner, I always balance my week between running and work. Some workdays are just jammed pack and I only run 2 miles. Other days are freeing, motivating me to tackle 10 miles. I built this app to help people plan their runs adaptively. Hope people find this useful!
I used K-Nearest Neighbors to cluster pitches based on release point and movement data. The core idea: a high-variety cluster (e.g., fastballs, sliders, curveballs all originating from a similar-looking delivery) signifies effective tunneling. You can look up your favorite pitcher in the app.
I used k-means clustering on MLB player percentile rankings to find data-driven player archetypes. The goal was to move beyond simple labels like "power hitter" and see what patterns the data revealed on its own. The algorithm found six distinct groups, including an 'Elite All-Around', a 'Contact & Speed' group, and a 'Three-True-Outcome' type. I wrote about the process here.
My data came from Baseball Savant. I like making custom leaderboards and viewing relationships between different stats. For this analysis, I decided to use a decision tree model to find groups of players by barrel and fast swing rate. The model returned 4 groups that were statistical different (p-val < 0.05). The majority of qualified batters fall into the 8%-35% fast swing rate group, garnering a barrel rate just shy of 9%. I wrote a blog post about the formalization of decision trees if anyone wants to learn more!
In messing around with the eye-catching visuals on Baseball Savant, I noticed a dichotomous pattern among batters and their ideal attack angle rate and hard-hit outcome.
The distribution of Ideal Attack Angle Rate is different for hard hits vs. non-hard hits.
We then trained a model on that signal. The resulting S-curve shows a predictive fit, correctly classifying most outcomes. The model's coefficient revealed that an odds ratio of 8.244, which we get by computing, means that for every one standard deviation increase in a player’s ideal attack angle rate, the odds of them hitting the ball hard multiply by approximately 8.244. This is a significant relationship, indicating that this feature is a strong predictor of hard-hit outcomes. The intercept of 0.0900 suggests that for a player with an average ideal attack angle rate, the odds of hitting the ball hard are about 1.094 to 1, or a 52.2% chance.
Data acquired from Baseball Savant. I used scikit-learn to train my logistic regression model.