我是神经网络的新手,我正在使用 Aforge 神经网络库来完成字符识别任务。我想使用反向传播来训练我的网络。这是 AForge 文档中给出的代码。
// 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
// ...
}
但我不知道如何确定 ActivationNetwork 的层数和神经元数。任何帮助,将不胜感激。谢谢。