我是神經網絡的新手,我正在使用Aforge神經網絡庫進行字符識別任務。我想使用反向傳播來訓練我的網絡。以下是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的數目。任何幫助,將不勝感激。謝謝。