MichaelisMentenSaturation#

class pymc_marketing.mmm.components.saturation.MichaelisMentenSaturation(priors=None, prefix=None)[source]#

Wrapper around Michaelis-Menten saturation function.

Calls pymc_marketing.mmm.transformers.michaelis_menten() directly. The saturation level is exposed by the underlying function as alpha, so no extra scaling parameter is added at this layer.

Parameters:
alphatensor

Maximum contribution, the asymptote that the response approaches. Default prior: Prior("Gamma", mu=2, sigma=1).

lamtensor

Half-saturation point on the input axis. Default prior: Prior("HalfNormal", sigma=1).

.. plot::
context:

close-figs

import matplotlib.pyplot as plt import numpy as np from pymc_marketing.mmm import MichaelisMentenSaturation

rng = np.random.default_rng(0)

adstock = MichaelisMentenSaturation() prior = adstock.sample_prior(random_seed=rng) curve = adstock.sample_curve(prior) adstock.plot_curve(curve, random_seed=rng) plt.show()

Methods

MichaelisMentenSaturation.__init__([priors, ...])

MichaelisMentenSaturation.apply(x, *[, ...])

Call within a model context.

MichaelisMentenSaturation.from_dict(data)

Reconstruct a saturation transformation from a dict.

MichaelisMentenSaturation.function(x, alpha, ...)

Michaelis-Menten saturation function.

MichaelisMentenSaturation.plot_curve(curve)

Plot curve HDI and samples.

MichaelisMentenSaturation.plot_curve_hdi(curve)

Plot the HDI of the curve.

MichaelisMentenSaturation.plot_curve_samples(curve)

Plot samples from the curve.

MichaelisMentenSaturation.sample_curve([...])

Sample the curve of the saturation transformation given parameters.

MichaelisMentenSaturation.sample_prior([coords])

Sample the priors for the transformation.

MichaelisMentenSaturation.set_dims_for_all_priors(dims)

Set the dims for all priors.

MichaelisMentenSaturation.to_dict([_orig])

Convert the transformation to a dictionary.

MichaelisMentenSaturation.update_priors(priors)

Update the priors for a function after initialization.

MichaelisMentenSaturation.with_default_prior_dims(dims)

Return a copy with default prior dims (dims=None) set to dims instead.

MichaelisMentenSaturation.with_updated_priors(priors)

Return a copy with updated priors.

Attributes

combined_dims

Get the combined dims for all the parameters.

default_priors

function_priors

Get the priors for the function.

model_config

Mapping from variable name to prior for the model.

prefix

priors

Get the priors for the function.

variable_mapping

Mapping from parameter name to variable name in the model.