【发布时间】:2022-06-28 19:15:41
【问题描述】:
我正在尝试调整xgboost和超频带我想使用建议的默认调整空间mlr3tuningspaces包裹。但是,在使用 lts 时,我找不到如何用“预算”标记超参数。
下面,我转载了mlr3 超频带包示例来说明我的问题:
library(mlr3verse)
library(mlr3hyperband)
library(mlr3tuningspaces)
## this does not work, because I don\'t know how to tag a hyperparameter
## with \"budget\" while using the suggested tuning space
search_space = lts(\"classif.xgboost.default\")
search_space$values
## this works because it has a hyperparameter (nrounds) tagged with \"bugdget\"
search_space = ps(
nrounds = p_int(lower = 1, upper = 16, tags = \"budget\"),
eta = p_dbl(lower = 0, upper = 1),
booster = p_fct(levels = c(\"gbtree\", \"gblinear\", \"dart\"))
)
# hyperparameter tuning on the pima indians diabetes data set
instance = tune(
method = \"hyperband\",
task = tsk(\"pima\"),
learner = lrn(\"classif.xgboost\", eval_metric = \"logloss\"),
resampling = rsmp(\"cv\", folds = 3),
measures = msr(\"classif.ce\"),
search_space = search_space,
term_evals = 100
)
# best performing hyperparameter configuration
instance$result