[R] Softmax in nnet

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Feb 15 15:48:40 CET 2008


Looks like you meant to use 'TRUE' not 'T'.  The latter is probably a 
variable you defined of length > 1.

Double-posting at least halves your chances of getting help, so please 
stop doing it.

On Fri, 15 Feb 2008, G Ilhamto wrote:

> Hi R help,
>
> I run my data in nnet with skip layer, factor response (with 0 & 1
> values) and explicitly put softmax=T to compare the result of the
> default nnet with no softmax specification. I assume this should give
> me the same result. I got the result the default one, but not the
> softmax version and I got the error message that I did not quite
> understand.
>
> test6.nn.skipT.softm.Yfac <- nnet(Yfac~ X1 +.. +X8, skip=T, size=0,
> softmax=T, data = train.set)
>
> Error in nnet.default(x, y, w, entropy = TRUE, ...) : no weights to fit
>
> In addition: Warning messages:
> 1: In if (softmax) { :  the condition has length > 1 and only the
> first element will be used
> 2: In if (skip) net <- add.net(net, seq(1, net$n[1]), seq(1 + net$n[1] +  :
>  the condition has length > 1 and only the first element will be used
>
> When I specify the weights (0.1 just for a try)
> test6.nn.skipT.softm.Yfac <- nnet(Yfac~ X1 +.. +X8, skip=T, size=0,
> weights= 0.1, softmax=T, data = train.set)
>
> I got another error message:
> Error in model.frame.default(formula = Yfac ~ HusYEduc + AgeRespd +
> muslimat +  :
> variable lengths differ (found for '(weights)')
> -----------------
>
> Q: Does softmax apply to two-category response?
>     What is softmax require?
>
> Thank you,
> Ilham
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list