00001
00002
00003
00004
00005
00006 #ifndef PERCEPTRONLAYER_H
00007 #define PERCEPTRONLAYER_H
00008
00009 #include <vector>
00010
00011 using namespace std;
00012
00013 #include <neuralnet/ActivationFunction.h>
00014 #include <neuralnet/RandomFunction.h>
00015 #include <neuralnet/PerceptronNeuron.h>
00016
00019 enum PerceptronLayerType { Input, Hidden, Output };
00020
00025 class
00026 PerceptronLayer {
00027 public:
00032 PerceptronLayerType type;
00033
00037 vector<PerceptronNeuron *> neurons;
00038
00045 PerceptronLayer (unsigned int neuron_count,
00046 const ActivationFunction *fact);
00047
00051 ~PerceptronLayer (void);
00052
00057 PerceptronLayer (PerceptronLayer& source);
00058
00068 void randomizeParameters (PerceptronLayer *succ,
00069 const RandomFunction *weight_func,
00070 const RandomFunction *theta_func);
00071
00079 void resetDiffs (void);
00080
00085 void setActivationFunction (const ActivationFunction *fact);
00086
00089 const ActivationFunction * getActivationFunction (void) const;
00090
00091
00092
00099 void propagate (PerceptronLayer *pred);
00100
00110 void backpropagate (PerceptronLayer *succ,
00111 vector<double> &output_optimal, double opt_tolerance);
00112
00121 void postprocess (PerceptronLayer *succ, double epsilon,
00122 double weight_decay, double momterm);
00123
00126 void update (void);
00127
00128 protected:
00133 const ActivationFunction * fact;
00134 };
00135
00136 #endif
00137