meridian.model.adstock_hill.transform_non_negative_reals_distribution

Transforms a distribution with support on [0, infinity) to (0, 1].

This allows for defining a prior directly on alpha_*, the exponent of the binomial Adstock decay function, and then translating it to a prior on the decay parameter alpha, which Meridian expects to be defined on the unit interval. Meridian maps alpha to the binomial decay exponent with alpha_* = 1 / alpha - 1, and this transformation applies the inverse mapping, alpha = 1 / (1 + alpha_*). See Set a custom prior directly on alpha for details.

For example, to define a LogNormal(0.2, 0.9) prior on alpha_*:

from meridian import backend
alpha_star_prior = backend.tfd.LogNormal(
    backend.np_float_dtype(0.2), backend.np_float_dtype(0.9)
)
alpha_prior = transform_non_negative_reals_distribution(alpha_star_prior)
prior = prior_distribution.PriorDistribution(
    alpha_m=alpha_prior,
    ...
)

distribution A Tensorflow Probability distribution with support on [0, infinity).

A Tensorflow Probability TransformedDistribution with support on (0, 1], such that the resultant prior on alpha_* is the input distribution.