ModelFitter#

class pymc_marketing.model_builder.ModelFitter[source]#

Mixin providing a unified fitting API for all PyMC-Marketing models.

Owns the whole fit pipeline: model preparation, sampler dispatch, deterministic recomputation, idata merging, and the fit_data group. Subclasses customize behaviour through the hooks below rather than by reimplementing fit().

Examples

class MyModel(ModelBuilder): ...

model = MyModel()
idata = model.fit(data, method="mcmc")

Methods

ModelFitter.__init__(*args, **kwargs)

ModelFitter.create_fit_data_group()

Build the fit_data group stored alongside the posterior.

ModelFitter.fit([data, method, progressbar, ...])

Infer the model posterior.

ModelFitter.post_sample_model_transformation()

Perform transformation on the model after sampling.

Attributes

model

idata

sampler_config

is_fitted_