BaseDelayedSaturatedMMM#
- class pymc_marketing.mmm.delayed_saturated_mmm.BaseDelayedSaturatedMMM(date_column, channel_columns, adstock_max_lag, model_config=None, sampler_config=None, validate_data=True, control_columns=None, yearly_seasonality=None, **kwargs)[source]#
Base class for a media mix model with delayed adstock and logistic saturation class (see [1]).
References
Methods
BaseDelayedSaturatedMMM.__init__
(...[, ...])Constructor method.
BaseDelayedSaturatedMMM.build_model
(X, y, ...)Builds a probabilistic model using PyMC for marketing mix modeling.
BaseDelayedSaturatedMMM.channel_contributions_forward_pass
(...)Evaluate the channel contribution for a given channel data and a fitted model, ie.
BaseDelayedSaturatedMMM.compute_channel_contribution_original_scale
()- rtype:
DataArray
BaseDelayedSaturatedMMM.compute_channel_curve_optimization_parameters_original_scale
([...])Experimental: Estimate the parameters for the saturating function of each channel's contribution.
BaseDelayedSaturatedMMM.compute_mean_contributions_over_time
([...])Get the contributions of each channel over time.
BaseDelayedSaturatedMMM.fit
(X[, y, ...])Fit a model using the data passed as a parameter.
Get all the model parameters needed to instantiate a copy of the model, not including training data.
- rtype:
Pipeline
BaseDelayedSaturatedMMM.graphviz
(**kwargs)BaseDelayedSaturatedMMM.load
(fname)Creates a DelayedSaturatedMMM instance from a file, instantiating the model with the saved original input parameters.
BaseDelayedSaturatedMMM.optimize_channel_budget_for_maximum_contribution
(...)Experimental: Optimize the allocation of a given total budget across multiple channels to maximize the expected contribution.
Experimental: Plots the budget and contribution bars side by side for multiple scenarios.
BaseDelayedSaturatedMMM.plot_channel_contribution_share_hdi
([...])- rtype:
Figure
- rtype:
Figure
- rtype:
Figure
BaseDelayedSaturatedMMM.plot_direct_contribution_curves
([...])Plots the direct contribution curves for each marketing channel.
BaseDelayedSaturatedMMM.plot_grouped_contribution_breakdown_over_time
([...])Plot a time series area chart for all channel contributions.
- rtype:
Figure
- rtype:
Figure
BaseDelayedSaturatedMMM.plot_waterfall_components_decomposition
([...])This function creates a waterfall plot.
BaseDelayedSaturatedMMM.predict
(X_pred[, ...])Uses model to predict on unseen data and return point prediction of all the samples.
Generate posterior predictive samples on unseen data.
Alias for
predict_posterior
, for consistency with scikit-learn probabilistic estimators.BaseDelayedSaturatedMMM.preprocess
(target, data)Preprocess the provided data according to the specified target.
Sample from the model's posterior predictive distribution.
Sample from the model's prior predictive distribution.
BaseDelayedSaturatedMMM.save
(fname)Save the model's inference data to a file.
Set attributes on an InferenceData object.
BaseDelayedSaturatedMMM.set_params
(**params)Set all the model parameters needed to instantiate the model, not including training data.
BaseDelayedSaturatedMMM.validate
(target, data)Validates the input data based on the specified target type.
- rtype:
None
- rtype:
None
- 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
Defines target variable for 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