Beispiel #1
0
        static void Main(string[] args)
        {
            var neural_net = new Neural_Net(784, new [] { 100, 60, 30, 10 }, 25, 1.5, 15.0);
            var Tester     = new Net_Test(neural_net);
            int best       = -10000;

            string _continue = "y";

            while (_continue == "y" || _continue == string.Empty)
            {
                int c1 = 0;
                int c2 = 0;
                for (int i = 0; i < 40; i++)
                {
                    Stopwatch sw = new Stopwatch();
                    sw.Start();
                    Tester.Epoch_Train();

                    sw.Stop();
                    Console.WriteLine(sw.Elapsed.TotalSeconds);
                    sw.Reset();
                    sw.Start();
                    c1 = Tester.Validate();
                    sw.Stop();
                    Console.WriteLine(sw.Elapsed.TotalSeconds);
                    if (c1 > c2)
                    {
                        neural_net.Shrink_Training_Speed();
                    }
                    if (c1 > best)
                    {
                        best = c1;
                    }
                    c2 = c1;
                }

                Console.WriteLine("The best run was correct in {0}% of validation cases.", (10000 + (float)best) / (float)100);

                Console.WriteLine("COntinue: y or n?");
                _continue = Console.ReadLine();
            }

            Console.WriteLine("test pass");
            Console.ReadLine();
        }
Beispiel #2
0
 public Net_Test(Neural_Net net)
 {
     _net = net;
 }