How google/lightweight_mmm works
LightweightMMM is a Bayesian marketing-mix modeling library: users prepare and scale media, KPI, feature, and cost data; fit national or geo-level models; inspect predictions and channel effects; and optimize budget allocation. The graph keeps those product stages and the documented model components visible. Sampled source confirms the model-fitting interface, prior definitions, transformation and time-series components, and plotting behavior; some subsystem connections are based on README-described capabilities because their implementation excerpts were not supplied.
Main entry points: models.py MMM model forms · lightweight_mmm.py Fit and predict · optimize_media.py Budget optimization · media_transforms.py Media transforms
Components 15
Analysis workflow
- Scale and inspect
lightweight_mmm/preprocessing.py - Fit and predict
lightweight_mmm/lightweight_mmm.py - Budget optimization
lightweight_mmm/optimize_media.py - Data utilities
lightweight_mmm/utils.py
Bayesian inference
- Media transforms
lightweight_mmm/media_transforms.py - Lag and carryover
lightweight_mmm/core/transformations/lagging.py - Saturation
lightweight_mmm/core/transformations/saturation.py - Prior definitions
lightweight_mmm/core/priors.py - Intercept
lightweight_mmm/core/baseline/intercept.py - Seasonality
lightweight_mmm/core/time/seasonality.py - Trend
lightweight_mmm/core/time/trend.py - MMM model forms
lightweight_mmm/models.py
Analysis outputs
- Model plots
lightweight_mmm/plot.py - Effect and budget insights
Other components
- Analyst
Connections 18
- Analyst → Scale and inspect: prepares data
- Analyst → Fit and predict: fits model
- Scale and inspect → Fit and predict: scaled inputs
- Fit and predict → MMM model forms: runs inference
- MMM model forms → Prior definitions: uses priors
- MMM model forms → Intercept: models baseline
- MMM model forms → Seasonality: models cycles
- MMM model forms → Trend: models trend
- MMM model forms → Media transforms: transforms media
- Media transforms → Lag and carryover: applies lag
- Media transforms → Saturation: applies saturation
- Analyst → Budget optimization: optimizes spend
- Budget optimization → Fit and predict: uses fitted model
- Analyst → Model plots: requests plots
- Model plots → Fit and predict: reads fit results
- Model plots → Effect and budget insights: visualizes effects
- Budget optimization → Effect and budget insights: returns allocation
- Analyst → Data utilities: simulates data