Neuron 101

A neural network from scratch / Backpropagation

Türkçe

Plate50

Unit 5 · Topic 8 of 12

Backpropagation

Hard, 9 min, 9 steps

0.80−0.400.300.901.20−0.701x₁0.50x₂0.67h₁0.63h₂0.64ŷ, target 0
Keyboard: left and right arrows change the step, space plays and pauses.

Step 1 of 9 Forward

First the forward pass

The input went through the network: h₁ = 0.668, h₂ = 0.634, ŷ = 0.636. The target is t = 0. Backpropagation reuses these values.

Open in Colab
  1. # h1, h2 ve y ileri yayılımdan
  2. L = 0.5 * (y - t) ** 2
  3. dy = (y - t) * y * (1 - y)
  4. gv1, gv2 = dy * h1, dy * h2
  5. d1 = dy * v1 * h1 * (1 - h1)
  6. d2 = dy * v2 * h2 * (1 - h2)
  7. g11, g21 = d1 * x1, d1 * x2
  8. g12, g22 = d2 * x1, d2 * x2
  9. lr = 1.0
  10. v1 -= lr * gv1
  11. c -= lr * dy
  12. w11 -= lr * g11
  13. b1 -= lr * d1
  14. # diğer ağırlıklar da aynı biçimde
x1
1
x2
0.50
h1
0.67
h2
0.63
y
0.64