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
Initialize model configuration and sampler configuration for the model.
RegressionModelBuilder.approximate_fit
(X[, ...])Fit a model using Variational Inference and return InferenceData.
Convert the model configuration and sampler configuration from the attributes to keyword arguments.
Build model from the InferenceData object.
RegressionModelBuilder.build_model
(X, y, ...)Create an instance of
pm.Model
based on provided data and model_config.Create the fit_data group based on the input data.
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.
Create the model configuration and sampler configuration from the InferenceData to keyword arguments.
RegressionModelBuilder.load
(fname[, check])Create a ModelBuilder instance from a file.
Create a ModelBuilder instance from an InferenceData object.
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.
Generate posterior predictive samples on unseen data.
RegressionModelBuilder.predict_proba
([X, ...])Alias for
predict_posterior
, for consistency with scikit-learn probabilistic estimators.Sample from the model's posterior predictive distribution.
Sample from the model's prior predictive distribution.
RegressionModelBuilder.save
(fname, **kwargs)Save the model's inference data to a file.
Set attributes on an InferenceData object.
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