没有合适的资源?快使用搜索试试~ 我知道了~
随机森林(Random Forest)的Fortran和R语言实现
2星 需积分: 50 75 下载量 141 浏览量
2014-03-04
14:51:28
上传
评论 2
收藏 182KB PDF 举报
温馨提示
试读
29页
August 29, 2013 Breiman and Cutler’s random forests for classification and regression Version 4.6-7
资源推荐
资源详情
资源评论
Package ‘randomForest’
August 29, 2013
Title Breiman and Cutler’s random forests for classification and regression
Version 4.6-7
Date 2012-10-16
Depends R (>= 2.5.0), stats
Suggests RColorBrewer, MASS
Author Fortran original by Leo Breiman and Adele Cutler, R port by Andy Liaw and Matthew Wiener.
Description Classification and regression based on a forest of trees using random inputs.
Maintainer Andy Liaw <andy_liaw@merck.com>
License GPL (>= 2)
URL http://stat-www.berkeley.edu/users/breiman/RandomForests
Repository CRAN
Date/Publication 2012-10-16 13:43:29
NeedsCompilation yes
R topics documented:
classCenter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
combine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
getTree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
grow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
importance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
imports85 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
margin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
MDSplot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
na.roughfix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
outlier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
partialPlot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1
2 classCenter
plot.randomForest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
predict.randomForest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
randomForest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
rfcv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
rfImpute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
rfNews . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
treesize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
tuneRF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
varImpPlot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
varUsed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Index 29
classCenter Prototypes of groups.
Description
Prototypes are ‘representative’ cases of a group of data points, given the similarity matrix among
the points. They are very similar to medoids. The function is named ‘classCenter’ to avoid conflict
with the function prototype in the methods package.
Usage
classCenter(x, label, prox, nNbr = min(table(label))-1)
Arguments
x a matrix or data frame
label group labels of the rows in x
prox the proximity (or similarity) matrix, assumed to be symmetric with 1 on the
diagonal and in [0, 1] off the diagonal (the order of row/column must match that
of x)
nNbr number of nearest neighbors used to find the prototypes.
Details
This version only computes one prototype per class. For each case in x, the nNbr nearest neighors
are found. Then, for each class, the case that has most neighbors of that class is identified. The pro-
totype for that class is then the medoid of these neighbors (coordinate-wise medians for numerical
variables and modes for categorical variables).
This version only computes one prototype per class. In the future more prototypes may be computed
(by removing the ‘neighbors’ used, then iterate).
Value
A data frame containing one prototype in each row.
combine 3
Author(s)
Andy Liaw
See Also
randomForest, MDSplot
Examples
data(iris)
iris.rf <- randomForest(iris[,-5], iris[,5], prox=TRUE)
iris.p <- classCenter(iris[,-5], iris[,5], iris.rf$prox)
plot(iris[,3], iris[,4], pch=21, xlab=names(iris)[3], ylab=names(iris)[4],
bg=c("red", "blue", "green")[as.numeric(factor(iris$Species))],
main="Iris Data with Prototypes")
points(iris.p[,3], iris.p[,4], pch=21, cex=2, bg=c("red", "blue", "green"))
combine Combine Ensembles of Trees
Description
Combine two more more ensembles of trees into one.
Usage
combine(...)
Arguments
... two or more objects of class randomForest, to be combined into one.
Value
An object of class randomForest.
Note
The confusion, err.rate, mse and rsq components (as well as the corresponding components in
the test compnent, if exist) of the combined object will be NULL.
Author(s)
Andy Liaw <andy\_liaw@merck.com>
See Also
randomForest, grow
4 getTree
Examples
data(iris)
rf1 <- randomForest(Species ~ ., iris, ntree=50, norm.votes=FALSE)
rf2 <- randomForest(Species ~ ., iris, ntree=50, norm.votes=FALSE)
rf3 <- randomForest(Species ~ ., iris, ntree=50, norm.votes=FALSE)
rf.all <- combine(rf1, rf2, rf3)
print(rf.all)
getTree Extract a single tree from a forest.
Description
This function extract the structure of a tree from a randomForest object.
Usage
getTree(rfobj, k=1, labelVar=FALSE)
Arguments
rfobj a randomForest object.
k which tree to extract?
labelVar Should better labels be used for splitting variables and predicted class?
Details
For numerical predictors, data with values of the variable less than or equal to the splitting point go
to the left daughter node.
For categorical predictors, the splitting point is represented by an integer, whose binary expansion
gives the identities of the categories that goes to left or right. For example, if a predictor has
four categories, and the split point is 13. The binary expansion of 13 is (1, 0, 1, 1) (because
13 = 1 ∗ 2
0
+ 0 ∗ 2
1
+ 1 ∗ 2
2
+ 1 ∗ 2
3
), so cases with categories 1, 3, or 4 in this predictor get sent
to the left, and the rest to the right.
Value
A matrix (or data frame, if labelVar=TRUE) with six columns and number of rows equal to total
number of nodes in the tree. The six columns are:
left daughter the row where the left daughter node is; 0 if the node is terminal
right daughter the row where the right daughter node is; 0 if the node is terminal
split var which variable was used to split the node; 0 if the node is terminal
split point where the best split is; see Details for categorical predictor
status is the node terminal (-1) or not (1)
prediction the prediction for the node; 0 if the node is not terminal
grow 5
Author(s)
Andy Liaw <andy\_liaw@merck.com>
See Also
randomForest
Examples
data(iris)
## Look at the third trees in the forest.
getTree(randomForest(iris[,-5], iris[,5], ntree=10), 3, labelVar=TRUE)
grow Add trees to an ensemble
Description
Add additional trees to an existing ensemble of trees.
Usage
## S3 method for class ’randomForest’
grow(x, how.many, ...)
Arguments
x an object of class randomForest, which contains a forest component.
how.many number of trees to add to the randomForest object.
... currently ignored.
Value
An object of class randomForest, containing how.many additional trees.
Note
The confusion, err.rate, mse and rsq components (as well as the corresponding components in
the test compnent, if exist) of the combined object will be NULL.
Author(s)
Andy Liaw <andy\_liaw@merck.com>
See Also
combine, randomForest
剩余28页未读,继续阅读
资源评论
- wangjianming2342016-12-08非常感谢!很有用的学习资料!
- lydstrive2018-07-15英文版的,感觉一般
u013899602
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功