Exemple #1
0
        public static void GoOverfit()
        {
            PointsGeneration.PointGeneration form = new PointsGeneration.PointGeneration();
            form.Hide();
            form.GenerateLinearSeparable();
            MultidimensionalPoint[] testArray = new MultidimensionalPoint[100];
            MultidimensionalPoint[] points    = PointsGeneration.PointGeneration.points;
            Random rand = new Random();

            for (int i = 0; i < 5; ++i)
            {
                for (int j = 0; j < 20; ++j)
                {
                    testArray[i * 20 + j] = new MultidimensionalPoint(2, 0);
                    do
                    {
                        testArray[i * 20 + j].coordinates[0] = points[i * 100].coordinates[0] + rand.NextDouble() * points[i * 100].radius * 1.5;
                        testArray[i * 20 + j].coordinates[1] = points[i * 100].coordinates[1] + rand.NextDouble() * points[i * 100].radius * 1.5;
                    }while(form.Distance(testArray[i * 20 + j], points[i * 100]) > points[i * 100].radius &&
                           form.Distance(testArray[i * 20 + j], points[i * 100]) < points[i * 100].radius * 1.5);
                    testArray[i * 20 + j].pointClass = i;
                }
            }
            NeuralNetwork nn = new NeuralNetwork(points, new int[4] {
                2, 15, 15, 15
            }, 1, 0, 0.7, 0.01, 2, 1, 0.1);

            nn.TrainNetwork(150, testArray);
        }
 private void start_Click(object sender, EventArgs e)
 {
     InitializeNetwork();
     NeurNet.TrainNetwork(Convert.ToInt32(epochsNumber.Text), null);
     NeurNet.WriteClassifiedResult(NeurNet.data);
 }