I'm new to neural networks and I'm using Aforge Neural network library for a character recognition task. I want to use the back propagation to train my network. Here's the code given in the AForge Documentation.
// initialize input and output values
double[][] input = new double[4][] {
new double[] {0, 0}, new double[] {0, 1},
new double[] {1, 0}, new double[] {1, 1}
};
double[][] output = new double[4][] {
new double[] {0}, new double[] {1},
new double[] {1}, new double[] {0}
};
// create neural network
ActivationNetwork network = new ActivationNetwork(
SigmoidFunction(2),
2, // two inputs in the network
2, // two neurons in the first layer
1); // one neuron in the second layer
// create teacher
BackPropagationLearning teacher = new BackPropagationLearning(network);
// loop
while (!needToStop)
{
// run epoch of learning procedure
double error = teacher.RunEpoch(input, output);
// check error value to see if we need to stop
// ...
}
But I don't know how to decide the Number of layers and Neurons for the ActivationNetwork. Any help would be appreciated. Thanks.