BaseGammaGammaModel#

class pymc_marketing.clv.models.gamma_gamma.BaseGammaGammaModel(data, *, model_config=None, sampler_config=None, non_distributions=None)[source]#

Base class for Gamma-Gamma models.

Methods

BaseGammaGammaModel.__init__(data, *[, ...])

Initialize model configuration and sampler configuration for the model.

BaseGammaGammaModel.attrs_to_init_kwargs(attrs)

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

BaseGammaGammaModel.build_from_idata(idata)

Build model from the InferenceData object.

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

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

BaseGammaGammaModel.create_fit_data(X, y)

Create the fit_data group based on the input data.

BaseGammaGammaModel.create_idata_attrs()

Create attributes for the inference data.

BaseGammaGammaModel.distribution_customer_spend(data)

Posterior distribution of mean spend values for each customer.

BaseGammaGammaModel.distribution_new_customer_spend([...])

Posterior distribution of mean spend values for new customers.

BaseGammaGammaModel.expected_customer_lifetime_value(...)

Compute the average lifetime value for a group of one or more customers.

BaseGammaGammaModel.expected_customer_spend(data)

Compute the expected future mean spend value per customer.

BaseGammaGammaModel.expected_new_customer_spend()

Compute the expected mean spend value for a new customer.

BaseGammaGammaModel.fit([method, fit_method])

Infer model posterior.

BaseGammaGammaModel.fit_summary(**kwargs)

Compute the summary of the fit result.

BaseGammaGammaModel.graphviz(**kwargs)

Get the graphviz representation of the model.

BaseGammaGammaModel.load(fname)

Create a ModelBuilder instance from a file.

BaseGammaGammaModel.load_from_idata(idata)

Create a ModelBuilder instance from an InferenceData object.

BaseGammaGammaModel.post_sample_model_transformation()

Perform transformation on the model after sampling.

BaseGammaGammaModel.predict([X, extend_idata])

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

BaseGammaGammaModel.predict_posterior([X, ...])

Generate posterior predictive samples on unseen data.

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

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

BaseGammaGammaModel.sample_posterior_predictive([...])

Sample from the model's posterior predictive distribution.

BaseGammaGammaModel.sample_prior_predictive([...])

Sample from the model's prior predictive distribution.

BaseGammaGammaModel.save(fname)

Save the model's inference data to a file.

BaseGammaGammaModel.set_idata_attrs([idata])

Set attributes on an InferenceData object.

BaseGammaGammaModel.thin_fit_result(keep_every)

Return a copy of the model with a thinned fit result.

Attributes

X

default_model_config

Return a class default configuration dictionary.

default_sampler_config

Default sampler configuration.

fit_result

Get the posterior fit_result.

id

Generate a unique hash value for the model.

output_var

Output variable of the model.

posterior

posterior_predictive

predictions

prior

prior_predictive

version

y