Re: [R] Softmax in nnet

From: G Ilhamto <gilhamto_at_gmail.com>
Date: Thu, 06 Mar 2008 11:05:09 -0500

(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
>



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. Received on Thu 06 Mar 2008 - 16:10:14 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 06 Mar 2008 - 17:30:20 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive