Neuron 101

A neural network from scratch / Training loop

Türkçe

Plate52

Unit 5 · Topic 10 of 12

Training loop

Medium, 8 min, 10 steps

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

Step 1 of 10 Data

Data

The four dots are the outputs of a logic gate; at the start exclusive or. Reds are 1, blues 0. Tap a dot to change its expected output. A single neuron could not learn exclusive or; now a network with 3 hidden neurons will try.

Open in Colab
  1. X = [(0, 0), (0, 1), (1, 0), (1, 1)]
  2. Y = [0, 1, 1, 0]
  3. ag = rastgele_ag(3, 1)
  4. for epok in range(800):
  5. g = sifir_gradyan(ag)
  6. for x, t in zip(X, Y):
  7. h, y = ileri(ag, x)
  8. geri(ag, g, x, h, y - t)
  9. for k in ag:
  10. ag[k] -= 2.0 * g[k] / 4
  11. print(kayip(ag, X, Y))
epok
0
kayip
0.71
dogru
2