1

I have a neural network with two output nodes and I am writing back propagation algorithm for it in c#. and this is how I am calculating instance error

 instanceErr += (double)((Math.Pow(error1[0], 2) + Math.Pow(error1[1], 2)) / 2);

this code is inside a loop with executes for 224 time as I have 224 instances.Is this the right way to do it? after that I calculate the error per epoch like this.

 meanSqrE = (double) (instanceErr/224);

but after the 2 epochs, it starts giving me same error 30 times and after that it prints this NaN. I have no idea where I go wrong

Saira
  • 107
  • 1
  • 12
  • by 30 times I mean for next 30 epochs – Saira May 19 '15 at 06:40
  • NaN is an abbreviation for "Not a Number". error1 or instanceErr may be null which is giving the error. – jdweng May 19 '15 at 06:50
  • I know its Not a Number which come when we try to divide 0 by 0, but I don't have any such thing in the code – Saira May 19 '15 at 06:53
  • if error is less than 1, squaring a number gets smaller. Than dividing a very small number by 2 will get the equivalent of 0/0. – jdweng May 19 '15 at 07:52
  • Are you rolling your own neural network? There are plenty of open-source frameworks that have complete implementations of back-propagation, see: http://stackoverflow.com/questions/11477145/open-source-neural-network-library for some more information. I know it doesn't answer your question directly, but it may save you the headache of re-inventing the wheel. – Clint May 19 '15 at 09:25
  • @Clint actually it is a very complex topic and I tried to understand the codes written by others but I couldn't, therefore I had to start writing it from scratch. I even couldn't find any tutorials with the open source. can you suggest me any that I can use with c#? with the tutorial if possible? – Saira May 19 '15 at 15:43

0 Answers0