【问题标题】:Conditional inference trees in party package R: how to predict the model and variance importance based on OOB data?派对包R中的条件推理树:如何根据OOB数据预测模型和方差重要性?
【发布时间】:2020-02-26 15:08:28
【问题描述】:

我使用 R 中 party 包的 cforest 来计算条件推理树。与随机森林类似,我想根据OOB 数据检索解释的方差和方差重要性(我读到随机森林返回解释的方差和基于 OOB 数据的变量重要性)。为此,cforest 我使用了以下代码:

model <- party::cforest(y ~ x1 + x2 + x3 + x4 , data=trainings_set ,  control=cforest_unbiased(ntree=1000, minsplit=25 , minbucket=8 , mtry=4))
model.pred <- predict(model, type="response" , OOB=TRUE)
R2=1 - sum((trainings_set$y-model.pred)^2)/sum((trainings_set$y-mean(trainings_set$y))^2)
varimp_model=party::varimp(model, conditional = TRUE, threshold = 0.2, OOB = TRUE)

我感兴趣的是命令 OOB=TRUE 是否会导致模型被预测并根据 trainings_set 的 OOB data 返回变量重要性?

我之前以不同的标题发布过这个问题,再次发布(稍微重新起草),希望有人能够提供答案?

【问题讨论】:

    标签: r machine-learning random-forest


    【解决方案1】:

    cforest 函数中的OOB 参数用于a logical defining out-of-bag predictions

    这只是TRUE,当您在cforest 中传递newdata 参数时,通常是一个测试数据帧。如果newdata 参数存在并且您设置了OOB=TRUE,那么您将在此newdata 上获得out-of-bag predictions

    我希望这能澄清你的疑问。

    【讨论】:

      猜你喜欢
      • 2018-09-28
      • 2021-12-04
      • 2012-09-23
      • 2018-10-31
      • 1970-01-01
      • 2020-01-10
      • 2021-02-25
      • 1970-01-01
      相关资源
      最近更新 更多