bSMED: Class providing object with methods for bSMED

Description Usage Format Value Fields Methods Examples

Description

Class providing object with methods for bSMED

Usage

1

Format

R6Class object.

Value

Object of R6Class with methods for running a bSMED experiment.

Fields

X

Design matrix

Z

Responses

b

batch size to select each iteration

nb

Number of batches, includes the first iteration taking X0

D

Dimension of data

Xopts

Available points

X0

Initial design

package

Which GP package to use in IGP. Default is "laGP" and probably is best choice.

stats

List of tracked stats

iteration

Which iteration

mod

The GP model from IGP

func

The function to maximize

func_run_together

Should the new points to evaluate be passed to func as a matrix of all new points in row or each separately as a vector. The matrix form (TRUE) lets you have all points passed at once to your function.

func_fast

Whether the function is fast to evaluate and thus can be used to estimate MSE and plot it. Probably TRUE for simple tests, but FALSE for real experiments

obj

Character telling what the objective function is, e.g. max or grad

obj_func

Function to evaluate the objective

obj_alpha

A parameter that can be used to have model focus on uncertain areas when model is poor. Not implemented now.

scale_obj

If the objective is not in [0,1), then this will scale it so it works with this method. Also can choose whether use_alpha. Either way the lowest value is scaled to zero. Both choices for use_alpha do similar things, not sure which is better.

n0

How many points were in initial design, not important since X0 must be given in

alpha

Estimated parameter. Scalar if scale_obj==FALSE as in paper. Vector with lower and upper bounds of p if scale_obj==TRUE, this is my own addition, not in paper.

use_alpha

Whether alpha should be estimated and used. This should be TRUE if function output is in [0,1) as required in paper. Can be FALSE if usings scale_obj.

alpha_regression_i_values

Values used to estimate alpha (iteration)

alpha_regression_p_values

Values used to estimate alpha (max func value)

gamma

Power used in energy

gammamax

A maximum value for gamma, a fraction is used based on the iteration

tau

Threshold for design region adaptation

kappa

Parameter for design region adaptation

delta

A small positive number to make sure the algorithm converges. The paper doesn't mention what value to use, 1e-3 seems to work but I have no clue.

Xopts_removed

Xopts values that were removed by the design region adaptation

pX

p values for rows of X

pXopts

p values for rows of Xopts

qX

q values for rows of q

qXopts

p values for rows of Xopts

p

Function used to calculate energy based on the model.

use_design_region_fix

I think it makes more sense to use the quantile of the average instead of the average of the quantiles. FALSE does what is in paper and is default.

exchange_algorithm_restarts

How many restarts for exchange algorithm. I didn't see a difference with more restarts.

parallel

Should the new values be calculated in parallel? Not for the model, for getting actual new Z values. Can cause trouble since I haven't used it much.

parallel_cores

Number of cores used for parallel

parallel_cluster

The object for the cluster currently running

verbose

0 means print nothing, 1 means print somewhat important things, 2 means print a lot. Not much implemented though.

Methods

Documentation

For full documentation of each method go to https://github.com/CollinErickson/bSMED

new(D, package="laGP", obj=NULL, func, func_run_together=FALSE, func_fast=TRUE, use_alpha=TRUE, scale_obj=NULL, delta=1e-3, use_design_region_fix = FALSE, exchange_algorithm_restarts=1, X0, Xopts, b, nb, estimate.nugget=FALSE, set.nugget=1e-8, parallel=FALSE, parallel_cores="detect", verbose=0, ...)

This method is used to create object of this class. User must give D, func, X0, Xopts, b, and nb.

run(maxit=self$nb - self$iteration + 1, plotlastonly=F, noplot=F)

This method run the model. It runs maxit iterations, which defaults to the end of the experiment as determined by nb. plotlastonly only shows last plot, noplot shows no plots.

run1(plotit=TRUE)

This method runs a single iteration. It plots the results if plotit==TRUE.

plot1()

This method plots the the current model.

print_results(give_best_prediction=TRUE)

This prints the best design point found in the experiment. If give_best_prediction==TRUE, it prints where it thinks the maximum of the surface is.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
set.seed(0)
a <- bSMED$new(D=2,func=TestFunctions::gaussian1, obj="func",
     n0=0,b=3, nb=5,
     X0=lhs::maximinLHS(20,2),
     Xopts=lhs::maximinLHS(500,2),
     parallel=FALSE)
a$run()
set.seed(1)
a <- bSMED$new(D=2,func=TestFunctions::quad_peaks_slant,
     obj="func", n0=0,b=3, nb=5,
     X0=lhs::maximinLHS(20,2),
     Xopts=lhs::maximinLHS(500,2),
     use_alpha=TRUE, package="laGP",
     parallel=FALSE, func_fast=TRUE,
     use_design_region_fix=TRUE)
a$run()

CollinErickson/bSMED documentation built on May 6, 2019, 12:27 p.m.