Backprobagation

Neuronale Netze

Disclaimer: Dieser Thread wurde aus dem alten Forum importiert. Daher werden eventuell nicht alle Formatierungen richtig angezeigt. Der ursprüngliche Thread beginnt im zweiten Post dieses Threads.

Backprobagation
Backprobagation bereitet mir seid Tagen “Kopfzerbrechen”.
Ich habe einen Sourcecode der zwei Kausalitäten übt. ( XOR 0 1 = 1)
Wie erweitere ich den Code auf eine weitere Variable ( XOR 0 1 0 = 1)
Im Sourcecode(Train) wäre das Input3.

double Train(double Input1, double Input2, double DesiredOutput)
{ // Bsp. erste Trainingseinheit:
// Weights[0]= 1 Weights[1]= 0 Weights[2]= 1 Weights[3]= 1
// Weights[4]= 1 Weights[5]= 1 Weights[6]= 0 Weights[7]= 1
// Weights[8]= 1

   Segma_H1 = Input1 * Weights[0] + Input2 * Weights[2] - 1 * Weights[4];
   // Segma_H1 = 1 * 1 + 0 + 1 -1 * 1
   // cout << "Segma_H1: " << Segma_H1 << endl;
    OH1 = Segmoied(Segma_H1);
   // cout << "OH1: " << OH1 << endl;
    Segma_H2 = Input1 * Weights[1] + Input2 * Weights[3] - 1 * Weights[5];
   // Segma_H2 = 1* 0 + 0 * 1 -1 * 1
   // cout << "Segma_H2: " << Segma_H2 << endl;
    OH2 = Segmoied(Segma_H2);
   // cout << "OH2: " << OH2 << endl;
    Segma_Y = OH1 * Weights[6] + OH2 * Weights[7] - 1 * Weights[8];
   // cout << "Segma_Y: " << Segma_Y << endl;
    OY = Segmoied(Segma_Y);
   // cout << "OY: " << OY << endl;
   // OY = 0,48
    Learn_Factor = 0.5;
    Beta_Y = DesiredOutput - OY;
   // cout <<  "Beta_Y: " << Beta_Y << endl;
   // Beta_Y = 0,52
    Beta_H1 = Weights[6] * OY * (1 - OY) * Beta_Y;
   // cout <<  "Beta_H1: " << Beta_H1 << endl;
   //  Beta_H1 = 0 * 0,48 * (1 - 0,48) * 0,52
   //  Beta_H1 = 0
    Beta_H2 = Weights[7] * OY * (1 - OY) * Beta_Y;
   //  cout << "Beta_H2" << Beta_H2 << endl;
   //  Beta_H2 = 1 * 0,48 * (1 - 0,48) * 0,52
   //  Beta_H2 = 0,129792
    DeltaWeights[0] = Learn_Factor * Input1 * OH1 * (1 - OH1) * Beta_H1;
   // cout << "DeltaWeights[0]: " << DeltaWeights[0] << endl;
   // DeltaWeights[0] = 0,5 * 1 * 0,731*(1-0,731)*0
   // DeltaWeights[0] = 0
    DeltaWeights[1] = Learn_Factor * Input1 * OH2 * (1 - OH2) * Beta_H2;
   // cout << "DeltaWeights[1]: " << DeltaWeights[1] << endl;
   // DeltaWeights[1] = 0,5 * 1 * 0,268 * (1 - 0,268) * 0,129792;
    DeltaWeights[2] = Learn_Factor * Input2 * OH1 * (1 - OH1) * Beta_H1;
   //  cout << "DeltaWeights[2]: " << DeltaWeights[2] << endl;
    DeltaWeights[3] = Learn_Factor * Input2 * OH2 * (1 - OH2) * Beta_H2;
   // cout << "DeltaWeights[3]: " << DeltaWeights[3] << endl;
    DeltaWeights[4] = Learn_Factor * -1 * OH1 * (1 - OH1) * Beta_H1;
   // cout << "DeltaWeights[4]: " << DeltaWeights[4] << endl;
    DeltaWeights[5] = Learn_Factor * -1 * OH2 * (1 - OH2) * Beta_H2;
   // cout << "DeltaWeights[5]: " << DeltaWeights[5] << endl;
    DeltaWeights[6] = Learn_Factor * OH1 * OY * (1 - OY) * Beta_Y;
   // cout << "DeltaWeights[6]: " << DeltaWeights[6] << endl;
    DeltaWeights[7] = Learn_Factor * OH2 * OY * (1 - OY) * Beta_Y;
   // cout << "DeltaWeights[7]: " << DeltaWeights[7] << endl;
    DeltaWeights[8] = Learn_Factor * -1 * OY * (1 - OY) * Beta_Y;
   // cout << "DeltaWeights[8]: " << DeltaWeights[8] << endl;
    Weights[0] += DeltaWeights[0];
   // cout << "Weights[0]" << Weights[0] << endl;
    Weights[1] += DeltaWeights[1];
   // cout << "Weights[1]" << Weights[1] << endl;
    Weights[2] += DeltaWeights[2];
   // cout << "Weights[2]" << Weights[2] << endl;
    Weights[3] += DeltaWeights[3];
   // cout << "Weights[3]" << Weights[3] << endl;
    Weights[4] += DeltaWeights[4];
   // cout << "Weights[4]" << Weights[4] << endl;
    Weights[5] += DeltaWeights[5];
   // cout << "Weights[5]" << Weights[5] << endl;
    Weights[6] += DeltaWeights[6];
   // cout << "Weights[6]" << Weights[6] << endl;
    Weights[7] += DeltaWeights[7];
   // cout << "Weights[7]" << Weights[7] << endl;
    Weights[8] += DeltaWeights[8];
   // cout << "Weights[8]" << Weights[8] << endl;
    return 0;
   }

double Run(double Input1, double Input2)
{
Segma_H1 = Input1 * Weights[0] + Input2 * Weights[2] - 1 * Weights[4];
OH1 = Segmoied(Segma_H1);
Segma_H2 = Input1 * Weights[1] + Input2 * Weights[3] - 1 * Weights[5];
OH2 = Segmoied(Segma_H2);
Segma_Y = OH1 * Weights[6] + OH2 * Weights[7] - 1 * Weights[8];
OY = Segmoied(Segma_Y);
return OY;
}

// Danke Gruß Heiko


lol Smegma

lol Smegma
lol Smegma … das bedeutet?

Bitte um Verständnis, da Thema neu für mich.

Danke

Heiko


Beta_H1 = 0 * 0,48 * (1 - 0,48) * 0,52

GOETTLICHST!


Tolles Forum!?
Beta_H1 = 0 * 0,48 * (1 - 0,48) * 0,52
stammt aus meine´m Sourcecode und weiter ???


er wollte drauf raus das 0 * irgendwas immer 0 gibt.


Nicht nur. Ich machs mal offensichtlicher:

Beta_H2 = 0,129792


Aber das sind doch auskommentierte Zeilen…


“Segma” steht im Code! Und dict.leo.org schlägt als Alternativen “Smegma” oder “Sigma” vor. Und da ich es gern humorig habe bevorzuge ich eindeutig die erste Alternative. “Segmoied” finde ich auch nicht übel.


Ja, auskommentiert vermutlich weil sie nie funktioniert haben. Warum nur…


Aber was ist mit 0 * NaN? :wink:

Lösung in Sicht???
Leute,

gehen die Antworten nicht an der Fragestellung vorbei?

Dekleration von Variablen sind subjektiv, soweit nicht generiert (von Entwicklungsumgebungen oder De-Compiler ect.).

Ist dieses Beispiel erweiterbar? Oder muss der Sourcecode komplett geändert werden.

Kodierungsanätze währen echt super!

Empfolene Literatur währe hilfreich.

Gruß

Heiko


ambodenkriechvorlachen


das forum macht mich voellig kaputt, ich habe anfangs BACK-Propagation gelesen und dachte es geht schon wieder um Bretzeln…


Ja, dann hast du eigentlich auch richtig gelesen - ich glaub back-propagation schreibt man richtigerweise auch mit zweimal hartem p. Nur was du ständig mit Brezeln hast… Die sind doch eher da relevant: https://fsi.informatik.uni-erlangen.de/forum/post/60179