Neuron 101

Learning from examples / Learning rate

Türkçe

Plate28

Unit 3 · Topic 7 of 11

Learning rate

Medium, 7 min, 7 steps

05101520−202468stepweight, wbottom, w = 3
Keyboard: left and right arrows change the step, space plays and pauses.

Step 1 of 7 Axes

The weight's journey

The loss from the gradient descent topic: L(w) = (w − 3)² + 0.5, with its bottom at w = 3. The horizontal axis is the step, the vertical axis the weight. The yellow dot is the start, w = −1.

Open in Colab
  1. def egim(w):
  2. return 2 * (w - 3)
  3. def indir(w, lr, n=20):
  4. for _ in range(n):
  5. w = w - lr * egim(w)
  6. return w
  7. w0 = -1.0
  8. for lr in [0.05, 0.9, 1.05]:
  9. print(lr, indir(w0, lr))
  10. print(0.3, indir(w0, 0.3))
lr
0.30
w
3.00
adim
20