Join the newly launched
Discord community for real-time discussions, peer support, and direct interaction with the Meridian team!
Set custom priors from a combination of distribution families
Stay organized with collections
Save and categorize content based on your preferences.
Meridian offers a custom distribution object
(prior_distribution.IndependentMultivariateDistribution
)
that lets you combine
distributions from multiple families into one prior distribution. For example,
you might want to use LogNormal distributions to define an ROI prior for three
media channels and a HalfNormal prior for a fourth:
import tensorflow_probability as tfp
from meridian.model import prior_distribution
distributions = [
tfp.distributions.LogNormal([0.2, 0.2, 0.2], [0.9, 0.9, 0.9]),
tfp.distributions.HalfNormal(5),
]
roi_m_prior = prior_distribution.IndependentMultivariateDistribution(distributions)
prior = PriorDistribution(roi_m=roi_m_prior)
model_spec = ModelSpec(prior=prior)
meridian_model = Meridian(
input_data = # an `InputData` object
model_spec=model_spec,
)
You might see slightly longer runtimes because
IndependentMultivariateDistribution
splits and delegates tensors under the
hood to its child distributions. Before you use
IndependentMultivariateDistribution
, consider if varying the parameters
between channels, but within the same distribution family, would help, or if
using a different distribution family is better.
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-08-28 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-08-28 UTC."],[],[],null,["Meridian offers a custom distribution object\n([`prior_distribution.IndependentMultivariateDistribution`](/meridian/reference/api/meridian/model/prior_distribution/IndependentMultivariateDistribution))\nthat lets you combine\ndistributions from multiple families into one prior distribution. For example,\nyou might want to use LogNormal distributions to define an ROI prior for three\nmedia channels and a HalfNormal prior for a fourth: \n\n import tensorflow_probability as tfp\n from meridian.model import prior_distribution\n\n distributions = [\n tfp.distributions.LogNormal([0.2, 0.2, 0.2], [0.9, 0.9, 0.9]),\n tfp.distributions.HalfNormal(5),\n ]\n\n roi_m_prior = prior_distribution.IndependentMultivariateDistribution(distributions)\n prior = PriorDistribution(roi_m=roi_m_prior)\n model_spec = ModelSpec(prior=prior)\n\n meridian_model = Meridian(\n input_data = # an `InputData` object\n model_spec=model_spec,\n )\n\nYou might see slightly longer runtimes because\n`IndependentMultivariateDistribution` splits and delegates tensors under the\nhood to its child distributions. Before you use\n`IndependentMultivariateDistribution`, consider if varying the parameters\nbetween channels, but within the same distribution family, would help, or if\nusing a different distribution family is better."]]