InverseScaledLogisticSaturation#

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

Wrapper around inverse scaled logistic saturation function.

Multiplies pymc_marketing.mmm.transformers.inverse_scaled_logistic_saturation() by an extra scaling parameter beta so the curve can reach an asymptote other than 1.

Parameters:
lamtensor

Half-saturation point of the curve (when eps keeps its default value). Default prior: Prior("Gamma", alpha=0.5, beta=1).

betatensor

Asymptote that the saturated response approaches as the input grows. Default prior: Prior("HalfNormal", sigma=2).

.. plot::
context:

close-figs

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

rng = np.random.default_rng(0)

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

Methods

InverseScaledLogisticSaturation.__init__([...])

InverseScaledLogisticSaturation.apply(x, *)

Call within a model context.

InverseScaledLogisticSaturation.from_dict(data)

Reconstruct a saturation transformation from a dict.

InverseScaledLogisticSaturation.function(x, ...)

Inverse scaled logistic saturation function.

InverseScaledLogisticSaturation.plot_curve(curve)

Plot curve HDI and samples.

InverseScaledLogisticSaturation.plot_curve_hdi(curve)

Plot the HDI of the curve.

InverseScaledLogisticSaturation.plot_curve_samples(curve)

Plot samples from the curve.

InverseScaledLogisticSaturation.sample_curve([...])

Sample the curve of the saturation transformation given parameters.

InverseScaledLogisticSaturation.sample_prior([...])

Sample the priors for the transformation.

InverseScaledLogisticSaturation.set_dims_for_all_priors(dims)

Set the dims for all priors.

InverseScaledLogisticSaturation.to_dict([_orig])

Convert the transformation to a dictionary.

InverseScaledLogisticSaturation.update_priors(priors)

Update the priors for a function after initialization.

InverseScaledLogisticSaturation.with_default_prior_dims(dims)

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

InverseScaledLogisticSaturation.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.