forked from hlamotte/decision-tree
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.cpp
30 lines (24 loc) · 905 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
#include "DecisionTree.hpp"
// for python library
extern "C" int* decisionTree(char* trainPathP, char* testPathP) {
//std::string trainPath(trainPathP);
//std::string testPath(testPathP);
//std::cout << trainPath;
//CSVReader reader;
//DataFrame test = reader.read("test/resources/test.csv");
//char trainPath[] = "test/resources/train.csv";
//std::string trainPathStr = "test/resources/train.csv";
//std::string testPathStr = "test/resources/train.csv";
DecisionTree* treeP = new DecisionTree(trainPathP);
std::vector<int> predictions = treeP->predict(testPathP);
delete treeP;
// need to get length of predictions
int predictionsSize = predictions.size();
int* predictionsArray = new int[predictionsSize];
int i = 0;
for(int val : predictions) {
predictionsArray[i] = val;
i += 1;
}
return predictionsArray;
}