ModelBuilder#

class pymc_marketing.model_builder.ModelBuilder(model_config=None, sampler_config=None)[source]#

Base class for building models with PyMC Marketing.

It provides an easy-to-use API (similar to scikit-learn) for models and help with deployment.

Methods

ModelBuilder.__init__([model_config, ...])

Initialize model configuration and sampler configuration for the model.

ModelBuilder.attrs_to_init_kwargs(attrs)

Convert the model configuration and sampler configuration from the attributes to keyword arguments.

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

Create an instance of pm.Model based on provided data and model_config.

ModelBuilder.create_idata_attrs()

Create attributes for the inference data.

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

Fit a model using the data passed as a parameter.

ModelBuilder.get_params([deep])

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

ModelBuilder.load(fname)

Create a ModelBuilder instance from a file.

ModelBuilder.predict(X_pred[, extend_idata])

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

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

Generate posterior predictive samples on unseen data.

ModelBuilder.predict_proba(X_pred[, ...])

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

ModelBuilder.sample_posterior_predictive(X_pred)

Sample from the model's posterior predictive distribution.

ModelBuilder.sample_prior_predictive(X_pred)

Sample from the model's prior predictive distribution.

ModelBuilder.save(fname)

Save the model's inference data to a file.

ModelBuilder.set_idata_attrs([idata])

Set attributes on an InferenceData object.

ModelBuilder.set_params(**params)

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

Attributes

X

default_model_config

Return a class default configuration dictionary.

default_sampler_config

Return a class default sampler configuration dictionary.

id

Generate a unique hash value for the model.

output_var

Returns the name of the output variable of the model.

version

y