لَآ إِلَـٰهَ إِلَّا هُوَ
LA ILAHA ILLA HU
Allah, Your Lord There Is No Deity Except Him.

Python Data Science NumPy Random Multinomial Data Distribution

Multinomial Distribution: Multinomial distribution is a generalization of binomial distribution.

It describes outcomes of multi-nomial scenarios unlike binomial where scenarios must be only one of two. e.g. Blood type of a population, dice roll outcome.

It has the following three parameters.

1. n - number of possible outcomes (e.g. 6 for dice roll).

2. pvals - list of probabilties of outcomes (e.g. [1/6, 1/6, 1/6, 1/6, 1/6, 1/6] for dice roll).

3. size - The shape of the returned array.

Example 1: Draw out a sample for dice roll

Example 1.

Code

from numpy import random

x = random.multinomial(n=6, pvals=[1/6, 1/6, 1/6, 1/6, 1/6, 1/6])

print(x)

the output will be

[0 0 3 1 1 1]

Note: Multinomial samples will NOT produce a single value! They will produce one value for each pval.