Example #1
0
        static void ForwardMLP()
        {
            MultiLayerPerceptronNetwork network = new MultiLayerPerceptronNetwork( new double[] { -1, -1 }, 2, 1, 0.5 );
            network.Forward();

            Console.WriteLine("MLP output: ");
            foreach (double output in network.GetOutputs())
                Console.Write("{0}\t", output);
        }
Example #2
0
        static void ForwardMLP()
        {
            MultiLayerPerceptronNetwork network = new MultiLayerPerceptronNetwork(new double[] { -1, -1 }, 2, 1, 0.5);

            network.Forward();

            Console.WriteLine("MLP output: ");
            foreach (double output in network.GetOutputs())
            {
                Console.Write("{0}\t", output);
            }
        }
Example #3
0
        static void BackwardMLP()
        {
            MultiLayerPerceptronNetwork network = new MultiLayerPerceptronNetwork(2, 1, 0.5);

            Console.WriteLine("Training network...");
            for (int i = 0; i < 100; i++)
            {
                network.Backward(new double[] { -1.0, -1.0 }, new double[] { -1.0 });
                Console.WriteLine("{0}: -1.0, -1.0 = {1:f6}", i, network.GetOutputs()[0]);

                network.Backward(new double[] { -1.0, 1.0 }, new double[] { 1.0 });
                Console.WriteLine("{0}: -1.0, 1.0 = {1:f6}", i, network.GetOutputs()[0]);

                network.Backward(new double[] { 1.0, -1.0 }, new double[] { 1.0 });
                Console.WriteLine("{0}: 1.0, -1.0 = {1:f6}", i, network.GetOutputs()[0]);

                network.Backward(new double[] { 1.0, 1.0 }, new double[] { -1.0 });
                Console.WriteLine("{0}: 1.0, 1.0 = {1:f6}", i, network.GetOutputs()[0]);

                Console.WriteLine();
            }
        }
Example #4
0
        static void BackwardMLP()
        {
            MultiLayerPerceptronNetwork network = new MultiLayerPerceptronNetwork(2, 1, 0.5);

            Console.WriteLine("Training network...");
            for (int i = 0; i < 100; i++)
            {
                network.Backward(new double[] { -1.0, -1.0 }, new double[]{ -1.0 });
                Console.WriteLine("{0}: -1.0, -1.0 = {1:f6}", i, network.GetOutputs()[0]);

                network.Backward(new double[] { -1.0, 1.0 }, new double[]{ 1.0 });
                Console.WriteLine("{0}: -1.0, 1.0 = {1:f6}", i, network.GetOutputs()[0]);

                network.Backward(new double[] { 1.0, -1.0 }, new double[]{ 1.0 });
                Console.WriteLine("{0}: 1.0, -1.0 = {1:f6}", i, network.GetOutputs()[0]);

                network.Backward(new double[] { 1.0, 1.0 }, new double[]{ -1.0 });
                Console.WriteLine("{0}: 1.0, 1.0 = {1:f6}", i, network.GetOutputs()[0]);

                Console.WriteLine();
            }
        }