Google Meridian

raw JSON →
1.6.0 verified Fri May 01 auth: no python

Google's open source mixed marketing model (MMM) library. It helps advertisers understand return on investment (ROI) and optimize ad spend. Current version: 1.6.0. Released quarterly.

pip install google-meridian
error ModuleNotFoundError: No module named 'meridian'
cause Package installed but the module name is 'meridian' not 'google-meridian'. Also, pip package name is 'google-meridian'.
fix
Install: pip install google-meridian. Then import as: import meridian
error ValueError: The data must contain at least one media channel.
cause Data passed to setup_data() does not have columns matching the specified media_channels or they contain only zeros.
fix
Ensure media channel columns exist in the DataFrame and have positive values. Use data.columns to check names.
error AttributeError: 'NoneType' object has no attribute 'group'
cause Often occurs when using plot functions before running inference or if model was not fitted.
fix
Run model.fit(md) first, then call analysis functions on the fitted model.
gotcha Data must be in a specific format: media channels as columns with non-negative values, response column as numeric, and no missing values. Missing values cause silent errors.
fix Preprocess data: impute missing values and ensure all media channel columns have dtype float64.
deprecated The 'Meridian' class has changed its API in v1.4.0. The old method 'model.fit(data, ...)' now expects a MeridianData object instead of raw pandas DataFrame.
fix Use setup_data() or MeridianData.from_dataframe() to convert data before calling fit().
gotcha Sampling can be extremely slow (hours) with default settings on large datasets. Many users think the code is stuck.
fix Reduce 'num_warmup' and 'num_samples' parameters in Meridian constructor (e.g., Meridian(num_warmup=50, num_samples=100)).
gotcha MCMC diagnostics (R-hat, ESS) may not be computed if TensorFlow Probability version is mismatched. Installation does not enforce compatible TFP version.
fix Use tfp-nightly or pin TFP version: pip install tensorflow-probability==0.22.0