Neural networks' evolutionary learning algorithm, which is based on Genetic Algorithms.
Namespace:
AForge.Neuro.LearningAssembly: AForge.Neuro (in AForge.Neuro.dll) Version: 2.2.5.0 (2.2.5.0)
Syntax
C# |
---|
public class EvolutionaryLearning : ISupervisedLearning |
Remarks
The class implements supervised neural network's learning algorithm, which is based on Genetic Algorithms. For the given neural network, it create a population of DoubleArrayChromosome chromosomes, which represent neural network's weights. Then, during the learning process, the genetic population evolves and weights, which are represented by the best chromosome, are set to the source neural network.
See Population class for additional information about genetic population and evolutionary based search.
Sample usage (training network to calculate XOR function):

// initialize input and output values double[][] input = new double[4][] { new double[] {-1, 1}, new double[] {-1, 1}, new double[] { 1, -1}, new double[] { 1, 1} }; double[][] output = new double[4][] { new double[] {-1}, new double[] { 1}, new double[] { 1}, new double[] {-1} }; // create neural network ActivationNetwork network = new ActivationNetwork( BipolarSigmoidFunction( 2 ), 2, // two inputs in the network 2, // two neurons in the first layer 1 ); // one neuron in the second layer // create teacher EvolutionaryLearning teacher = new EvolutionaryLearning( network, 100 ); // number of chromosomes in genetic population // loop while ( !needToStop ) { // run epoch of learning procedure double error = teacher.RunEpoch( input, output ); // check error value to see if we need to stop // ... }