This project generates animations of pytorch optimizers solving toy problems. Examples Below.
Some nice animations were posted a few years ago by Alex Radford but didn't include the Adam optimizer or landscapes with noise. Louis Tiao blogged about how to make the visualizations. The pytorch unit tests show how to run the optimizers on test functions. I pulled these together and shared the result at https://github.com/wassname/viz_torch_optim.
Please note that each optimizer has a differen't learning rate, so they are not directly comparable. This is because simpler optimizers perform better on low dimensional problems and are often given a smaller learning rate. With the same learning rate, the simpler SGD optimizer races to the finish while Adam crawls along. In that case SGD is too fast to see and Adam is too boring to watch. For visualisation purposes I used differen't learning rates for each optimizer to make them move at similar speeds in the video.
Beales function (cyclic annealing)
Beales function with noise
Six humped camel function
git clone https://github.com/wassname/viz_torch_optim
- open main.ipynb
- install any missing dependencies with pip
- Run and wait, because rendering video is quite slow