public void AutoTeaching(BackPropagationLearning _teacher) { for (int i = 0; i < 100000; i++) { double pacmanLength = R.Next(800); double AlphaSine = R.NextDouble(); double ghostLength = R.Next(600); double BetaSine = R.NextDouble(); double[] Inputs = { pacmanLength, AlphaSine, ghostLength, BetaSine }; Console.Write("[T] Inputs >> "); for (int j = 0; j < Inputs.Length; j++) { Console.Write(Inputs[j] + " "); } Console.WriteLine(); double[] Outputs = { BetaSine }; Console.Write("[T] Outputs >> "); for (int j = 0; j < Outputs.Length; j++) { Console.Write(Outputs[j] + " "); } Console.WriteLine(); for (int j = 0; j < 2; j++) { _teacher.Teach(Inputs, Outputs); double[] Test = _teacher.Launch(Inputs); Console.Write("[T] Out >> "); for (int k = 0; k < Test.Length; k++) { Console.Write(Test[k] + " "); } Console.WriteLine(); } } }
public OddTest() { Console.WriteLine("Welcome to Neural Odd Test Example"); FeedForwardNetwork network = new FeedForwardNetwork(new SigmoidFunction(), 1, 10, 1); BackPropagationLearning teacher = new BackPropagationLearning(network); teacher.LearningRate = 0.1; Random R = new Random(Environment.TickCount); Console.WriteLine("Training..."); for (int i = 0; i < 1000; i++) { Console.Write("[T] Input >> "); int Input = R.Next(1024); Console.WriteLine(Input); teacher.Teach(Binary(Input), (Input % 2 == 0) ? (new double[] { 0 }) : (new double[] { 1 })); Console.Write("[T] Output >> "); Console.WriteLine(network.Launch(Binary(Input))[0].ToString()); } Console.WriteLine("Examing..."); Console.Write("[E] Input >> "); string userString = Console.ReadLine(); while (userString != "stop") { int Number = int.Parse(userString.Split(' ')[0]); Console.Write("[E] Output >> "); Print(network.Launch(Binary(Number))); Console.Write("[E] Input >> "); userString = Console.ReadLine(); } Console.WriteLine(); }
public void ManualTeaching(BackPropagationLearning _teacher) { Console.Write("[T] Inputs >> "); string userString = Console.ReadLine(); while (userString != "stop") { double[] Inputs = ParseDoubles(userString); Console.Write("[T] Outputs >> "); userString = Console.ReadLine(); double[] Outputs = ParseDoubles(userString); for (int i = 0; i < 5; i++) { _teacher.Teach(Inputs, Outputs); } Console.Write("[T] Inputs >> "); userString = Console.ReadLine(); } }