data_vars#

pymc_marketing.terms.data_vars(param)[source]#

List the dataset variables a term tree reads, at any depth.

A term that reads shared data declares it through ModelTerm.data_vars (Dot declares the variable it wraps). This walks compositions and term wrappers such as Named and Transform, so a covariate nested inside a recipe is still found. Order is first-seen and names are unique.

Parameters:

param (Any) – The term tree to inspect.

Return type:

list[str]

Returns:

Names of the dataset variables the tree reads.

Examples

recipe = Parameter(
    "p_base", prior=Prior("Beta", alpha=1.5, beta=20)
) * Transform(Dot(var_name="market_size", prior=Prior("Normal")), ptx.math.exp)
data_vars(recipe)
# ['market_size']