Example #1
0
        static void Testing()
        {
            int[] array = { 10, 20, 2 };

            string str = File.ReadAllText("TD1.txt");

            double[][] vs1   = JsonConvert.DeserializeObject <double[][]>(str);
            NNModel    model = new NNModel(array);

            Console.Beep();
            var             watch           = System.Diagnostics.Stopwatch.StartNew();
            BackPropagation backPropagation = new BackPropagation();

            backPropagation.Learn(model, vs1);
            watch.Stop();
            Console.WriteLine(watch.ElapsedMilliseconds);
            string str1 = File.ReadAllText("TD2.txt");

            double[][] vs2 = JsonConvert.DeserializeObject <double[][]>(str1);
            for (int i = 0; i < vs2.Length; i++)
            {
                model.Compute(NNModel.ReculcArray(vs2[i])).Neurons.ForEach(x =>
                {
                    Console.WriteLine(x.Value + "  ");
                });
                Console.WriteLine();
            }
            Console.WriteLine("_______");
            model.Save();
            Console.Beep();
            Console.ReadKey();
        }
Example #2
0
        static void TestingOpen()
        {
            int[] array = { 9, 20, 1 };

            NNModel model = NNModel.Open("nnmodel.dat");
            string  str1  = File.ReadAllText("TD2.txt");

            double[][] vs2 = JsonConvert.DeserializeObject <double[][]>(str1);
            for (int i = 0; i < vs2.Length; i++)
            {
                model.Compute(NNModel.ReculcArray(vs2[i])).Neurons.ForEach(x =>
                {
                    Console.WriteLine(x.Value + "  ");
                });
                Console.WriteLine();
            }
            Console.WriteLine("_______");
            Console.ReadKey();
        }