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
657 stars 183 forks source link

plot_posterior_predictive(original_scale=True) DTypePromotionError #976

Open patrickgamer opened 4 weeks ago

patrickgamer commented 4 weeks ago

I'm successfully running MMM.sample_posterior_predictive(X, extend_idata=True) but when I call plot_posterior_predictive(original_scale=True) I get a type error:

DTypePromotionError: The DType <class 'numpy.dtypes.DateTime64DType'> could not be promoted by <class 'numpy.dtypes.Float64DType'>. This means that no common DType exists for the given inputs. For example they cannot be stored in a single array unless the dtype isobject. The full list of DTypes is: (<class 'numpy.dtypes.DateTime64DType'>, <class 'numpy.dtypes.Float64DType'>)

Basically it appears that MMM is trying to combine my 'Date' data with my Y values. It's weird b/c I would expect if there was any misunderstanding about how the Date column was being used, it'd appear in the sampling. However sampling appears to run just fine.

My guess (I'm pretty new to pymc) is that there is a problem specifically within plotting feature where it's not handling default date column properly.

PyMC version: 5.15.1 PyMC Marketing version: 0.8.0

juanitorduz commented 3 weeks ago

Thanks, @patrickgamer. Could you please provide us with a minimal reproducible example where we can see this error? This will help us find the issue. Thanks!