Hi,
I've done the quick inspection of your code. Deltas seem to be calculated correctly, but weight updates seem wrong:
pcNeuralNetwork->ReturnNeuron( i, j ).SetWeight( k, pcNeuralNetwork->ReturnNeuron( i, j ).ReturnWeight( k ) + ( dbLearningRate * pcNeuralNetwork->ReturnNeuron( i - 1, k ).ReturnOutput() * pcNeuralNetwork->ReturnNeuron( i, j ).ReturnDelta() ) );
Why do you add learning rate multiplied by delta? You should be subtracting the value, and that's the point of backpropagation. The algorithm calculates delta as a measure of error made by the node. Then this error is multiplied by learning rate and subtracted from current weight, so that next error should become smaller than it was - this is because sigmoid function is strictly growing, so you should just walk down the error gradient to get to the point where error is around zero.
Please tell if this was the problem. Otherwise, please correct me!
And a couple of advices when programming nerual networks.
- Try training the network with different starting weights, including different ranges of weights. It is hard to tell right from wrong in this area, just keep experimenting and you'll get some sense of it.
- Try different algorithms in parallel to backpropagation. For example, simulated annealing has much higher educational value than backpropagation - use it often to gain feeling of how neural networks actually work.
- Try different implementations of backpropagation algorithm - there are exotic implementations that are very well grounded in automation theory, etc. As much texts you read in the field, you'll perform better when teaching networks with any algorithm.