The VoseAliasSampling implementation migrated from the older PathPy versions does as far as I am aware the same thing as torch.multinomial or np.random.choice. Both are an order of magnitude faster for large values and similarly fast for one sample. The following MWE shows this:
Although there is a small runtime benefit for single samples, I propose to remove this class altogether in favor of using torch.multinomial, since our goal is to speed up the code that would be using this sampler with torch anyway.
The
VoseAliasSampling
implementation migrated from the older PathPy versions does as far as I am aware the same thing astorch.multinomial
ornp.random.choice
. Both are an order of magnitude faster for large values and similarly fast for one sample. The following MWE shows this:Using the Jupyter cell magic
%timeit
, we get the following runtimes for each of them:Although there is a small runtime benefit for single samples, I propose to remove this class altogether in favor of using
torch.multinomial
, since our goal is to speed up the code that would be using this sampler withtorch
anyway.