R语言randomForest包实现随机森林——iris数据集和kyphosis数据集

library(randomForest)
model.forest<-randomForest(Species~.,data=iris)
pre.forest<-predict(model.forest,iris)
table(pre.forest,iris$Species)

 

library(rpart)
library(randomForest)
model.forest<-randomForest(Kyphosis~.,data=kyphosis)
pre.forest<-predict(model.forest,kyphosis)
table(pre.forest,kyphosis$Kyphosis)

posted @ 2015-11-01 14:03  地表最强队队员  阅读(3223)  评论(0编辑  收藏  举报