home *** CD-ROM | disk | FTP | other *** search
/ The Devil's Doorknob BBS Capture (1996-2003) / devilsdoorknobbbscapture1996-2003.iso / Dloads / OTHERUTI / MASTER-2.ZIP / NEURAL / NEURAL.LZH / NEURON.CPP < prev    next >
Text File  |  1990-10-01  |  404b  |  24 lines

  1. #include "neural.hpp"
  2. #include <math.h>
  3.  
  4. Neuron::Neuron(void)
  5. {
  6.     input = 0;
  7.     output = 0;
  8.     error = 0;
  9. }
  10.  
  11.  
  12. void Neuron::transfer(void)
  13. {
  14.     //This is the "classic" transfer function.
  15.     output = 1 / (1 + exp(-1 * M_FACTOR * input));
  16. }
  17.  
  18.  
  19. float Neuron::derivTransfer(float weightedSumOfErrors)
  20. {
  21.     error = output * (1 - output) * weightedSumOfErrors;
  22.     return error;
  23. }
  24.