I understand that strictly on concept, they are different. But in a single trial (or experiment) for numpy.random.multinomial
, is it sampling the same way as numpy.random.choice
though giving a different view of the output?
For example:
>> np.random.choice(6, size=6, replace=True, p=[1/6.]*6)
>> array([2, 0, 4, 2, 5, 4])
Output gives the identity of what was picked in the array [0,1,2,3,4,5]
and
>> np.random.multinomial(1, [1/6.]*6, size=6)
>> array([[0, 0, 1, 0, 0, 0],
[0, 0, 0, 0, 0, 1],
[0, 0, 0, 1, 0, 0],
[0, 0, 0, 1, 0, 0],
[0, 0, 0, 0, 1, 0],
[1, 0, 0, 0, 0, 0]])
Output gives the number of times each choice was picked, but since it was limited to 1 trial, it can also be summarized as [2,5,3,3,4,1]
from choices [0,1,2,3,4,5]
Aucun commentaire:
Enregistrer un commentaire