-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cpp
45 lines (35 loc) · 995 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
41
42
43
44
#include <iostream>
#include <vector>
#include <neuron_network.h>
#include <network_training.h>
using namespace std;
void XOR_network(){
// XOR датасет
vector <vector<float>> dataset_input = {
{0, 0}, {0, 1}, {1, 0}, {1, 1}
};
vector <vector<float>> dataset_output = {
{0}, {1}, {1}, {0}
};
// Создание и тренировка нейросети
Neuron_network XOR(2, 3, 2, 1);
Network_training Training_network(dataset_input, dataset_output, XOR);
XOR = Training_network.training(100000);
// Проверка обученной нейросети
cout << "\nDatasets result: \n";
for (auto & set : dataset_input) {
cout << "[ ";
for (float i : set) {
cout << i << " ";
}
cout << "] - ";
cout << XOR.run(set)[0] << "\n";
}
cout << "\n";
XOR.print_weights();
}
int main() {
srand(time(nullptr));
XOR_network();
return 0;
}