The Gradient Descent Algorithm

Follow the gradient to the optimum. FIXME

Animations

Demonstration of the Gradient Descent Algorithm
loading animation frames... 0%

The arrows will take you to the optimum step by step.

When Gradient Descent Algorithm Fails
loading animation frames... 0%

This example shows how the gradient descent algorithm will fail with a too large step length.

R code

library(animation)
# gradient descent works
oopt = ani.options(ani.height = 500, ani.width = 500, outdir = getwd(), interval = 0.3,
    nmax = 50, title = "Demonstration of the Gradient Descent Algorithm",
    description = "The arrows will take you to the optimum step by step.")
ani.start()
grad.desc()
ani.stop()
ani.options(oopt)
 
# gradient descent fails
oopt = ani.options(ani.height = 480, ani.width = 480, outdir = getwd(), interval = 0.2,
    nmax = 70, title = "When Gradient Descent Algorithm Fails",
    description = "This example shows how the gradient descent algorithm will fail with 
    a too large step length.")
ani.start()
f2 = function(x, y) sin(1/2 * x^2 - 1/4 * y^2 + 3) *
    cos(2 * x + 1 - exp(y))
grad.desc(f2, c(-2, -2, 2, 2), c(-1, 0.5), gamma = 0.3, tol = 1e-04)
ani.stop()
ani.options(oopt)
 
compstat/gradient_descent_algorithm.txt · Last modified: 2009/01/07 00:06 by 218.107.132.124
 
Recent changes RSS feed Creative Commons License Donate to AniWiki Contribute Your Ideas! Driven by DokuWiki