如何解释 mlr3 中嵌套重采样的聚合性能结果?

How to interpret the aggregated performance result of nested resampling in mlr3?

最近在学习mlr3包中的嵌套重采样。根据 mlr3 书,嵌套重采样的目标是为学习者获得无偏的性能估计。我运行测试如下:

# loading packages
library(mlr3)
library(paradox)
library(mlr3tuning)

# setting tune_grid
tune_grid <- ParamSet$new(
  list(
  ParamInt$new("mtry", lower = 1, upper = 15),
  ParamInt$new("num.trees", lower = 50, upper = 200))
  )

# setting AutoTuner
at <- AutoTuner$new(
  learner = lrn("classif.ranger", predict_type = "prob"),
  resampling = rsmp("cv", folds = 5),
  measure = msr("classif.auc"),
  search_space = tune_grid,
  tuner = tnr("grid_search", resolution = 3),
  terminator = trm("none"),
  store_tuning_instance = TRUE)

# nested resampling
set.seed(100)
resampling_outer <- rsmp("cv", folds = 3)   # outer resampling
rr <- resample(task_train, at, resampling_outer, store_models = TRUE)

> lapply(rr$learners, function(x) x$tuning_result)
[[1]]
   mtry num.trees learner_param_vals  x_domain classif.auc
1:    1       200          <list[2]> <list[2]>   0.7584991

[[2]]
   mtry num.trees learner_param_vals  x_domain classif.auc
1:    1       200          <list[2]> <list[2]>   0.7637077

[[3]]
   mtry num.trees learner_param_vals  x_domain classif.auc
1:    1       125          <list[2]> <list[2]>   0.7645588

> rr$aggregate(msr("classif.auc"))
classif.auc 
  0.7624477 

结果表明,3次内重采样选择的3个超参数不保证相同。它类似于这个post(它从内部重采样得到3个不同的cp):.

我的问题是:

  1. 我以前认为聚合结果rr$aggregate是3个模型的均值,其实不是,(0.7584991 + 0.7637077 + 0.7645588) / 3 = 0.7622552 ,而不是 0.7624477,我是否误解了汇总结果?
  2. 如何解释来自内部重采样过程的具有不同最佳超参数的 3 个模型的聚合性能结果?是什么的无偏表现?

谢谢!

The result shows that the 3 hyperparameters chosen from 3 inner resampling are not garantee to be the same.

听起来您想用内部重采样中的超参数 select 拟合最终模型。嵌套重采样不用于 select 最终模型的超参数值。仅检查稳定超参数的内部调整结果。这意味着 selected 超参数不应变化太大。

  1. 是的,您正在将所有 外部重采样 测试集(rr$aggregate())的综合性能与 [=20] 上估计的性能进行比较=]内部重采样 测试集 (lapply(rr$learners, function(x) x$tuning_result)).

  2. 所有外部重采样迭代的聚合性能是具有通过网格搜索找到的最佳超参数的游侠模型的无偏性能。您可以 运行 at$train(task) 获得最终模型并将使用嵌套重采样估计的性能报告为该模型的无偏性能。