3
votes

In other words, when I do nnet(...) I can use the size parameter to control the number of units in the hidden layer. My particular model requires outputting probabilities so I wanted logistic units and so I turned to multinom from the nnet package to output type='probs' in my predict function. How can I pass down a size argument? When I call it with, say, size=5 or something I get an error:

 formal argument "size" matched by multiple actual arguments
1
nnet Error: object 'nnet' not found - IRTFM
multinom appears to have hard coded size = 0 in its calls to nnet.default. I suspect there's a mathematical reason for this, but don't feel comfortable speculating further. - joran
library('nnet')..also, yes it seems to be size=0 which sounds like it's identical to just logistic regression! - Palace Chan
@PalaceChan: the difference is that multinom can handle factor responses with 3 or more levels, while logistic regression (as implemented in glm) is for binary responses only. - Hong Ooi

1 Answers

5
votes

multinom fits linear multinomial logistic models, which is why the size parameter is hardcoded to 0. If you want an actual neural network with multinomial outputs, just use nnet with a response with more than 2 levels, and set softmax=TRUE.