{"id":23106,"library":"google-meridian","title":"Google Meridian","description":"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.","status":"active","version":"1.6.0","language":"python","source_language":"en","source_url":"https://github.com/google-meridian/meridian","tags":["marketing-mix-model","mmm","google","bayesian","ROI"],"install":[{"cmd":"pip install google-meridian","lang":"bash","label":"install latest"}],"dependencies":[{"reason":"Numerical computations","package":"numpy","optional":false},{"reason":"Data handling","package":"pandas","optional":false},{"reason":"Google API client (for some features)","package":"google-api-python-client","optional":true},{"reason":"BigQuery data source","package":"google-cloud-bigquery","optional":true}],"imports":[{"note":"Correct import from the top-level meridian package.","symbol":"Meridian","correct":"from meridian import Meridian"},{"note":"Data container class.","symbol":"MeridianData","correct":"from meridian.data import MeridianData"},{"note":"Helper to load data into MeridianData.","symbol":"setup_data","correct":"from meridian.data import setup_data"},{"note":"Run inference on a fitted model.","symbol":"run_inference","correct":"from meridian.analysis import run_inference"},{"note":"Generate diagnostic plots.","symbol":"plot_media_effectiveness_curves","correct":"from meridian.analysis import plot_media_effectiveness_curves"},{"note":"Model is not a direct module; Meridian is the main class in the meridian package.","wrong":"import meridian.Model","symbol":"Model","correct":null}],"quickstart":{"code":"import pandas as pd\nfrom meridian import Meridian\nfrom meridian.data import setup_data\n\n# Load your data (example: CSV)\ndata = pd.read_csv('mmm_data.csv')\n\n# Create MeridianData object\nmd = setup_data(data, media_channels=['tv', 'digital'],\n                non_media_variables=['price', 'macro_index'],\n                response='sales', target_roi=2.0)\n\n# Initialize model\nmodel = Meridian()\n\n# Fit model (sampling may take time)\nmodel.fit(md)\n\n# Run inference and get ROI summary\nsummary = model.get_summary(md)\nprint(summary)","lang":"python","description":"Basic workflow: load data, prepare MeridianData, initialize Meridian model, fit, and get ROI summary."},"warnings":[{"fix":"Preprocess data: impute missing values and ensure all media channel columns have dtype float64.","message":"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.","severity":"gotcha","affected_versions":"all"},{"fix":"Use setup_data() or MeridianData.from_dataframe() to convert data before calling fit().","message":"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.","severity":"deprecated","affected_versions":">=1.4.0"},{"fix":"Reduce 'num_warmup' and 'num_samples' parameters in Meridian constructor (e.g., Meridian(num_warmup=50, num_samples=100)).","message":"Sampling can be extremely slow (hours) with default settings on large datasets. Many users think the code is stuck.","severity":"gotcha","affected_versions":"all"},{"fix":"Use tfp-nightly or pin TFP version: pip install tensorflow-probability==0.22.0","message":"MCMC diagnostics (R-hat, ESS) may not be computed if TensorFlow Probability version is mismatched. Installation does not enforce compatible TFP version.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install: pip install google-meridian. Then import as: import meridian","cause":"Package installed but the module name is 'meridian' not 'google-meridian'. Also, pip package name is 'google-meridian'.","error":"ModuleNotFoundError: No module named 'meridian'"},{"fix":"Ensure media channel columns exist in the DataFrame and have positive values. Use data.columns to check names.","cause":"Data passed to setup_data() does not have columns matching the specified media_channels or they contain only zeros.","error":"ValueError: The data must contain at least one media channel."},{"fix":"Run model.fit(md) first, then call analysis functions on the fitted model.","cause":"Often occurs when using plot functions before running inference or if model was not fitted.","error":"AttributeError: 'NoneType' object has no attribute 'group'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}