RegressionModelBuilder#

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

ModelBuilder class providing an easy-to-use API similar to scikit-learn for regression models.

Training data is provided in the fit method and must follow the following convention: - X: Matrix containing predictor variables - y: Target variable array

Methods

RegressionModelBuilder.__init__([...])

Initialize model configuration and sampler configuration for the model.

RegressionModelBuilder.attrs_to_init_kwargs(attrs)

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

RegressionModelBuilder.build_from_idata(idata)

Build model from the InferenceData object.

RegressionModelBuilder.build_model(X, y, ...)

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

RegressionModelBuilder.create_fit_data(X, y)

Create the fit_data group based on the input data.

RegressionModelBuilder.create_idata_attrs()

Create attributes for the inference data.

RegressionModelBuilder.fit(X[, y, ...])

Fit a model using the data passed as a parameter.

RegressionModelBuilder.graphviz(**kwargs)

Get the graphviz representation of the model.

RegressionModelBuilder.idata_to_init_kwargs(idata)

Create the model configuration and sampler configuration from the InferenceData to keyword arguments.

RegressionModelBuilder.load(fname[, check])

Create a ModelBuilder instance from a file.

RegressionModelBuilder.load_from_idata(idata)

Create a ModelBuilder instance from an InferenceData object.

RegressionModelBuilder.post_sample_model_transformation()

Perform transformation on the model after sampling.

RegressionModelBuilder.predict([X, extend_idata])

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

RegressionModelBuilder.predict_posterior([...])

Generate posterior predictive samples on unseen data.

RegressionModelBuilder.predict_proba([X, ...])

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

RegressionModelBuilder.sample_posterior_predictive([...])

Sample from the model's posterior predictive distribution.

RegressionModelBuilder.sample_prior_predictive([...])

Sample from the model's prior predictive distribution.

RegressionModelBuilder.save(fname, **kwargs)

Save the model's inference data to a file.

RegressionModelBuilder.set_idata_attrs([idata])

Set attributes on an InferenceData object.

RegressionModelBuilder.table(...)

Get the summary table of the model.

Attributes

default_model_config

Return a class default configuration dictionary.

default_sampler_config

Return a class default sampler configuration dictionary.

fit_result

Get the posterior fit_result.

id

Generate a unique hash value for the model.

output_var

Returns the name of the output variable of the model.

posterior

posterior_predictive

predictions

prior

prior_predictive

version

idata

sampler_config

model_config