HillSaturationSigmoid#
- class pymc_marketing.mmm.components.saturation.HillSaturationSigmoid(priors=None, prefix=None)[source]#
Wrapper around Hill saturation sigmoid function.
Calls
pymc_marketing.mmm.transformers.hill_saturation_sigmoid()directly. The saturation level is exposed by the underlying function assigma, so no extra scaling parameter is added at this layer. Note thatbetahere is the slope of the sigmoid, not a scaling factor.- Parameters:
- sigma
tensor Upper-asymptote parameter (approximate; the true maximum is
sigma * (1 - 1 / (1 + exp(beta * lam))), seehill_saturation_sigmoid()). Default prior:Prior("HalfNormal", sigma=1.5).- beta
tensor Slope of the sigmoid, controlling the steepness of the transition. Default prior:
Prior("HalfNormal", sigma=1.5).- lam
tensor Midpoint of the transition on the input axis. Default prior:
Prior("HalfNormal", sigma=1.5).- .. plot::
- context:
close-figs
import matplotlib.pyplot as plt import numpy as np from pymc_marketing.mmm import HillSaturationSigmoid
rng = np.random.default_rng(0)
adstock = HillSaturationSigmoid() prior = adstock.sample_prior(random_seed=rng) curve = adstock.sample_curve(prior) adstock.plot_curve(curve, random_seed=rng) plt.show()
- sigma
Methods
HillSaturationSigmoid.__init__([priors, prefix])HillSaturationSigmoid.apply(x, *[, dims, ...])Call within a model context.
Reconstruct a saturation transformation from a dict.
HillSaturationSigmoid.function(x, sigma, ...)Hill sigmoid function.
HillSaturationSigmoid.plot_curve(curve[, ...])Plot curve HDI and samples.
Plot the HDI of the curve.
Plot samples from the curve.
Sample the curve of the saturation transformation given parameters.
HillSaturationSigmoid.sample_prior([coords])Sample the priors for the transformation.
Set the dims for all priors.
HillSaturationSigmoid.to_dict([_orig])Convert the transformation to a dictionary.
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
combined_dimsGet the combined dims for all the parameters.
default_priorsfunction_priorsGet the priors for the function.
model_configMapping from variable name to prior for the model.
prefixpriorsGet the priors for the function.
variable_mappingMapping from parameter name to variable name in the model.