[sampling] Explanation of sample_from_categorical
cyrilou242 opened this issue · comments
Hello, I am trying to understand your implementation.
In sample_from_output
, you use the function sample_from_categorical
to get the mixture component normal distribution you will sample from after.
It is commented:
# Alternative way to sample from categorical:
# m = np.random.choice(range(len(pis)), p=pis)
Do you have any reason for using your function sample_from_categorical
instead of numpy's one ?
I would prefer to use the numpy function, rather than sample_from_categorical
, but, if I remember correctly, the numpy one seemed to fail ungracefully for some badly generated input.
So - I ended up sticking to the sample_from_categorical, which I think is borrowed from hardmaru's MDN implementations (e.g., SketchRNN).
What do you think? I'd prefer not to reimplement something that should be fairly straightforward.
That makes sense, thanks.