a reproducible gallery of statistical graphics
In the animation package, there is a function named
grad.desc()
. It provides a visual illustration for the process of minimizing a real-valued
function through the Gradient Descent Algorithm.
The two examples below show you how to use the grad.desc()
function.
The default objective function in grad.desc()
is . The arrows will take
you to the minima step by step:
This example shows how the gradient descent algorithm will fail with a too large step length.
To find a local minimum of a bivariate objective function:
Apparently the arrows get lost eventually. You can replace gamma=0.3
with a smaller value and
retry the function.