【问题标题】:Repeated CV in TuneRangerTuneRanger 中的重复 CV
【发布时间】:2020-12-11 15:17:29
【问题描述】:

我正在使用“TuneRanger”包来调整射频模型。它效果很好,我得到了很好的结果,但我不确定它是否过度拟合了我的模型。我想为包正在调整模型的每个实例使用重复 CV,但我找不到方法。另外我想知道是否有人知道包如何验证每次尝试的结果(训练测试、简历、重复 cv?)我一直在阅读包的说明(https://cran.r-project.org/web/packages/tuneRanger/tuneRanger.pdf),但它什么也没说。

感谢您的帮助。

【问题讨论】:

    标签: r random-forest r-ranger


    【解决方案1】:

    袋外估计用于估计错误,我认为您不能使用该包切换到 CV。 CV是否比这更好由您决定。在他们的readme 中,他们链接到publication,并在其第 3.5 节下写道:

    袋外预测用于评估,这很重要 比其他使用评估策略的软件包更快,例如 交叉验证

    如果要使用交叉验证或重复交叉验证,则必须使用caret,例如:

    library(caret)
    
    mdl = train(Species ~ .,data=iris,method="ranger",trControl=trainControl(method="repeatedcv",repeats=2),
    tuneGrid = expand.grid(mtry=2:3,min.node.size = 1:2,splitrule="gini"))
    
    Random Forest 
    
    150 samples
      4 predictor
      3 classes: 'setosa', 'versicolor', 'virginica' 
    
    No pre-processing
    Resampling: Cross-Validated (10 fold, repeated 2 times) 
    Summary of sample sizes: 135, 135, 135, 135, 135, 135, ... 
    Resampling results across tuning parameters:
    
      mtry  min.node.size  Accuracy  Kappa
      2     1              0.96      0.94 
      2     2              0.96      0.94 
      3     1              0.96      0.94 
      3     2              0.96      0.94 
    
    Tuning parameter 'splitrule' was held constant at a value of gini
    Accuracy was used to select the optimal model using the largest value.
    The final values used for the model were mtry = 2, splitrule = gini
     and min.node.size = 1.
    

    您可以调整的参数会有所不同。我认为mlr 也允许您执行cross-validation,但同样的限制也适用。

    【讨论】:

      猜你喜欢
      • 2021-06-17
      • 1970-01-01
      • 2017-12-23
      • 1970-01-01
      • 1970-01-01
      • 2020-06-07
      • 2023-03-27
      • 2023-03-08
      • 1970-01-01
      相关资源
      最近更新 更多