JM
  • Home
  • Projects
  • Resume

Gradient Descent Convergence Visualizer

Try the live demo → · View the code on GitHub →

I built an interactive Shiny for Python app for exploring how gradient descent behaves under different objective functions, learning rates, and starting points. The visualizer includes three optimization surfaces with distinct geometry: a Quadratic Bowl, the Rosenbrock Function, and a Saddle Point.

You can adjust the learning rate, iteration count, and starting point and watch the optimization path update on a contour plot. This makes it possible to see how the same algorithm can converge quickly, oscillate, or diverge depending on the objective surface and parameter choices.

Alongside the optimization path, the app tracks loss and gradient norm across iterations. These diagnostics make it easier to distinguish successful convergence from behavior such as overshooting, slow progress through the Rosenbrock valley, or movement near the saddle point.

Skills used

Python · Shiny for Python · NumPy · Matplotlib · Numerical methods

Try it yourself

Try the live visualizer →

If you’re new to gradient descent, start with the Quadratic Bowl and a moderate learning rate. The contour plot shows the path taken toward the minimum, while the loss and gradient norm show how quickly the algorithm is converging.

Then try increasing the learning rate until the path begins to oscillate or diverge. For a more difficult example, switch to the Rosenbrock Function: its narrow, curved valley makes reaching the minimum much more sensitive to the learning rate and starting point.