JJoeven

Exercises / math

One gradient descent step

f(x) = (x-3)**2 has slope 2*(x-3). step(x, lr) returns x - lr * slope. Print the new x starting from 0 with lr 0.25.

Live Pythonpython
Output
Run to execute this in your browser. Nothing is sent to a server.