Using mxnet 1.6.0b20190926
on Windows (as recommended in D2L book) I am experiencing highly nonuniform samples from np.random.multinomial
from mxnet import np, npx
fair_probs = [1.0 / 6] * 6
np.random.multinomial(10, fair_probs, size=1)
Out[5]: array([[ 0, 0, 0, 0, 0, 10]], dtype=int64)
np.random.multinomial(100, fair_probs, size=1)
Out[6]: array([[ 0, 0, 0, 0, 0, 100]], dtype=int64)
np.random.multinomial(10000, fair_probs, size=1)
Out[7]: array([[ 0, 0, 0, 0, 0, 10000]], dtype=int64)
np.random.multinomial(10000, fair_probs, size=3)
Out[8]:
array([[ 0, 0, 0, 0, 0, 10000],
[ 1610, 0, 0, 0, 0, 8390],
[ 1684, 1710, 0, 0, 0, 6606]], dtype=int64)
Corresponding jupyter notebook gives the same result.
Note that the mxnet.ndarray.random.multinomial
version behaves as expected.
I’ve found slightly similar issue on GitHub: https://github.com/apache/incubator-mxnet/issues/15383. But it was closed on Jul 16.