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) 2011 Sergey Lisitsyn 00008 * Copyright (C) 2011 Berlin Institute of Technology and Max-Planck-Society 00009 */ 00010 00011 #ifndef MULTICLASSACCURACY_H_ 00012 #define MULTICLASSACCURACY_H_ 00013 00014 #include <shogun/evaluation/Evaluation.h> 00015 #include <shogun/labels/Labels.h> 00016 00017 namespace shogun 00018 { 00019 00020 class CLabels; 00021 00034 class CMulticlassAccuracy: public CEvaluation 00035 { 00036 public: 00038 CMulticlassAccuracy() : 00039 CEvaluation(), m_ignore_rejects(false), m_rejects_num(0) {}; 00040 00042 CMulticlassAccuracy(bool ignore_rejects) : 00043 CEvaluation(), m_ignore_rejects(ignore_rejects), m_rejects_num(0) {}; 00044 00046 virtual ~CMulticlassAccuracy() {}; 00047 00053 virtual float64_t evaluate(CLabels* predicted, CLabels* ground_truth); 00054 00060 static SGMatrix<int32_t> get_confusion_matrix(CLabels* predicted, CLabels* ground_truth); 00061 00062 inline EEvaluationDirection get_evaluation_direction() 00063 { 00064 return ED_MAXIMIZE; 00065 } 00066 00068 int32_t get_rejects_num() const 00069 { 00070 return m_rejects_num; 00071 } 00072 00074 virtual const char* get_name() const { return "MulticlassAccuracy"; } 00075 00076 protected: 00077 00079 bool m_ignore_rejects; 00080 00082 int32_t m_rejects_num; 00083 }; 00084 00085 } 00086 00087 #endif /* MULTICLASSACCURACY_H_ */