[英]Can I see the out of bag error for regression tasks in the R randomForest package?
I'm using the randomForest package in R for prediction, and want to plot the out of bag (OOB) errors to see if I have enough trees, and to tune the mtry (number of variables at each split) variable.我正在使用 R 中的 randomForest 包进行预测,并且想要绘制袋外 (OOB) 错误以查看我是否有足够的树,并调整 mtry(每次拆分时的变量数)变量。 The package seems to automatically compute the OOB errors for classification tasks, but doesn't do so for regression tasks.
该包似乎会自动计算分类任务的 OOB 错误,但不会为回归任务这样做。 Does anyone know if there is a way to look at the OOB errors for regressions tasks?
有谁知道是否有办法查看回归任务的 OOB 错误?
You can also look directly at the out of bag predictions:您还可以直接查看 out of bag 预测:
data(airquality)
set.seed(131)
ozone.rf <- randomForest(Ozone ~ ., data=airquality, mtry=3,
importance=TRUE, na.action=na.omit)
ozone.rf$predicted
As said in the comments the mse object is computed OOB.正如评论中所说,mse 对象是 OOB 计算的。 See page 20 in https:\/\/datajobs.com\/data-science-repo\/Random-Forest-%5bLiaw-and-Weiner%5d.pdf<\/a> Hence, the mse object is already an estimate of the OOB mean squared error.
请参阅
https:\/\/datajobs.com\/data-science-repo\/Random-Forest-%5bLiaw-and-Weiner%5d.pdf<\/a>中的第 20 页因此,mse 对象已经是 OOB 均方误差的估计值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.