This directory contains Python scripts and models for analyzing and predicting outcomes in Major League Baseball (MLB) betting markets. These tools are designed for bettors, analysts, and content creators who want to explore MLB data and generate actionable insights.
Predicts the probability of a pitcher going over or under a given strikeout (K) line in their next game. The script uses:
- Recent and season-long strikeout data
- Poisson and Bayesian models (with recency weighting)
- American odds conversion for probability outputs
Features:
- Looks up a pitcher by name
- Fetches recent and season strikeout stats
- Calculates SO/G (strikeouts per game) for various timeframes
- Predicts probability of going over/under a user-specified K line
- Outputs probabilities and equivalent American odds
Example usage:
./pitching_ks_per_game.py FIRST LAST --line 5.5Replace FIRST and LAST with the player's name. The --line argument is the strikeout line you want to evaluate.
All scripts require Python 3. Install dependencies with:
pip install -r requirements.txtKey packages:
- pybaseball: For MLB data access
- scipy: For statistical modeling
- Create and activate a virtual environment:
python3 -m venv venv source venv/bin/activate - Install dependencies:
pip install -r requirements.txt
- Run the desired script as shown above.
- These scripts are for educational and illustrative purposes. They may require adaptation for production or betting use.
- For more information about the overall project, see the top-level README.
See the repository's LICENSE.md file for details.