| R6_hype {comparer} | R Documentation |
Hyperparameter optimization
Description
Hyperparameter optimization
Hyperparameter optimization
Public fields
XData frame of inputs that have been evaluated or will be evaluated next.
ZOutput at X
runtimeThe time it took to evaluate each row of X
parnamesNames of the parameters
parlowerrawLower bounds for each parameter on raw scale
parupperrawUpper bounds for each parameter on raw scale
parlowertransLower bounds for each parameter on transformed scale
paruppertransUpper bounds for each parameter on transformed scale
parlistList of all parameters
modlistA list with details about the model. The user shouldn't ever edit this directly.
ffexpAn ffexp R6 object used to run the experiment and store the results.
eval_funcThe function we evaluate.
extract_output_funcA function that takes in the output from 'eval_func' and returns the value we are trying to minimize.
par_all_ctsAre all the parameters continuous?
verboseHow much should be printed? 0 is none, 1 is standard, 2 is more, 5+ is a lot
Active bindings
modGaussian process model used to predict what the output will be.
Methods
Public methods
Method new()
Create hype R6 object.
Usage
R6_hype$new( eval_func, ..., X0 = NULL, Z0 = NULL, n_lhs, extract_output_func, verbose = 1, model = "GauPro", covtype = "matern5_2", nugget.estim = TRUE )
Arguments
eval_funcThe function used to evaluate new points.
...Hyperparameters to optimize over.
X0Data frame of initial points to run, or points already evaluated. If already evaluated, give in outputs in "Z0"
Z0Evaluated outputs at "X0".
n_lhsThe number that should initially be run using a maximin Latin hypercube.
extract_output_funcA function that takes in the output from 'eval_func' and returns the value we are trying to minimize.
verboseHow much should be printed? 0 is none, 1 is standard, 2 is more, 5+ is a lot
modelWhat package to fit the Gaussian process model with. Either "GauPro" or "DiceKriging"/"DK".
covtypeCovariance/correlation/kernel function for the GP model.
nugget.estimShould the nugget be estimated when fitting the GP model?
Method add_data()
Add data to the experiment results.
Usage
R6_hype$add_data(X, Z)
Arguments
XData frame with names matching the input parameters
ZOutput at rows of X matching the experiment output.
Method add_X()
Add new inputs to run. This allows the user to specify what they want run next.
Usage
R6_hype$add_X(X)
Arguments
XData frame with names matching the input parameters.
Method add_LHS()
Add new input points using a maximin Latin hypercube. Latin hypercubes are usually more spacing than randomly picking points.
Usage
R6_hype$add_LHS(n, just_return_df = FALSE)
Arguments
nNumber of points to add.
just_return_dfInstead of adding to experiment, should it just return the new set of values?
Method convert_trans_to_raw()
Convert parameters from transformed scale to raw scale.
Usage
R6_hype$convert_trans_to_raw(Xtrans)
Arguments
XtransParameters on the transformed scale
Method convert_raw_to_trans()
Convert parameters from raw scale to transformed scale.
Usage
R6_hype$convert_raw_to_trans(Xraw)
Arguments
XrawParameters on the raw scale
Method change_par_bounds()
Change lower/upper bounds of a parameter
Usage
R6_hype$change_par_bounds(parname, lower, upper)
Arguments
parnameName of the parameter
lowerNew lower bound. Leave empty if not changing.
upperNew upper bound. Leave empty if not changing.
Method add_EI()
Add new inputs to run using the expected information criteria
Usage
R6_hype$add_EI( n, covtype = NULL, nugget.estim = NULL, model = NULL, eps, just_return = FALSE, calculate_at )
Arguments
nNumber of points to add.
covtypeCovariance function to use for the Gaussian process model.
nugget.estimShould a nugget be estimated?
modelWhich package should be used to fit the model and calculate the EI? Use "DK" for DiceKriging or "GauPro" for GauPro.
epsExploration parameter. The minimum amount of improvement you care about.
just_returnJust return the EI info, don't actually add the points to the design.
calculate_atCalculate the EI at a specific point.
Method fit_mod()
Fit model to the data collected so far
Usage
R6_hype$fit_mod(covtype = NULL, nugget.estim = NULL, model = NULL)
Arguments
covtypeCovariance function to use for the Gaussian process model.
nugget.estimShould a nugget be estimated?
modelWhich package should be used to fit the model and calculate the EI? Use "DK" for DiceKriging or "GauPro" for GauPro.
Method run_all()
Run all unevaluated input points.
Usage
R6_hype$run_all(...)
Arguments
...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'
Method run_EI_for_time()
Add points using the expected information criteria, evaluate them, and repeat until a specified amount of time has passed.
Usage
R6_hype$run_EI_for_time( sec, batch_size, covtype = "matern5_2", nugget.estim = TRUE, verbose = 0, model = "GauPro", eps = 0, ... )
Arguments
secNumber of seconds to run for. It will go over this time limit, finish the current iteration, then stop.
batch_sizeNumber of points to run at once.
covtypeCovariance function to use for the Gaussian process model.
nugget.estimShould a nugget be estimated?
verboseVerbose parameter to pass to ffexp$
modelWhich package should be used to fit the model and calculate the EI? Use "DK" for DiceKriging or "GauPro" for GauPro.
epsExploration parameter. The minimum amount of improvement you care about.
...Passed into 'ffexp$run_all'.
Method plot()
Make a plot to summarize the experiment.
Usage
R6_hype$plot()
Method pairs()
Plot pairs of inputs and output
Usage
R6_hype$pairs()
Method plotorder()
Plot the output of the points evaluated in order.
Usage
R6_hype$plotorder()
Method plotX()
Plot the output as a function of each input.
Usage
R6_hype$plotX( addlines = TRUE, addEIlines = TRUE, covtype = NULL, nugget.estim = NULL, model = NULL )
Arguments
addlinesShould prediction mean and 95% interval be plotted?
addEIlinesShould expected improvement lines be plotted?
covtypeCovariance function to use for the Gaussian process model.
nugget.estimShould a nugget be estimated?
modelWhich package should be used to fit the model and calculate the EI? Use "DK" for DiceKriging or "GauPro" for GauPro.
Method plotXorder()
Plot each input in the order they were chosen. Colored by quality.
Usage
R6_hype$plotXorder()
Method plotinteractions()
Plot the 2D plots from inputs to the output. All other variables are held at their values for the best input.
Usage
R6_hype$plotinteractions(covtype = "matern5_2", nugget.estim = TRUE)
Arguments
covtypeCovariance function to use for the Gaussian process model.
nugget.estimShould a nugget be estimated?
Method print()
Print details of the object.
Usage
R6_hype$print(...)
Arguments
...not used
Method best_params()
Returns the best parameters evaluated so far.
Usage
R6_hype$best_params()
Method update_mod_userspeclist()
Updates the specifications for the GP model.
Usage
R6_hype$update_mod_userspeclist( model = NULL, covtype = NULL, nugget.estim = NULL )
Arguments
modelWhat package to fit the Gaussian process model with. Either "GauPro" or "DiceKriging"/"DK".
covtypeCovariance/correlation/kernel function for the GP model.
nugget.estimShould the nugget be estimated when fitting the GP model?
Method clone()
The objects of this class are cloneable with this method.
Usage
R6_hype$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Examples
# 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()