multinomial

problem with np.random.multinomial and size option in python

problem with np.random.multinomial and size option in python Question: My problem is the following: I have N people choosing between three objects [1,2,3] with probabilities [p_1,p_2,p_3] such that p_1+p_2+p_3=1. Let’s call X_1,X_2,X_3 the counts of the chosen objects in one sample among the N people (then, for example, X_1 is the number of people choosing …

Total answers: 1

Functionally is torch.multinomial the same as torch.distributions.categorical.Categorical?

Functionally is torch.multinomial the same as torch.distributions.categorical.Categorical? Question: For example, if I provide a probability array of [0.5, 0.5], both functions will sample the index [0,1] with equal probability? Asked By: Mzq || Source Answers: Yes: [torch.distributions.categorical.Categorical()] is equivalent to the distribution that torch.multinomial() samples from. https://pytorch.org/docs/stable/distributions.html#categorical Answered By: iacob

Total answers: 1