This is a locally run web-application that can classify pitches in real-time based on which pitcher is in a game. Using the socket.io package in JavaScript, a pitcher can be selected from a dropdown-menu. After pressing "Start," an sklearn model is built on the pitcher's Yakkertech pitch data, and a Python connection to the Yakkertech cameras is established using the socketIO-client package. Incoming pitch data is then continuously parsed and predicted on. Each prediction is written from a Python localhost client to the front-end HTML page in the style of an MLB stadium showing pitch data. "Pausing" the application will terminate the socket.io server but keep the Python client running. A working demo of this application can be found here.
The spark for this project came during my first days interning with the UCSD Baseball Team. While tagging scrimmages initally, I found myself making some errors based on unfamiliarity with each pitcher's unique pitch characteristics (i.e. differences in spin rates for fastballs and sinkers, vertical and horizontal break for LHP curveballs and sliders). At the same time, I had been introduced to the Python package sklearn in my academics. This project aims to increase my familiarity with sklearn and build a tool that can correct for initial tagging errors.
- HTML
- socket.io (version 1.7.4)
- NodeJS, v12.19.0
- socketIO-client (Python)
- Python Packages: pandas, numpy, difflib, os, time, sklearn
Component | Description |
---|---|
File Schematic | Layout of file organization and relationships |
Code | Code section including all coding files except for datasets, node, .env, and Python server files |
Miscellaneous | Miscellaneous section including diagrams documenting thought process of project, proof of concepts, and test scripts |
- Install all necessary packages via terminal commands.
- cd to directory of classifier project, and initialize a split terminal, running the following functions separately in VSCode:
npm start
python3 Client/client.py
- Load in application via url http://127.0.0.1:3000/
- Select a pitcher via the dropdown menu, and press 'Start' button
- To pause classification, click the 'Pause' button. The HTML page will stop writing incoming pitch data.
- To change to a new pitcher, reload the application and restart the Python client file from the terminal. To kill the Python client, press control+c and re-enter the client command in Step 2
Grateful for UCSD President of Baseball Operations Ryan Bobb for granting me access to UCSD pitch data and Yakkertech interface, as well as Jacob Clark of Yakkertech for staying in correspondence with me throughout the duration of this project. None of this would have happened without their help.