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 ROCEVALUATION_H_ 00012 #define ROCEVALUATION_H_ 00013 00014 #include <shogun/evaluation/BinaryClassEvaluation.h> 00015 00016 namespace shogun 00017 { 00018 00019 class CLabels; 00020 00030 class CROCEvaluation: public CBinaryClassEvaluation 00031 { 00032 public: 00034 CROCEvaluation() : 00035 CBinaryClassEvaluation(), m_computed(false) 00036 { 00037 m_ROC_graph = SGMatrix<float64_t>(); 00038 m_thresholds = SGVector<float64_t>(); 00039 }; 00040 00042 virtual ~CROCEvaluation(); 00043 00045 virtual const char* get_name() const { return "ROCEvaluation"; }; 00046 00052 virtual float64_t evaluate(CLabels* predicted, CLabels* ground_truth); 00053 00054 virtual EEvaluationDirection get_evaluation_direction() 00055 { 00056 return ED_MAXIMIZE; 00057 } 00058 00062 float64_t get_auROC(); 00063 00067 SGMatrix<float64_t> get_ROC(); 00068 00072 SGVector<float64_t> get_thresholds(); 00073 00074 protected: 00075 00081 float64_t evaluate_roc(CLabels* predicted, CLabels* ground_truth); 00082 00083 protected: 00084 00086 SGMatrix<float64_t> m_ROC_graph; 00087 00089 SGVector<float64_t> m_thresholds; 00090 00092 float64_t m_auROC; 00093 00095 bool m_computed; 00096 }; 00097 00098 } 00099 00100 #endif /* ROCEVALUATION_H_ */