BaseGammaGammaModel#
- class pymc_marketing.clv.models.gamma_gamma.BaseGammaGammaModel(data, *, model_config=None, sampler_config=None)[source]#
Methods
BaseGammaGammaModel.__init__(data, *[, ...])Initializes model configuration and sampler configuration for the model
BaseGammaGammaModel.build_model(X, y, **kwargs)Creates an instance of pm.Model based on provided data and model_config, and attaches it to self.
Posterior distribution of mean spend values for each customer.
Posterior distribution of mean spend values for new customers.
Compute the average lifetime value for a group of one or more customers, and apply a discount rate for net present value estimations.
Expected future mean spend value per customer.
Expected mean spend value for a new customer.
BaseGammaGammaModel.fit([fit_method])Infer model posterior
BaseGammaGammaModel.fit_summary(**kwargs)BaseGammaGammaModel.get_params([deep])Get all the model parameters needed to instantiate a copy of the model, not including training data.
BaseGammaGammaModel.load(fname)Creates a ModelBuilder instance from a file, Loads inference data for the model.
BaseGammaGammaModel.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.
BaseGammaGammaModel.predict_proba(X_pred[, ...])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.
BaseGammaGammaModel.save(fname)Save the model's inference data to a file.
BaseGammaGammaModel.set_idata_attrs([idata])Set attributes on an InferenceData object.
BaseGammaGammaModel.set_params(**params)Set all the model parameters needed to instantiate the model, not including training data.
BaseGammaGammaModel.thin_fit_result(keep_every)Return a copy of the model with a thinned fit result.
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 Examples -------- >>> @classmethod >>> def default_model_config(self): >>> Return { >>> 'a' : { >>> 'loc': 7, >>> 'scale' : 3 >>> }, >>> 'b' : { >>> 'loc': 3, >>> 'scale': 5 >>> } >>> 'obs_error': 2 >>> }
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 Examples -------- >>> @classmethod >>> def default_sampler_config(self): >>> Return { >>> 'draws': 1_000, >>> 'tune': 1_000, >>> 'chains': 1, >>> 'target_accept': 0.95, >>> }
fit_resultidGenerate a unique hash value for the model.
output_varReturns the name of the output variable of the model.
versiony