Skip to content

Commit

Permalink
add iteration to context
Browse files Browse the repository at this point in the history
  • Loading branch information
be-marc committed Dec 3, 2024
1 parent cf92e71 commit 8f7f308
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion R/ContextEvaluation.R
Original file line number Diff line number Diff line change
Expand Up @@ -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``.
Expand Down Expand Up @@ -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")
}
Expand Down
2 changes: 1 addition & 1 deletion R/worker.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 8f7f308

Please sign in to comment.