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 00051 inline EEvaluationDirection get_evaluation_direction() 00052 { 00053 return ED_MAXIMIZE; 00054 } 00055 00056 virtual const char* get_name() const { return "StructuredAccuracy"; } 00057 00058 private: 00066 float64_t evaluate_real(CStructuredLabels* predicted, CStructuredLabels* ground_truth); 00067 00075 float64_t evaluate_sequence(CStructuredLabels* predicted, CStructuredLabels* ground_truth); 00076 00077 }; /* class CStructuredAccuracy*/ 00078 00079 } /* namespace shogun */ 00080 00081 #endif /* __STRUCTURED_ACCURACY_H__ */