C# in C Übersetzen (KNN)
-
Hey Leute könnte mir jemand diesen Quelltext von C# in C Übersetzen, ich bekomm das nicht gebacken!
public double F(double x)
{
return (1.0 / (1 + Math.Exp(-_beta * x))); //Aktivierungsfunktion
}PROCEDURE Backpropagation //Lernprozess
nCycles := 0;
REPEAT
error := 0;
nCycles := nCycles + 1;
FOR i := 1 TO Number of patterns DO
Set pattern i to the layer;
FOR j := 1 TO Number of output-neurons DO
Calculate output value oj;
Calculate error value fj := tj - oj;
Calculate error signal fsigj := oj * (1 - oj) * fj;
error := error + fj2;
END FOR
FOR s := Output layer - 1 DOWNTO First layer DO
FOR k := 1 TO Number of neuronal layers DO
fsum := 0;
FOR m := 1 TO Number of neuronal layer(s+1) DO
fsum := fsum + wkm * fsig(s+1)m;
END FOR
fsigsk := osk * (1 - osk) * fsum;
FOR m := 1 TO Number of neuronal layer(s+1) DO
wkm := wkm + learnrate * osk * fsig(s+1)m;
END FOR
END FOR
END FOR
END FOR
UNTIL error < Tolerable error OR Maximum cycles reached;
END Backpropagation
-
Alex77777 schrieb:
public double F(double x)
{
return (1.0 / (1 + Math.Exp(-_beta * x))); //Aktivierungsfunktion
}#include <math.h> /* für exp */ double F(double x) { return 1.0 / (1 + exp(-_beta * x)); /* Aktivierungsfunktion */ }
Der Rest ist kein C#.
-
Das ist Pseudocode von hier
Falls du das von hier hast schäm dich, falls nicht schaus dir an