R6_hype | R Documentation |
Hyperparameter optimization
Hyperparameter optimization
X
Data frame of inputs that have been evaluated or will be evaluated next.
Z
Output at X
runtime
The time it took to evaluate each row of X
parnames
Names of the parameters
parlowerraw
Lower bounds for each parameter on raw scale
parupperraw
Upper bounds for each parameter on raw scale
parlowertrans
Lower bounds for each parameter on transformed scale
paruppertrans
Upper bounds for each parameter on transformed scale
parlist
List of all parameters
modlist
A list with details about the model. The user shouldn't ever edit this directly.
ffexp
An ffexp R6 object used to run the experiment and store the results.
eval_func
The function we evaluate.
extract_output_func
A function that takes in the output from 'eval_func' and returns the value we are trying to minimize.
par_all_cts
Are all the parameters continuous?
verbose
How much should be printed? 0 is none, 1 is standard, 2 is more, 5+ is a lot
mod
Gaussian process model used to predict what the output will be.
new()
Create hype R6 object.
R6_hype$new( eval_func, ..., X0 = NULL, Z0 = NULL, n_lhs, extract_output_func, verbose = 1, model = "GauPro", covtype = "matern5_2", nugget.estim = TRUE )
eval_func
The function used to evaluate new points.
...
Hyperparameters to optimize over.
X0
Data frame of initial points to run, or points already evaluated. If already evaluated, give in outputs in "Z0"
Z0
Evaluated outputs at "X0".
n_lhs
The number that should initially be run using a maximin Latin hypercube.
extract_output_func
A function that takes in the output from 'eval_func' and returns the value we are trying to minimize.
verbose
How much should be printed? 0 is none, 1 is standard, 2 is more, 5+ is a lot
model
What package to fit the Gaussian process model with. Either "GauPro" or "DiceKriging"/"DK".
covtype
Covariance/correlation/kernel function for the GP model.
nugget.estim
Should the nugget be estimated when fitting the GP model?
add_data()
Add data to the experiment results.
R6_hype$add_data(X, Z)
X
Data frame with names matching the input parameters
Z
Output at rows of X matching the experiment output.
add_X()
Add new inputs to run. This allows the user to specify what they want run next.
R6_hype$add_X(X)
X
Data frame with names matching the input parameters.
add_LHS()
Add new input points using a maximin Latin hypercube. Latin hypercubes are usually more spacing than randomly picking points.
R6_hype$add_LHS(n, just_return_df = FALSE)
n
Number of points to add.
just_return_df
Instead of adding to experiment, should it just return the new set of values?
convert_trans_to_raw()
Convert parameters from transformed scale to raw scale.
R6_hype$convert_trans_to_raw(Xtrans)
Xtrans
Parameters on the transformed scale
convert_raw_to_trans()
Convert parameters from raw scale to transformed scale.
R6_hype$convert_raw_to_trans(Xraw)
Xraw
Parameters on the raw scale
change_par_bounds()
Change lower/upper bounds of a parameter
R6_hype$change_par_bounds(parname, lower, upper)
parname
Name of the parameter
lower
New lower bound. Leave empty if not changing.
upper
New upper bound. Leave empty if not changing.
add_EI()
Add new inputs to run using the expected information criteria
R6_hype$add_EI( n, covtype = NULL, nugget.estim = NULL, model = NULL, eps, just_return = FALSE, calculate_at )
n
Number of points to add.
covtype
Covariance function to use for the Gaussian process model.
nugget.estim
Should a nugget be estimated?
model
Which package should be used to fit the model and calculate the EI? Use "DK" for DiceKriging or "GauPro" for GauPro.
eps
Exploration parameter. The minimum amount of improvement you care about.
just_return
Just return the EI info, don't actually add the points to the design.
calculate_at
Calculate the EI at a specific point.
fit_mod()
Fit model to the data collected so far
R6_hype$fit_mod(covtype = NULL, nugget.estim = NULL, model = NULL)
covtype
Covariance function to use for the Gaussian process model.
nugget.estim
Should a nugget be estimated?
model
Which package should be used to fit the model and calculate the EI? Use "DK" for DiceKriging or "GauPro" for GauPro.
run_all()
Run all unevaluated input points.
R6_hype$run_all(...)
...
Passed into ‘ffexp$run_all'. Can set ’parallel=TRUE' to evaluate multiple points simultaneously as long as all needed variables have been passed to 'varlist'
run_EI_for_time()
Add points using the expected information criteria, evaluate them, and repeat until a specified amount of time has passed.
R6_hype$run_EI_for_time( sec, batch_size, covtype = "matern5_2", nugget.estim = TRUE, verbose = 0, model = "GauPro", eps = 0, ... )
sec
Number of seconds to run for. It will go over this time limit, finish the current iteration, then stop.
batch_size
Number of points to run at once.
covtype
Covariance function to use for the Gaussian process model.
nugget.estim
Should a nugget be estimated?
verbose
Verbose parameter to pass to ffexp$
model
Which package should be used to fit the model and calculate the EI? Use "DK" for DiceKriging or "GauPro" for GauPro.
eps
Exploration parameter. The minimum amount of improvement you care about.
...
Passed into 'ffexp$run_all'.
plot()
Make a plot to summarize the experiment.
R6_hype$plot()
pairs()
Plot pairs of inputs and output
R6_hype$pairs()
plotorder()
Plot the output of the points evaluated in order.
R6_hype$plotorder()
plotX()
Plot the output as a function of each input.
R6_hype$plotX( addlines = TRUE, addEIlines = TRUE, covtype = NULL, nugget.estim = NULL, model = NULL )
addlines
Should prediction mean and 95% interval be plotted?
addEIlines
Should expected improvement lines be plotted?
covtype
Covariance function to use for the Gaussian process model.
nugget.estim
Should a nugget be estimated?
model
Which package should be used to fit the model and calculate the EI? Use "DK" for DiceKriging or "GauPro" for GauPro.
plotXorder()
Plot each input in the order they were chosen. Colored by quality.
R6_hype$plotXorder()
plotinteractions()
Plot the 2D plots from inputs to the output. All other variables are held at their values for the best input.
R6_hype$plotinteractions(covtype = "matern5_2", nugget.estim = TRUE)
covtype
Covariance function to use for the Gaussian process model.
nugget.estim
Should a nugget be estimated?
print()
Print details of the object.
R6_hype$print(...)
...
not used
best_params()
Returns the best parameters evaluated so far.
R6_hype$best_params()
update_mod_userspeclist()
Updates the specifications for the GP model.
R6_hype$update_mod_userspeclist( model = NULL, covtype = NULL, nugget.estim = NULL )
model
What package to fit the Gaussian process model with. Either "GauPro" or "DiceKriging"/"DK".
covtype
Covariance/correlation/kernel function for the GP model.
nugget.estim
Should the nugget be estimated when fitting the GP model?
clone()
The objects of this class are cloneable with this method.
R6_hype$clone(deep = FALSE)
deep
Whether to make a deep clone.
# Have df output, but only use one value from it
h1 <- hype(
eval_func = function(a, b) {data.frame(c=a^2+b^2, d=1:2)},
extract_output_func = function(odf) {odf$c[1]},
a = par_unif('a', -1, 2),
b = par_unif('b', -10, 10),
n_lhs = 10
)
h1$run_all()
h1$add_EI(n = 1)
h1$run_all()
#system.time(h1$run_EI_for_time(sec=3, batch_size = 1))
#system.time(h1$run_EI_for_time(sec=3, batch_size = 3))
h1$plotorder()
h1$plotX()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.