新しく開設された
Discord コミュニティに参加して、リアルタイムのディスカッション、ユーザー同士のサポート、メリディアン チームとの直接の交流をお楽しみください。
モデルの適合度と結果を評価する
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
マーケティング ミックス モデリング(MMM)の主な目的は、マーケティングの因果効果を正確に推定することですが、因果推論の質を直接検証することは困難であり、適切に設計されたテストが必要です。これらのテストは正しく実施され、MMM と推定値が同じになる必要があります。MMM を使用するため、テストは現実的ではない可能性があります。そのため、因果推論を直接評価することはできません。代わりに、間接的な指標に頼る必要があります。
モデリングの際は、決定予測誤差を最小限に抑えることではなく、因果推論の目標重視で判断を下すことをおすすめします。ガイドラインは次のとおりです。
コントロール変数のセットには、メディア マーケティングとレスポンスの両方に影響する重要な交絡変数がすべて含まれていることを確認してください。詳細については、コントロール変数の選択をご確認ください。
実際には交絡因子ではないコントロール変数を含める場合は注意が必要です。変数が多すぎると、過学習やモデルの誤指定バイアスのリスクが高まる可能性があります。
因果推論の学習では、重要なメディア変数のみを追加してください。
モデル内の時間効果のノット数の選択のアドバイスに沿って、時間をモデル化します。ノット数を最大限に増やして時間をモデル化する必要はありません。
このプロセスでは広告主様による自己分析が必要ですが、そうすることで最適なモデルの適合につながる可能性が高くなります。独自のメディア戦略を策定したのであれば、メディア マーケティング関連の計画に影響を与えた変数を把握しているか、目星がついているはずです。
結果は妥当である必要があります。妥当ではない結果には、ベースラインが異常に低い(多くの場合マイナス)場合(ベースラインを評価するを参照)や、特定のメディア チャネルが他のすべてのメディア チャネルを圧倒している場合などがあります。メリディアンにはサンプル外の予測指標があります。これは、モデル構造が適切で、過度にパラメータ化されていないことを確認するための予備チェックとして役立ちます。
サンプル外予測指標について
マーケティング ミックス モデリング(MMM)の目標は因果推論であり、必ずしもサンプル外の予測指標を最小化することではありません。モデルが過学習になる場合でも、すべての交絡変数を含むモデルを用意し、モデル構造に十分な柔軟性を持たせて、バイアスがない因果推定(費用対効果など)を取得できるようにすることをおすすめします。
それでも、モデル構造が適切で、過度にパラメータ化されていないことを確認するために、サンプル外の適合度を確認することをおすすめします。ただし、サンプル外の予測指標をモデル適合度の主な評価方法にはしないでください。サンプル外の適合度は、ModelSpec
の holdout_id
引数と Analyzer
の predictive_accuracy
メソッドを使用して評価できます。
すべてのパラメータの事後分布の抽出にアクセスする
すべてのパラメータの事後分布の抽出には、メリディアン モデル オブジェクトの inference_data
属性からアクセスできます。
たとえば、mmm
という名前の メリディアン モデル オブジェクトから、各メディア チャネルのアルファ(Adstock 減衰パラメータ)の事後分布の値には、プロパティ mmm.inference_data.posterior.alpha_m
からアクセスします。そこから、75 パーセンタイルの場合のこの例と同様の構文を使用して、事後分布から任意のパーセンタイルを取得できます。
np.percentile(meridian.inference_data.posterior.alpha_m, 0.75, axis=(0, 1))
ROI が 1 以上の事後確率も計算できます。
(meridian.inference_data.posterior.roi_m >= 1).mean(dim=('chain', 'draw'))
また、パラメータの推定事後分布について、指定した幅の中心的傾向と信頼区間を取得できます。たとえば、alpha_m
の平均と 90 パーセンタイルの信頼区間は、次の構文を使用して取得できます。
Analyzer.get_central_tendency_and_ci(mmm.inference_data.posterior.alpha_m, 0.9)
他のすべてのパラメータの事後分布にも、同様の方法でアクセスできます。
モデルの適合度と結果にアクセスする方法
Analyzer
クラスには、モデリング後の多くの量を提供するメソッドがいくつかあります。
以下にいくつか例を示します。
Analyzer.media_summary_metrics
は、チャネル別にまとめられた概要表を返します。対象となる指標には、impressions
、spend
、incremental_outcome
、pct_of_contribution
、ROI
、effectiveness
、mROI
があります。
Analyzer.incremental_outcome
を使用すると、特定のメディアソースの結果を調べることができます。
Analyzer.roi
は費用対効果の推定値を提供し、メディア、時間、地域別にカスタマイズできます。
Analyzer.marginal_roi
は限界費用対効果の推定値を提供し、メディア、時間、地域別にカスタマイズできます。
Analyzer.response_curves
は、応答曲線のプロットに使用されるデータを返します。
Analyzer.predictive_accuracy
は、決定係数、MAPE、wMAPE などの予測精度の指標を返します。
Analyzer.expected_outcome
は、事前分布または事後分布の想定される結果を返します。
メソッドの一覧と、特定の地域や時間の選択など、メソッドの潜在的な仕様について詳しくは、analyzer.py コードをご確認ください。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-08-04 UTC。
[null,null,["最終更新日 2025-08-04 UTC。"],[[["\u003cp\u003eMarketing mix modeling (MMM) focuses on estimating causal marketing effects, but direct validation is challenging, requiring reliance on indirect measures and informed modeling decisions.\u003c/p\u003e\n"],["\u003cp\u003ePrioritize modeling choices that support causal inference over minimizing prediction error, such as carefully selecting control variables and focusing on relevant media variables.\u003c/p\u003e\n"],["\u003cp\u003eEvaluate model results for reasonableness, ensuring they align with expectations and avoid unrealistic outcomes like negative baselines or single-channel dominance.\u003c/p\u003e\n"],["\u003cp\u003eWhile out-of-sample prediction metrics offer a preliminary check, they shouldn't be the primary model fit assessment; causal inference remains the central goal.\u003c/p\u003e\n"],["\u003cp\u003eAccess posterior distribution draws and utilize Analyzer methods to gain insights into model parameters, media impact, ROI, and other key performance indicators.\u003c/p\u003e\n"]]],[],null,["# Assess the model fit and the results\n\nThe primary goal of marketing mix modeling (MMM) is the accurate estimation of\ncausal marketing effects. However, directly validating the quality of causal\ninference is difficult and requires well-designed experiments. These\nexperiments must be executed correctly and must have the same estimand as the\nMMM. Since you are using an MMM, experiments are likely not practical. For\nthis reason, the causal inference cannot be directly assessed. Instead, you\nhave to rely on indirect measures.\n\nWe recommend that you make modeling decisions that make sense for the goal of\ncausal inference, and not for minimizing prediction error. Consider these\nguidelines:\n\n- Make sure that your control variable set includes all important confounding\n variables, which impact both media execution and the response. For more\n information, see [Selecting control variables](/meridian/docs/advanced-modeling/control-variables#selecting-control-variables).\n\n- Be careful about including control variables that are not actually\n confounders. Too many variables can increase the risk of overfitting and\n model misspecification bias.\n\n- Only add media variables for which you are interested in learning the causal\n inference.\n\n- Model time using the advice in [Choosing the number of knots for time effects in the model](/meridian/docs/advanced-modeling/setting-knots#choosing-number-of-knots-time-effects),\n and don't necessarily try to model time with as many knots as you can.\n\nThis process does require some self-reflection from you as the advertiser,\nhowever this will most likely lead to the best model fit. Considering that you\nplanned your own media strategy, you probably know or have a strong sense of\nwhat variables impacted your planning around media execution.\n\nThe [results](#access-results) need to make sense. Results that don't make sense\ninclude unusually low baselines that are often negative (see\n[Assess the baseline](/meridian/docs/advanced-modeling/baseline)) or one media\nchannel dominating all other media channels. Meridian has\n[out-of-sample prediction metrics](/meridian/docs/advanced-modeling/model-fit#out-of-sample-metrics)\nwhich are useful as a preliminary check to make sure the model structure is\nappropriate and not extremely overparameterized.\n\nAbout out-of-sample prediction metrics\n--------------------------------------\n\nThe goal in marketing mix modeling (MMM) is causal inference, and not\nnecessarily to minimize out-of-sample prediction metrics. It can be safer to\nhave a model that includes all confounding variables and allows enough\nflexibility in the model structure to get unbiased, causal estimates (such as\nROI), even if this means the model is overfit.\n\nIt is still a good idea to check the out-of-sample fit to make sure your model\nstructure is appropriate and not extremely overparameterized, but the\nout-of-sample prediction metrics shouldn't be the primary way model fit is\nassessed. Out-of-sample fit can be evaluated using the `holdout_id`\nargument in `ModelSpec` and the `predictive_accuracy` method of `Analyzer`.\n\nAccess the posterior distribution draws for all parameters\n----------------------------------------------------------\n\nThe posterior distribution draws of all parameters can be accessed from the\nMeridian model object through the `inference_data` attribute.\n\nFor example, to access values of the posterior for alpha (Adstock decay\nparameter) for each media channel from a Meridian model object named\n`mmm` you can access the property `mmm.inference_data.posterior.alpha_m`. From\nthere you can obtain any percentile from the posterior distribution using syntax\nsimilar to this example for a 75th percentile: \n\n np.percentile(meridian.inference_data.posterior.alpha_m, 0.75, axis=(0, 1))\n\nYou can also calculate the posterior probability of ROI being at least 1: \n\n (meridian.inference_data.posterior.roi_m \u003e= 1).mean(dim=('chain', 'draw'))\n\nAdditionally, you can obtain the central tendency and credible interval of\nspecified width for the estimated posterior distribution of a parameter. For\nexample, the mean and 90th percentile credible interval for `alpha_m`can be\nobtained using the following syntax: \n\n Analyzer.get_central_tendency_and_ci(mmm.inference_data.posterior.alpha_m, 0.9)\n\nThe posterior distributions for all other parameters can be accessed in a\nsimilar manner.\n\nMethods for model fit and results\n---------------------------------\n\nThe `Analyzer` class has several methods providing many of the post-modeling\nquantities of interest.\n\nSome examples include:\n\n- `Analyzer.media_summary_metrics` provides a summary table organized by channel. The metrics of interest include: `impressions`, `spend`, `incremental_outcome`, `pct_of_contribution`, `ROI`, `effectiveness`, and `mROI`.\n- `Analyzer.incremental_outcome` lets you explore the outcome of a specific media source.\n- `Analyzer.roi` provides estimates of ROI and can be customized by media, time, and geo.\n- `Analyzer.marginal_roi` provides estimates of marginal ROI and can be customized by media, time, and geo.\n- `Analyzer.response_curves` returns the data used in plotting the response curves.\n- `Analyzer.predictive_accuracy` returns metrics for predictive accuracy, including R-squared, MAPE, wMAPE.\n- `Analyzer.expected_outcome` returns either the prior or posterior expected outcome.\n\nFor a full list of methods and more information about their potential\nspecifications, including selecting specific geos or times, see the\n[analyzer.py](/meridian/reference/api/meridian/analysis/analyzer) code."]]