home *** CD-ROM | disk | FTP | other *** search
/ World of Shareware - Software Farm 2 / wosw_2.zip / wosw_2 / CPROG / AI-90-10.ZIP / 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.