-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
40 lines (28 loc) · 893 Bytes
/
main.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
#include "Core.h"
int main() {
std::filesystem::current_path("..");
Network net;
net.add_layer(LayerType::input, 2, FunctionType::sigmoid);
net.add_layer(LayerType::hidden, 3, FunctionType::sigmoid);
net.add_layer(LayerType::hidden, 5, FunctionType::sigmoid);
net.add_layer(LayerType::output, 1, FunctionType::sigmoid);
net.build();
net.show_network();
net.save("base.json");
std::vector<std::vector<float>> input_data = {
{1.0f, 0.0f},
{1.0f, 1.0f},
{0.0f, 1.0f},
{0.0f, 0.0f},
};
std::vector<std::vector<float>> output_data = {
{0.0f},
{1.0f},
{1.0f},
{1.0f},
};
const int epochs = 100;
net.train(input_data, output_data, Normalisation::without_normalisation, epochs, 1, 0.5);
net.work({{1.0f, 0.0f}});
return 0;
}