-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathHeart.cpp
54 lines (44 loc) · 1.76 KB
/
Heart.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
45
46
47
48
49
50
51
52
53
54
#include "stdafx.h"
#include "Model.h"
#include "LabelVector.h"
#include "PatternVector.h"
#include "Submission.h"
#include "imebra/imebra.h"
int main()
{
try {
double scaleMin, errorMin = DBL_MAX;
Model modelMin;
//double scale = -0.05; int i = 16; int j = 16; {
for (double scale = -0.06; scale < -0.04; scale += 0.001)
for (int i = 14; i < 20; ++i)
for (int j = 14; j < 20; ++j) {
Model model (PatternVector("E:\\Heart\\train\\", 1, 500), LabelVector("E:\\Heart\\train.csv"), array<int, 2>{i, j});
double error = model
.predict (PatternVector("E:\\Heart\\train\\", 1, 500))
.makeSubmission (scale)
.evaluateAgainst(LabelVector("E:\\Heart\\train.csv"));
if (error < errorMin) {
errorMin = error;
modelMin = model;
scaleMin = scale;
}
cout << "*";
}
string stamp = "-erf-square-sigma-" + to_string(scaleMin) + "-" + to_string(modelMin.fullGrownAge[0]) + "-" +
to_string(modelMin.fullGrownAge[1]) + "-" + to_string(errorMin);
ofstream report("C:\\Heart\\documents\\report" + stamp + ".txt");
cout << "\n\n\a";
modelMin.print(report);
modelMin.print(cout);
report << "error:\t" << setprecision(6) << errorMin << endl << "scale:\t" << scaleMin << endl;
cout << "error:\t" << setprecision(6) << errorMin << endl << "scale:\t" << scaleMin << endl;
modelMin.predict (PatternVector("E:\\Heart\\validate\\", 501, 700))
.makeSubmission(scaleMin)
.write ("C:\\Heart\\documents\\submission" + stamp + ".txt");
}
catch (exception& e) {
cout << e.what();
}
return 0;
}