-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_ann.cpp
executable file
·59 lines (42 loc) · 1.39 KB
/
test_ann.cpp
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
54
55
56
57
58
59
#include <vector>
#include "ann.cpp"
#include "activation.cpp"
#include <iostream>
int main(){
Ann_settings ann_settings;
ann_settings.number_of_inputs = 2;
ann_settings.number_of_hidden_neurons = 2;
ann_settings.number_of_outputs = 1;
ann_settings.initial_weight_range = 2.0;
std::vector<double> input1;
input1.push_back(1.0);
input1.push_back(0.0);
std::vector<double> input2;
input2.push_back(0.0);
input2.push_back(1.0);
std::vector<double> input3;
input3.push_back(1.0);
input3.push_back(1.0);
std::vector<double> input4;
input4.push_back(0.0);
input4.push_back(0.0);
Network net = Network(ann_settings, Tanh);
net.init_network();
net.init_weights();
std::vector<double> output = net.evaluate(input1);
for(std::vector<double>::iterator it = output.begin(); it != output.end(); it++){
std::cout << * it << " ";
}
output = net.evaluate(input2);
for(std::vector<double>::iterator it = output.begin(); it != output.end(); it++){
std::cout << * it << " ";
}
output = net.evaluate(input3);
for(std::vector<double>::iterator it = output.begin(); it != output.end(); it++){
std::cout << * it << " ";
}
output = net.evaluate(input4);
for(std::vector<double>::iterator it = output.begin(); it != output.end(); it++){
std::cout << * it << " ";
}
}