[Numpy-discussion] categorical distributions
Tue Nov 23 02:14:14 CST 2010
> Can you compare the speed of your cython solution with the version of Chuck
For multiple samples of the same distribution, it would do more or less
the same as the "searchsorted" method, so I don't expect any improvement
(except for being easier to find).
For multiple samples of different distributions, my version is 4-5x
faster than "searchsorted(random())". This is without normalizing the
probability vector, which means that you typically don't have to sum up
the whole vector (and store all the intermediate sums).
More information about the NumPy-Discussion