Open longouyang opened 8 years ago
followup: it seems to be much slower inside Infer
than repeat
Noah had a good hypothesis: it's actually the scorer that's slow (this seems likely, given that the scorer computes lnfact(n)
).
So maybe we could add an option to Binomial
that turns on Stirling's approximation for the scorer.
Is it slow inside rejection inference? The scorer shouldn't be used there.
It's fast inside rejection, so it does appear to be the scorer.
While working on the presidential election example for the PPAML summer course, I discovered that our binomial sampler is pretty slow for values like
n = 2400000, p = 0.5
We might try switching to something like Marsaglia 04: https://www.jstatsoft.org/article/view/v011b03/v11b03.pdf