MulticlassOVREvaluation.h

Go to the documentation of this file.
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  * Copyright (C) 2012 Sergey Lisitsyn
00008  */
00009 
00010 #ifndef MULTICLASSOVREVALUATION_H_
00011 #define MULTICLASSOVREVALUATION_H_
00012 
00013 #include <shogun/evaluation/Evaluation.h>
00014 #include <shogun/evaluation/BinaryClassEvaluation.h>
00015 #include <shogun/labels/Labels.h>
00016 
00017 namespace shogun
00018 {
00019 
00020 class CLabels;
00021 
00028 class CMulticlassOVREvaluation: public CEvaluation
00029 {
00030 public:
00032     CMulticlassOVREvaluation();
00033 
00035     CMulticlassOVREvaluation(CBinaryClassEvaluation* binary_evaluation);
00036 
00038     virtual ~CMulticlassOVREvaluation();
00039 
00041     void set_binary_evaluation(CBinaryClassEvaluation* binary_evaluation)
00042     {
00043         SG_REF(binary_evaluation);
00044         SG_UNREF(m_binary_evaluation);
00045         m_binary_evaluation = binary_evaluation;
00046     }
00047 
00049     CBinaryClassEvaluation* get_binary_evaluation()
00050     {
00051         SG_REF(m_binary_evaluation);
00052         return m_binary_evaluation;
00053     }
00054 
00060     virtual float64_t evaluate(CLabels* predicted, CLabels* ground_truth);
00061 
00063     SGVector<float64_t> get_last_results()
00064     {
00065         return m_last_results;
00066     }
00067 
00069     SGMatrix<float64_t> get_graph_for_class(int32_t class_idx)
00070     {
00071         ASSERT(m_graph_results);
00072         ASSERT(class_idx>=0);
00073         ASSERT(class_idx<m_num_graph_results);
00074         return m_graph_results[class_idx];
00075     }
00076 
00078     virtual EEvaluationDirection get_evaluation_direction()
00079     {
00080         return m_binary_evaluation->get_evaluation_direction();
00081     }
00082 
00084     virtual const char* get_name() const { return "MulticlassOVREvaluation"; }
00085 
00086 protected:
00087 
00089     CBinaryClassEvaluation* m_binary_evaluation;
00090 
00092     SGVector<float64_t> m_last_results;
00093 
00095     SGMatrix<float64_t>* m_graph_results;
00096 
00098     int32_t m_num_graph_results;
00099 
00100 };
00101 
00102 }
00103 
00104 #endif /* MULTICLASSOVREVALUATION_H_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation