Skip to content

Consolidate outcome_names() and .get_tune_outcome_names() #1002

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
hfrick opened this issue Apr 17, 2025 · 0 comments
Open

Consolidate outcome_names() and .get_tune_outcome_names() #1002

hfrick opened this issue Apr 17, 2025 · 0 comments
Labels
upkeep maintenance, infrastructure, and similar

Comments

@hfrick
Copy link
Member

hfrick commented Apr 17, 2025

When reviewing #994 I noticed that we have outcome_names() with methods for different objects and also .get_tune_outcome_names() (as part of various .get_tune_*() functions).

We can consolidate .get_tune_outcome_names() with outcome_names.tune_results():

tune/R/outcome-names.R

Lines 53 to 63 in a8f0c05

#' @export
#' @rdname outcome_names
outcome_names.tune_results <- function(x, ...) {
att <- attributes(x)
if (any(names(att) == "outcomes")) {
res <- att$outcomes
} else {
res <- NA_character_
}
res
}

tune/R/utils.R

Lines 208 to 218 in a8f0c05

#' @export
#' @rdname tune_accessor
.get_tune_outcome_names <- function(x) {
x <- attributes(x)
if (any(names(x) == "outcomes")) {
res <- x$outcomes
} else {
res <- character(0)
}
res
}

@hfrick hfrick added the upkeep maintenance, infrastructure, and similar label Apr 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upkeep maintenance, infrastructure, and similar
Projects
None yet
Development

No branches or pull requests

1 participant