-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathROCCurve.hpp
36 lines (32 loc) · 890 Bytes
/
ROCCurve.hpp
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
#ifndef ROC_CURVE_H
#define ROC_CURVE_H
#include "Statistics.hpp"
#include <memory>
#include <string>
#include <fstream>
#include <iostream>
#include <chrono>
struct ExamData {
int x11;
int notX11;
int FP;
int CD;
ExamData() : x11(0), notX11(0), FP(0), CD(0) { }
void clear() { x11 = notX11 = FP = CD = 0; }
void detected(bool result) { ++x11; if(result){ ++CD; } }
void notDetected(bool result) { ++notX11; if(result){ ++FP; } }
};
class ROCCurve {
private:
std::unique_ptr<Statistics> stat;
ExamData examData;
public:
ROCCurve(std::unique_ptr<Statistics>&& stat_)
: stat(std::move(stat_)) { }
void plotCurve(const std::string& fileName, int iter = 100000);
void writeToTSV(const std::string& fileName, const DoubleVec& FPRList, const DoubleVec& CDRList);
void recognition(double thresh);
double FPR();
double CDR();
};
#endif