public void Test_NeuralNetworkLogic()
        {
            INeuralNetworkBuilder <double> builder = new SigmoidNeuralNetworkBuilder <GeneticTrainingNeuralNetwork>();

            builder.BuildNetwork(2, new int[] { 3 }, 1);
            INeuralNetwork <double> network = builder.InitializeNeuralNetworkWithData(
                new double[] { 1, 1 },
                null,
                null);

            // First Hidden Layer
            network.HiddenLayers.ElementAt(0)[0].Inputs.ElementAt(0).DendriteWeight.Weight = 0.8;
            network.HiddenLayers.ElementAt(0)[0].Inputs.ElementAt(1).DendriteWeight.Weight = 0.2;
            network.HiddenLayers.ElementAt(0)[1].Inputs.ElementAt(0).DendriteWeight.Weight = 0.4;
            network.HiddenLayers.ElementAt(0)[1].Inputs.ElementAt(1).DendriteWeight.Weight = 0.9;
            network.HiddenLayers.ElementAt(0)[2].Inputs.ElementAt(0).DendriteWeight.Weight = 0.3;
            network.HiddenLayers.ElementAt(0)[2].Inputs.ElementAt(1).DendriteWeight.Weight = 0.5;
            // Output Nueron
            network.Output.Neurons.ElementAt(0)[0].DendriteWeight.Weight = 0.3;
            network.Output.Neurons.ElementAt(0)[0].DendriteWeight.Weight = 0.5;
            network.Output.Neurons.ElementAt(0)[0].DendriteWeight.Weight = 0.9;
            // Run sigmoid function
            network.Pulse(null);
            ;
        }
Example #2
0
        static void Main(string[] args)
        {
            INeuralNetworkBuilder <double> builder = new SigmoidNeuralNetworkBuilder <GeneticTrainingNeuralNetwork>();

            builder.BuildNetwork(9, null, 1); // no hidden layers
            INeuralNetwork <double> network = builder.InitializeNeuralNetworkWithData(new double[]
            {
                2, 0, 1,
                0, 1, 0,
                2, 0, 0
            }, null, null);

            network.LearningRate = 0.1;

            for (int i = 0; i < 10000; ++i)
            {
                // Calculates Sigmoid Neurons value.
                network.Pulse(null);
                // Function prepared for Genetic Training of Feed Forward Network
                network.ApplyLearning(null);
            }
        }