我是 R 的新用户,也是随机森林建模的新手。我似乎无法弄清楚如何获得使用 R 中的 Party 包构建的 cforest 模型的袋外 (OOB) 误差估计值。在 randomForest 包中,如果您只是“打印”模型,则会显示 OOB 误差估计值对象,但派对包的工作方式不同。
使用 randomForest 包运行随机森林模型:
> SBrf<- randomForest(formula = factor(SB_Pres) ~ SST + Chla + Dist2Shr + DaylightHours + Bathy + Slope + MoonPhase + factor(Region), data = SBrfImpute, ntree = 500, replace = FALSE, importance = TRUE)
> print(SBrf)
Call:
randomForest(formula = factor(SB_Pres) ~ SST + Chla + Dist2Shr + DaylightHours + Bathy + Slope + MoonPhase + factor(Region), data = SBrfImpute, ntree = 500, replace = FALSE, importance = TRUE)
Type of random forest: classification
Number of trees: 500
No. of variables tried at each split: 2
OOB estimate of error rate: 23.67%
Confusion matrix:
0 1 class.error
0 823 127 0.1336842
1 211 267 0.4414226
使用派对包运行随机森林模型:
> SBcf<- cforest(formula = factor(SB_Pres) ~ SST + Chla + Dist2Shr+ DaylightHours + Bathy + Slope + MoonPhase + factor(Region), data = bll_SB_noNA, control = cforest_unbiased())
> print(SBcf)
Random Forest using Conditional Inference Trees
Number of trees: 500
Response: factor(SB_Pres)
Inputs: SST, Chla, Dist2Shr, DaylightHours, Bathy, Slope, MoonPhase, factor(Region)
Number of observations: 534
我已经阅读了手册和小插曲,但似乎找不到答案。一旦您使用派对包运行了随机森林模型,有谁知道如何检索 OOB 错误估计?还是我完全错过了两个包之间的一些非常重要的区别,导致使用派对包构建的随机森林模型没有 OOB 错误估计?