This project demonstrates how a zero-sum stochastic game model of baseball can be used to approach more complex baseball problems. We explore some strategies for optimizing batter lineups and achieve some interesting results.
Read the write-up here for the full details.
- Install the requirements with
pip install -r requirements.txt
- Or manually install PyTorch, CVXPY, Pandas, Matplotlib, blosc2, and tqdm
- Fetch the raw data with
raw_data/fetch_data.py
- Process the data with
src/data/data_loading.py
- Try out the zero-sum stochastic game model with
src/policy/optimal_policy.py
- Try the batting lineup optimization scripts with
src/policy/batting_order_optimization.py
- Check out some visualizations with
src/statistics.ipynb
andsrc/policy/batting_order.ipnyb
- Feel free to load the data with
bd = BaseballData()
and experiment!
model_weights/
contains pre-trained models for the distributionspresentation/
contains the research poster and write-upsrc/
contains the made codebasesrc/data/
contains the data processing scripts and Pytorch datasetssrc/distributions/
contains the Pytorch models for learning the distributionssrc/model/
contains the object classes for the game model, like players, zones, pitches, etc.src/policy/
contains the zero-sum stochastic game model and work on batting lineup optimization