Пример #1
0
        static void Main(string[] args)
        {
            int[] H =
            {
                1, 0, 1,
                1, 1, 1,
                1, 0, 1
            };
            int[] answers =
            {
                1, 0, 1,
                1, 1, 1,
                1, 0, 1
            };

            int[,] letters =
            {
                {
                    0, 1, 0,
                    0, 1, 0,
                    0, 1, 0
                },
                {
                    1, 1, 1,
                    1, 0, 1,
                    1, 1, 1
                },{
                    1, 0, 1,
                    1, 1, 1,
                    1, 0, 1
                },
                {
                    1, 0, 1,
                    1, 0, 1,
                    1, 1, 1
                },
                {
                    1, 1, 1,
                    1, 0, 1,
                    1, 0, 1
                }
            };


            Neuron neuron = new Neuron(H, answers);

            neuron.Train();
            Console.WriteLine("It took {0} generations", neuron.generation);
            Console.ReadKey();
            Console.Clear();
            for (int i = 0; i < letters.GetLength(0); i++)
            {
                int[] array = new int[letters.GetLength(1)];
                for (int j = 0; j < letters.GetLength(1); j++)
                {
                    array[j] = letters[i, j];
                }
                bool isH = neuron.Test(array);
                if (isH)
                {
                    Console.WriteLine("It is a H!");
                }
            }
            Console.ReadKey();
        }