找回密码
 注册
查看: 3610|回复: 0

R语言:predict.nnet()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-2-16 19:02:24 | 显示全部楼层 |阅读模式
predict.nnet(nnet)
predict.nnet()所属R语言包:nnet

                                         Predict New Examples by a Trained Neural Net
                                         由受过训练的神经网络预测新的例子

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

Predict new examples by a trained neural net.
由受过训练的神经网络预测新的例子。


用法----------Usage----------


## S3 method for class 'nnet'
predict(object, newdata, type = c("raw","class"), ...)



参数----------Arguments----------

参数:object
an object of class nnet as  returned by nnet.  
类对象nnet返回nnet的。


参数:newdata
matrix or data frame of test examples. A vector is considered to be a row vector comprising a single case.  
矩阵或数据框的测试例子。一个向量被认为是一个行向量组成一情况例。


参数:type
Type of output  
输出类型


参数:...
arguments passed to or from other methods.  </table>
参数传递或其他方法。 </ TABLE>


Details

详情----------Details----------

This function is a method for the generic function predict() for class "nnet". It can be invoked by calling predict(x) for an object x of the appropriate class, or directly by calling predict.nnet(x) regardless of the class of the object.
这个函数是一个泛型函数predict()类"nnet"方法。它可以通过调用调用predict(x)对象x适当的类,或直接致电predict.nnet(x)不管对象的类。


值----------Value----------

If type = "raw", the matrix of values returned by the trained network; if type = "class", the corresponding class (which is probably only useful if the net was generated by nnet.formula).
如果type = "raw",如果返回值由训练有素的网络矩阵;type = "class",对应的类(这可能是唯一有用的,如果净生成nnet.formula)。


参考文献----------References----------

Pattern Recognition and Neural Networks. Cambridge.
Modern Applied Statistics with S. Fourth edition.  Springer.

参见----------See Also----------

nnet, which.is.max
nnet,which.is.max


举例----------Examples----------


# use half the iris data[使用一半的虹膜数据]
ir <- rbind(iris3[,,1], iris3[,,2], iris3[,,3])
targets <- class.ind( c(rep("s", 50), rep("c", 50), rep("v", 50)) )
samp <- c(sample(1:50,25), sample(51:100,25), sample(101:150,25))
ir1 <- nnet(ir[samp,], targets[samp,],size = 2, rang = 0.1,
            decay = 5e-4, maxit = 200)
test.cl <- function(true, pred){
        true <- max.col(true)
        cres <- max.col(pred)
        table(true, cres)
}
test.cl(targets[-samp,], predict(ir1, ir[-samp,]))

# or[或]
ird <- data.frame(rbind(iris3[,,1], iris3[,,2], iris3[,,3]),
        species=factor(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"))

转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2025-5-5 01:49 , Processed in 0.026422 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表