Poisson distribution sparse example

Hi NumPyro, I was wondering if anyone has an example on how to use the Poisson distribution with is_sparse=True?

Hi @peter, the usage and behavior of Poisson is the same for both values of is_sparse. The flag merely toggles an internal computation, using a dense computation when is_sparse=False, and using an equivalent computation when is_sparse=True, but where the latter can be slightly cheaper when much of the observed count tensor is zero. We do the same thing in dist.DirichletMultinomial, but there the cost savings is more significant.

1 Like

@fritzo Thank you for that reference. I created a small PR to add that information to the NumPyro Poisson distribution documentation: Document Poisson is_sparse by peterroelants · Pull Request #1139 · pyro-ppl/numpyro · GitHub