This function creates optimizer functions with arguments.
Usage
h_get_optimizers(
optimizer = c("L-BFGS-B", "BFGS", "CG", "nlminb"),
optimizer_fun = h_optimizer_fun(optimizer),
optimizer_args = list(),
optimizer_control = list()
)
Arguments
- optimizer
(
character
)
names of built-in optimizers to try, subset of "L-BFGS-B", "BFGS", "CG" and "nlminb".- optimizer_fun
(
function
orlist
offunction
)
alternatively tooptimizer
, an optimizer function or a list of optimizer functions can be passed directly here.- optimizer_args
(
list
)
additional arguments foroptimizer_fun
.- optimizer_control
(
list
)
passed to argumentcontrol
inoptimizer_fun
.
Value
Named list
of optimizers created by h_partial_fun_args()
.
Details
If you want to use only the built-in optimizers:
optimizer
is a shortcut to create a list of built-in optimizer functions passed tooptimizer_fun
.Allowed are "L-BFGS-B", "BFGS", "CG" (using
stats::optim()
with corresponding method) and "nlminb" (usingstats::nlminb()
).Other arguments should go into
optimizer_args
.
If you want to use your own optimizer function:
Make sure that there are three arguments: parameter (start value), objective function and gradient function are sequentially in the function arguments.
If there are other named arguments in front of these, make sure they are correctly specified through
optimizer_args
.If the hessian can be used, please make sure its argument name is
hessian
and please add attributeuse_hessian = TRUE
to the function, usingattr(fun, "use_hessian) <- TRUE
.