-
Notifications
You must be signed in to change notification settings - Fork 1
/
neuron.h
26 lines (23 loc) · 803 Bytes
/
neuron.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#ifndef NEURON
#define NEURON
#include "net.h"
class Neuron {
public:
Neuron(int numOutputs, int index);
void setOutputVal(double val) { mOutputVal = val; }
double getOutputVal() const { return mOutputVal; }
void feedForward(const Layer& prevLayer);
void calculateOutputGradients(double targetVal);
void calculateHiddenGradients(const Layer& nextLayer);
void updateInputWeights(Layer &prevLayer);
private:
static double activationFunction(double x);
static double activationFunctionDerivative(double x);
double sumDOW(const Layer& nextLayer);
double mOutputVal, mGradient;
vector<Connection> mOutputWeights;
int mIndex;
static double eta; //overall net learning rate
static double alpha; //momentum, multiplier of last deltaWeight
};
#endif