-
Notifications
You must be signed in to change notification settings - Fork 0
/
NeuralNetwork.h
25 lines (21 loc) · 934 Bytes
/
NeuralNetwork.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
#ifndef NeuralNetwork_H
#define NeuralNetwork_H
#include <iostream>
#include <vector>
class NeuralNetwork
{
public:
NeuralNetwork(const std::vector<int> &topology);
void train(const std::vector<std::vector<double>> &training_inputs,
const std::vector<std::vector<double>> &training_outputs, int epochs, double learning_rate);
std::vector<double> predict(const std::vector<double> &input);
double calculate_loss(const std::vector<double> &predicted, const std::vector<double> &actual);
private:
std::vector<int> topology;
std::vector<std::vector<std::vector<double>>> weights;
std::vector<std::vector<double>> biases;
std::vector<std::vector<double>> layers;
void forward(const std::vector<double> &input);
void backward(const std::vector<double> &input, const std::vector<double> &expected_output, double learning_rate);
};
#endif