Skip to content

Commit c7bf883

Browse files
authored
feat: add debug messages (#136)
* feat: add debug messages * ...
1 parent b2bd33c commit c7bf883

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

DESCRIPTION

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ URL: https://mlr3fselect.mlr-org.com,
2424
https://github.com/mlr-org/mlr3fselect
2525
BugReports: https://github.com/mlr-org/mlr3fselect/issues
2626
Depends:
27-
mlr3 (>= 0.21.1),
27+
mlr3 (>= 0.23.0.9000),
2828
R (>= 3.1.0)
2929
Imports:
30-
bbotk (>= 1.5.0),
30+
bbotk (>= 1.5.0.9000),
3131
checkmate (>= 2.0.0),
3232
data.table,
3333
lgr,
@@ -43,6 +43,9 @@ Suggests:
4343
rpart,
4444
fastVoteR,
4545
testthat (>= 3.0.0)
46+
Remotes:
47+
mlr-org/mlr3,
48+
mlr-org/bbotk
4649
Config/testthat/edition: 3
4750
Config/testthat/parallel: true
4851
Encoding: UTF-8

R/ObjectiveFSelectBatch.R

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ ObjectiveFSelectBatch = R6Class("ObjectiveFSelectBatch",
5858
.eval_many = function(xss, resampling) {
5959
private$.xss = xss
6060

61+
lg$trace("Evaluating hyperparameter configuration %s", as_short_string(xs))
62+
6163
tasks = map(private$.xss, function(x) {
6264
state = self$task$feature_names[unlist(x)]
6365
task = self$task$clone()
@@ -71,13 +73,19 @@ ObjectiveFSelectBatch = R6Class("ObjectiveFSelectBatch",
7173
private$.design = data.table(task = tasks, learner = list(self$learner), resampling = resampling)
7274
call_back("on_eval_after_design", self$callbacks, self$context)
7375

76+
lg$debug("Resampling feature subsets")
77+
7478
# learner is already cloned, task is internally cloned by PipeOpSelect, and resampling is not changed
7579
private$.benchmark_result = benchmark(private$.design, store_models = self$store_models || private$.model_required, clone = character())
7680
call_back("on_eval_after_benchmark", self$callbacks, self$context)
7781

82+
lg$debug("Aggregating performance")
83+
7884
# aggregate performance scores
7985
private$.aggregated_performance = private$.benchmark_result$aggregate(self$measures, conditions = TRUE)[, c(self$codomain$target_ids, "warnings", "errors"), with = FALSE]
8086

87+
lg$debug("Aggregated performance %s", as_short_string(private$.aggregated_performance))
88+
8189
# add runtime to evaluations
8290
time = map_dbl(private$.benchmark_result$resample_results$resample_result, function(rr) {
8391
sum(map_dbl(get_private(rr)$.data$learner_states(get_private(rr)$.view), function(state) state$train_time + state$predict_time))
@@ -86,6 +94,7 @@ ObjectiveFSelectBatch = R6Class("ObjectiveFSelectBatch",
8694

8795
# store benchmark result in archive
8896
if (self$store_benchmark_result) {
97+
lg$debug("Storing resample result")
8998
self$archive$benchmark_result$combine(private$.benchmark_result)
9099
set(private$.aggregated_performance, j = "uhash", value = private$.benchmark_result$uhashes)
91100
}

R/zzz.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
x$add("mlr3fselect.one_se_rule", load_callback_one_se_rule)
3030
x$add("mlr3fselect.internal_tuning", load_callback_internal_tuning)
3131

32-
assign("lg", lgr::get_logger("bbotk"), envir = parent.env(environment()))
32+
assign("lg", lgr::get_logger("mlr3/bbotk"), envir = parent.env(environment()))
3333
if (Sys.getenv("IN_PKGDOWN") == "true") {
3434
lg$set_threshold("warn")
3535
}

0 commit comments

Comments
 (0)