| Title: | Track Numerical Optimization |
|---|---|
| Description: | Tracks parameter values, gradients, and Hessians at each iteration of numerical optimizers. Useful for analyzing optimization progress, diagnosing issues, and studying convergence behavior. |
| Authors: | Lennart Oelschläger [aut, cre] |
| Maintainer: | Lennart Oelschläger <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 0.1.1 |
| Built: | 2026-05-12 17:18:15 UTC |
| Source: | https://github.com/loelschlaeger/trackopt |
nlm_track(): track nlm iterations
optim_track(): track optim iterations
summary(): summarize an optimization track
autoplot(): visualize a track with one or two parameters
nlm_track( f, p, target = NULL, npar = NULL, gradient = NULL, hessian = NULL, ..., iterations_max = 100, tolerance = 1e-06, typsize = rep(1, length(p)), fscale = 1, ndigit = 12, stepmax = max(1000 * sqrt(sum((p/typsize)^2)), 1000), steptol = 1e-06, minimize = TRUE, verbose = FALSE ) optim_track( f, p, target = NULL, npar = NULL, gradient = NULL, ..., iterations_max = 100, tolerance = 1e-06, lower = NULL, upper = NULL, method = c("Nelder-Mead", "BFGS", "CG", "L-BFGS-B", "SANN", "Brent"), control = list(), minimize = TRUE, verbose = FALSE ) ## S3 method for class 'trackopt' summary(object, ...) ## S3 method for class 'trackopt' autoplot(object, iteration = NULL, xlim = NULL, xlim2 = NULL, ...)nlm_track( f, p, target = NULL, npar = NULL, gradient = NULL, hessian = NULL, ..., iterations_max = 100, tolerance = 1e-06, typsize = rep(1, length(p)), fscale = 1, ndigit = 12, stepmax = max(1000 * sqrt(sum((p/typsize)^2)), 1000), steptol = 1e-06, minimize = TRUE, verbose = FALSE ) optim_track( f, p, target = NULL, npar = NULL, gradient = NULL, ..., iterations_max = 100, tolerance = 1e-06, lower = NULL, upper = NULL, method = c("Nelder-Mead", "BFGS", "CG", "L-BFGS-B", "SANN", "Brent"), control = list(), minimize = TRUE, verbose = FALSE ) ## S3 method for class 'trackopt' summary(object, ...) ## S3 method for class 'trackopt' autoplot(object, iteration = NULL, xlim = NULL, xlim2 = NULL, ...)
f |
[ By default, the first argument of Use |
p |
[ |
target |
[ If |
npar |
[ Specify If |
gradient |
[ Its arguments must match the arguments of |
hessian |
[ Its arguments must match the arguments of |
... |
Additional arguments passed to |
iterations_max |
[ |
tolerance |
[ |
typsize, fscale, ndigit, stepmax, steptol
|
Arguments passed on to |
minimize |
[ |
verbose |
[ |
lower, upper
|
[ |
method, control
|
Arguments passed on to Elements |
object |
[ |
iteration |
[ If This option is useful for creating animations with the R Markdown
|
xlim, xlim2
|
[ If |
A tibble with one row per stored iteration, including the starting point.
himmelblau <- function(x) { (x[1]^2 + x[2] - 11)^2 + (x[1] + x[2]^2 - 7)^2 } track <- nlm_track(f = himmelblau, p = c(0, 0)) summary(track) ggplot2::autoplot(track)himmelblau <- function(x) { (x[1]^2 + x[2] - 11)^2 + (x[1] + x[2]^2 - 7)^2 } track <- nlm_track(f = himmelblau, p = c(0, 0)) summary(track) ggplot2::autoplot(track)