spot | R Documentation |
Sequential Parameter Optimization.
This is one of the main interfaces for using the SPOT package. Based on a user-given objective function
and configuration, spot
finds the parameter setting that yields the lowest objective value (minimization).
To that end, it uses methods from the fields of design of experiment, statistical modeling / machine learning
and optimization.
spot(x = NULL, fun, lower, upper, control = list(), ...)
x |
is an optional start point (or set of start points), specified as a matrix. One row for each point, and one column for each optimized parameter. |
fun |
is the objective function. It should receive a matrix x and return a matrix y.
In case the function uses external code and is noisy, an additional seed parameter may be used, see the |
lower |
is a vector that defines the lower boundary of search space. This determines also the dimensionality of the problem. |
upper |
is a vector that defines the upper boundary of search space. |
control |
is a list with control settings for spot. See |
... |
additional parameters passed to |
This function returns a list with:
xbest
Parameters of the best found solution (matrix).
ybest
Objective function value of the best found solution (matrix).
x
Archive of all evaluation parameters (matrix).
y
Archive of the respective objective function values (matrix).
count
Number of performed objective function evaluations.
msg
Message specifying the reason of termination.
modelFit
The fit of the last build model, i.e., an object returned by the last call to the function specified by control$model
.
## Only a few examples. More examples can be found in the vignette and in ## the paper "In a Nutshell -- The Sequential Parameter Optimization Toolbox", ## see https://arxiv.org/abs/1712.04076 ## 1. Most simple example: Kriging + LHS search + predicted mean optimization ## (not expected improvement) set.seed(1) res <- spot(x=NULL,funSphere,c(-2,-3),c(1,2), control=list(funEvals=15)) res$xbest res$ybest ## 2. With expected improvement set.seed(1) res <- spot(x=NULL,funSphere,c(-2,-3),c(1,2), control=list(funEvals=15, modelControl=list(target="ei"))) res$xbest res$ybest ### 3. Use local optimization instead of LHS search set.seed(1) res <- spot(,funSphere,c(-2,-3),c(1,2), control=list(funEvals=15, modelControl=list(target="ei"), optimizer=optimLBFGSB)) res$xbest res$ybest ### 4. Use transformed input values set.seed(1) f2 <- function(x){2^x} lower <- c(-100, -100) upper <- c(100, 100) transformFun <- rep("f2", length(lower)) res <- spot(x=NULL,funSphere,lower=lower, upper=upper, control=list(funEvals=15, modelControl=list(target="ei"), optimizer=optimLBFGSB, transformFun=transformFun)) res$xbest res$ybest
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.