SHOGUN
v3.2.0
|
00001 /* 00002 * This program is free software; you can redistribute it and/or modify 00003 * it under the terms of the GNU General Public License as published by 00004 * the Free Software Foundation; either version 3 of the License, or 00005 * (at your option) any later version. 00006 * 00007 * Written (W) 2012 Fernando José Iglesias García 00008 * Copyright (C) 2012 Fernando José Iglesias García 00009 */ 00010 00011 #ifndef __STRUCTURED_ACCURACY_H__ 00012 #define __STRUCTURED_ACCURACY_H__ 00013 00014 #include <shogun/evaluation/Evaluation.h> 00015 #include <shogun/labels/StructuredLabels.h> 00016 00017 namespace shogun 00018 { 00019 00023 class CStructuredAccuracy : public CEvaluation 00024 { 00025 public: 00027 CStructuredAccuracy(); 00028 00030 virtual ~CStructuredAccuracy(); 00031 00039 virtual float64_t evaluate(CLabels* predicted, CLabels* ground_truth); 00040 00049 static SGMatrix<int32_t> get_confusion_matrix(CLabels* predicted, CLabels* ground_truth); 00050 00055 inline EEvaluationDirection get_evaluation_direction() const 00056 { 00057 return ED_MAXIMIZE; 00058 } 00059 00061 virtual const char* get_name() const { return "StructuredAccuracy"; } 00062 00063 private: 00071 float64_t evaluate_real(CStructuredLabels* predicted, CStructuredLabels* ground_truth); 00072 00080 float64_t evaluate_sequence(CStructuredLabels* predicted, CStructuredLabels* ground_truth); 00081 00082 }; /* class CStructuredAccuracy*/ 00083 00084 } /* namespace shogun */ 00085 00086 #endif /* __STRUCTURED_ACCURACY_H__ */