我从某人那里获得了R脚本来运行随机森林模型。我修改并运行了一些员工数据。我们正在尝试预测自愿离职。
以下是一些其他信息:这是一个分类模型,其中0 =员工留下,1 =员工终止,我们目前仅查看十二个预测变量,数据“不平衡”,因为术语记录约占7占总记录集的百分比。
我使用各种mtry和ntree选择来运行模型,但是选择了以下内容。OOB是6.8%,我认为这很好,但是混淆矩阵似乎在讲另一个预测术语的方法,因为错误率非常高,达到92.79%。我认为我不能依靠和使用此模型是正确的,因为预测术语的高错误率?还是可以做一些事情来使用RF并获得较小的错误率来预测术语?
 FOREST_model <- randomForest(theFormula, data=trainset, mtry=3, ntree=500, importance=TRUE, do.trace=100)
ntree      OOB      1      2
  100:   6.97%  0.47% 92.79%
  200:   6.87%  0.36% 92.79%
  300:   6.82%  0.33% 92.55%
  400:   6.80%  0.29% 92.79%
  500:   6.80%  0.29% 92.79%
> print(FOREST_model)
Call:
 randomForest(formula = theFormula, data = trainset, mtry = 3,      ntree = 500, importance = TRUE, do.trace = 100) 
               Type of random forest: classification
                     Number of trees: 500
No. of variables tried at each split: 3
        OOB estimate of  error rate: 6.8%
Confusion matrix:
     0  1 class.error
0 5476 16 0.002913328
1  386 30 0.927884615
> nrow(trainset)
[1] 5908