HillSaturation#
- class pymc_marketing.mmm.components.saturation.HillSaturation(priors=None, prefix=None)[source]#
Wrapper around Hill saturation function.
Multiplies
pymc_marketing.mmm.transformers.hill_function()by an extra scaling parameterbetaso the curve can reach an asymptote other than 1.- Parameters:
- slope
tensor Slope of the Hill curve, controlling its steepness. Default prior:
Prior("HalfNormal", sigma=1.5).- kappa
tensor Half-saturation point where the response equals half its asymptote. Default prior:
Prior("HalfNormal", sigma=1.5).- beta
tensor Asymptote that the saturated response approaches as the input grows. 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 HillSaturation
rng = np.random.default_rng(0)
adstock = HillSaturation() prior = adstock.sample_prior(random_seed=rng) curve = adstock.sample_curve(prior) adstock.plot_curve(curve, random_seed=rng) plt.show()
- slope
Methods
HillSaturation.__init__([priors, prefix])HillSaturation.apply(x, *[, dims, core_dim, idx])Call within a model context.
HillSaturation.from_dict(data)Reconstruct a saturation transformation from a dict.
HillSaturation.function(x, slope, kappa, beta, *)Hill saturation function.
HillSaturation.plot_curve(curve[, ...])Plot curve HDI and samples.
HillSaturation.plot_curve_hdi(curve[, ...])Plot the HDI of the curve.
HillSaturation.plot_curve_samples(curve[, ...])Plot samples from the curve.
HillSaturation.sample_curve([parameters, ...])Sample the curve of the saturation transformation given parameters.
HillSaturation.sample_prior([coords])Sample the priors for the transformation.
Set the dims for all priors.
HillSaturation.to_dict([_orig])Convert the transformation to a dictionary.
HillSaturation.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
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.