00001 /* PerceptronNeuron.h 00002 * 00003 * Copyright (C) 2002-2003 -- Sebastian Nowozin 00004 */ 00005 00006 #ifndef PERCEPTRONNEURON_H 00007 #define PERCEPTRONNEURON_H 00008 00009 #include <vector> 00010 00011 using namespace std; 00012 00016 class 00017 PerceptronNeuron { 00018 public: 00020 unsigned int num; 00021 00023 double input; 00024 00026 double output; 00027 00031 vector<double> weight; 00032 00039 vector<double> weight_diff; 00040 00041 /* functions */ 00042 00047 PerceptronNeuron (unsigned int in_layer_num); 00048 00051 double getDelta (void) { 00052 return (delta); 00053 } 00054 00059 void setDelta (double newval) { 00060 delta = newval; 00061 } 00062 00065 double getTheta (void) { 00066 return (theta); 00067 } 00068 00071 void setTheta (double newval) { 00072 theta = newval; 00073 } 00074 00077 double getThetaDiff (void) { 00078 return (theta_diff); 00079 } 00080 00085 void initializeWeightings (unsigned int succ_count); 00086 00089 void resetWeights (void); 00090 00093 void resetWeightDiffs (void); 00094 00097 void resetDiffs (void); 00098 00099 /* ALGORITHMS */ 00100 00116 void postprocessWeight (PerceptronNeuron *succ, double epsilon, 00117 double weight_decay, double momterm); 00118 00126 void postprocessTheta (double epsilon, double weight_decay, 00127 double momterm); 00128 00132 void update (void); 00133 00134 protected: 00139 double delta; 00140 00142 double theta; 00146 double theta_diff; 00147 00150 double theta_diff_last; 00151 00154 vector<double> weight_diff_last; 00155 }; 00156 00157 #endif 00158