[R] Softmax in nnet
G Ilhamto
gilhamto at gmail.com
Thu Mar 6 17:05:09 CET 2008
(this is a resend)
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 from 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
On 2/18/08, G Ilhamto <gilhamto at gmail.com> 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
>
More information about the R-help
mailing list