Newton-Raphson optimizer
OptimizerNR.RdImplements Newton-Raphson updates by combining gradients and Hessians of the objective with optional Armijo backtracking. Falls back to the gradient direction when the Hessian is singular or indefinite.
Super class
vistool::Optimizer -> OptimizerNR
Methods
Method new()
Creates a new Newton-Raphson optimizer.
Usage
OptimizerNR$new(
objective,
x_start,
step_size = 1,
gamma = 0.99,
tau = 0.5,
max_backtracks = 20L,
fallback = c("gradient", "stop"),
id = "Newton-Raphson",
print_trace = TRUE
)Arguments
objective(
Objective)
The objective to optimize.objective(
Objective)
The objective to optimize.x_start(
numeric())
Start value of the optimization. Note, after the first call of$optimize()the last value is used to continue optimization. Get this value with$x.x_start(
numeric())
Start value of the optimization. Note, after the first call of$optimize()the last value is used to continue optimization. Get this value with$x.step_size(
numeric(1)) Initial step size used as the starting value for line search. Default1.gamma(
numeric(1)) Armijo slope parameter in(0, 1).tau(
numeric(1)) Multiplicative backtracking factor in(0, 1).max_backtracks(
integer(1)) Maximum number of Armijo backtracking attempts.fallback(
character(1)) Strategy when the Hessian cannot be inverted. One of "gradient" or "stop".id(
character(1))
Id of the object.id(
character(1))
Id of the object.print_trace(
logical(1))
Indicator whether to print the status of$optimize().print_trace(
logical(1))
Indicator whether to print the status of$optimize().
Method optimize()
Optimize the associated objective for a number of steps.
Arguments
steps(
integer(1))
Number of steps/iterations.step_size_control(
function()) Optional callback with signature(x, u, obj, opt)returning a scalar step size. Defaults to Armijo backtracking that uses the configuredgamma,tau, andmax_backtracksparameters.minimize(
logical(1)) Whether to minimize the objective. Defaults toself$objective$minimize. Maximization is not supported and triggers an error.
Method gamma()
Access or update the Armijo slope parameter.