-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathneuron.h
36 lines (30 loc) · 837 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
27
28
29
30
31
32
33
34
35
36
#ifndef NEURON_H
#define NEURON_H
#include <vector>
enum typeActivation { SIGMOID, RELU };
class neuron
{
public:
int layerID;
int neuronIdLayer;
float output;
void setInputs(std::vector<float> newInputs);
void learn(float learningRate); // use delta and weights
float propagate(); // get result
void defineWeight(int numInputs);
void emptyInputsOutput();
neuron(int layerID,int layerId,typeActivation activationFunction);
float getWeightWithIndex(int index);
float delta=0;
std::vector<float> getInputs() const;
typeActivation getActivation() const;
private:
float bias = 1;
typeActivation activation;
std::vector<float> inputs;
std::vector<float> weights;
float sigmoid(float x);
float relu(float x);
float preActivation();
};
#endif // NEURON_H