SoftPlusHSGPTerm#

class pymc_marketing.terms_gp.SoftPlusHSGPTerm(*, var_name='date', name='tvp', X_mid=None, dims=None, demeaned_basis=False, time_resolution=None, eta=None, ls=None, m=None, L=None, centered=False, drop_first=True, eta_mass=0.05, eta_upper=1.0, ls_lower=1.0, ls_upper=None, ls_mass=0.9, cov_func=CovFunc.ExpQuad)[source]#

HSGP term with softplus transformation and mean-one centering.

Maps the latent GP to strictly positive values and normalizes multiplicatively by the time-mean, so the resulting multiplier has mean one over the time dimension while remaining strictly positive. This is the canonical time-varying multiplier for media effects, matching the time-varying parameters of the stable MMM classes.

The output broadcasts across a media term’s channel dimension through *:

tvp_media = SoftPlusHSGPTerm() * media

For out-of-sample prediction with pymc_marketing.model_graph.deterministics_to_flat(), the {name}_f_mean deterministic is the one to replace:

SoftPlusHSGPTerm.deterministics_to_replace("tvp")
# ['tvp_f_mean']

Methods

SoftPlusHSGPTerm.__init__(*[, var_name, ...])

SoftPlusHSGPTerm.add_coords(ds)

Resolve deferred values.

SoftPlusHSGPTerm.create_variable()

Build the GP curve through the wrapped HSGP class.

SoftPlusHSGPTerm.deterministics_to_replace(name)

Deterministics to replace with pm.Flat for out-of-sample.

SoftPlusHSGPTerm.from_dict(data)

Reconstruct a term from its serialized form.

SoftPlusHSGPTerm.get_coords(ds)

Collect coordinates from the time reference and extra dims.

SoftPlusHSGPTerm.named(name[, dims])

Record this expression as a named deterministic model variable.

SoftPlusHSGPTerm.register_data(ds)

Register the numeric time index as pmd.Data and freeze X_mid.

SoftPlusHSGPTerm.set_data(ds[, model])

Update the shared time index for out-of-sample prediction.

SoftPlusHSGPTerm.sum(dim)

Sum this expression over one named dimension.

SoftPlusHSGPTerm.to_dict([_orig])

Attributes