楼主: 西湖断桥
4648 6

[问答] R语言中randomForest包做回归时没发现oob error [推广有奖]

  • 0关注
  • 0粉丝

初中生

52%

还不是VIP/贵宾

-

威望
0
论坛币
1 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
69 点
帖子
4
精华
0
在线时间
28 小时
注册时间
2011-12-30
最后登录
2020-8-23

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
用R语言中randomForest包做回归预测时没发现oob error,请问是什么原因呢?怎么求oob error?
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:回归预测 R语言 随机森林;OOB error

沙发
ckevinit 发表于 2018-6-13 13:59:53 |只看作者 |坛友微信交流群
randomForest()函数的参数设置正确吗?截图看看~‘

使用道具

藤椅
西湖断桥 发表于 2018-6-13 15:05:57 |只看作者 |坛友微信交流群
ckevinit 发表于 2018-6-13 13:59
randomForest()函数的参数设置正确吗?截图看看~‘
新手,参数也不知道怎么设置,照着例子学的,还请您多多帮忙。
  1. > library("randomForest")
  2. > m <- read.csv("C:/Users/ASUS~/Desktop/r/m.csv")
  3. > str(m)
  4. > ind<-sample(2,nrow(m),replace=TRUE,prob=c(0.7,0.3))
  5. > set.seed(100)
  6. > train<-m[ind==1,]
  7. > test<-m[ind==2,]
  8. > str(train)
  9. > str(test)
  10. > set.seed(100)
  11. > ntree_fit<-randomForest(ssc~.,data=train,mtry=2,ntree=1000)
  12. > plot(ntree_fit)
  13. > rf<-randomForest(ssc~.,data=train,mtry=5,ntree=500,nodesize = 5, proximity=TRUE, importance=TRUE)
  14. > print(rf)
  15. pred<-predict(rf,test)
  16. > print(pred)
复制代码

使用道具

板凳
jgchen1966 发表于 2018-6-13 16:42:51 |只看作者 |坛友微信交流群
新手,参数也不知道怎么设置???得到randomForest包做回归预测时没发现oob error,与参数设定有啥子关系??

(randomForest) Value
An object of class randomForest, which is a list with the following components:
。。。
。。
err.rate    (classification only) vector error rates of the prediction on the input data, the i-th
               element being the (OOB) error rate for all trees up to the i-th.
confusion   (classification only) the confusion matrix of the prediction (based on OOB data).
votes         (classification only) a matrix with one row for each input data point and one
                 column for each class, giving the fraction or number of (OOB) ‘votes’ from the
                   random forest.

使用道具

报纸
jgchen1966 发表于 2018-6-13 16:44:33 |只看作者 |坛友微信交流群
西湖断桥 发表于 2018-6-13 15:05
新手,参数也不知道怎么设置,照着例子学的,还请您多多帮忙。
你的最后预测结果是 test 集的预测,非OOB 预测结果。。。
已有 1 人评分论坛币 收起 理由
jiangbeilu + 5 鼓励积极发帖讨论

总评分: 论坛币 + 5   查看全部评分

使用道具

地板
jgchen1966 发表于 2018-6-13 16:49:51 |只看作者 |坛友微信交流群
jgchen1966 发表于 2018-6-13 16:44
你的最后预测结果是 test 集的预测,非OOB 预测结果。。。
randomForest 模型结果中必会有 :
predicted    the predicted values of the input data based on out-of-bag samples.

这个predicted才是OOB预测结果。。。
已有 1 人评分论坛币 收起 理由
cheetahfly + 10 热心帮助其他会员

总评分: 论坛币 + 10   查看全部评分

使用道具

7
gyy12 发表于 2018-9-8 23:07:17 |只看作者 |坛友微信交流群
你好 问题解决了吗 我也遇见了相同的问题 求帮助

使用道具

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

本版微信群
加好友,备注cda
拉您进交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-5-22 21:09