NNetCpp
Neural network implementation in C++
 All Classes Namespaces Functions Variables
Neuron.h
1 #ifndef NEURON_H
2 #define NEURON_H
3 
4 #include <functional>
5 #include <vector>
6 #include "Node.h"
7 #include "Edge.h"
8 
9 // Forward declaration
10 class Edge;
11 
15 class Neuron: public Node {
16  private:
17  std::vector<Edge*> inputs;
18  std::vector<Edge*> outputs;
19 
20  double output = 0;
21 
22  std::function<double(double)> activationFunc;
23 
24  protected:
28  double delta = 0;
29 
35  double sigmoidDelta();
36 
37  public:
45  Neuron(std::function<double(double)> activationFunc,
46  std::vector<Edge*> inputs,
47  std::vector<Edge*> outputs);
48 
54  Neuron(std::function<double(double)> activationFunc);
55 
61  void setInputs(std::vector<Edge*> inputs);
62 
68  void setOutputs(std::vector<Edge*> outputs);
69 
74  void calcOutput();
75 
80  void calcDelta();
81 
87  double getOutput();
88 
94  double getDelta();
95 };
96 
97 #endif // NEURON_H
Definition: Neuron.h:15
Definition: Node.h:7
Definition: Edge.h:19
void calcDelta()
Definition: Neuron.cpp:36
Neuron(std::function< double(double)> activationFunc, std::vector< Edge * > inputs, std::vector< Edge * > outputs)
Definition: Neuron.cpp:3
double delta
Definition: Neuron.h:28
double sigmoidDelta()
Definition: Neuron.cpp:11
void calcOutput()
Definition: Neuron.cpp:25
void setInputs(std::vector< Edge * > inputs)
Definition: Neuron.cpp:17
double getDelta()
Definition: Neuron.cpp:51
double getOutput()
Definition: Neuron.cpp:47
void setOutputs(std::vector< Edge * > outputs)
Definition: Neuron.cpp:21