-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GST.h
119 lines (88 loc) · 2.31 KB
/
GST.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#pragma once
//
// FILE: GST.h
// VERSION: 0.1.4
// PURPOSE: Arduino library for Gold Standard Test metrics
// URL: https://github.com/RobTillaart/GST
// https://en.wikipedia.org/wiki/Sensitivity_and_specificity
// https://en.wikipedia.org/wiki/Confusion_matrix
//
// formula's based upon Wikipedia.
#define GST_LIB_VERSION (F("0.1.4"))
#include "Arduino.h"
class GST
{
public:
GST();
// These four values of the matrix need to be set to get started.
void setTruePositive(float v = 0);
void setTrueNegative(float v = 0);
void setFalsePositive(float v = 0);
void setFalseNegative(float v = 0);
void clearAll();
// These are used for updating the test matrix
float addTruePositive(float v);
float addTrueNegative(float v);
float addFalsePositive(float v);
float addFalseNegative(float v);
// Output functions I
float getTruePositive();
float getTrueNegative();
float getFalsePositive();
float getFalseNegative();
float getTotal();
float getActualPositive();
float getActualNegative();
float getTestedPositive();
float getTestedNegative();
float sensitivity();
float specificity();
float truePositiveRate();
float TPR();
float trueNegativeRate();
float TNR();
float falseNegativeRate();
float FNR();
float falsePositiveRate();
float FPR();
// Output functions II
float positivePredictiveValue();
float PPV();
float negativePredictiveValue();
float NPV();
float falseDiscoveryRate();
float FDR();
float falseOmissionRate();
float FOR();
float positiveLikelihoodRatio();
float LRplus();
float negativeLikelihoodRatio();
float LRminus();
float prevalenceThreshold();
float threatScore();
float criticalSuccessIndex();
float prevalence();
float accuracy();
float balancedAccuracy();
float F1Score();
float MatthewsCorrelationCoefficient();
float phi();
float MCC();
float FowlkesMallowsIndex();
float FM();
float BookmakerInformedness();
float BM();
float markedness();
float deltaP();
float MK();
float diagnosticOddsRatio();
float DOR();
private:
float AP; // actual positive
float AN; // actual negative
float TP; // true positive
float TN; // true negative
float FP; // false positive
float FN; // false positive
};
// -- END OF FILE --