FanPulse
Bayesian Marketing Mix Model · MLB Fan Demand · Causal Analytics
Project Info
- Domain: Marketing Analytics / Bayesian ML
- Stack: Python, PyMC, NUTS (HMC), pytensor, Streamlit, pandas, NumPy
- Data: 11,972 real MLB home games — Baseball Reference (2019, 2021–2024)
- GitHub: View Repository
The Problem
What actually drives MLB game attendance, and how should a team allocate a fixed seasonal marketing budget? The drivers are correlated — opening day, a pennant race, market size, and promotions all move attendance at once — and marketing has carry-over and saturation effects that naive regression cannot capture.
What I Built
- Fit a Bayesian Marketing Mix Model in PyMC on 11,972 real MLB home games across 5 seasons and all 30 teams using NUTS (Hamiltonian Monte Carlo) — decomposing log-attendance into a hierarchical team intercept, game-context and performance covariates, and 4 marketing channels passed through geometric adstock and Hill saturation transforms
- Built a fully Bayesian variant that places priors on and learns each channel's adstock decay, Hill α, and Hill γ from data using a reset-aware
pytensor.scan— full posteriors over every parameter, uncertainty included - Six-page Streamlit dashboard for effect decomposition, posterior predictive checks, channel diagnostics, and interactive budget scenario planning with return-on-spend curves
Impact
A production-grade Bayesian causal model on real sports data — demonstrating the same technique used by major advertisers to attribute and optimize spend, applied end-to-end from data to interactive planning tool.