"justify"> {
Col ​​= bmp.GetPixel (i + 10, j + 10); [i * (pictureBox1.Height - 20) + j] = (Convert.ToDouble (Col.B)/255.0);
}
}. Neironu [0]. setInput (temp);. Neironu [1]. setInput (temp);. Activate (); st = ""; (int i = 0; i <2; i + +)
{+ = Sloy1.Neironu [i]. getOutput (). ToString () + ",";
}. Show (st);
} void button6_Click (object sender, EventArgs e)// навчання
{bmp = new Bitmap (pictureBox1.BackgroundImage); Col; [] temp = new double [(pictureBox1.Width - 20) * (pictureBox1.Height - 20)]; (int i = 0 ; i <(pictureBox1.Width - 20); i + +)
{(int j = 0; j <(pictureBox1.Height - 20); j + +)
{= bmp.GetPixel (i + 10, j + 10); [i * (pictureBox1.Height - 20) + j] = (Convert.ToDouble (Col.B)/255.0);
}
else.Learning (2);
}}}
Зміст файлу Neuron1.cs представлено на малюнку 6
System; System.Collections.Generic; System.Linq; System.Text; set
{Neuron1
{int n = 1; double lyambda; double [] input; double [] weight; double output; Neuron1 ()
{. weight = new double [1];. input = new double [1];. lyambda = 1;
} Neuron1 (int n)
{. weight = new double [n];. input = new double [n];. lyambda = 1;. n = n;
} void Activate ()
{sum = 0; net = 0; (int i = 0; i
{+ = input [i] * weight [i];
} = lyambda * sum; = net/1000; = (Math.Exp (net) - Math.Exp (-net))/(Math.Exp (net) + Math.Exp (- net));
// output = 1/(1 + Math.Exp (-lyambda * sum)) -0.5; = Math.Floor (output * 10000)/10000;}
///Отримання виходу нейрона.
/// double getOutput ()
{output;
}
///
///Установка ваг
///
/// void setWeight ()
{(int i = 0; i
{[i] = 0.01;
}
} void setInput (double [] temp)
{(int i = 0; i
{[i] = temp [i];
}
} void setInput (double temp)
{[0] = temp;
}
}
}
using System; System.Collections.Generic; System.Linq; System.Text; set
{Sloy1