How exactly should this “max_n_steps” be specified?
I got the same TruncationError using HurdleNegativeBinomial. It didn’t work if I just passed it to HurdleNegativeBinomial.
It seems only pm.Truncated explicitly has ‘max_n_steps’ in it, and so when I followed the code of _hurdle_mixture and tried the following which worked, I didn’t feel surprised. But I presume there must be an easier way to pass the ‘max_n_steps’ parameter?
Btw, on one hand, HurdleNB provides more accurate estimation in one specific application I am working with, but painfully it comes with the slowness issue as in " Optimization Warning: The Op betainc does not provide a C implementation. As well as being potentially slow, this also disables loop fusion". Is there any thing I do about it?
nonzero_p = .1
with pm.Model():
nonzero_p = pt.as_tensor_variable(nonzero_p)
weights = pt.stack([1 - nonzero_p, nonzero_p], axis=-1)
comp_dists = [
pm.DiracDelta.dist(0),
pm.Truncated.dist(pm.NegativeBinomial.dist(p=1-6*1e-5, n=4000), lower=1, max_n_steps=10000),
]
pm.Mixture('ads', weights, comp_dists)
prior = pm.sample_prior_predictive(samples=1000)