-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsource.cpp
More file actions
44 lines (31 loc) · 1004 Bytes
/
source.cpp
File metadata and controls
44 lines (31 loc) · 1004 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
#include "header.h"
int main()
{
vs imagesToLearn;
vector<figure> processedImages;
imagesToLearn = getAllFilesNamesWithinFolder("trainImages");
for (size_t i = 0; i < imagesToLearn.size(); i++)
{
processedImages.push_back(processImage(imagesToLearn[i]));
}
vvs dataTable;
dataTable.push_back(getHeaders());
for (size_t i = 0; i < processedImages.size(); i++)
{
dataTable.push_back(figureToVS(processedImages[i]));
}
vvs tableInfo = generateTableInfo(dataTable);
node* root = new node;
root->isLeaf = false;
root = buildDecisionTree(dataTable, root, tableInfo);
printDecisionTree(root, "");
string defaultClass = returnMostFrequentClass(dataTable);
dataTable.clear();
string imageToTest;
imageToTest = "test01.jpg";
vs processedTestImage = figureToVS(processImage(imageToTest));
string prediction = testDataOnDecisionTree(processedTestImage, root, tableInfo, defaultClass);
cout << "Przewidziana klasa = " << prediction << endl;
system("pause");
return 0;
}