Skip to content

Instantly share code, notes, and snippets.

@RaphaelS1
Last active April 18, 2021 08:15
Show Gist options
  • Save RaphaelS1/6d493eea6630b401f891620789001e51 to your computer and use it in GitHub Desktop.
Save RaphaelS1/6d493eea6630b401f891620789001e51 to your computer and use it in GitHub Desktop.
library(paradox)
search_space <- ps(
 ## p_dbl for numeric valued parameters
 dropout = p_dbl(lower = 0, upper = 1),
 weight_decay = p_dbl(lower = 0, upper = 0.5),
 learning_rate = p_dbl(lower = 0, upper = 1),
 ## p_int for integer valued parameters
 nodes = p_int(lower = 1, upper = 32),
 k = p_int(lower = 1, upper = 4)
)
search_space$trafo <- function(x, param_set) {
 x$num_nodes = rep(x$nodes, x$k)
 x$nodes = x$k = NULL
 return(x)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment