我在模型中使用了两步 cforest。训练集的准确率为 87%,而测试集的准确率为 57%。这表明模型严重过拟合。如何解决这个问题呢?我应该减少树的节点还是将数据分成 k 折?如何确定应该保留多少个节点?
这是第 1 步的代码。
fit1 <- cforest((b == 'three')~ posemo + social + family
+friend + home + humans + money + they
+ social+article+certain+insight+affect+ negemo+ future+swear+sad
+negate+ppron+sexual+death + filler+leisure, data = trainset1,
controls=cforest_unbiased(ntree=3000, mtry= 3))