Aan de slagGa gratis aan de slag

Experimenting with momentum

In this exercise, your goal is to find the optimal momentum such that the optimizer can find the minimum of the following non-convex function \(x^{4} + x^{3} - 5x^{2}\) in 20 steps. You will experiment with two different momentum values. For this problem, the learning rate is fixed at 0.01.

You are provided with the optimize_and_plot() function that accepts as input the momentum parameter. This function will run 20 steps of the SGD optimizer and display the results.

Deze oefening maakt deel uit van de cursus

Introduction to Deep Learning with PyTorch

Cursus bekijken

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Try a first value for momentum
mom0 = ____
optimize_and_plot(momentum=mom0)
Code bewerken en uitvoeren