When I use np.random.multinomial using the following commands (according to page 79-80 of d2l book)
%matplotlib inline
import d2l
from mxnet import np, npx
import random
npx.set_np()
fair_probs = [1.0/6]*6
np.random.multinomial(1000, fair_probs)
output is
array([ 0, 0, 0, 0, 0, 1000], dtype=int64)
Any idea why is it giving this answer. I was expecting more randomly distributed. Every time, I issue this command, the same output pops up.
vaidyanathanms:
import d2l
from mxnet import np, npx
import random
npx.set_np()
fair_probs = [1.0/6]*6
np.random.multinomial(1000, fair_probs)
Hi @vaidyanathanms , I tried to reproduce your error while it returns me:
array([160, 146, 183, 171, 164, 176], dtype=int64)
Can you check what are the versions of d2l and mxnet you are using?
2 Likes
Hi, I am not sure how to check the d2l and mxnet versions. Is there a command that I can use?
1 Like
Hi @vaidyanathanms , try this:
pip list
1 Like
Hi @gold_piggy ,
d2l version: 0.11.3
mxnet version: 1.6.0b20191125
Please let me know if you need any other details. I am on Windows 10 system
1 Like
hi how to do it on win 7?
Zane
March 17, 2020, 8:31am
7
Hi @vaidyanathanms @gold_piggy , I came across the same issue as the poster.
My mxnet version is 1.6.0 and that of d2l is 0.11.4
However when I run numpy.random.multinomial(1000, fair_probs)
, the result is randomly distributed.
But I’m wondering if there is a way to fix the original code? I’m afraid that this may affect other parts of the book.