Skip to content

Production v1.0.0

Latest

Choose a tag to compare

@vivekjag1 vivekjag1 released this 07 Aug 23:03
· 3 commits to main since this release

MLB Stat Classifier - A machine learning application for better understanding the MLB, developed by Vivek Jagadeesh

Note - This readme serves a "user manual" for this application. A detailed explanation of my experience developing the application (along with other projects), and the construction of the technology stack is available at vivekjagadeesh.com.

Overview and Motivation

As a lifelong fan of the Boston Red Sox, I've frequently found myself asking "what pitch was that?" while watching the games. As I began to learn more about machine learning, I found that classifying MLB pitches would be a fun introduction to the field.

Features

This application contains the following features
  • A machine learning model for classifying MLB pitches (more on this later)
  • A tool for comparing MLB pitchers on the basis of velocity, horizontal and vertical movement
  • A tool for viewing historical pitch and player data from baseball savant

Getting Started - Classifying a pitch

The first feature of MLB Classifier is the ability to classify any pitch using the following features:

  • The pitch velocity
  • The movement in the Z direction
  • The rise (vertical movement relative to its expected path)
  • The movement in the x direction
  • The tail (horizontal movement realtive to its expected path)

Note - A detailed description of how the dataset and features were selected is available on my portfolio website at vivekjagadeesh.com

To classify a pitch, simply enter the features into the form in the bottom left hand corner, and use the submit button to run the classifier. The clear button is used to remove any temporary entries in the form.

Using the player comparison tool

To compare two players, start by clicking the "New Comparison" button in the center. This will open a modal where you can select the players that you would like to compare via the two drop-down menus (these contain active players as of August 2024)

. Once you have selected two players to compare, continue by clicking submit, and the statistics for each player will appear in the two panes on the screen.

Viewing historical MLB data

Finally, the last feature of MLB Classifier is the ability to view historical data from Baseball Savant. To individual pitches (and their related statistics), use the slider at the top of the page to select pitches. To view pitchers, selected pitchers and the below table will appear. Finally, pagination controls are available at the bottom of the table

Appendix - Building and Running the project

To run this project, clone the repository and run npm run start in the root directory. This will start both the frontend (next.js) and backend (flask). Additionally, you will need to have a local postgresql server running and configure the connection string. To run just the frontend, run npm run dev in the frontend directory. To run just the backend, run flask run in the backend directory.

What's Changed

Full Changelog: https://github.com/vivekjag1/MLBStatClassifier/commits/v1.0.0