public static void LogicGatesExample()
        {
            //First layer is input layer
            //Initialize a 2-layer ANN
            //Two inputs, one output
            int[] layers = new int[] { 2, 3, 1 };
            FeedforwardNeuralNetwork fnn = new FeedforwardNeuralNetwork(layers, 1.0F, 0.1F);
            //Train this many cycles
            int numTrainingEpochs = 10000;
            TrainingExample ex1 = new TrainingExample(new Matrix(new float[,]{ { 0 },
                                                                               { 0 } }),
                                                      new Matrix(new float[,]{ { 0 } }));

            TrainingExample ex2 = new TrainingExample(new Matrix(new float[,]{ { 0 },
                                                                               { 1 } }),
                                                      new Matrix(new float[,]{ { 1 } }));

            TrainingExample ex3 = new TrainingExample(new Matrix(new float[,]{ { 1 },
                                                                               { 0 } }),
                                                      new Matrix(new float[,]{ { 1 } }));

            TrainingExample ex4 = new TrainingExample(new Matrix(new float[,]{ { 1 },
                                                                               { 1 } }),
                                                      new Matrix(new float[,]{ { 0 } }));

            TrainingExample[] trainingExamples = { ex1, ex2, ex3, ex4 };
            for (int i = 0; i < numTrainingEpochs; ++i) {
                //Sets input matrices and output matrices and trains the network accordingly for all combinations
                Random rand = new Random();
                trainingExamples = trainingExamples.OrderBy(x => rand.Next()).ToArray();
                for (int j = 0; j < 4; ++j) {
                    fnn.TrainIteration(trainingExamples[j].input, trainingExamples[j].expectedOutput, 1 - (1.0F * 0.1F / 4));
                }
            }
            //After training, evaluates the network with respect to all possible inputs
            //Prints their outputs to the console to see the result of training
            float[,] inputArray = new float[,] { { 0 },
                                                 { 0 } };
            Matrix input = new Matrix(inputArray);
            Matrix output = fnn.Evaluate(input);
            Console.WriteLine(output[1, 1]);
            inputArray = new float[,] { { 0 },
                                        { 1 } };
            input = new Matrix(inputArray);
            output = fnn.Evaluate(input);
            Console.WriteLine(output[1, 1]);
            inputArray = new float[,] { { 1 },
                                        { 0 } };
            input = new Matrix(inputArray);
            output = fnn.Evaluate(input);
            Console.WriteLine(output[1, 1]);
            inputArray = new float[,] { { 1 },
                                        { 1 } };
            input = new Matrix(inputArray);
            output = fnn.Evaluate(input);
            Console.WriteLine(output[1, 1]);
        }
        public static void LogicGatesExample()
        {
            //First layer is input layer
            //Initialize a 2-layer ANN
            //Two inputs, one output
            int[] layers = new int[] { 2, 3, 1 };
            FeedforwardNeuralNetwork fnn = new FeedforwardNeuralNetwork(layers, 1.0F, 0.1F);
            //Train this many cycles
            int             numTrainingEpochs = 10000;
            TrainingExample ex1 = new TrainingExample(new Matrix(new float[, ] {
                { 0 },
                { 0 }
            }),
                                                      new Matrix(new float[, ] {
                { 0 }
            }));

            TrainingExample ex2 = new TrainingExample(new Matrix(new float[, ] {
                { 0 },
                { 1 }
            }),
                                                      new Matrix(new float[, ] {
                { 1 }
            }));

            TrainingExample ex3 = new TrainingExample(new Matrix(new float[, ] {
                { 1 },
                { 0 }
            }),
                                                      new Matrix(new float[, ] {
                { 1 }
            }));

            TrainingExample ex4 = new TrainingExample(new Matrix(new float[, ] {
                { 1 },
                { 1 }
            }),
                                                      new Matrix(new float[, ] {
                { 0 }
            }));

            TrainingExample[] trainingExamples = { ex1, ex2, ex3, ex4 };
            for (int i = 0; i < numTrainingEpochs; ++i)
            {
                //Sets input matrices and output matrices and trains the network accordingly for all combinations
                Random rand = new Random();
                trainingExamples = trainingExamples.OrderBy(x => rand.Next()).ToArray();
                for (int j = 0; j < 4; ++j)
                {
                    fnn.TrainIteration(trainingExamples[j].input, trainingExamples[j].expectedOutput, 1 - (1.0F * 0.1F / 4));
                }
            }
            //After training, evaluates the network with respect to all possible inputs
            //Prints their outputs to the console to see the result of training
            float[,] inputArray = new float[, ] {
                { 0 },
                { 0 }
            };
            Matrix input  = new Matrix(inputArray);
            Matrix output = fnn.Evaluate(input);

            Console.WriteLine(output[1, 1]);
            inputArray = new float[, ] {
                { 0 },
                { 1 }
            };
            input  = new Matrix(inputArray);
            output = fnn.Evaluate(input);
            Console.WriteLine(output[1, 1]);
            inputArray = new float[, ] {
                { 1 },
                { 0 }
            };
            input  = new Matrix(inputArray);
            output = fnn.Evaluate(input);
            Console.WriteLine(output[1, 1]);
            inputArray = new float[, ] {
                { 1 },
                { 1 }
            };
            input  = new Matrix(inputArray);
            output = fnn.Evaluate(input);
            Console.WriteLine(output[1, 1]);
        }