Skip to content

Commit

Permalink
forgot a few
Browse files Browse the repository at this point in the history
  • Loading branch information
mb706 committed Jun 10, 2024
1 parent a70ac43 commit 188e82e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion R/Domain_methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ domain_test = function(param, values) isTRUE(domain_check(param, values))
#' This should be the number of discrete possible levels for discrete type [`Domain`]s such as [`p_int()`] or [`p_fct()`], and
#' `Inf` for continuous or untyped parameters.
#'
#' @param x (`Domain`).
#' @param param (`Domain`).
#' @return `numeric`.
#' @keywords internal
#' @export
Expand Down
4 changes: 3 additions & 1 deletion R/ParamSet.R
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ ParamSet = R6Class("ParamSet",
if (is.data.frame(x)) x = as.list(x)
assert_list(x, names = "unique")
trafos = private$.trafos[names(x), .(id, trafo), nomatch = 0]
value = NULL # static checks
trafos[, value := x[id]]
if (nrow(trafos)) {
transformed = pmap(trafos, function(id, trafo, value) trafo(value))
Expand Down Expand Up @@ -547,6 +548,7 @@ ParamSet = R6Class("ParamSet",
x = t(x)
params = private$.params[rownames(x), on = "id"]
params$result = list()
result = NULL # static checks
params[, result := list(as.list(as.data.frame(t(matrix(domain_qunif(recover_domain(.SD, .BY), x[id, ]), nrow = .N))))),
by = c("cls", "grouping")]
as.data.table(set_names(params$result, params$id))
Expand Down Expand Up @@ -750,7 +752,7 @@ ParamSet = R6Class("ParamSet",
# convert all integer params really to storage type int, move doubles to within bounds etc.
# solves issue #293, #317
nontt = discard(xs, inherits, "TuneToken")

values = special_vals = NULL # static checks
sanitized = set(private$.params[names(nontt), on = "id"], , "values", list(nontt))[
!pmap_lgl(list(special_vals, values), has_element),
.(id, values = domain_sanitize(recover_domain(.SD, .BY), values)), by = c("cls", "grouping")]
Expand Down
2 changes: 1 addition & 1 deletion R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# data.table-variables to announce:
# .init_given, .trafo

utils::globalVariables(c("J", "id", "original_id", "owner_ps_index", ".tags", "tag", ".trafo", ".", "cargo", "default", "cls", "cond", "on"))
utils::globalVariables(c("J", "id", "original_id", "owner_ps_index", ".tags", "tag", ".trafo", "trafo", ".", "cargo", "default", "cls", "cond", "on"))

.onLoad = function(libname, pkgname) { # nolint
# nocov start
Expand Down
2 changes: 1 addition & 1 deletion man/domain_nlevels.Rd

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

0 comments on commit 188e82e

Please sign in to comment.