-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPerformanceAnalysis.h
36 lines (31 loc) · 990 Bytes
/
PerformanceAnalysis.h
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
#pragma once
#include <string>
#include <fstream>
#include <iostream>
using namespace std;
class PerformanceAnalysis
{
public:
static void AnalyzePerformance(const string &output, const string &correct, const string &results) {
cout << "Analyzing Performance..." << endl;
ifstream out(output);
ifstream cor(correct);
ofstream res(results);
string str1, str2;
double all = 0, corect = 0;
while (getline(cor, str1)) {
all++;
if (getline(out, str2)) {
if (str1 == str2) corect++;
cout << "correct: " << str1 << " predicted: " << str2 << endl;
res << "correct: " << str1 << " predicted: " << str2 << endl;
}
}
cout << endl;
res << endl;
cout << "correctly classified " << corect << " / " << all << endl;
cout << "Accuracy = " << 100.0 * corect / all << "%" << endl;
res << "correctly classified " << corect << " / " << all << endl;
res << "Accuracy = " << 100.0 * corect / all << "%" << endl;
}
};