-
Notifications
You must be signed in to change notification settings - Fork 0
/
metrics.h
62 lines (49 loc) · 1.03 KB
/
metrics.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
#ifndef METRICS_H
#define METRICS_H
#include <vector>
namespace casimiro {
class Metrics;
typedef std::vector<Metrics> MetricsVector;
class Metrics {
public:
Metrics(int _position)
{
calculateMRR(_position);
calculateSAt5(_position);
calculateSAt10(_position);
}
virtual ~Metrics() {}
virtual float MRR() const
{
return m_MRR;
}
virtual float SAt5() const
{
return m_SAt5;
}
virtual float SAt10() const
{
return m_SAt10;
}
private:
float m_MRR = 0.0;
float m_SAt5 = 0.0;
float m_SAt10 = 0.0;
virtual void calculateMRR(int _position)
{
if(_position != -1)
m_MRR = 1.0 / (++_position);
}
virtual void calculateSAt5(int _position)
{
if(_position != -1 && _position <= 4)
m_SAt5 = 1;
}
virtual void calculateSAt10(int _position)
{
if(_position != -1 && _position <= 9)
m_SAt10 = 1;
}
};
}
#endif // METRICS_H