# \donttest{
### These examples require an activated Python environment as described in
### Bartz-Beielstein, T., Rehbach, F., Sen, A., and Zaefferer, M.:
### Surrogate Model Based Hyperparameter Tuning for Deep Learning with SPOT,
### June 2021. http://arxiv.org/abs/2105.14625.
PYTHON_RETICULATE <- FALSE
if(PYTHON_RETICULATE){
model <- "dl"
activeVars <- c("layers", "units", "epochs")
kerasConf <- getKerasConf()
kerasConf$active <- activeVars
cfg <- getModelConf("dl", active = activeVars)
lower <- cfg$lower
upper <- cfg$upper
types <- cfg$type
result <- spotKeras(x = NULL,
fun = funKerasMnist,
lower = lower,
upper = upper,
control = list(funEvals = 2,
noise = TRUE,
types = types,
plots = FALSE,
progress = TRUE,
seedFun = 1,
seedSPOT = 1,
designControl = list(size = 1)),
kerasConf = kerasConf,
kerasData = getMnistData(kerasConf))
# The result does contain the active parameters only. To get the full vector, use
active2All(x=result$xbest, a=activeVars, model=model)
}# }
Run the code above in your browser using DataLab