Questions tagged [multinomial]

The multinomial distribution provides a probability distribution over three or more possible outcomes. It generalizes the more fundamental binomial distribution (two outcomes).

In probability theory, the multinomial distribution generalizes the binomial distribution to three or more outcomes.

Suppose two chess players had played numerous games, from which we estimate that Player A would win with probability 0.40, Player B would win with probability 0.35, and the probability that the game ends in a draw is 0.25. The multinomial distribution can be used to answer questions like:

  1. If these two chess players played 12 games, what is the expected number of wins, losses, and draws for player A?
  2. If these two chess players play 3 games, what is the probability that A wins one, B, wins one, and they draw on the other?

Binary classification/prediction methods (such as logistic regression) can also be generalized for multinomial outcomes (i.e., three or more class labels). Multinomial logistic regression is also sometimes called a maximum entropy (MaxEnt) model.

421 questions
4
votes
1 answer

How to write a custom function for extracting predictions from `effects::Effect()`

I want to write a function that takes in data and runs a multinomial regression (using nnet::multinom), then extracts a focal prediction (using Effects::effect). While I'm able to get it done with regular code, a custom function fails. Example …
Emman
  • 3,695
  • 2
  • 20
  • 44
4
votes
1 answer

Tensorflow: Efficient multinomial sampling (Theano x50 faster?)

I want to be able to sample from a multinomial distribution very efficiently and apparently my TensorFlow code is very... very slow... The idea is that, I have: A vector: counts = [40, 50, 26, ..., 19] for example A matrix of probabilities: probs =…
priseJack
  • 396
  • 2
  • 14
4
votes
2 answers

Is numpy.random.choice with replacement equivalent to multinomial sampling for a single trial?

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: >>…
kentwait
  • 1,969
  • 2
  • 21
  • 42
4
votes
1 answer

MultinomialNB - Theory vs practice

OK so I'm just studying Andrew Ng's Machine Learning course. I'm currently reading this chapter and want to try the Multinomial Naive Bayes (bottom of page 12) for myself using SKLearn and Python. So Andrew proposes a method, in which each email in…
lte__
  • 7,175
  • 25
  • 74
  • 131
4
votes
0 answers

Constrained multinomial logistic regression in R using mlogit

I would like to add some constraints to a multinomial logistic regression model using mlogit in R. For example only look for negative values during coefficient estimation. But apparently the model doesn't have such capabilities. I was wondering if…
Frank
  • 41
  • 2
4
votes
1 answer

Extracting coefficients of multinomial cv.glmnet

How do you extract the coefficients corresponding to a specific lambda of a cv.glmnet object built on a multinomial model? When I try to do it using the syntax one might use for a binomial model, the coef function returns a list of coefficient…
ostrichgroomer
  • 344
  • 3
  • 11
4
votes
0 answers

Predicted probability from multinomial logistic with clustered standard errors

I would like to get the predicted values (with confidence intervals) for a multinomial logistic regression. I know this could be done with predict but in my case I have clustered standard errors in the following way: multinom <- mlogit(Y ~0| X1+ X2…
user2246905
  • 1,029
  • 1
  • 12
  • 31
4
votes
2 answers

Cannot handle multi-valued nominal class - JAVA

I'm trying to pass a .arff file to LinearRegression object and while doing so it gives me this exception Cannot handle multi-valued nominal class!. What actually happening is i'm performing Attribute selection using CFSSubsetEval evaluater and…
Sashi
  • 533
  • 3
  • 6
  • 21
4
votes
1 answer

Dirichlet-Multinomial WinBUGS code

I'm trying to code a dirichlet-multinomial model using BUGS. Basically I have 18 regions and 3 categories per region. In example, Region 1: 0.50 belongs to Low, 0.30 belongs to Middle, and 0.20 belongs to High. The list goes on to Region 18 of…
user3764358
  • 41
  • 1
  • 2
4
votes
1 answer

'Leading minor of order % is not positive definite' error in MICE

When running mice in R with a rather large set of data (30 categorical predictors and predicted variables, n = 1000), I get the following error: Error in chol.default(fit.sum$cov.unscaled) : the leading minor of order 17 is not positive definite I…
tomka
  • 2,516
  • 7
  • 31
  • 45
3
votes
2 answers

Sample multinomial distribution from the log-probabilities

I have three numbers: lp_1 <- -316480 lp_2 <- -85041 lp_3 <- -1197042 The goal is to sample a multinomial distribution with probabilities proportional to the exp(lp_i). With these numbers, one gets 0 if one takes the exponential, and even if we set…
Stéphane Laurent
  • 75,186
  • 15
  • 119
  • 225
3
votes
1 answer

Redefining R's nnet::multinom predict.multinom predict method to support type="link"

I would like to have R's nnet::multinom function being supported by the new marginaleffects package, but marginaleffects::predictions() relies on the predict() methods supplied by the modeling packages to compute predicted values on both the…
Tom Wenseleers
  • 7,535
  • 7
  • 63
  • 103
3
votes
2 answers

broom::tidy fails on multinomial regression

I'm trying to run a multinomial logistic regression in R using tidymodels but I can't convert my results to a tidy object. Here's a sample using the iris data set. # Multinomial ----------------------------------------------------------------- #…
kaseyzapatka
  • 149
  • 2
  • 9
3
votes
2 answers

Sampling from a discrete distribution in Julia

I would like to repeatedly sample from a discrete distribution so as to get a single number. The following is some code implementing what I am looking for: const probabilities = [0.3, 0.3, 0.2, 0.15, 0.05] const cummulative_probabilities =…
Tarik
  • 10,810
  • 2
  • 26
  • 40
3
votes
0 answers

How to appropriately predict/classify using smf.mnlogit.predict()?

I'm curious if someone can help me understand an effective way of getting a single vector of predictions using .predict() for the multinomial logistic regression using statsmodels.formula.api.mnlogit() import pandas as pd, statsmodels.formula.api as…
1 2
3
27 28