While fitting the pymc model I am getting a convergence error. Every time I add or remove features to be considered in the model, it throws me the same error. any idea on how can I resolve this in an efficient way?
Hi YT, low effective sample size can arise for a variety of reasons. It will take a more thorough exploration of your model to identify the root cause. But I’ll say a bit about how to interpret the diagnostic and directions you might take.
Low effective sample size is a metric that indicates how many “useful” samples you are getting out the NUTS algorithm. When a posterior distribution is easy to explore, the sampler can easily jump across the distribution. Each new sample will be fairly independent of the sample that came before it. When a posterior is hard to explore, then the jumps are harder to make. Each sample will be correlated with the sample that came before. ESS uses the amount of autocorrelation in the location of the samples to estimate how many useful samples you have.
My first suggestion is to figure out which parameters are hard to sample. If you take the InferenceData object generated by the function you posted and pass it to arviz.summary(), it will give you a report like this:
ess_bulk and ess_tail are the effective sample size metrics. As you can see, some of my parameters are hard to sample from. The saturation point in channel 2 only has a 166 samples. But the saturation point in channel 1 has 1000 samples.
At this point, I would think about what’s weird about channel 2. There is no universal path to follow. Exploratory data visualization can be really helpful here.
In my case, the marketing activity on channel 2 always surpasses its own saturation point. So it’s hard to identify a unique saturation point and that interferes with my ability to identify other parameters. So in my case, it’s a data issue and not a modeling issue.