Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement faster Multinomial JAX dispatch #868

Closed
ricardoV94 opened this issue Jun 28, 2024 · 0 comments · Fixed by #1316
Closed

Implement faster Multinomial JAX dispatch #868

ricardoV94 opened this issue Jun 28, 2024 · 0 comments · Fixed by #1316
Labels

Comments

@ricardoV94
Copy link
Member

ricardoV94 commented Jun 28, 2024

Description

We are defaulting to the numpyro implementation when that's installed, but the numpyro implementation is incredibly wasteful for large N, as it consists of doing n Categorical draws and summing up the values.

https://github.com/pyro-ppl/numpyro/blob/5af9ebda72bd7aeb08c61e4248ecd0d982473224/numpyro/distributions/util.py#L238

We should probably do sequential Binomial sampling: https://en.wikipedia.org/wiki/Multinomial_distribution#Algorithm:_Sequential_conditional_binomial_sampling

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant