private static void Train() { Console.WriteLine("Network Training"); PrintUnderline(50); Console.WriteLine("\t1. Train to minimum error"); Console.WriteLine("\t2. Train to max epoch"); Console.WriteLine("\t3. Network Menu"); PrintNewLine(); //BackPropTrainParams trainParams = null; BackPropLearning learning = null; switch (GetInput("\tYour Choice: ", 1, 3)) { case 1: var minError = GetDouble("\tMinimum Error: ", 0.000000001, 1.0); PrintNewLine(); Console.WriteLine("\tTraining..."); //trainParams = new BackPropTrainParams { Training = TrainingType.MinimumError, MinimumError = minError }; learning = new BackPropLearning(_network) { MinimumError = minError }; learning.TrainByError(_dataSets); //_network.Train(_dataSets, trainParams); Console.WriteLine("\t**Training Complete**"); PrintNewLine(); NetworkMenu(); break; case 2: var maxEpoch = GetInput("\tMax Epoch: ", 1, int.MaxValue); if (!maxEpoch.HasValue) { PrintNewLine(); NetworkMenu(); return; } PrintNewLine(); Console.WriteLine("\tTraining..."); learning = new BackPropLearning(_network) { NumEpochs = maxEpoch.Value }; learning.TrainByEpochs(_dataSets); Console.WriteLine("\t**Training Complete**"); PrintNewLine(); break; case 3: NetworkMenu(); break; } PrintNewLine(); }
public void BackPropRationalSigmoidXorTest() { var nnet = new Network(2, new int[] { 2 }, 1, typeof(RationalSigmoid), typeof(RationalSigmoid)); var learning = new BackPropLearning(nnet) { MinimumError = 0.1, Momentum = 0.5, LearnRate = 0.1 }; learning.TrainByError(BuildXorDataSets(), 20000); System.Diagnostics.Debug.WriteLine("trained in {0} epochs", learning.ResultEpochs); CheckResults(nnet, 0.15); }