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

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

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

                                         Predictions from a Fitted Rpart Object
                                         预测从装软件rpart对象的

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

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

Returns a vector of predicted responses from a fitted rpart object.
返回装rpart对象的预测反应的向量。


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


## S3 method for class 'rpart'
predict(object, newdata = list(),
       type = c("vector", "prob", "class", "matrix"),
       na.action = na.pass, ...)



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

参数:object
fitted model object of class rpart.  This is assumed to be the result of some function that produces an object with the same named  components as that returned by the rpart function.   
拟合模型对象类rpart。这被认为是一些功能,产生一个具有相同的命名组件对象rpart函数返回的结果。


参数:newdata
data frame containing the values at which predictions are required.  The predictors referred to in the right side of formula(object) must be present by name in newdata. If missing, the fitted values are returned.   
数据框包含的预测值。简称在formula(object)的右侧的预测必须由名称,目前在newdata。如果丢失,返回拟合值。


参数:type
character string denoting the type of predicted value returned.  If the rpart object is a classification tree, then the default is to return prob predictions, a matrix whose columns are the probability of the first, second, etc. class.  (This agrees with the default behavior of tree).  Otherwise, a vector result is returned.  
表示预测值类型的字符串返回。如果rpart对象是分类树,则默认为返回prob预测,矩阵的列第一,第二,等类的概率。 (同意的tree的默认行为)。否则,一个向量,返回结果。


参数:na.action
a function to determine what should be done with missing values in newdata.  The default is to pass them down the tree using surrogates in the way selected when the model was built. Other possibilities are na.omit and na.fail.  
一个函数来确定应做与newdata缺失值。默认是通过他们在建模型时选择的方式,利用代理人的树。其他的可能性是na.omit和na.fail。


参数:...
further arguments passed to or from other methods.  
通过进一步的论据或其他方法。


Details

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

This function is a method for the generic function predict for class rpart. It can be invoked by calling predict for an object of the appropriate class, or directly by calling predict.rpart regardless of the class of the object.
此功能是一个泛型函数类rpart预测方法。它可以调用调用predict适当的类的对象,或直接通过调用predict.rpart不管对象的类。


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

A new object is obtained by dropping newdata down the object.  For factor predictors, if an observation contains a level not used to grow the tree, it is left at the deepest possible node and frame$yval at the node is the prediction.
下降newdata下来的对象得到一个新的对象。对于因素的预测,如果观察不包含用于种植树的水平,它留在最深的节点和frame$yval节点的预测。

If type="vector":<br> vector of predicted responses. For regression trees this is the mean response at the node, for Poisson trees it is the estimated response rate, and for classification trees it is the predicted class (as a number).
如果type="vector":参考矢量预测的反应。对于回归树,这是在节点的平均响应,泊松树,它是估计的响应速度,分类树,它是预测类(如数字)。

If type="prob":<br> (for a classification tree) a matrix of class probabilities.
如果type="prob":参考(分类树)一类概率矩阵。

If type="matrix":<br> a matrix of the full responses (frame$yval2 if this exists, otherwise frame$yval). For regression trees, this is the mean response, for Poisson trees it is the response rate and the number of events at that node in the fitted tree, and for classification trees it is the concatenation of the predicted class, the class counts at that node in the fitted tree, and the class probabilities.
如果type="matrix":参考一个完整的响应矩阵(frame$yval2如果存在的话,否则frame$yval)。对于回归树,这是平均响应,,泊松树木是拟合树中的节点在该事件的响应速度和数量,分类树,它是预测的类,类计数在该节点的串联在拟合的树,和一流的概率。

If type="class":<br> (for a classification tree) a factor of classifications based on the responses.
如果type="class":参考(分类树)分类的基础上的反应的一个因素。


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

predict,  rpart.object   
predict,rpart.object


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


z.auto <- rpart(Mileage ~ Weight, car.test.frame)
predict(z.auto)

fit <- rpart(Kyphosis ~ Age + Number + Start, data=kyphosis)
predict(fit, type="prob")   # class probabilities (default)[类的概率(默认)]
predict(fit, type="vector") # level numbers[级别的数字]
predict(fit, type="class")  # factor[因素]
predict(fit, type="matrix") # level number, class frequencies, probabilities[数量级,一流的频率,概率]

sub <- c(sample(1:50, 25), sample(51:100, 25), sample(101:150, 25))
fit <- rpart(Species ~ ., data=iris, subset=sub)
fit
table(predict(fit, iris[-sub,], type="class"), iris[-sub, "Species"])

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-1-24 05:44 , Processed in 0.030926 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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