Пример #1
0
 public void TrainAllCases()
 {
     foreach (var sample in cases)
     {
         net.FeedForward(sample.input);
         net.PropagateBack(sample.target);
         CurrentSampleCount++;
         TotalSampleCount++;
     }
     EpochCount++;
     CurrentSampleCount = 0;
 }
Пример #2
0
        public static void Recognize(double[] inputVector = null)
        {
            double[] myNumberToTest = new double[] { 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1 };
            if (inputVector != null)
            {
                myNumberToTest = inputVector;
            }

            double[] output = numberNetwork.FeedForward(myNumberToTest);
            for (int i = 0; i < output.Length; i++)
            {
                Console.WriteLine(output[i]);
            }

            int numberRecognized = numberNetwork.RecognizeNumberFromVector(myNumberToTest);

            if (numberRecognized < 10)   //recognized with high probability
            {
                Console.WriteLine(" ====   Recognized num: " + numberRecognized.ToString());
                recognizedPostalNums.Add(numberRecognized);
                probablyPostalNums.Add(numberRecognized);
            }
            else  //recognized with lower probability
            {
                Console.WriteLine(" ====   Probably num: " + (numberRecognized / 10).ToString());
                recognizedPostalNums.Add(numberRecognized);
                probablyPostalNums.Add(numberRecognized / 10);
            }
        }