Re: [R] how to get actual value from predict in nnet?

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Thu 28 Jul 2005 - 15:41:57 EST

Ask predict.nnet for a type other than "class", as described on its help page.

Please do read the help pages for yourself (as the posting guide asks).

On Wed, 27 Jul 2005, Baoqiang Cao wrote:

> Dear All,
>
> After followed the help of nnet, I could get the networks trained and,
> excitedly, get the prediction for other samples. It is a two classes
> data set, I used "N" and "P" to label the two. My question is, how do I
> get the predicted numerical value for each sample? Not just give me the
> label(either "N" or "P")? Thanks!
>
> FYI: The nnet example I followed from help document is,
> ird <- data.frame(rbind(iris3[,,1], iris3[,,2], iris3[,,3]),
> species = c(rep("s",50), rep("c", 50), rep("v", 50)))
> ir.nn2 <- nnet(species ~ ., data = ird, subset = samp, size = 2, rang = 0.1,
> decay = 5e-4, maxit = 200)
> table(ird$species[-samp], predict(ir.nn2, ird[-samp,], type = "class"))

-- 
Brian D. Ripley,                  ripley@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

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Thu Jul 28 15:47:17 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:34:06 EST