Optimizer class
Optimizer.Rd
This class defines the optimization technique.
Public fields
id
(
character(1)
)
The id of the object.print_trace
(
logical(1)
Indicator whether to print the status of$optimize()
.
Active bindings
lr
(
numeric(1
) Step size of the algorithm.archive
(
data.table()
) Archive of all calls to$eval_store
.objective
(
Objective
) The objective function.x
(
numeric()
) The numerical input vector used as starting point by$optimize()
.
Methods
Method new()
Creates a new instance of this R6 class.
Usage
Optimizer$new(objective, x_start, id = NULL, print_trace = TRUE)
Arguments
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
.id
(
character(1)
)
Id of the object.print_trace
(
logical(1)
)
Indicator whether to print the status of$optimize()
.
Method prepare_update_for_archive()
Prepare updates for adding them to the archive.
Usage
Optimizer$prepare_update_for_archive(
x_out,
x_in,
update,
fval_out,
fval_in,
lr,
step_size,
objective,
step,
...
)
Arguments
x_out
(
numeric()
) The new proposed point by the optimizer.x_in
(
numeric()
) The old input value which is updated tox_out
.update
(
numeric()
) The update fromx_in
tox_out
.fval_out
(
numeric(1)
) The objective valueobjetive$eval(x_out)
.fval_in
(
numeric(1)
) The objective valueobjetive$eval(x_in)
.lr
(
numeric(1)
) The learning rate used to multiplyupdate
with.step_size
(
numeric(1)
) The step_size used to multiplylr * update
with.objective
(
Objective
) The objective used by$optimize()
.step
(
integer(1)
) The step or iteration....
Additional objects added to the archive (e.g.
momentum
).
Returns
data.table()
of the input arguments.
Method update_archive()
Add points to the archive.
Arguments
ain
data.table()
with names "x_out", "x_in", "update", "fval_out", "fval_in", "lr", "objective", and "step".
Method set_x()
Set the current input vector used as start point of $optimize()
.
Arguments
x
(
numeric()
) Input vector.