Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hyperband and CV. is this combinable? #5

Closed
berndbischl opened this issue Sep 11, 2019 · 6 comments
Closed

hyperband and CV. is this combinable? #5

berndbischl opened this issue Sep 11, 2019 · 6 comments
Assignees

Comments

@berndbischl
Copy link
Sponsor Member

No description provided.

@SebGGruber SebGGruber self-assigned this Sep 15, 2019
@SebGGruber
Copy link
Contributor

It's already working as it is by replacing holdout with cv.
The question is what are the consequences compared to ho?

  • better estimation in each successive halving iteration --> we are more confident the survivors actually deserve to survive
  • more accurate overall outcome
  • hugely increases runtime

I think it makes great sense as we are less likely to waste computing power/time on "lucky" configs in advanced bracket stages, plus the usual CV benefits.

An example with 3-fold CV:

devtools::load_all()
library(mlr3learners)
set.seed(123)

# define hyperparameter and budget parameter for tuning with hyperband
ps = ParamSet$new(list(

  ParamInt$new("nrounds",           lower = 1, upper = 16, tag = "budget"),
  ParamDbl$new("eta",               lower = 0, upper = 1),
  ParamInt$new("num_parallel_tree", lower = 1, upper = 100),
  ParamInt$new("max_depth",         lower = 1, upper = 100),
  ParamFct$new("normalize_type", levels = c("tree", "forest")),
  ParamFct$new("sample_type",    levels = c("uniform", "weighted")),
  ParamFct$new("booster",        levels = c("gbtree", "gblinear", "dart"))
))

# tuning instance with 3-fold CV
inst = TuningInstance$new(
  tsk("iris"),
  lrn("classif.xgboost"),
  rsmp("cv", folds = 3),
  msr("classif.ce"),
  ps,
  term("evals", n_evals = 100000)
)

# hyperband + tuning
tuner = TunerHyperband$new(eta = 2L)
tuner$tune(inst)

print(inst$archive())
print(tuner$info)

@berndbischl
Copy link
Sponsor Member Author

@SebGruber1996 simply make sure that this work also in a unit test (with a small CV) then we are done here

@SebGGruber
Copy link
Contributor

added 2 fold CV to the unit tests

@pfistfl
Copy link
Sponsor Member

pfistfl commented Nov 4, 2019

One other question would be if we can for example only do 1 out of 10 CV folds in the beginning and then subsequently increase this.
I.e. can we somehow treat the number of folds we want to evaluate as a hyperparameter.

@juliambr
Copy link
Contributor

One other question would be if we can for example only do 1 out of 10 CV folds in the beginning and then subsequently increase this.
I.e. can we somehow treat the number of folds we want to evaluate as a hyperparameter.

I opened a new issue for that #56.

@juliambr
Copy link
Contributor

There was a bug regarding the evaluation of configs with cross-validation #50. Tests did not cover this case, so maybe tests should be improved.

@jakob-r jakob-r closed this as completed Jul 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants