Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen RevisionVorhergehende ÜberarbeitungNächste Überarbeitung | Vorhergehende Überarbeitung | ||
p:ki:machinelearning4 [2024/05/02 08:57] – Tscherter, Vincent | p:ki:machinelearning4 [2024/07/04 08:38] (aktuell) – [2. Das Gradientenverfahren von Hand durchrechnen] Ralf Kretzschmar | ||
---|---|---|---|
Zeile 191: | Zeile 191: | ||
⚠️ In diesem Auftrag rechnest du einen Vorwärts-, dann einen Rückwärts- und anschliessend einen weiteren Vorwärtsschritt für das kleine FNN aus Abb.3 für ein einziges Sample durch. Alle Formeln, welche du dafür brauchst, sind in diesem Auftrag enthalten. Ebenso gegeben sind die Eingangsgrössen $x_1$ und $x_2$ des Samples zusammen mit dem Desired Output $d_1$, alle Gewichte $v_{hi}[k]$ und $w_{ij}[k]$ zum Zeitpunkt $k$ und die Lernrate $\mu$. Alle weiteren Zahlen, welche du brauchst, wirst du Schritt für Schritt berechnen. | ⚠️ In diesem Auftrag rechnest du einen Vorwärts-, dann einen Rückwärts- und anschliessend einen weiteren Vorwärtsschritt für das kleine FNN aus Abb.3 für ein einziges Sample durch. Alle Formeln, welche du dafür brauchst, sind in diesem Auftrag enthalten. Ebenso gegeben sind die Eingangsgrössen $x_1$ und $x_2$ des Samples zusammen mit dem Desired Output $d_1$, alle Gewichte $v_{hi}[k]$ und $w_{ij}[k]$ zum Zeitpunkt $k$ und die Lernrate $\mu$. Alle weiteren Zahlen, welche du brauchst, wirst du Schritt für Schritt berechnen. | ||
- | - Berechne alle Zahlen und trage sie in die Textfelder ein. | + | - Berechne alle Zahlen |
\\ | \\ | ||
Zeile 205: | Zeile 205: | ||
| $a_1[k] = \displaystyle\sum_{h=0}^{n_i} v_{h1}[k] \cdot x_h = v_{01}[k] + v_{11}[k]\cdot x_1 + v_{21}[k]\cdot x_2 =$ | {{gem/ | | $a_1[k] = \displaystyle\sum_{h=0}^{n_i} v_{h1}[k] \cdot x_h = v_{01}[k] + v_{11}[k]\cdot x_1 + v_{21}[k]\cdot x_2 =$ | {{gem/ | ||
| $\phi_1[k](.) = \displaystyle\frac{1}{1 + e^{-a_1[k]}} =$ | {{gem/ | | $\phi_1[k](.) = \displaystyle\frac{1}{1 + e^{-a_1[k]}} =$ | {{gem/ | ||
- | | $y_1[k] = \displaystyle\sum_{i=0}^{n_h} w_{i1}[k] \cdot \phi_i[k](.) = w_{01}[k] + w_{11}[k]\cdot \phi_1[k](.) =$ | {{gem/ | + | | $y_1[k] = \displaystyle\sum_{i=0}^{n_h} w_{i1}[k] \cdot \phi_i[k](.) = w_{01}[k] + w_{11}[k]\cdot \phi_1[k](.) =$ | {{gem/ |
| $J[k] = \displaystyle\frac{1}{2} (y_1[k]-d_1)^2 = $ | {{gem/ | | $J[k] = \displaystyle\frac{1}{2} (y_1[k]-d_1)^2 = $ | {{gem/ | ||
Zeile 211: | Zeile 211: | ||
**Rückwärtsschritt zum Zeitpunkt [k] inklusive Gewicht-Update ** | **Rückwärtsschritt zum Zeitpunkt [k] inklusive Gewicht-Update ** | ||
- | | $(y_1[k]-d_1) =$ | {{gem/ | + | | $(y_1[k]-d_1) =$ | {{gem/ |
- | | $\phi' | + | | $\phi' |
- | | $\displaystyle\frac{\partial J[k]}{\partial w_{01}} = (y_1[k] - d_1) =$ | {{gem/ | + | | $\displaystyle\frac{\partial J[k]}{\partial w_{01}} = (y_1[k] - d_1) =$ | {{gem/ |
- | | $\displaystyle\frac{\partial J[k]}{\partial w_{11}} = (y_1[k] - d_1) \cdot \phi_1[k](.) =$ | {{gem/ | + | | $\displaystyle\frac{\partial J[k]}{\partial w_{11}} = (y_1[k] - d_1) \cdot \phi_1[k](.) =$ | {{gem/ |
- | | $\displaystyle\frac{\partial J[k]}{\partial v_{01}} = (y_1[k] - d_1) \cdot w_{11}[k] \cdot \phi' | + | | $\displaystyle\frac{\partial J[k]}{\partial v_{01}} = (y_1[k] - d_1) \cdot w_{11}[k] \cdot \phi' |
- | | $\displaystyle\frac{\partial J[k]}{\partial v_{11}} = (y_1[k] - d_1) \cdot w_{11}[k] \cdot \phi' | + | | $\displaystyle\frac{\partial J[k]}{\partial v_{11}} = (y_1[k] - d_1) \cdot w_{11}[k] \cdot \phi' |
| $\displaystyle\frac{\partial J[k]}{\partial v_{21}} = (y_1[k] - d_1) \cdot w_{11}[k] \cdot \phi' | | $\displaystyle\frac{\partial J[k]}{\partial v_{21}} = (y_1[k] - d_1) \cdot w_{11}[k] \cdot \phi' | ||
- | | $w_{01}[k+1] = w_{01}[k] - \mu \cdot \displaystyle\frac{\partial J[k]}{\partial w_{01}}=$ | {{gem/ | + | | $w_{01}[k+1] = w_{01}[k] - \mu \cdot \displaystyle\frac{\partial J[k]}{\partial w_{01}}=$ | {{gem/ |
- | | $w_{11}[k+1] = w_{11}[k] - \mu \cdot \displaystyle\frac{\partial J[k]}{\partial w_{11}}=$ | {{gem/ | + | | $w_{11}[k+1] = w_{11}[k] - \mu \cdot \displaystyle\frac{\partial J[k]}{\partial w_{11}}=$ | {{gem/ |
- | | $v_{01}[k+1] = v_{01}[k] - \mu \cdot \displaystyle\frac{\partial J[k]}{\partial v_{01}}=$ | {{gem/ | + | | $v_{01}[k+1] = v_{01}[k] - \mu \cdot \displaystyle\frac{\partial J[k]}{\partial v_{01}}=$ | {{gem/ |
| $v_{11}[k+1] = v_{11}[k] - \mu \cdot \displaystyle\frac{\partial J[k]}{\partial v_{11}}=$ | {{gem/ | | $v_{11}[k+1] = v_{11}[k] - \mu \cdot \displaystyle\frac{\partial J[k]}{\partial v_{11}}=$ | {{gem/ | ||
| $v_{21}[k+1] = v_{21}[k] - \mu \cdot \displaystyle\frac{\partial J[k]}{\partial v_{21}}=$ | {{gem/ | | $v_{21}[k+1] = v_{21}[k] - \mu \cdot \displaystyle\frac{\partial J[k]}{\partial v_{21}}=$ | {{gem/ | ||
Zeile 227: | Zeile 227: | ||
**Vorwärtsschritt zum Zeitpunkt [k] inklusive Berechnung des Fehlerwerts ** | **Vorwärtsschritt zum Zeitpunkt [k] inklusive Berechnung des Fehlerwerts ** | ||
- | | $a_1[k+1] = \displaystyle\sum_{h=0}^{n_i} v_{h1}[k+1] \cdot x_h = v_{01}[k+1] + v_{11}[k+1]\cdot x_1 + v_{21}[k+1]\cdot x_2 =$ | {{gem/ | + | | $a_1[k+1] = \displaystyle\sum_{h=0}^{n_i} v_{h1}[k+1] \cdot x_h = v_{01}[k+1] + v_{11}[k+1]\cdot x_1 + v_{21}[k+1]\cdot x_2 =$ | {{gem/ |
- | | $\phi_1[k+1](.) = \displaystyle\frac{1}{1 + e^{-a_1[k+1]}} =$ | {{gem/ | + | | $\phi_1[k+1](.) = \displaystyle\frac{1}{1 + e^{-a_1[k+1]}} =$ | {{gem/ |
- | | $y_1[k+1] = \displaystyle\sum_{i=0}^{n_h} w_{i1}[k+1] \cdot \phi_i[k+1](.) = w_{01}[k+1] + w_{11}[k+1]\cdot \phi_1[k+1](.) =$ | {{gem/ | + | | $y_1[k+1] = \displaystyle\sum_{i=0}^{n_h} w_{i1}[k+1] \cdot \phi_i[k+1](.) = w_{01}[k+1] + w_{11}[k+1]\cdot \phi_1[k+1](.) =$ | {{gem/ |
- | | $J[k+1] = \displaystyle\frac{1}{2} (y_1[k+1]-d_1)^2 = $ | {{gem/ | + | | $J[k+1] = \displaystyle\frac{1}{2} (y_1[k+1]-d_1)^2 = $ | {{gem/ |
\\ | \\ | ||
**Vergleich der Fehlerwerte $J[k+1]$ und $J[k]$** | **Vergleich der Fehlerwerte $J[k+1]$ und $J[k]$** | ||
- | Der Fehler hat durch das Training um so viel abgenommen (d.h. trage das Resultat von $J[k] - J[k+1]$ ein): {{gem/ | + | Der Fehler hat durch das Training um so viel abgenommen (d.h. trage das Resultat von $J[k] - J[k+1]$ ein): {{gem/ |
</ | </ | ||