Skip to content

hfepbook1/bayesian-sports-analytics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

🏀 Bayesian Sports Prediction App 🏆

Live Demo Python 3.10 Streamlit License: MIT Last Updated

Predict NBA champions with Bayesian stats & optimize fantasy lineups with Monte Carlo simulation.


🚀 Overview

Bayesian Sports Prediction App is an interactive Streamlit web app that tackles two hoops-analytics problems:

  1. NBA Championship Probabilities – Uses a Bayesian Bradley-Terry model (PyMC) and thousands of simulated playoff brackets to estimate each team’s odds of winning the title.
  2. Daily Fantasy Lineup Optimization – Runs Monte Carlo simulations of player performance, then picks the highest-EV lineup under the salary cap.

Everything runs in a friendly Streamlit UI—tweak parameters, watch the numbers change, and make smarter hoops decisions.


✨ Features

Category Highlights
🏆 Championship Predictor Posterior team strengths · Top-8 bracket simulation · Probability table & bar chart · “Roster-change” slider to test injuries/upgrades
🤖 DFS Optimizer Brute-force + MC lineup builder · Salary-cap aware · Histogram of total lineup points · Manual lineup-builder UI
📊 EDA Dashboards Interactive Plotly violin / histogram / scatter charts for team & player stats
🎮 Streamlit UX Multi-page layout · Instant re-simulation · Downloadable results

🛠 Tech Stack

Tool Role
Python Core language (v3.10)
PyMC & Aesara Bayesian inference & MCMC
NumPy / Pandas Data wrangling
Streamlit App framework
Plotly Interactive visualizations

⚙️ Architecture

┌────────────────────────┐ │ Streamlit Front End │ ◄──── user interacts └──────────┬─────────────┘ │ calls ┌──────────▼─────────────┐ │ Simulation Engine │ (PyMC: Bradley-Terry & MC) └──────────┬─────────────┘ │ returns results ┌──────────▼─────────────┐ │ DFS Optimizer Module │ (salary-cap + MC totals) └────────────────────────┘


☁️ Live Demo

The app is deployed on Streamlit Community Cloud: <https://sports-predictor.streamlit.app>


💻 Local Setup

  1. Clone
git clone https://github.com/yourusername/bayesian-sports-prediction-app.git
cd bayesian-sports-prediction-app
  1. Create / activate a Python 3.10 env (optional)
python -m venv venv
source venv/bin/activate   # on Windows: venv\Scripts\activate
  1. Install deps
pip install -r requirements.txt
  1. Run
streamlit run app.py

☁️ Deploy on Streamlit Cloud

  1. Fork this repo ➜ push to your GitHub.
  2. Go to share.streamlit.io ➜ “New app”.
  3. Select the repo, branch, and app.py (or streamlit_app.py) as entrypoint.
  4. (Optional) In Advanced settings, pick Python 3.10 and add secrets.
  5. Click Deploy. Streamlit Cloud installs requirements.txt and spins up your app.

📄 License

Distributed under the MIT License. See LICENSE for info.

About

Streamlit app that applies Bayesian modelling to sports data — live win-probability curves, player impact estimates, and predictive simulations.

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages