Python | Numpy np.multinomial() method
With the help of np.multinomial()
method, we can get the array of multinomial distribution by using np.multinomial()
method.
Syntax : np.multinomial(n, nval, size)
Return : Return the array of multinomial distribution.
Example #1 :
In this example we can see that by using np.multinomial()
method, we are able to get the multinomial distribution array using this method.
import numpy as np
gfg = np.random.multinomial( 8 , [ 0.1 , 0.22 , 0.333 , 0.4444 ], 2 )
print (gfg)
|
Output :
[[1 4 2 1]
[0 0 3 5]]
Example #2 :
import numpy as np
gfg = np.random.multinomial( 12 , [ 0.1 , 0.12 , 0.123 , 0.1234 , 0.12345 ], 3 )
print (gfg)
|
Output :
[[2 0 1 1 8]
[0 1 1 1 9]
[1 1 1 0 9]]
Last Updated :
13 Oct, 2019
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...