compare.adaptR6: Class providing object with methods for...

Description Format Value Methods Public fields Methods Examples

Description

Class providing object with methods for adapt.concept2.sFFLHD.R6

Class providing object with methods for adapt.concept2.sFFLHD.R6

Format

R6Class object.

Value

Object of R6Class with methods for running a comparison of adaptive experiments. You can set which parameters to use, and it will run experiments using all combinations. This object is used to run experiments and examine and plot output.

Methods

Documentation

For source code, go to https://github.com/CollinErickson/DOE-Code

new(X, Z, corr="Gauss", verbose=0, separable=T, useC=F,useGrad=T, parallel=T, nug.est=T, ...)

This method is used to create object of this class with X and Z as the data.

update(Xnew=NULL, Znew=NULL, Xall=NULL, Zall=NULL, restarts = 5, param_update = T, nug.update = self$nug.est)

This method updates the model, adding new data if given, then running optimization again.

Public fields

L

batch size

batches

Number of batches to run each for

reps

Number of replicates of each

forces

Can force values

force_vals

Can force values

b

batch size

func

Actual function to get experiment values from

D

Dimension of data

package

Which GP package to use in IGP

design

A string saying which design object should be used.

obj

A string saying what the objective is.

n0

The initial number of points to be selected.

force_old

A number saying how often the oldest candidate points should be forced into the design.

force_pvar

A number saying how often the points with the highest predictive variance should be forced into the design.

des_func

The desirability function.

alpha_des

The alpha constant for the weight function.

actual_des_func

The true des func used to evaluate the model, not known in practice

weight_const

The weight constant in the weight function, usually 1.

selection_method

What the selection method should be.

parallel

Should new values be calculated in parallel?

seed_start

A seed to be set for each run

func_string

The name of the function

save_output

Should the output be saved regularly?

stage1batches

Number of batches to be run in "stage 1," aka nonadaptively, chosen to be space filling

folder_name

Where should the files be saved?

folder_path

What is the path for the folder?

design_seed_start

Random seed for the designs

outdf

A data frame with all the output

outrawdf

A data frame with all the raw output

plotdf

A data frame with data to be plotted

enddf

A data frame with the output at the end of each simulation

meandf

A data frame of the output that has been grouped and taken the mean

meanlogdf

Same as meandf except some stats have been put on log scale

endmeandf

A data frame of the means at the end

rungridlist

A list of all runs

rungrid

A data frame of all runs

error_power

What power to put the error to for stat calculations. Either 0, 1, or c(0,1).

number_runs

Total number of runs to be done

completed_runs

Logical of whether each run is completed

pass_list

List of names of objects to be passed when using parallel

parallel_cores

Number of cores to use when running in parallel

parallel_cluster

If running in parallel, the parallel cluster

Methods

Public methods


Method new()

Initialize the R6 object

Usage
compare.adaptR6$new(
  func,
  D,
  L,
  b = NULL,
  batches = 10,
  reps = 5,
  obj = c("nonadapt", "grad"),
  force_old = c(0),
  force_pvar = c(0),
  n0 = 0,
  stage1batches = 0,
  save_output = F,
  func_string = NULL,
  seed_start = as.numeric(Sys.time()),
  design_seed_start = as.numeric(Sys.time()),
  package = "laGP",
  selection_method = "SMED",
  design = "sFFLHD",
  des_func = NA,
  alpha_des = 1,
  weight_const = 0,
  error_power = 1,
  actual_des_func = NULL,
  pass_list = list(),
  folder_name,
  parallel = FALSE,
  parallel_cores = "detect"
)
Arguments
func

The true function. Should take a matrix as input with D columns, each row is an X point. Or just each point as a vector, depends on func_run_together

D

Number of input dimensions. Should all be 0 to 1.

L

Batch size

b

Batch size to add each iteration

batches

Number of batches to run for

reps

Number of replicates of each combination

obj

Objective type

force_old

Proportion of points to be force added from Xopts because they are old.

force_pvar

Proportion of points to be force added from Xopts because they have highest predictive variance

n0

Number of points to start experiment with

stage1batches

Number of batches to be run in "stage 1," aka nonadaptively, chosen to be space filling

save_output

Should the output be saved regularly?

func_string

The name of the function

seed_start

A seed to be set for each run

design_seed_start

A seed to be set for the design points

package

Gaussian process model package to use

selection_method

How should points be selected?

design

The design to take candidate points from.

des_func

The desirability function

alpha_des

Alpha value for the desirability function

weight_const

What is the weight constant?

error_power

Which error power should be saved? Either 0, 1, or maybe c(0,1)?

actual_des_func

The actual des func

pass_list

List of things to pass to adapt concept for each.

folder_name

Where should the files be saved?

parallel

Should points be evaluated in parallel

parallel_cores

Number of parallel cores to be used.

useSMEDtheta

Should theta be used when SMED is used? Theta is the correlation parameter in each dimension. Helps space things properly

take_until_maxpvar_below

If given, nonadaptive batches will be taken instead of adaptive until max pvar is below this value.

new_batches_per_batch

Each time a batch is added, how many batches of points should be added as candidates


Method set_folder_name()

Set the folder name where this will be saved

Usage
compare.adaptR6$set_folder_name(folder_name, add_timestamp = FALSE)
Arguments
folder_name

Name of the folder to use

add_timestamp

Should the timestamp be included in the folder name?


Method create_output_folder()

Create the folder to save the output

Usage
compare.adaptR6$create_output_folder(add_timestamp = FALSE)
Arguments
add_timestamp

Not used.


Method run_all()

Run all remaining simulations

Usage
compare.adaptR6$run_all(
  redo = FALSE,
  noplot = FALSE,
  save_every = FALSE,
  run_order,
  parallel = self$parallel,
  parallel_temp_save = FALSE
)
Arguments
redo

Should already completed ones be redone?

noplot

Should plots not be made?

save_every

Should the object be saved after each simulation, or just at the end?

run_order

In what order should they be run?

parallel

Should it be run in parallel?

parallel_temp_save

Should temporary files be saved by each core when running in parallel? Useful if it crashes in the middle, can just recover from the files afterward.


Method run_one()

Run a single simulation

Usage
compare.adaptR6$run_one(
  irow = NULL,
  save_output = self$save_output,
  noplot = FALSE,
  is_parallel = FALSE
)
Arguments
irow

The simulation number to be run

save_output

Should the output be saved?

noplot

Should the plots not be made?

is_parallel

Is it running in a parallel environment?


Method add_result_of_one()

Add result of one simulation run to the results

Usage
compare.adaptR6$add_result_of_one(irow, newdf1, save_output = self$save_output)
Arguments
irow

The simulation number that was run

newdf1

The output data frame from that run

save_output

Should the output be saved?


Method postprocess_outdf()

Postprocess the output in outdf

Usage
compare.adaptR6$postprocess_outdf(save_output = self$save_output)
Arguments
save_output

Should the output be saved?


Method plot_MSE_over_batch()

Plot MSE by batch

Usage
compare.adaptR6$plot_MSE_over_batch(
  save_output = self$save_output,
  legend_labels = NULL
)
Arguments
save_output

Should the plot be saved?

legend_labels

Override the legend labels


Method plot_AWE_over_batch()

Ploted average weighted integrated weighted error by batch.

Usage
compare.adaptR6$plot_AWE_over_batch(save_output = self$save_output)
Arguments
save_output

Should the plot be saved?


Method plot_AWE_over_group()

Plot actual integrated weighted error by group

Usage
compare.adaptR6$plot_AWE_over_group(
  save_output = self$save_output,
  boxpl = TRUE,
  logy = TRUE
)
Arguments
save_output

Should the plot be saved?

boxpl

Should it be a box plot?

logy

Should the y axis be on the log scale?


Method plot_MSE_PVar()

Plot Predicted variance vs mean squared error

Usage
compare.adaptR6$plot_MSE_PVar(save_output = self$save_output)
Arguments
save_output

Should the plot be saved?


Method plot_RMSE_PRMSE()

Plot Predicted RMSE vs RMSE

Usage
compare.adaptR6$plot_RMSE_PRMSE(save_output = self$save_output)
Arguments
save_output

Should the plot be saved?


Method plot()

Make plots

Usage
compare.adaptR6$plot(save_output = self$save_output)
Arguments
save_output

Should the plots be saved?


Method plot_run_times()

Plot the time it took to run each one.

Usage
compare.adaptR6$plot_run_times()

Method save_self()

Save this object to file.

Usage
compare.adaptR6$save_self(object_name = "object")
Arguments
object_name

Name of object to save in file. By default it is "object".


Method delete_save_folder_if_empty()

Deletes the save folder if empty. Prevents empty folders from being left behind.

Usage
compare.adaptR6$delete_save_folder_if_empty()

Method recover_parallel_temp_save()

Recover temporary files that were saved while running in parallel if it crashed previously while running.

Usage
compare.adaptR6$recover_parallel_temp_save(save_if_any_recovered = TRUE)
Arguments
save_if_any_recovered

Should the object be saved immediately if it was able to recover files?


Method parallel_efficiency()

Calculate the parallel efficiency

Usage
compare.adaptR6$parallel_efficiency()

Method clone()

The objects of this class are cloneable with this method.

Usage
compare.adaptR6$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

1
2
3
4
5
6
ca1 <- compare.adaptR6$new(func=TestFunctions::gaussian1, D=2, L=3,
                           batches=2, reps=2,
                           n0=6, obj="desirability",
                           selection_method=c('max_des', 'SMED'),
                           des_func=c('des_func_relmax', 'des_func_relmax')
                           )$run_all()$plot()

CollinErickson/AdaptCompExp documentation built on April 13, 2020, 4:53 p.m.