BaseMMM#
- class pymc_marketing.mmm.base.BaseMMM(date_column, channel_columns, model_config=None, sampler_config=None, **kwargs)[source]#
Methods
BaseMMM.__init__
(date_column, channel_columns)Initializes model configuration and sampler configuration for the model
BaseMMM.build_model
(X, y, **kwargs)Creates an instance of pm.Model based on provided data and model_config, and attaches it to self.
- rtype:
DataArray
BaseMMM.compute_channel_curve_optimization_parameters_original_scale
([...])Experimental: Estimate the parameters for the saturating function of each channel's contribution.
Get the contributions of each channel over time.
BaseMMM.fit
(X[, y, progressbar, ...])Fit a model using the data passed as a parameter.
BaseMMM.get_params
([deep])Get all the model parameters needed to instantiate a copy of the model, not including training data.
- rtype:
Pipeline
BaseMMM.graphviz
(**kwargs)BaseMMM.load
(fname)Creates a ModelBuilder instance from a file, Loads inference data for the model.
BaseMMM.optimize_channel_budget_for_maximum_contribution
(...)Experimental: Optimize the allocation of a given total budget across multiple channels to maximize the expected contribution.
BaseMMM.plot_budget_scenearios
(*, base_data)Experimental: Plots the budget and contribution bars side by side for multiple scenarios.
- rtype:
Figure
BaseMMM.plot_channel_parameter
(param_name, ...)- rtype:
Figure
- rtype:
Figure
Plots the direct contribution curves for each marketing channel.
BaseMMM.plot_grouped_contribution_breakdown_over_time
([...])Plot a time series area chart for all channel contributions.
- rtype:
Figure
BaseMMM.plot_prior_predictive
([samples])- rtype:
Figure
This function creates a waterfall plot.
BaseMMM.predict
(X_pred[, extend_idata])Uses model to predict on unseen data and return point prediction of all the samples.
BaseMMM.predict_posterior
(X_pred[, ...])Generate posterior predictive samples on unseen data.
BaseMMM.predict_proba
(X_pred[, ...])Alias for
predict_posterior
, for consistency with scikit-learn probabilistic estimators.BaseMMM.preprocess
(target, data)Preprocess the provided data according to the specified target.
Sample from the model's posterior predictive distribution.
BaseMMM.sample_prior_predictive
(X_pred[, ...])Sample from the model's prior predictive distribution.
BaseMMM.save
(fname)Save the model's inference data to a file.
BaseMMM.set_idata_attrs
([idata])Set attributes on an InferenceData object.
BaseMMM.set_params
(**params)Set all the model parameters needed to instantiate the model, not including training data.
BaseMMM.validate
(target, data)Validates the input data based on the specified target type.
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