
Begin A Greedy Multiple Kernel Design Search
Source:R/greedy_multiple_kernel_search.R
initGreedyMultipleKernelExperimentalDesignObject.RdThis method creates an object of type greedy_multiple_kernel_experimental_design and will immediately initiate
a search through allocation space for forced balance designs. For debugging, you can use set the seed
parameter and num_cores = 1 to be assured of deterministic output.
Usage
initGreedyMultipleKernelExperimentalDesignObject(
X = NULL,
kernel_names = NULL,
Kgrams = NULL,
kernel_weights = NULL,
objective = "added_pct_reduction",
maximum_gain_scaling = TRUE,
nT = NULL,
max_designs = 10000,
kernel_pre_num_designs = 1000,
wait = FALSE,
start = TRUE,
max_iters = Inf,
semigreedy = FALSE,
diagnostics = FALSE,
num_cores = 1,
seed = NULL,
verbose = TRUE,
use_safe_inverse = FALSE
)Arguments
- X
The design matrix with $n$ rows (one for each subject) and $p$ columns (one for each measurement on the subject). This parameter must be specified unless you choose objective type
"kernel"in which case, theKgramsparameter must be specified.- kernel_names
A vector of M >= 1 strings indicating the kernels to be used. Valid values are "
mahalanobis", "gaussian", "laplacian", "exponential", "inv_mult_quad", "poly_2", "poly_3". Or a special value "manual" to indicate the kernels are specified manually using theKgramsparameter.- Kgrams
A list of M >= 1 elements where each is a
n x nmatrix whose entries are the evaluation of the kernel function between subject i and subject j. Default isNULL.- kernel_weights
A vector of M weights for each kernel which should sum to 1. Default is
NULLwhich specifies equal weighting.- objective
The method used to aggregate the kernel objective functions together. Default is "added_pct_reduction".
- maximum_gain_scaling
Should we scale the kernels to have the same maximum gain? Default is
TRUE.- nT
The number of treatments to assign. Default is
NULLwhich is for forced balance allocation i.e. nT = nC = n / 2 where n is the number of rows in X (or Kgram if X is unspecified).- max_designs
The maximum number of designs to be returned. Default is 10,000. Make this large so you can search however long you wish as the search can be stopped at any time by using the
stopSearchmethod.- kernel_pre_num_designs
The number of initial designs to search through before starting the greedy search for each kernel. Default is
1000.- wait
Should the
Rterminal hang until allmax_designsvectors are found? The deafult isFALSE.- start
Should we start searching immediately (default is
TRUE).- max_iters
The maximum number of iterations of the greedy search algorithm to run. Default is
Inf.- semigreedy
Should we use a fully greedy approach or the quicker semi-greedy approach? The default is
FALSEcorresponding to the fully greedy approach.- diagnostics
Should the objective function values at each iteration be saved? Default is
FALSE.- num_cores
The number of CPU cores to use for the search. Default is 1.
- seed
The set to set for deterministic output. This should only be set if
num_cores = 1otherwise the output will not be deterministic. Default isNULLfor no seed set.- verbose
Should the algorithm emit progress output? Default is
TRUE.- use_safe_inverse
Should a regularized inverse be used for the Mahalanobis objective? Default is
FALSE.
Value
An object of type greedy_multiple_kernel_experimental_design which can be further operated upon
Examples
if (FALSE) { # \dontrun{
library(MASS)
data(Boston)
#pretend the Boston data was an experiment setting
#first pull out the covariates
X = Boston[, 1 : 13]
#begin the greedy design search
mk = initGreedyMultipleKernelExperimentalDesignObject(X,
max_designs = 100, num_cores = 3, kernel_names = c("mahalanobis", "gaussian"))
#wait
res = resultsMultipleKernelGreedySearch(mk, max_vectors = 2)
design = res$ending_indicTs[1, ] #ordered already by best-->worst
design
#how far have we come of the 100 we set out to do?
mk
#we can cut it here
stopSearch(mk)
} # }