buildLasso: Lasso Model Interface

Description Usage Arguments Value Examples

View source: R/buildLasso.R

Description

The purpose of this function is to provide an interface as required by spot, to enable modeling and model-based optimization with Lasso models.

Usage

1
buildLasso(x, y, control = list())

Arguments

x

matrix of input parameters. Rows for each point, columns for each parameter.

y

one column matrix of observations to be modeled.

control

list of control parameters, currently only with parameter formula. The useStep boolean specifies whether the step function is used. The formula is passed to the lm function. Without a formula, a second order model will be built.

Value

an object of class "spotLassoModel", with a predict method and a print method.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Test-function:
braninFunction <- function (x) {	
	(x[2]  - 5.1/(4 * pi^2) * (x[1] ^2) + 5/pi * x[1]  - 6)^2 + 
10 * (1 - 1/(8 * pi)) * cos(x[1] ) + 10
}
## Create design points
set.seed(1)
x <- cbind(runif(20)*15-5,runif(20)*15)
## Compute observations at design points (for Branin function)
y <- as.matrix(apply(x,1,braninFunction))
## Create model
fit <- buildLasso(x,y,control = list(algTheta=optimLHD))
## Print model parameters
print(fit)
## Predict at new location
predict(fit,cbind(1,2))
## True value at location
braninFunction(c(1,2))

SPOT documentation built on Oct. 23, 2021, 1:06 a.m.