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 PRCEVALUATION_H_ 00012 #define PRCEVALUATION_H_ 00013 00014 #include <shogun/evaluation/BinaryClassEvaluation.h> 00015 00016 namespace shogun 00017 { 00018 00019 class CLabels; 00020 00025 class CPRCEvaluation: public CBinaryClassEvaluation 00026 { 00027 public: 00029 CPRCEvaluation() : 00030 CBinaryClassEvaluation(), m_computed(false) 00031 { 00032 m_PRC_graph = SGMatrix<float64_t>(); 00033 m_thresholds = SGVector<float64_t>(); 00034 m_auPRC = 0.0; 00035 }; 00036 00038 virtual ~CPRCEvaluation(); 00039 00041 virtual const char* get_name() const { return "PRCEvaluation"; }; 00042 00048 virtual float64_t evaluate(CLabels* predicted, CLabels* ground_truth); 00049 00050 inline EEvaluationDirection get_evaluation_direction() 00051 { 00052 return ED_MAXIMIZE; 00053 } 00054 00058 float64_t get_auPRC(); 00059 00063 SGMatrix<float64_t> get_PRC(); 00064 00068 SGVector<float64_t> get_thresholds(); 00069 00070 protected: 00071 00073 SGMatrix<float64_t> m_PRC_graph; 00074 00076 SGVector<float64_t> m_thresholds; 00077 00079 float64_t m_auPRC; 00080 00082 bool m_computed; 00083 }; 00084 00085 } 00086 00087 #endif /* PRCEVALUATION_H_ */