View source: R/utils-testopt.R
test_optim | R Documentation |
test_optim()
function is useful to visualize how optimizers solve the
minimization problem by showing the convergence path using a test function.
User can choose any test optimization
functions
provided by torchopt
:
"beale"
, "booth"
, "bukin_n6"
, "easom"
, "goldstein_price"
,
"himmelblau"
, "levi_n13"
, "matyas"
, "rastrigin"
,
"rosenbrock"
, and "sphere"
.
Besides these functions, users can pass any function that receives two numerical values and returns a scalar.
Optimization functions are useful to evaluate characteristics of optimization algorithms, such as convergence rate, precision, robustness, and performance. These functions give an idea about the different situations that optimization algorithms can face.
Function test_function()
plot the 2D-space of a test optimization function.
test_optim(
optim,
...,
opt_hparams = list(),
test_fn = "beale",
steps = 200,
pt_start_color = "#5050FF7F",
pt_end_color = "#FF5050FF",
ln_color = "#FF0000FF",
ln_weight = 2,
bg_xy_breaks = 100,
bg_z_breaks = 32,
bg_palette = "viridis",
ct_levels = 10,
ct_labels = FALSE,
ct_color = "#FFFFFF7F",
plot_each_step = FALSE
)
optim |
Torch optimizer function. |
... |
Additional parameters (passed to |
opt_hparams |
A list with optimizer initialization parameters (default: |
test_fn |
A test function (default |
steps |
Number of steps to run (default |
pt_start_color |
Starting point color (default |
pt_end_color |
Ending point color (default |
ln_color |
Line path color (default |
ln_weight |
Line path weight (default |
bg_xy_breaks |
Background X and Y resolution (default |
bg_z_breaks |
Background Z resolution (default |
bg_palette |
Background palette (default |
ct_levels |
Contour levels (default |
ct_labels |
Should show contour labels? (default |
ct_color |
Contour color (default |
plot_each_step |
Should output each step? (default |
No return value, called for producing animated gifs
Rolf Simoes, rolf.simoes@inpe.br
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.