Description Usage Arguments Details Examples
Factory function for creating a (possibly uninitialized) optimizer.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51  make_mize(
method = "LBFGS",
norm_direction = FALSE,
scale_hess = TRUE,
memory = 5,
cg_update = "PR+",
preconditioner = "",
tn_init = 0,
tn_exit = "curvature",
nest_q = 0,
nest_convex_approx = FALSE,
nest_burn_in = 0,
step_up = 1.1,
step_up_fun = c("*", "+"),
step_down = NULL,
dbd_weight = 0.1,
line_search = "MoreThuente",
c1 = 1e04,
c2 = NULL,
step0 = NULL,
step_next_init = NULL,
try_newton_step = NULL,
ls_max_fn = 20,
ls_max_gr = Inf,
ls_max_fg = Inf,
ls_max_alpha_mult = Inf,
ls_max_alpha = Inf,
ls_safe_cubic = FALSE,
strong_curvature = NULL,
approx_armijo = NULL,
mom_type = NULL,
mom_schedule = NULL,
mom_init = NULL,
mom_final = NULL,
mom_switch_iter = NULL,
mom_linear_weight = FALSE,
use_init_mom = FALSE,
restart = NULL,
restart_wait = 10,
par = NULL,
fg = NULL,
max_iter = 100,
max_fn = Inf,
max_gr = Inf,
max_fg = Inf,
abs_tol = NULL,
rel_tol = abs_tol,
grad_tol = NULL,
ginf_tol = NULL,
step_tol = NULL
)

method 
Optimization method. See 'Details' of 
norm_direction 
If 
scale_hess 
if 
memory 
The number of updates to store if using the 
cg_update 
Type of update to use for the 
preconditioner 
Type of preconditioner to use in Truncated Newton.
Leave blank or set to 
tn_init 
Type of initialization to use in inner loop of Truncated
Newton. Use 
tn_exit 
Type of exit criterion to use when terminating the inner CG
loop of Truncated Newton method. Either 
nest_q 
Strong convexity parameter for the 
nest_convex_approx 
If 
nest_burn_in 
Number of iterations to wait before using a nonzero
momentum. Only applies if using the 
step_up 
Value by which to increase the step size for the 
step_up_fun 
Operator to use when combining the current step size with

step_down 
Multiplier to reduce the step size by if using the

dbd_weight 
Weighting parameter used by the 
line_search 
Type of line search to use. See 'Details' of

c1 
Sufficient decrease parameter for Wolfetype line searches. Should be a value between 0 and 1. 
c2 
Sufficient curvature parameter for line search for Wolfetype line
searches. Should be a value between 
step0 
Initial value for the line search on the first step. See
'Details' of 
step_next_init 
For Wolfetype line searches only, how to initialize
the line search on iterations after the first. See 'Details' of

try_newton_step 
For Wolfetype line searches only, try the line step
value of 1 as the initial step size whenever 
ls_max_fn 
Maximum number of function evaluations allowed during a line search. 
ls_max_gr 
Maximum number of gradient evaluations allowed during a line search. 
ls_max_fg 
Maximum number of function or gradient evaluations allowed during a line search. 
ls_max_alpha_mult 
The maximum value that can be attained by the ratio of the initial guess for alpha for the current line search, to the final value of alpha of the previous line search. Used to stop line searches diverging due to very large initial guesses. Only applies for Wolfetype line searches. 
ls_max_alpha 
Maximum value of alpha allowed during line search. Only
applies for 
ls_safe_cubic 
(Optional). If 
strong_curvature 
(Optional). If 
approx_armijo 
(Optional). If 
mom_type 
Momentum type, either 
mom_schedule 
Momentum schedule. See 'Details' of 
mom_init 
Initial momentum value. 
mom_final 
Final momentum value. 
mom_switch_iter 
For 
mom_linear_weight 
If 
use_init_mom 
If 
restart 
Momentum restart type. Can be one of "fn" or "gr". See
'Details' of 
restart_wait 
Number of iterations to wait between restarts. Ignored if

par 
(Optional) Initial values for the function to be optimized over. 
fg 
(Optional). Function and gradient list. See 'Details' of

max_iter 
(Optional). Maximum number of iterations. See the
'Convergence' section of 
max_fn 
(Optional). Maximum number of function evaluations. See the
'Convergence' section of 
max_gr 
(Optional). Maximum number of gradient evaluations. See the
'Convergence' section of 
max_fg 
(Optional). Maximum number of function or gradient evaluations.
See the 'Convergence' section of 
abs_tol 
(Optional). Absolute tolerance for comparing two function
evaluations. See the 'Convergence' section of 
rel_tol 
(Optional). Relative tolerance for comparing two function
evaluations. See the 'Convergence' section of 
grad_tol 
(Optional). Absolute tolerance for the length (l2norm) of
the gradient vector. See the 'Convergence' section of 
ginf_tol 
(Optional). Absolute tolerance for the infinity norm (maximum
absolute component) of the gradient vector. See the 'Convergence' section
of 
step_tol 
(Optional). Absolute tolerance for the size of the parameter
update. See the 'Convergence' section of 
If the function to be optimized and starting point are not present at
creation time, then the optimizer should be initialized using
mize_init
before being used with mize_step
.
See the documentation to mize
for an explanation of all the
parameters.
Details of the fg
list containing the function to be optimized and its
gradient can be found in the 'Details' section of mize
. It is
optional for this function, but if it is passed to this function, along with
the vector of initial values, par
, the optimizer will be returned
already initialized for this function. Otherwise, mize_init
must be called before optimization begins.
Additionally, optional convergence parameters may also be passed here, for
use with check_mize_convergence
. They are optional here if you
plan to call mize_init
later, or if you want to do your own
convergence checking.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22  # Function to optimize and starting point
rosenbrock_fg < list(
fn = function(x) {
100 * (x[2]  x[1] * x[1])^2 + (1  x[1])^2
},
gr = function(x) {
c(
400 * x[1] * (x[2]  x[1] * x[1])  2 * (1  x[1]),
200 * (x[2]  x[1] * x[1])
)
}
)
rb0 < c(1.2, 1)
# Create an optimizer and initialize it for use with the Rosenbrock function
opt < make_mize(method = "LBFGS", par = rb0, fg = rosenbrock_fg)
# Create optimizer without initialization
opt < make_mize(method = "LBFGS")
# Need to call mize_init separately:
opt < mize_init(opt, rb0, rosenbrock_fg)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.