-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathNet.h
39 lines (28 loc) · 1.27 KB
/
Net.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
37
38
39
//
// Created by Tommy Ludwig on 23.09.23.
//
#ifndef XORGATE_NEURALNETWORK_NET_H
#define XORGATE_NEURALNETWORK_NET_H
#include <vector>
#include "Neuron.h"
using namespace std;
typedef vector<Neuron> Layer;
class Net {
public:
// topology is a vector of unsigned integers, it stands for the number of neurons in each layer
explicit Net(const vector<unsigned> &topology);
// FeedForward is used to calculate the output values
void feedForward(const vector<double> &inputValues);
// backPropagate is used to calculate the error and adjust the weights
void backPropagate(const vector<double> &targetValues);
// get results is used to get the output values
void getResults(vector<double> &resultValues) const;
[[nodiscard]] double getRecentAverageError() const;
[[maybe_unused]] void printPrediction(vector<double> &inputValues);
private:
vector<Layer> m_layers; // m_layers[layerNum][neuronNum]
double m_error; // error is the average error of the output neurons
double m_recentAverageError; // recentAverageError is the average error of the output neurons, but it is smoothed
double m_recentAverageSmoothingFactor; // recentAverageSmoothingFactor is the smoothing factor for the recentAverageError
};
#endif //XORGATE_NEURALNETWORK_NET_H