pymc-marketing
pymc-marketing copied to clipboard
Add `log-likelihood` Attribute to fitted `InferenceData` object
The Widely Available Information Criterion (WAIC) is a useful model comparison metric:
https://python.arviz.org/en/stable/api/generated/arviz.waic.html
However, the InferenceData object returned from CLV and MMM models do not contain the required log-likelihood group.
For MCMC fits this can be done via sample_config:
mcmc_fit = ParetoNBDModel(df,sampler_config = {"idata_kwargs": {"log_likelihood": True}})
WAIC doesn't really apply for MAP fits though.
We can call pm.compute_log_likelihood for methods that need this quantity when it's missing?
https://www.pymc.io/projects/docs/en/latest/api/generated/pymc.compute_log_likelihood.html#pymc.compute_log_likelihood
The critical thing is we need to add Potentials manually to var_names. This means this venue is actually the best because the default through the idata_kwargs doesn't allow you to specify it AFAIK
Actually that method checks the variable is an observed_RV, we should lift the restriction to allow Potentials as well. The value transform logic in that method can also be removed in favor of https://www.pymc.io/projects/docs/en/latest/api/model/generated/pymc.model.transform.conditioning.remove_value_transforms.html
BetaGeoModel is currently using a Potential, which precludes the use of an important evaluation function. If this were implemented along with a data simulation method, I wonder if it would be more performant than the external distribution block approach used in ParetoNBDModel.
I wonder if it would be more performant than the external distribution block approach used in ParetoNBDModel.
That shouldn't matter
Could be good with #742