-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.cpp
More file actions
53 lines (45 loc) · 1.26 KB
/
test.cpp
File metadata and controls
53 lines (45 loc) · 1.26 KB
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
50
51
52
53
#include <iostream>
#include <vector>
#include <memory>
#include "NeuralNetwork.hpp"
using namespace std;
//RELU 1
//SIGM 2
//SFMX 3
//PRELU 4
//SIGM2 5
int main(int argc, char **argv) {
auto top = make_unique<vector<int> >();
auto input = make_unique<vector<vector<double> > >();
auto output = make_unique<vector<vector<double> > >();
NeuralNetwork::askInitializers(top, input, output);
//vector<vector<double> > input{{0, 0}, {1, 0}, {0, 1}, {1, 1}};
//vector<vector<double> > out{ {1, 0}, {1, 0}, {0, 1}};
//vector<vector<double> > out{{0}, {1}, {1}, {0}};
auto nn = make_unique<NeuralNetwork>(move(top), false, 1, 2);
char a, b;
nn->m_learning_rate = .3;
for (long i = 1; i <= 100000; i++) {
for (int j = 0; j < input->size(); j++) {
nn->setCurrentInput(input->at(j));
nn->setCurrentTarget(output->at(j));
//nn->printToConsole();
//cin.get();
nn->feedForward();
//nn->printToConsole();
nn->setErrors();
nn->backPropagation(1);
}
if (!(i % 10000)) {
cout << "\nEpoch: \t" << i << '\n';
for (int j = 0; j < input->size(); j++) {
nn->setCurrentInput(input->at(j));
nn->setCurrentTarget(output->at(j));
nn->feedForward();
nn->printToConsole();
nn->printOutput();
cin.get();
}
}
}
}