BaseDelayedSaturatedMMM#
- class pymc_marketing.mmm.delayed_saturated_mmm.BaseDelayedSaturatedMMM(date_column, channel_columns, adstock_max_lag, time_varying_intercept=False, 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 model errors posterior distribution.
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.
Plot model errors by taking the difference between true values and predicted.
BaseDelayedSaturatedMMM.plot_grouped_contribution_breakdown_over_time([...])Plot a time series area chart for all channel contributions.
Plot posterior distribution from the model fit.
- 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
Xdefault_model_configReturns 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_configReturns 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_resultidGenerate a unique hash value for the model.
methodsoutput_varDefines target variable for the model
posterior_predictivepreprocessing_methodsA property that provides preprocessing methods for features ("X") and the target variable ("y").
priorprior_predictivevalidation_methodsA property that provides validation methods for features ("X") and the target variable ("y").
versionymodeldate_columnchannel_columns