Figure 1: Gradient Descent on a convex function
In Gradient Descent example we saw how we can minimize a function. If we want to show the animation of gradient descent we can write the program as below.
Below program uses matplotlib and FuncAnimation to show the animation.
At each iteration of gradient descent, we store the values of (x, y) in a list. In animation function we iterate this list to show the animation.