예제 #1
0
        private void TrainNeuralNetwork()
        {
            Debug.WriteLine("MyNN: Learning Started");
            m_BPLearning = new BackPropagationLearning(m_network, m_learningRate, m_momentum, m_goal);
            double[][] input;
            double[][] output;
            int        maxEpochs = 500;

            CreateInputOutput(out input, out output);
            if (input == null && output == null)
            {
                return; //network is too small (needs to be recreated)
            }
            double error = m_BPLearning.Train(input, output, ref maxEpochs);

            Debug.WriteLine(string.Format("MyNN trained: {0} epochs, {1} error", maxEpochs, error));
            if (m_saveIsRequired)
            {
                m_saveIsRequired = false;
                FileOptions.SaveTrainingSet(m_curveSets);
                m_curveSets = null;
                FileOptions.SaveNeuralNetwork(m_network);
            }

            OnNetworkLearnt(error, maxEpochs);
        }