diff --git a/R/ContextEvaluation.R b/R/ContextEvaluation.R index 9c366aa5f..d12a1e76f 100644 --- a/R/ContextEvaluation.R +++ b/R/ContextEvaluation.R @@ -30,6 +30,10 @@ ContextEvaluation = R6Class("ContextEvaluation", #' Is usually only set while tuning. param_values = NULL, + #' @field iteration (`integer()`)\cr + #' The current iteration. + iteration = NULL, + #' @field sets (`list()`)\cr #' The train and test set. #' The sets are available on stage `on_evaluation_before_train``. @@ -66,11 +70,12 @@ ContextEvaluation = R6Class("ContextEvaluation", #' The resampling strategy to be used. #' @param param_values (`list()`)\cr #' The parameter values to be used. - initialize = function(task, learner, resampling, param_values) { + initialize = function(task, learner, resampling, param_values, iteration) { # no assertions to avoid overhead self$task = task self$learner = learner self$resampling = resampling + self$iteration = iteration super$initialize(id = "evaluate", label = "Evaluation") } diff --git a/R/worker.R b/R/worker.R index bf3ecb51e..957e223e2 100644 --- a/R/worker.R +++ b/R/worker.R @@ -265,7 +265,7 @@ workhorse = function( unmarshal = TRUE, callbacks = NULL ) { - ctx = ContextEvaluation$new(task, learner, resampling, param_values) + ctx = ContextEvaluation$new(task, learner, resampling, param_values, iteration) call_back("on_evaluation_begin", callbacks, ctx)