Zo werkt een �neuraal netwerk
Schrijver: Brandon Rohrer. �NL vertaling: Martijn de Boer
Een afbeelding met vier pixels
Een afbeelding met vier pixels
solide
verticaal
diagonaal
horizontaal
Afbeeldingen Categoriseren
solide
verticaal
diagonaal
horizontaal
Afbeeldingen Categoriseren
solide
verticaal
diagonaal
horizontaal
Afbeeldingen Categoriseren
solide
verticaal
diagonaal
horizontaal
Eenvoudige regels zijn niet genoeg
solide
verticaal
diagonaal
horizontaal
Eenvoudige regels zijn niet genoeg
solid
vertical
diagonal
horizontal
Invoer neuronen
Pixel helderheid
-1.0
-.75
-.50
-.25
0.0
+.25
+.50
+.75
+1.0
Invoer vector
.75
-.75
0.0
.50
Receptieve velden
Een neuron
+
De totaalsom van alle invoers
+
.75
-.75
0.0
.50
.50
.50
0.00
-.75
.50
Gewichten (Weights)
+
.75
-.75
0.0
.50
.50
1.0
1.0
1.0
1.0
.50
0.00
-.75
.50
x 1.0
x 1.0
x 1.0
x 1.0
Gewichten (Weights)
+
.75
-.75
0.0
.50
-1.075
-.2
0.0
.8
-.5
.50
0.00
-.75
-1.075
-.2
0.0
.8
-.5
x
x
x
x
Gewichten (Weights)
+
.75
-.75
0.0
.50
-1.075
-.2
0.0
.8
-.5
.50
0.00
-.75
-1.075
-.2
0.0
.8
-.5
x
x
x
x
Activeer het resultaat
+
.75
-.75
0.0
.50
1.075
.746
Sigmoid activatie functie
1.0
.5
-1.0
-.5
1.0
.5
1.5
2.0
-1.0
-.5
-1.5
-2.0
Sigmoid activatie functie
1.0
.5
-1.0
-.5
1.0
.5
1.5
2.0
-1.0
-.5
-1.5
-2.0
Jouw nummer gaat hier in
Sigmoid activatie functie
1.0
.5
-1.0
-.5
1.0
.5
1.5
2.0
-1.0
-.5
-1.5
-2.0
Sigmoid activatie functie
1.0
.5
-1.0
-.5
1.0
.5
1.5
2.0
-1.0
-.5
-1.5
-2.0
De verbroken versie �komt hier uit
Sigmoid activatie functie
1.0
.5
-1.0
-.5
1.0
.5
1.5
2.0
-1.0
-.5
-1.5
-2.0
Sigmoid activatie functie
1.0
.5
-1.0
-.5
1.0
.5
1.5
2.0
-1.0
-.5
-1.5
-2.0
Het maakt niet uit met welke waarde je start, het antwoord blijft altijd tussen -1 en 1.
1.0
.5
-1.0
-.5
1.0
.5
1.5
2.0
-1.0
-.5
-1.5
-2.0
Verbreek het resultaat
+
.75
-.75
0.0
.50
1.075
.746
Gewogen optel-en-verbreek neuronen
.75
-.75
0.0
.50
.746
Maak veel van de neuronen in het netwerk identiek, dit met uitzondering van de gewichten (Weights)
Ter verduidelijking,�de gewichten zijn:
1.0 (wit)
-1.0 (zwart) of
0.0 (missend)
De ontvangende velden worden steeds complexer
Herhaal dit ook voor de additionele lagen (additional layers) van je netwerk indien van toepassing!
De ontvangende velden worden nu nog complexer
Herhaal dit met variatie (variation)
Gerectificeerde lineaire eenheden (ReLUs)
1.0
.5
-1.0
-.5
1.0
.5
1.5
2.0
-1.0
-.5
-1.5
-2.0
Als het nummer positief is dan blijft het behouden, anders krijg het een nul waarde.
Voeg een uitvoer (output) laag toe
solide
verticaal
diagonaal
horizontaal
solide
verticaal
diagonaal
horizontaal
solide
verticaal
diagonaal
horizontaal
solide
verticaal
diagonaal
horizontaal
solide
verticaal
diagonaal
horizontaal
solide
verticaal
diagonaal
horizontaal
solide
verticaal
diagonaal
horizontaal
solide
verticaal
diagonaal
horizontaal
Fouten (Errors)
solide
verticaal
diagonaal
horizontaal
1.
0.
0.
0.
waarheid
Fouten (Errors)
solide
verticaal
diagonaal
horizontaal
-.75
-.25
.75
.5
1.
0.
0.
0.
waarheid
antwoord
Fouten (Errors)
solide
verticaal
diagonaal
horizontaal
-.75
-.25
.75
.5
1.
0.
0.
0.
waarheid
antwoord
fouten
1.75
.25
.75
.5
Fouten (Errors)
solide
verticaal
diagonaal
horizontaal
-.75
-.25
.75
.5
1.
0.
0.
0.
waarheid
andwoord
fouten
1.75
.25
.75
.5
totaal
3.25
Leer alle gewichten (Weights): Gradient descent
Fout bij:
Gewicht
Origineel gewicht
Leer alle gewichten (Weights): Gradient descent
Fout bij:
Gewicht
origineel gewicht
lager gewicht
Leer alle gewichten (Weights): Gradient descent
Fout bij:
Gewichten
origineel gewicht
lager gewicht
hoger gewicht
Het numeriek calculeren van de Gradiënt is duur
Fout bij:
Gewicht
origineel gewicht
lager gewicht
hoger gewicht
Het numeriek calculeren van de Gradiënt is heel duur
Het direct calculeren van de Gradiënt (slope)
Fout bij:
Gewicht
origineel gewicht
Gradiënt (slope)
Fout bij:
Gewicht
origineel gewicht
de verandering in het�gewicht (Weight) = +1
Gradiënt (slope)
Fout bij:
Gewicht
origineel gewicht
de verandering in het�gewicht (Weight) = +1
beweeg langs de �kromme lijn (curve)
Gradiënt (slope)
Fout bij:
Gewicht
origineel gewicht
de verandering in het�gewicht (Weight) = +1
de verandering in �de fout (error) = -2
Slope = gradient = helling
Fout bij:
Gewicht
origineel gewicht
de verandering in het�gewicht (Weight) = +1
de verandering in �de fout (error) = -2
gradient = verandering in fouten
verandering in gewichten
Gradiënt (slope)
Fout bij:
Gewicht
origineel gewicht
de verandering in het�gewicht (Weight) = +1
de verandering in �de fout (error) = -2
gradient = verandering in fout
verandering in gewicht
= ∆ fout
∆ gewicht
= d(fout)
d(gewicht)
= ∂e
∂w
Gradiënt (slope)
Fout bij:
Gewicht
origineel gewicht
de verandering in �gewicht (Weight) = +1
verandering in de �fout (error) = -2
Gradient = verandering fouten
verandering gewicht
= ∆ fout
∆ gewicht
= d(fout)
d(gewicht)
= ∂e
∂w
= -2 = -2
+1
Gradiënt (slope)
Fout bij:
Gewicht
origineel gewicht
Men moet de fout (error) functie weten.
Bijvoorbeeld:
fout = gewicht ^2
0
-1
+1
Gradiënt (slope)
Fout bij:
Gewicht
origineel gewicht
Men moet de fout (error) functie weten.
Bijvoorbeeld:
fout = gewicht ^2
∂e = 2 * gewicht
∂w
0
-1
+1
Gradiënt (slope)
Fout bij:
Gewicht
origineel gewicht
Men moet de fout (error) functie weten.
Bijvoorbeeld:
fout = gewicht ^2
∂e = 2 * gewicht
∂w
= 2 * -1
= -2
0
-1
+1
Ketenen
y = x * w1
+
+
x
(invoer)
e
(uitvoer)
y
(tussenwaarde)
w1
w2
Ketenen
y = x * w1
∂y = x
∂w1
+
+
x
(invoer)
e
(uitvoer)
y
(tussenwaarde)
w1
w2
Ketenen
y = x * w1
∂y = x
∂w1
e = y * w2
∂e = w2
∂y
+
+
x
(invoer)
e
(uitvoer)
y
(tussenwaarde)
w1
w2
Ketenen
y = x * w1
∂y = x
∂w1
e = y * w2
∂e = w2
∂y
e = x * w1 * w2
∂e = x * w2
∂w1
+
+
x
(invoer)
e
(invoer)
y
(tussenwaarde)
w1
w2
Ketenen
y = x * w1
∂y = x
∂w1
e = y * w2
∂e = w2
∂y
e = x * w1 * w2
∂e = x * w2
∂w1
∂e = ∂y * ∂e
∂w1 ∂w1 ∂y
+
+
x
(invoer)
e
(uitvoer)
y
(tussenwaarde)
w1
w2
Ketenen
y = x * w1
∂y = x
∂w1
e = y * w2
∂e = w2
∂y
e = x * w1 * w2
∂e = x * w2
∂w1
∂e = ∂y * ∂e
∂w1 ∂w1 ∂y
+
+
x
(invoer)
e
(uitvoer)
y
(tussenwaarde)
w1
w2
Ketenen
∂fout = ∂a * ∂b * ∂c * ∂d * … * ∂y * ∂z * ∂fout
∂gewicht ∂gewicht ∂a ∂b ∂c ∂x ∂y ∂z
+
fout
a
gewicht
b
c
x
y
z
...
Terugwaartse propagatie (Backpropagation)
∂fout = ∂a * ∂b * ∂c * ∂d * … * ∂y * ∂z * ∂fout
∂gewicht ∂gewicht ∂a ∂b ∂c ∂x ∂y ∂z
+
fout
a
gewicht
b
c
x
y
z
...
Terugwaartse propagatie (Backpropagation)
∂fout = ∂a * ∂b * ∂c * ∂d * … * ∂y * ∂z * ∂fout
∂gewicht ∂gewicht ∂a ∂b ∂c ∂x ∂y ∂z
+
fout
a
gewicht
b
c
x
y
z
...
Terugwaartse propagatie (Backpropagation)
∂fout = ∂a * ∂b * ∂c * ∂d * … * ∂y * ∂z * ∂fout
∂gewicht ∂gewicht ∂a ∂b ∂c ∂x ∂y ∂z
+
fout
a
gewicht
b
c
x
y
z
...
Terugwaartse propagatie (Backpropagation)
∂fout = ∂a * ∂b * ∂c * ∂d * … * ∂y * ∂z * ∂fout
∂gewicht ∂gewicht ∂a ∂b ∂c ∂x ∂y ∂z
+
fout
a
gewicht
b
c
x
y
z
...
Terugwaartse propagatie (Backpropagation)
∂err = ∂a * ∂b * ∂c * ∂d * … * ∂y * ∂z * ∂fout
∂gewicht ∂gewicht ∂a ∂b ∂c ∂x ∂y ∂z
+
fout
a
gewicht
b
c
x
y
z
...
Terugwaartse propagatie (Backpropagation)
∂fout = ∂a * ∂b * ∂c * ∂d * … * ∂y * ∂z * ∂fout
∂gewicht ∂gewicht ∂a ∂b ∂c ∂x ∂y ∂z
+
fout
a
gewicht
b
c
x
y
z
...
Terugwaartse propagatie (Backpropagation)
∂fout = ∂a * ∂b * ∂c * ∂d * … * ∂y * ∂z * ∂fout
∂gewicht ∂gewicht ∂a ∂b ∂c ∂x ∂y ∂z
+
fout
a
gewicht
b
c
x
y
z
...
Terugwaartse propagatie uitdaging: gewichten
+
+
a
b
w
Terugwaartse propagatie uitdaging: gewichten
∂fout = ∂b * ∂fout
∂a ∂a ∂b
+
+
a
b
w
Terugwaartse propagatie uitdaging: gewichten
∂fout = ∂b * ∂fout
∂a ∂a ∂b
+
+
a
b
w
b = wa
Terugwaartse propagatie uitdaging: gewichten
∂fout = ∂b * ∂fout
∂a ∂a ∂b
+
+
a
b
w
b = wa
∂b = w
∂a
Terugwaartse propagatie uitdaging: sommen
+
+
a
z
b
c
d
...
Terugwaartse propagatie uitdaging: sommen
∂fout= ∂z * ∂fout
∂a ∂a ∂z
+
+
a
z
b
c
d
...
Terugwaartse propagatie uitdaging: sommen
∂fout = ∂z * ∂fout
∂a ∂a ∂z
+
+
a
z
z = a + b + c + d + ...
b
c
d
...
Terugwaartse propagatie uitdaging: sommen
∂fout= ∂z * ∂fout
∂a ∂a ∂z
+
+
a
z
z = a + b + c + d + ...
∂z = 1
∂a
b
c
d
...
Terugwaartse propagatie uitdaging: sigmoid
∂fout = ∂b * ∂fout
∂a ∂a ∂b
+
+
a
b
Terugwaartse propagatie uitdaging: sigmoid
∂fout = ∂b * ∂fout
∂a ∂a ∂b
+
+
a
b
b = 1
1 + e
-a
Terugwaartse propagatie uitdaging: sigmoid
∂fout = ∂b * ∂fout
∂a ∂a ∂b
+
+
a
b
b = 1
1 + e
= 𝝈(a)
-a
Terugwaartse propagatie uitdaging: sigmoid
∂fout = ∂b * ∂fout
∂a ∂a ∂b
+
+
a
b
b = 1
1 + e
= 𝝈(a)
Omdat wiskunde heel mooi is �/ dom geluk:
∂b = 𝝈(a) * (1 - 𝝈(a))
∂a
-a
Terugwaartse propagatie uitdaging: ReLu
∂fout = ∂b * ∂fout
∂a ∂a ∂b
+
+
a
b
Terugwaartse propagatie uitdaging: ReLu
∂fout = ∂b * ∂fout
∂a ∂a ∂b
+
+
a
b
b = a , a > 0
= 0 , anderszins
Terugwaartse propagatie uitdaging: ReLu
∂fout = ∂b * ∂fout
∂a ∂a ∂b
+
+
a
b
b = a , a > 0
= 0 , anderszins
∂b = 1 , a > 0
∂a 0 , anderszins
Training vanaf het begin
solide
verticaal
diagonaal
horizontaal
Eindresultaat
solide
verticaal
diagonaal
horizontaal
Geavanceerde onderwerpen (Engels)
Bias neurons
Dropout
Backpropagation details
Andrej Karpathy’s Stanford CS231 lecture
Backpropagation gotchas
Andrej Karpathy’s article “Yes you should understand backprop”
Tips and tricks
Nikolas Markou’s article “The Black Magic of Deep Learning”
For more How it Works:
How Convolutional Neural Networks work
https://docs.google.com/presentation/d/1AAEFCgC0Ja7QEl3-wmuvIizbvaE-aQRksc7-W8LR2GY/edit?usp=sharing