pymc-labs / pymc-marketing

Bayesian marketing toolbox in PyMC. Media Mix (MMM), customer lifetime value (CLV), buy-till-you-die (BTYD) models and more.
https://www.pymc-marketing.io/
Apache License 2.0
718 stars 203 forks source link

Raise Exception when `GammaGammaModel` does not converge properly #594

Open ColtAllen opened 8 months ago

ColtAllen commented 8 months ago

If a fitted GammaGammaModel has a q parameter less than 1, all predicted spend values will be negative. This usually happens when the model is fit to heavy-tailed monetary value arrays with values in the millions.

We should add a check for this raising the following exception:

ValueError: Model did not converge properly. Scale monetary_value array by maximum value and refit model.

ricardoV94 commented 8 months ago

I don't think we should raise after fitting. It's fine to have q < 1, except some expectation methods fail then (but not distributional methods for instance). We should warn/raise only on the specific methods where q < 1 is problematic.