predict.RRF(RRF)
predict.RRF()所属R语言包:RRF
predict method for random forest objects
预测方法随机森林的对象
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Prediction of test data using random forest.
测试数据,使用随机森林的预测。
用法----------Usage----------
## S3 method for class 'RRF'
predict(object, newdata, type="response",
norm.votes=TRUE, predict.all=FALSE, proximity=FALSE, nodes=FALSE,
cutoff, ...)
参数----------Arguments----------
参数:object
an object of class RRF, as that created by the function RRF.
类的一个对象RRF,创建的功能RRF。
参数:newdata
a data frame or matrix containing new data. (Note: If not given, the out-of-bag prediction in object is returned.
一个数据框或的矩阵包含新的数据。 (注:如果没有给出,在object,袋预测,则返回。
参数:type
one of response, prob. or votes, indicating the type of output: predicted values, matrix of class probabilities, or matrix of vote counts. class is allowed, but automatically converted to "response", for backward compatibility.
一个response,prob。或votes,表示输出类型的预测值,矩阵类的概率,矩阵计票结果。 class是允许的,但自动转换为“反应”,是为了向后兼容。
参数:norm.votes
Should the vote counts be normalized (i.e., expressed as fractions)? Ignored if object$type is regression.
投票数归一化(即,以分数表示)?忽略如果object$type是regression。
参数:predict.all
Should the predictions of all trees be kept?
如果预测的所有树木被保留?
参数:proximity
Should proximity measures be computed? An error is issued if object$type is regression.
邻近措施计算?如果object$type是regression发出一个错误。
参数:nodes
Should the terminal node indicators (an n by ntree matrix) be return? If so, it is in the “nodes” attribute of the returned object.
如果终端节点指标(一个n矩阵的ntree)的回报?如果是的话,它是在返回的对象的“节点”属性。
参数:cutoff
(Classification only) A vector of length equal to number of classes. The "winning" class for an observation is the one with the maximum ratio of proportion of votes to cutoff. Default is taken from the forest$cutoff component of object (i.e., the setting used when running RRF).
(分类)的矢量长度相等的班级数目。观察“殊荣的”类是有票的截止比值最高的比例。默认取自forest$cutoff组成部分object(即运行时使用的设置RRF)。
参数:...
not used currently.
目前没有使用。
值----------Value----------
If object$type is regression, a vector of predicted values is returned. If predict.all=TRUE, then the returned object is a list of two components: aggregate, which is the vector of predicted values by the forest, and individual, which is a matrix where each column contains prediction by a tree in the forest.
如果object$typeregression,预测值的矢量被返回。如果predict.all=TRUE,则返回的对象是一个aggregate,这是向量的预测值由森林,和individual,这是一个矩阵,其中每一列都包含两部分组成:预测森林中的一棵树。
If object$type is classification, the object returned depends on the argument type:
object$type如果是classification,返回的对象取决于参数type:
参数:response
predicted classes (the classes with majority vote).
预测类(多数票类)。
参数:prob
matrix of class probabilities (one column for each class and one row for each input).
矩阵类的概率为每个类和每个输入的一行(一列)。
参数:vote
matrix of vote counts (one column for each class and one row for each new input); either in raw counts or in fractions (if norm.votes=TRUE).
矩阵计票结果为每个类和每个新的输入行(一列);无论是在原始计数或部分(如果norm.votes=TRUE)。
If predict.all=TRUE, then the individual component of the returned object is a character matrix where each column contains the predicted class by a tree in the forest.
如果predict.all=TRUE,那么individual组成部分,返回的对象是一个字符矩阵,其中每一列都包含在森林里的树预测类。
If proximity=TRUE, the returned object is a list with two components: pred is the prediction (as described above) and proximity is the proximitry matrix. An error is issued if object$type is regression.
如果proximity=TRUE,返回的对象是与两部分组成:一个列表pred的预测(如上面所述),和proximity是proximitry的矩阵。如果object$type是regression发出一个错误。
If nodes=TRUE, the returned object has a “nodes” attribute, which is an n by ntree matrix, each column containing the node number that the cases fall in for that tree.
如果nodes=TRUE,返回的对象有一个“节点”属性,它是一个n×ntree矩阵,每一列包含的节点数量的情况下,在该树。
NOTE: If the object inherits from RRF.formula, then any data with NA are silently omitted from the prediction. The returned value will contain NA correspondingly in the aggregated and individual tree predictions (if requested), but not in the proximity or node matrices.
注意:如果object继承自RRF.formula,然后与NA的任何数据都提示的情况下省略的预测。返回值将包含NA相应的汇总和个人的的树预测(如果要求),而不是在接近或节点矩阵。
NOTE2: Any ties are broken at random, so if this is undesirable, avoid it by using odd number ntree in RRF().
注2:在随机任何关系被打破,因此,如果这是不可取的,避免使用奇数ntree中RRF()。
(作者)----------Author(s)----------
Andy Liaw <a href="mailto:andy\_liaw@merck.com">andy\_liaw@merck.com</a> and Matthew Wiener
<a href="mailto:matthew\_wiener@merck.com">matthew\_wiener@merck.com</a>, based on original Fortran code by
Leo Breiman and Adele Cutler.
参考文献----------References----------
5-32.
参见----------See Also----------
RRF
RRF
实例----------Examples----------
data(iris)
set.seed(111)
ind <- sample(2, nrow(iris), replace = TRUE, prob=c(0.8, 0.2))
iris.rf <- RRF(Species ~ ., data=iris[ind == 1,])
iris.pred <- predict(iris.rf, iris[ind == 2,])
table(observed = iris[ind==2, "Species"], predicted = iris.pred)
## Get prediction for all trees.[#获取所有的树木的预测。]
predict(iris.rf, iris[ind == 2,], predict.all=TRUE)
## Proximities.[#近似性。]
predict(iris.rf, iris[ind == 2,], proximity=TRUE)
## Nodes matrix.[#节点矩阵。]
str(attr(predict(iris.rf, iris[ind == 2,], nodes=TRUE), "nodes"))
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|