private void btnReset_Click(object sender, EventArgs e) { sP = new simplePerceptron(3); lRes.Text = "\r\nW1 = " + sP.getWeightEntry(0).ToString(doublePrecision) + "\r\nW2 = " + sP.getWeightEntry(1).ToString(doublePrecision) + "\r\nW3 = " + sP.getWeightEntry(2).ToString(doublePrecision); }
private void drawData() { g.Clear(Color.White); for (int i = 0; i < data[0].Count; i += 2) { Point p1 = toPixel(data[0][i], data[0][i + 1]); Point p2 = toPixel(data[1][i], data[1][i + 1]); g.DrawEllipse(pen1, p1.X, p1.Y, 4, 4); g.DrawEllipse(pen2, p2.X, p2.Y, 4, 4); } //calcule de f(min) et f(max) en fonction des poids //equation de la droite : //w1x+w2y+w3 = 0; //f(x) = (-w1x-w3)/w2 double fmin = (-sP.getWeightEntry(0) * minX - sP.getWeightEntry(2)) / sP.getWeightEntry(1); double fmax = (-sP.getWeightEntry(0) * maxX - sP.getWeightEntry(2)) / sP.getWeightEntry(1); g.DrawLine(penLine, toPixel(minX, fmin), toPixel(maxX, fmax)); pBox.Refresh(); }