Join the newly launched
Discord community for real-time discussions, peer support, and direct interaction with the Meridian team!
Holdout observations (train and test split)
Stay organized with collections
Save and categorize content based on your preferences.
The Meridian model specification contains a holdout_id
argument (a
boolean array of dimensions \(G \times T\)) that can be used to specify a
holdout sample. The KPI data of the holdout observations is ignored during model
training (for example, MCMC posterior sampling), and does not affect the model
likelihood or posterior density. Media data for the holdout observations is
still used for model training, because it affects the adstocked media values for
subsequent time periods.
The primary use of the holdout sample is for calculating out-of-sample goodness
of fit metrics, such as R-squared. This is useful for comparing different model
specifications, such as prior distribution strengths, provided that each model
being compared uses the same holdout sample. There is no guarantee that the
model with the best out-of-sample model fit is the best model for causal
inference, but generally a better fitting model is preferred. Model
misspecifications that lead to poor model fit can also cause bias in causal
inference.
We recommend using a holdout sample that is fairly balanced across geos and time
periods. In other words, use a holdout sample that has approximately the same
number of holdout observations for each geo and approximately the same number of
holdout observations for each time period. If the holdout sample is imbalanced,
this can result in too few training observations to estimate the geo effect
\(\tau_g\) for certain geos, or the time effect \(\mu_t\) for certain time
periods. By default, Meridian does not specify a holdout sample. You
must specify the holdout sample and ensure that it has a reasonable degree of
balance.
Avoid holding out large, contiguous-in-time, chunks of data, such as at the end
of the MMM time window, to assess forecast error in the KPI. Meridian
isn't designed for forecasting the KPI, especially if there is strong trend and
seasonality in the KPI. Instead, Meridian estimates the causal media
impact and uses the knot-based approach to modeling trend and seasonality. The
knot-based approach needs data near the knot to estimate the knot effectively.
If large, contiguous-in-time, chunks of data are held out, there is no data near
the knots within the held out period. In this case, the knot's posterior
distribution is driven by the prior, which can result in poor forecasting.
Additionally, Meridian can be used to estimate the impact of both
historical and future media because it assumes that model parameters which
determine media impact are consistent over time.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-06-11 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-06-11 UTC."],[[["\u003cp\u003eThe Meridian model's \u003ccode\u003eholdout_id\u003c/code\u003e argument allows you to specify a holdout sample for calculating out-of-sample goodness of fit metrics, like R-squared, to compare different model specifications.\u003c/p\u003e\n"],["\u003cp\u003eWhile media data for holdout observations is used in training, their KPI data is excluded, ensuring the holdout sample doesn't influence model parameters.\u003c/p\u003e\n"],["\u003cp\u003eFor optimal performance, use a balanced holdout sample across geos and time periods to ensure sufficient data for accurate model estimation.\u003c/p\u003e\n"],["\u003cp\u003eAvoid holding out large, continuous time chunks as Meridian focuses on causal impact estimation, not KPI forecasting, and requires data near knots for effective trend and seasonality modeling.\u003c/p\u003e\n"],["\u003cp\u003eMeridian can be used to estimate the impact of both past and future media due to its assumption of consistent media impact parameters over time.\u003c/p\u003e\n"]]],["The `holdout_id` in the Meridian model defines a holdout sample, where KPI data is excluded from model training but media data is still used. This holdout is used to calculate out-of-sample fit metrics. It is recommended the holdout sample be balanced across geos and time periods. Avoid holding out large contiguous time blocks as this can negatively impact the estimation of knots, affecting model forecasting ability. Meridian can estimate the impact of both past and future media.\n"],null,["# Holdout observations (train and test split)\n\nThe Meridian model specification contains a `holdout_id` argument (a\nboolean array of dimensions \\\\(G \\\\times T\\\\)) that can be used to specify a\nholdout sample. The KPI data of the holdout observations is ignored during model\ntraining (for example, MCMC posterior sampling), and does not affect the model\nlikelihood or posterior density. Media data for the holdout observations is\nstill used for model training, because it affects the adstocked media values for\nsubsequent time periods.\n\nThe primary use of the holdout sample is for calculating out-of-sample goodness\nof fit metrics, such as R-squared. This is useful for comparing different model\nspecifications, such as prior distribution strengths, provided that each model\nbeing compared uses the same holdout sample. There is no guarantee that the\nmodel with the best out-of-sample model fit is the best model for causal\ninference, but generally a better fitting model is preferred. Model\nmisspecifications that lead to poor model fit can also cause bias in causal\ninference.\n\nWe recommend using a holdout sample that is fairly balanced across geos and time\nperiods. In other words, use a holdout sample that has approximately the same\nnumber of holdout observations for each geo and approximately the same number of\nholdout observations for each time period. If the holdout sample is imbalanced,\nthis can result in too few training observations to estimate the geo effect\n\\\\(\\\\tau_g\\\\) for certain geos, or the time effect \\\\(\\\\mu_t\\\\) for certain time\nperiods. By default, Meridian does not specify a holdout sample. You\nmust specify the holdout sample and ensure that it has a reasonable degree of\nbalance.\n\nAvoid holding out large, contiguous-in-time, chunks of data, such as at the end\nof the MMM time window, to assess forecast error in the KPI. Meridian\nisn't designed for forecasting the KPI, especially if there is strong trend and\nseasonality in the KPI. Instead, Meridian estimates the causal media\nimpact and uses the knot-based approach to modeling trend and seasonality. The\nknot-based approach needs data near the knot to estimate the knot effectively.\nIf large, contiguous-in-time, chunks of data are held out, there is no data near\nthe knots within the held out period. In this case, the knot's posterior\ndistribution is driven by the prior, which can result in poor forecasting.\n\nAdditionally, Meridian can be used to estimate the impact of both\nhistorical and future media because it assumes that model parameters which\ndetermine media impact are consistent over time."]]