/
StructuredAccuracy.h
86 lines (72 loc) · 2.35 KB
/
StructuredAccuracy.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
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* Written (W) 2012 Fernando José Iglesias García
* Copyright (C) 2012 Fernando José Iglesias García
*/
#ifndef __STRUCTURED_ACCURACY_H__
#define __STRUCTURED_ACCURACY_H__
#include <shogun/evaluation/Evaluation.h>
#include <shogun/labels/StructuredLabels.h>
namespace shogun
{
/**
* @brief class CStructuredAccuracy used to compute accuracy of structured classification
*/
class CStructuredAccuracy : public CEvaluation
{
public:
/** default constructor */
CStructuredAccuracy();
/** destructor */
virtual ~CStructuredAccuracy();
/** evaluate accuracy
*
* @param predicted labels to be evaluated
* @param ground_truth labels assumed to be correct
*
* @return accuracy
*/
virtual float64_t evaluate(CLabels* predicted, CLabels* ground_truth);
/** NOT IMPLEMENTED
* constructs confusion matrix for multiclass classification
*
* @param predicted labels to be evaluated
* @param ground_truth labels assumed to be correct
*
* @return confusion matrix
*/
static SGMatrix<int32_t> get_confusion_matrix(CLabels* predicted, CLabels* ground_truth);
/** whether the evaluation criterion has to be maximimed or minimized
*
* @return maximize evaluation criterion
*/
inline EEvaluationDirection get_evaluation_direction() const
{
return ED_MAXIMIZE;
}
/** @return name of SGSerializable */
virtual const char* get_name() const { return "StructuredAccuracy"; }
private:
/** evaluate accuracy for structured labels composed of real numbers
*
* @param predicted labels to be evaluated
* @param ground_truth labels assumed to be correct
*
* @return accuracy
*/
float64_t evaluate_real(CStructuredLabels* predicted, CStructuredLabels* ground_truth);
/** evaluate accuracy for structured labels composed of sequences
*
* @param predicted labels to be evaluated
* @param ground_truth labels assumed to be correct
*
* @return accuracy
*/
float64_t evaluate_sequence(CStructuredLabels* predicted, CStructuredLabels* ground_truth);
}; /* class CStructuredAccuracy*/
} /* namespace shogun */
#endif /* __STRUCTURED_ACCURACY_H__ */