Skip to content

Commit

Permalink
add clone to as_measure(s) generic
Browse files Browse the repository at this point in the history
  • Loading branch information
sebffischer committed Jan 29, 2025
1 parent b2de8f4 commit 5b5fbbb
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 15 deletions.
1 change: 1 addition & 0 deletions R/LearnerRegr.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#' @template param_packages
#' @template param_label
#' @template param_man
#' @template param_task_type
#'
#' @template seealso_learner
#' @export
Expand Down
12 changes: 6 additions & 6 deletions R/as_measure.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
#'
#' @return [Measure].
#' @export
as_measure = function(x, task_type = NULL, ...) { # nolint
as_measure = function(x, task_type = NULL, clone = FALSE, ...) { # nolint
UseMethod("as_measure")
}

#' @export
#' @rdname as_measure
as_measure.NULL = function(x, task_type = NULL, ...) { # nolint
as_measure.NULL = function(x, task_type = NULL, clone = FALSE, ...) { # nolint
assert_empty_ellipsis(...)
default_measures(task_type)[[1L]]
}
Expand All @@ -30,24 +30,24 @@ as_measure.Measure = function(x, task_type = NULL, clone = FALSE, ...) { # nolin

#' @export
#' @rdname as_measure
as_measures = function(x, task_type = NULL, ...) { # nolint
as_measures = function(x, task_type = NULL, clone = FALSE, ...) { # nolint
UseMethod("as_measures")
}

#' @export
#' @rdname as_measure
as_measures.default = function(x, task_type = NULL, ...) { # nolint
as_measures.default = function(x, task_type = NULL, clone = FALSE, ...) { # nolint
list(as_measure(x, task_type = task_type, ...))
}

#' @export
#' @rdname as_measure
as_measures.NULL = function(x, task_type = NULL, ...) { # nolint
as_measures.NULL = function(x, task_type = NULL, clone = FALSE, ...) { # nolint
default_measures(task_type)
}

#' @export
#' @rdname as_measure
as_measures.list = function(x, task_type = NULL, ...) { # nolint
as_measures.list = function(x, task_type = NULL, clone = FALSE, ...) { # nolint
lapply(x, as_measure, task_type = NULL, ...)
}
5 changes: 5 additions & 0 deletions man/LearnerRegr.Rd

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

18 changes: 9 additions & 9 deletions man/as_measure.Rd

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

0 comments on commit 5b5fbbb

Please sign in to comment.