Beispiel

Bei der Modellierung des XOR-Netzwerkes wird schrittweise vorgegangen, und zwar bottom up, d.h. zuerst werden die Grundelemente bereitgestellt, und dann werden aus diesen komplexere Einheiten zusammengebaut.

Im Fall des binären Neurons gibt es zwei Grundelemente: die Summenfunktion $net\_bin$ -einmal mit zwei, einmal mit 3 Eingängen- und die Aktivierungsfunktion $act\_bin$. Alle werden so konstruiert, daß man ein neues Modell eröffnet und dieses unter dem neuen Thema netxor abspeichert. Das Bild 10.8 zeigt, wie man ein kleines Modell auch durch direkte Eingabe einer Formel erzeugen kann. In diesem Fall die Formel für eine Netzsummenfunktion mit drei Eingängen. Das Ergebnis kann man dann im Bild 10.9 sehen. Allerdings muß man noch die Eingangsparameter $IN1-3, W1-2$ sowie den Ausgangsparameter $NET\_SUM$ zusätzlich einfügen.

Figure 10.8: Eingabe einer Formel mit dem Formeleditor
\includegraphics[width=2.5in]{EnterFormulaNetBin3.eps}

Figure 10.9: Das Ergebnis nach der Eingabe plus Eingangs- und Ausgangsparametern
\includegraphics[width=2.5in]{netBin3.eps}

Das Bild 10.10 zeigt das FCL-Modell der binären Aktivierungsfunktion. Sie hat als einen Input den Output der Summenfunktion $net\_bin$ und vergleicht diesen Werte mittels der Funktion $if\_geq$ (wenn größer oder gleich). Ist der Wert der Summenfunktion größer oder gleich dem Schwellwert, dann wird eine '1' ausgegeben, sonst eine '0'.

Figure 10.10: Binäre Aktivierungsfunktion
\includegraphics[width=2.5in]{actBin_intern.eps}

Dann kann man das eigentliche Modell des binären Neurons bauen, indem man ein neues Modell beginnt und die vorher gebauten Modelle $net\_bin$ und $act\_bin$ als Elemente aus der Bibliothek hereinzieht. Fügt man die entsprechenden Input und Outputparameter noch hinzu und verbindet alle Ein- und Ausgänge, dann erhält man ein binäres Neuron mit zwei Eingängen (vgl. das Bild 10.12 bzw. eines mit 3 Eingängen (vgl. Bild 10.12)

Figure 10.11: Binäres Neuron mit Summen- und Aktivierungsfunktion; 2 Eingänge, 1 Ausgang
\includegraphics[width=2.5in]{neuronbin2.eps}

Figure 10.12: Binäres Neuron mit Summen- und Aktivierungsfunktion; 3 Eingänge, 1 Ausgang
\includegraphics[width=2.5in]{neuronbin3.eps}

Die Konstruktion des vollständigen XOR-Netzwerkes ist dann sehr einfach. Man eröffnet ein neues Modell und zieht die beiden binären Neuronen mit den 2 bzw. 3 Eingängen in das Konstruktionsfeld. Dann fügt man die entsprechenden Input- und Outputparameter hinzu und die Konstruktion ist abgeschlossen (siehe Bild 10.13. Die Gewichte wurden in diesem Fall mittels Konstanten (:= roten Kästchen im Modell) fest verdrahtet. Diese Konstanten könnte man natürlich auch nach Bedarf -z.B. innerhalb von Lernalgorithmen- durch frei programmierbare Parameter ersetzen. Dann kann man dieses Netzwerk wieder ganz einfach in die schon bekannte Testumgebung einsetzen (vgl. Bild 10.14).

Figure 10.13: Vollständiges XOR-Netzwerk
\includegraphics[width=3.0in]{xor.eps}

Figure 10.14: Vollständiges XOR-Netzwerk innerhalb einer Testumgebung
\includegraphics[width=3.0in]{expxor.eps}

Im simulationsmodus kann man sich dann die Konsolenausgabe anzeigen lassen:

Sat Mar 21 16:35:11 CET 2009 Editor: 0.8.3 Simulator: ForSYnt V 0.4.2d beta - FCL Message: 
Start Simulation with id: expnetxor_1
Simulator version: ForSYnt V 0.4.2d beta
 Start Time: Saturday, March 21, 2009 4:35:11 PM


*** ForSYnt V 0.4.2d beta

$S1_IN1,$CLCK_IN2,$S2_IN3,$OUT_OUT7,$S2_CTRL_OUT6,$S1_CTRL_OUT5,$CLCK_OUT4
0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 0,0,0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0,
 1 Output:  OUT, contains 1 INT: 0 
 1 Output:  S2_CTRL, contains 1 INT: 0 
 1 Output:  S1_CTRL, contains 1 INT: 0 
 1 Output:  CLCK, contains 1 INT: 1 
 2 Input :  S1, contains 20 INT: 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 0 
 2 Input :  CLCK, contains 1 INT: 1 
 2 Input :  S2, contains 20 INT: 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 
 2 Output:  OUT, contains 1 INT: 0 
 2 Output:  S2, contains 1 INT: 0 
 2 Output:  S1, contains 1 INT: 0 
 2 Output:  CLCK, contains 1 INT: 2 
 3 Input :  S1, contains 20 INT: 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 0 
 3 Input :  CLCK, contains 1 INT: 2 
 3 Input :  S2, contains 20 INT: 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 
 3 Output:  OUT, contains 1 INT: 0 
 3 Output:  S2, contains 1 INT: 1 
 3 Output:  S1, contains 1 INT: 1 
 3 Output:  CLCK, contains 1 INT: 3 
 4 Input :  S1, contains 20 INT: 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 0 
 4 Input :  CLCK, contains 1 INT: 3 
 4 Input :  S2, contains 20 INT: 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 
 4 Output:  OUT, contains 1 INT: 1 
 4 Output:  S2, contains 1 INT: 0 
 4 Output:  S1, contains 1 INT: 1 
 4 Output:  CLCK, contains 1 INT: 4 
 5 Input :  S1, contains 20 INT: 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 0 
 5 Input :  CLCK, contains 1 INT: 4 
 5 Input :  S2, contains 20 INT: 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 
 5 Output:  OUT, contains 1 INT: 1 
 5 Output:  S2, contains 1 INT: 1 
 5 Output:  S1, contains 1 INT: 0 
 5 Output:  CLCK, contains 1 INT: 5 
 6 Input :  S1, contains 20 INT: 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 0 
 6 Input :  CLCK, contains 1 INT: 5 
 6 Input :  S2, contains 20 INT: 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 
 6 Output:  OUT, contains 1 INT: 0 
 6 Output:  S2, contains 1 INT: 0 
 6 Output:  S1, contains 1 INT: 0 
 6 Output:  CLCK, contains 1 INT: 6 
 7 Input :  S1, contains 20 INT: 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 0 
 7 Input :  CLCK, contains 1 INT: 6 
 7 Input :  S2, contains 20 INT: 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 
 7 Output:  OUT, contains 1 INT: 0 
 7 Output:  S2, contains 1 INT: 1 
 7 Output:  S1, contains 1 INT: 1 
 7 Output:  CLCK, contains 1 INT: 7 
 8 Input :  S1, contains 20 INT: 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 0 
 8 Input :  CLCK, contains 1 INT: 7 
 8 Input :  S2, contains 20 INT: 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 
 8 Output:  OUT, contains 1 INT: 1 
 8 Output:  S2, contains 1 INT: 0 
 8 Output:  S1, contains 1 INT: 1 
 8 Output:  CLCK, contains 1 INT: 8 
 9 Input :  S1, contains 20 INT: 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 0 
 9 Input :  CLCK, contains 1 INT: 8 
 9 Input :  S2, contains 20 INT: 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 
 9 Output:  OUT, contains 1 INT: 1 
 9 Output:  S2, contains 1 INT: 1 
 9 Output:  S1, contains 1 INT: 0 
 9 Output:  CLCK, contains 1 INT: 9 
 10 Input :  S1, contains 20 INT: 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 0 
 10 Input :  CLCK, contains 1 INT: 9 
 10 Input :  S2, contains 20 INT: 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 
 10 Output:  OUT, contains 1 INT: 0 
 10 Output:  S2, contains 1 INT: 0 
 10 Output:  S1, contains 1 INT: 0 
 10 Output:  CLCK, contains 1 INT: 10 
 11 Input :  S1, contains 20 INT: 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 0 
 11 Input :  CLCK, contains 1 INT: 10 
 11 Input :  S2, contains 20 INT: 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 
 11 Output:  OUT, contains 1 INT: 0 
 11 Output:  S2, contains 1 INT: 1 
 11 Output:  S1, contains 1 INT: 1 
 11 Output:  CLCK, contains 1 INT: 11 
 12 Input :  S1, contains 20 INT: 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 0 
 12 Input :  CLCK, contains 1 INT: 11 
 12 Input :  S2, contains 20 INT: 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 
 12 Output:  OUT, contains 1 INT: 1 
 12 Output:  S2, contains 1 INT: 0 
 12 Output:  S1, contains 1 INT: 1 
 12 Output:  CLCK, contains 1 INT: 12 
 13 Input :  S1, contains 20 INT: 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 0 
 13 Input :  CLCK, contains 1 INT: 12 
 13 Input :  S2, contains 20 INT: 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 
 13 Output:  OUT, contains 1 INT: 1 
 13 Output:  S2, contains 1 INT: 1 
 13 Output:  S1, contains 1 INT: 0 
 13 Output:  CLCK, contains 1 INT: 13 
 14 Input :  S1, contains 20 INT: 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 0 
 14 Input :  CLCK, contains 1 INT: 13 
 14 Input :  S2, contains 20 INT: 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 
 14 Output:  OUT, contains 1 INT: 0 
 14 Output:  S2, contains 1 INT: 0 
 14 Output:  S1, contains 1 INT: 0 
 14 Output:  CLCK, contains 1 INT: 14 
 15 Input :  S1, contains 20 INT: 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 0 
 15 Input :  CLCK, contains 1 INT: 14 
 15 Input :  S2, contains 20 INT: 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 
 15 Output:  OUT, contains 1 INT: 0 
 15 Output:  S2, contains 1 INT: 1 
 15 Output:  S1, contains 1 INT: 1 
 15 Output:  CLCK, contains 1 INT: 15 
 16 Input :  S1, contains 20 INT: 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 0 
 16 Input :  CLCK, contains 1 INT: 15 
 16 Input :  S2, contains 20 INT: 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 
 16 Output:  OUT, contains 1 INT: 1 
 16 Output:  S2, contains 1 INT: 0 
 16 Output:  S1, contains 1 INT: 1 
 16 Output:  CLCK, contains 1 INT: 16 
 17 Input :  S1, contains 20 INT: 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 0 
 17 Input :  CLCK, contains 1 INT: 16 
 17 Input :  S2, contains 20 INT: 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 
 17 Output:  OUT, contains 1 INT: 1 
 17 Output:  S2, contains 1 INT: 1 
 17 Output:  S1, contains 1 INT: 0 
 17 Output:  CLCK, contains 1 INT: 17 
 18 Input :  S1, contains 20 INT: 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 0 
 18 Input :  CLCK, contains 1 INT: 17 
 18 Input :  S2, contains 20 INT: 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 
 18 Output:  OUT, contains 1 INT: 0 
 18 Output:  S2, contains 1 INT: 0 
 18 Output:  S1, contains 1 INT: 0 
 18 Output:  CLCK, contains 1 INT: 18 
 19 Input :  S1, contains 20 INT: 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 0 
 19 Input :  CLCK, contains 1 INT: 18 
 19 Input :  S2, contains 20 INT: 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 
 19 Output:  OUT, contains 1 INT: 0 
 19 Output:  S2, contains 1 INT: 0 
 19 Output:  S1, contains 1 INT: 0 
 19 Output:  CLCK, contains 1 INT: 19 
 20 Input :  S1, contains 20 INT: 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 0 
 20 Input :  CLCK, contains 1 INT: 19 
 20 Input :  S2, contains 20 INT: 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 

..................... done

Sat Mar 21 16:35:11 CET 2009 Editor: 0.8.3 Simulator: ForSYnt V 0.4.2d beta - FCL Message: 
Simulation with id: expnetxor_1 was finished.
Simulation Time: 0 h 0 m 0 s 70 ms

Den gleichen Testlauf kann man sich auch grafisch anzeigen lassen (siehe Bild 10.15).

Figure 10.15: Testlauf mit vollständigem XOR-Netzwerk in Umgebung
\includegraphics[width=3.5in]{ann_xor_testrun1.eps}

Gerd Doeben-Henisch 2013-01-17