https://github.com/bobona/zerosumbaseball
We apply a zero-sum stochastic model of baseball to optimizing batting lineups.
https://github.com/bobona/zerosumbaseball
baseball game-theory machine-learning permutation-algorithms value-iteration zero-sum-game
Last synced: 2 months ago
JSON representation
We apply a zero-sum stochastic model of baseball to optimizing batting lineups.
- Host: GitHub
- URL: https://github.com/bobona/zerosumbaseball
- Owner: BOBONA
- Created: 2024-05-22T17:33:40.000Z (12 months ago)
- Default Branch: master
- Last Pushed: 2024-08-02T17:43:34.000Z (9 months ago)
- Last Synced: 2025-01-05T12:14:16.947Z (4 months ago)
- Topics: baseball, game-theory, machine-learning, permutation-algorithms, value-iteration, zero-sum-game
- Language: Jupyter Notebook
- Homepage:
- Size: 91.7 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Zero-Sum Baseball

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](presentation/writeup.pdf) for the full details.
### Getting Started
1. Install the requirements with `pip install -r requirements.txt`
- Or manually install PyTorch, CVXPY, Pandas, Matplotlib, blosc2, and tqdm
2. Fetch the raw data with `raw_data/fetch_data.py`
3. Process the data with `src/data/data_loading.py`
4. Try out the zero-sum stochastic game model with `src/policy/optimal_policy.py`
5. Try the batting lineup optimization scripts with `src/policy/batting_order_optimization.py`
6. Check out some visualizations with `src/statistics.ipynb` and `src/policy/batting_order.ipnyb`
7. Feel free to load the data with `bd = BaseballData()` and experiment!### Project Structure
- `model_weights/` contains pre-trained models for the distributions
- `presentation/` contains the research poster and write-up
- `src/` contains the made codebase
- `src/data/` contains the data processing scripts and Pytorch datasets
- `src/distributions/` contains the Pytorch models for learning the distributions
- `src/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