Neuron 101

A neural network from scratch / Forward pass

Türkçe

Plate48

Unit 5 · Topic 6 of 12

Forward pass

Medium, 7 min, 8 steps

1x₁0.50x₂
Keyboard: left and right arrows change the step, space plays and pauses.

Step 1 of 8 Input

Input

Two numbers enter the network: x₁ = 1, x₂ = 0.50. Tap an input node to type another value.

Open in Colab
  1. import math
  2. def s(z):
  3. return 1 / (1 + math.exp(-z))
  4. x1, x2, t = 1.0, 0.5, 0.0
  5. z1 = 0.8 * x1 + -0.4 * x2 + 0.1
  6. z2 = 0.3 * x1 + 0.9 * x2 + -0.2
  7. h1, h2 = s(z1), s(z2)
  8. z = 1.2 * h1 + -0.7 * h2 + 0.2
  9. y = s(z)
  10. L = 0.5 * (y - t) ** 2
  11. print(y, L)
x1
1
x2
0.50
h1
0.67
h2
0.63
y
0.64