-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNetwork.h
More file actions
49 lines (31 loc) · 994 Bytes
/
Network.h
File metadata and controls
49 lines (31 loc) · 994 Bytes
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
40
41
42
43
44
45
46
47
48
49
#pragma once
#include "Matrix.h"
#include "utils.h"
#include <vector>
#include <cstdint>
#include <iostream>
#include <stdexcept>
#include <sstream>
class Network
{
public:
Network(const Matrix &trainingData, uint32_t inputCols, uint32_t outputCols);
uint32_t getDataSetSize() const;
uint32_t getLayerCount() const;
uint32_t getLayerNeurons(uint32_t layer) const;
void addLayers(const std::vector<uint32_t> &neuronCounts);
void addLayer(uint32_t neurons);
void feedForwardTo(const Matrix &data, uint32_t layerIndex);
double computeCost();
void train(uint32_t epochs, double eps, double rate);
void feedForward(const Matrix &inputData);
Matrix predict(const Matrix &inputRow) const;
void feedForwardRow(const Matrix &data);
private:
std::vector<Matrix> inputs_;
std::vector<Matrix> expectedOutputs_;
std::vector<Matrix> weights_;
std::vector<Matrix> biases_;
uint32_t inputCols_;
uint32_t outputCols_;
};