RootSaturation#
- class pymc_marketing.mmm.components.saturation.RootSaturation(priors=None, prefix=None)[source]#
Wrapper around Root saturation function.
Multiplies
pymc_marketing.mmm.transformers.root_saturation()by an extra scaling parameterbeta.- Parameters:
- alpha
tensor Exponent applied to the input by
root_saturation(). Default prior:Prior("Beta", alpha=1, beta=2).- beta
tensor Scaling factor applied to the root-transformed input. Default prior:
Prior("Gamma", mu=1, sigma=1).- .. plot::
- context:
close-figs
import matplotlib.pyplot as plt import numpy as np from pymc_marketing.mmm import RootSaturation
rng = np.random.default_rng(0)
saturation = RootSaturation() prior = saturation.sample_prior(random_seed=rng) curve = saturation.sample_curve(prior) saturation.plot_curve(curve, random_seed=rng) plt.show()
- alpha
Methods
RootSaturation.__init__([priors, prefix])RootSaturation.apply(x, *[, core_dim, idx])Call within a model context.
RootSaturation.from_dict(data)Reconstruct a transformation from a dict.
RootSaturation.function(x, alpha, beta, *[, dim])Root saturation function.
RootSaturation.plot_curve(curve[, ...])Plot curve HDI and samples.
RootSaturation.plot_curve_hdi(curve[, ...])Plot the HDI of the curve.
RootSaturation.plot_curve_samples(curve[, ...])Plot samples from the curve.
RootSaturation.sample_curve([parameters, ...])Sample the curve of the saturation transformation given parameters.
RootSaturation.sample_prior([coords])Sample the priors for the transformation.
Set the dims for all priors.
RootSaturation.to_dict([_orig])Convert the transformation to a dictionary.
RootSaturation.update_priors(priors)Update the priors for a function after initialization.
Return a copy with default prior dims (dims=None) set to
dimsinstead.Return a copy with updated priors.
Attributes
Get the combined dims for all the parameters.
Get the priors for the function.
Mapping from variable name to prior for the model.
Get the priors for the function.
Whether the saturation must receive raw (unscaled) channel inputs.
Mapping from parameter name to variable name in the model.