-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
47 lines (42 loc) · 878 Bytes
/
main.cpp
File metadata and controls
47 lines (42 loc) · 878 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
45
46
47
#include "iostream"
#include "fstream"
#include "math.h"
#include "stdio.h"
#include "string"
#include "RandomForest.h"
#include "stdlib.h"
#include "RandomForest.h"
#include "ctime"
using namespace std;
void fun(){
ifstream in("train.csv");
ofstream out("train1.csv");
string s;
getline(in, s);
out << s << endl;
while (1){
if (in.eof())
break;
getline(in, s);
double p = rand() * 1.0 / RAND_MAX;
if (p <= 0.1)
out << s << endl;
if (in.peek() == '\n')
in.get();
}
in.close();
out.close();
}
int main(int argc, char * argv[]) {
// insert code here...
clock_t start, end;
start = clock();
RandomForest forest;
forest.readTrainSample("train.csv");
forest.readTestSample("test.csv");
forest.buildTree(120);
forest.predict();
end = clock();
cout << "runint time is " << (end - start) / CLOCKS_PER_SEC << " second" << endl;
return 0;
}