MMM#

class pymc_marketing.mmm.base.MMM(date_column, channel_columns, model_config=None, sampler_config=None, **kwargs)[source]#

Methods

MMM.__init__(date_column, channel_columns[, ...])

Initializes model configuration and sampler configuration for the model

MMM.build_model(X, y, **kwargs)

Creates an instance of pm.Model based on provided data and model_config, and attaches it to self.

MMM.compute_channel_contribution_original_scale()

rtype:

DataArray

MMM.compute_channel_curve_optimization_parameters_original_scale([...])

Experimental: Estimate the parameters for the saturating function of each channel's contribution.

MMM.compute_mean_contributions_over_time([...])

Get the contributions of each channel over time.

MMM.fit(X[, y, progressbar, ...])

Fit a model using the data passed as a parameter.

MMM.get_params([deep])

Get all the model parameters needed to instantiate a copy of the model, not including training data.

MMM.get_target_transformer()

rtype:

Pipeline

MMM.graphviz(**kwargs)

MMM.load(fname)

Creates a ModelBuilder instance from a file, Loads inference data for the model.

MMM.optimize_channel_budget_for_maximum_contribution(...)

Experimental: Optimize the allocation of a given total budget across multiple channels to maximize the expected contribution.

MMM.plot_budget_scenearios(*, base_data[, ...])

Experimental: Plots the budget and contribution bars side by side for multiple scenarios.

MMM.plot_channel_contribution_share_hdi([...])

rtype:

Figure

MMM.plot_channel_parameter(param_name, ...)

rtype:

Figure

MMM.plot_components_contributions(**plt_kwargs)

rtype:

Figure

MMM.plot_direct_contribution_curves([...])

Plots the direct contribution curves for each marketing channel.

MMM.plot_grouped_contribution_breakdown_over_time([...])

Plot a time series area chart for all channel contributions.

MMM.plot_posterior_predictive([original_scale])

rtype:

Figure

MMM.plot_prior_predictive([samples])

rtype:

Figure

MMM.plot_waterfall_components_decomposition([...])

This function creates a waterfall plot.

MMM.predict(X_pred[, extend_idata])

Uses model to predict on unseen data and return point prediction of all the samples.

MMM.predict_posterior(X_pred[, ...])

Generate posterior predictive samples on unseen data.

MMM.predict_proba(X_pred[, extend_idata, ...])

Alias for predict_posterior, for consistency with scikit-learn probabilistic estimators.

MMM.preprocess(target, data)

Preprocess the provided data according to the specified target.

MMM.sample_posterior_predictive(X_pred[, ...])

Sample from the model's posterior predictive distribution.

MMM.sample_prior_predictive(X_pred[, ...])

Sample from the model's prior predictive distribution.

MMM.save(fname)

Save the model's inference data to a file.

MMM.set_idata_attrs([idata])

Set attributes on an InferenceData object.

MMM.set_params(**params)

Set all the model parameters needed to instantiate the model, not including training data.

MMM.validate(target, data)

Validates the input data based on the specified target type.

MMM.validate_channel_columns(data)

rtype:

None

MMM.validate_date_col(data)

rtype:

None

MMM.validate_target(data)

rtype:

None

Attributes

X

default_model_config

Returns a class default config dict for model builder if no model_config is provided on class initialization Useful for understanding structure of required model_config to allow its customization by users .

default_sampler_config

Returns a class default sampler dict for model builder if no sampler_config is provided on class initialization Useful for understanding structure of required sampler_config to allow its customization by users .

fit_result

id

Generate a unique hash value for the model.

methods

output_var

Returns the name of the output variable of the model.

posterior_predictive

preprocessing_methods

A property that provides preprocessing methods for features ("X") and the target variable ("y").

prior

prior_predictive

validation_methods

A property that provides validation methods for features ("X") and the target variable ("y").

version

y

model

date_column

channel_columns