Closed superbobry closed 8 years ago
Thank you for your contribution and introducing me to such an elegant algorithm!
Regarding the naming, you're correct. Feel free to file an issue or fix the incorrect usage in this PR. I'll merge this PR once a bit more testing on the 4.03 logic is complete (mostly just built systems checking).
I've also added a random test in this commit.
Although in general I am pretty loose about style guidelines, I've made a couple of comments that you can ignore for now and maybe take into account in the future.
Thanks for the review! I've addressed all of the comments and additionally renamed Multinomial to Categorical.
Unlike the previous cumsum implementation, the Alias method generates a value in constant time.
I also wanted to discuss the naming of
multinomial
. The sampling procedure looks like it samples from a discrete (aka Categorical) distribution.