To Swing or Not To Swing: a Shiny App Plate Discipline Simulator

· Source: Data Science on Medium · Field: Technology & Digital — Artificial Intelligence & Machine Learning, Data Science & Analytics, Software Development & Engineering · Depth: Intermediate, medium

Summary

An interactive R Shiny application was developed using MLB Statcast data to simulate and optimize baseball plate discipline by evaluating the mathematical quality of swing decisions. The simulator calculates the Expected Value (EV) of swinging versus taking a pitch, factoring in pitch type, location (categorized into heart, shadow, chase, and waste zones), current count, and batter/pitcher handedness. It utilizes functions like `avg_woba_lookup`, `pitch_odds`, and `loc_odds` to assign probabilities and wOBA values, guiding users to make "GOOD DECISION" or "BAD DECISION" choices. The open-source tool provides a practical framework for training, aiming to simplify the complex art of plate discipline rather than creating "robots." Future enhancements include hitter archetypes and animated pitches.

Key takeaway

An R Shiny application uses MLB Statcast data to simulate and optimize baseball plate discipline by calculating the Expected Value (EV) of swinging versus taking. It probabilistically models pitch type, location (heart, shadow, chase, waste), count, and handedness via `avg_woba_lookup`, `pitch_odds`, and `loc_odds` functions to provide real-time decision feedback. This framework offers AI/ML professionals a practical, interactive tool for applying data-driven decision-making to complex, high-speed scenarios, shifting focus from outcomes to underlying decision quality.

Topics

Code references

Best for: Data Scientist, Software Engineer, AI Student

Related on AIssential

Open in AIssential →

Editorial summary, takeaway, and curation by AIssential. Original article published by Data Science on Medium.