NoSaturation#
- class pymc_marketing.mmm.components.saturation.NoSaturation(priors=None, prefix=None)[source]#
Wrapper around linear saturation function.
Identity-like transformation that returns
beta * x. Useful when a channel should not be saturated but still needs a learned coefficient.- Parameters:
- beta
tensor Slope of the linear response. Default prior:
Prior("HalfNormal", sigma=1).- .. plot::
- context:
close-figs
import matplotlib.pyplot as plt import numpy as np from pymc_marketing.mmm import NoSaturation
rng = np.random.default_rng(0)
saturation = NoSaturation() prior = saturation.sample_prior(random_seed=rng) curve = saturation.sample_curve(prior) saturation.plot_curve(curve, random_seed=rng) plt.show()
- beta
Methods
NoSaturation.__init__([priors, prefix])NoSaturation.apply(x, *[, core_dim, idx])Call within a model context.
NoSaturation.from_dict(data)Reconstruct a transformation from a dict.
NoSaturation.function(x, beta, *[, dim])Linear saturation function.
NoSaturation.plot_curve(curve[, n_samples, ...])Plot curve HDI and samples.
NoSaturation.plot_curve_hdi(curve[, ...])Plot the HDI of the curve.
NoSaturation.plot_curve_samples(curve[, n, ...])Plot samples from the curve.
NoSaturation.sample_curve([parameters, ...])Sample the curve of the saturation transformation given parameters.
NoSaturation.sample_prior([coords])Sample the priors for the transformation.
Set the dims for all priors.
NoSaturation.to_dict([_orig])Convert the transformation to a dictionary.
NoSaturation.update_priors(priors)Update the priors for a function after initialization.
Return a copy with default prior dims (dims=None) set to
dimsinstead.NoSaturation.with_updated_priors(priors)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.