Skip to content

Commit

Permalink
Merge branch 'main' into xgb
Browse files Browse the repository at this point in the history
  • Loading branch information
sebffischer authored Jun 25, 2024
2 parents 4723ca6 + bdd1bc0 commit 775b063
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 93 deletions.
43 changes: 0 additions & 43 deletions .github/workflows/test-task-1.yml

This file was deleted.

43 changes: 0 additions & 43 deletions .github/workflows/test-task-2.yml

This file was deleted.

4 changes: 3 additions & 1 deletion R/LearnerClassifXgboost.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ LearnerClassifXgboost = R6Class("LearnerClassifXgboost",
tags = c("train", "hotstart", "internal_tuning"),
aggr = crate(function(x) as.integer(ceiling(mean(unlist(x)))), .parent = topenv()),
in_tune_fn = crate(function(domain, param_vals) {
assert_true(!is.null(param_vals$early_stopping_rounds), .var.name = "early stopping rounds is set")
if (is.null(param_vals$early_stopping_rounds)) {
stop("Parameter 'early_stopping_rounds' must be set to use internal tuning.")
}
assert_integerish(domain$upper, len = 1L, any.missing = FALSE) }, .parent = topenv()),
disable_in_tune = list(early_stopping_rounds = NULL)
)
Expand Down
4 changes: 3 additions & 1 deletion R/LearnerRegrXgboost.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ LearnerRegrXgboost = R6Class("LearnerRegrXgboost",
tags = c("train", "hotstart", "internal_tuning"),
aggr = crate(function(x) as.integer(ceiling(mean(unlist(x)))), .parent = topenv()),
in_tune_fn = crate(function(domain, param_vals) {
assert_true(!is.null(param_vals$early_stopping_rounds), .var.name = "early stopping rounds is set")
if (is.null(param_vals$early_stopping_rounds)) {
stop("Parameter 'early_stopping_rounds' must be set to use internal tuning.")
}
assert_integerish(domain$upper, len = 1L, any.missing = FALSE) }, .parent = topenv()),
disable_in_tune = list(early_stopping_rounds = NULL)
)
Expand Down
3 changes: 1 addition & 2 deletions inst/paramtest/test_paramtest_classif.xgboost.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ test_that("classif.xgboost", {
"eval_metric", # handled by mlr3
"label", # handled by mlr3
"weight", # handled by mlr3
"nthread", # handled by mlr3
"early_stopping" # extra parameter of mlr3
"nthread" # handled by mlr3
)

ParamTest = run_paramtest(learner, fun, exclude, tag = "train")
Expand Down
1 change: 0 additions & 1 deletion inst/paramtest/test_paramtest_regr.xgboost.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ test_that("regr.xgboost", {
"label", # handled by mlr3
"weight", # handled by mlr3
"nthread" # handled by mlr3
"early_stopping" # extra parameter of mlr3
)

ParamTest = run_paramtest(learner, fun, exclude, tag = "train")
Expand Down
32 changes: 32 additions & 0 deletions man/mlr_learners_regr.xgboost.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/testthat/test_classif_xgboost.R
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ test_that("validation and inner tuning", {
validate = 0.2
)
s = learner$param_set$search_space()
expect_error(learner$param_set$convert_internal_search_space(s), "early stopping")
expect_error(learner$param_set$convert_internal_search_space(s), "Parameter")
learner$param_set$set_values(early_stopping_rounds = 10)
learner$param_set$disable_internal_tuning("nrounds")
expect_equal(learner$param_set$values$early_stopping_rounds, NULL)
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test_regr_xgboost.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ test_that("validation and inner tuning", {
validate = 0.2
)
s = learner$param_set$search_space()
expect_error(learner$param_set$convert_internal_search_space(s), "early stopping")
expect_error(learner$param_set$convert_internal_search_space(s), "Parameter")
learner$param_set$set_values(early_stopping_rounds = 10)
learner$param_set$disable_internal_tuning("nrounds")
expect_equal(learner$param_set$values$early_stopping_rounds, NULL)
Expand Down

0 comments on commit 775b063

Please sign in to comment.