SHOGUN
v3.2.0
|
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 MULTITASKROCEVALUATION_H_ 00011 #define MULTITASKROCEVALUATION_H_ 00012 00013 #include <shogun/transfer/multitask/TaskRelation.h> 00014 #include <shogun/evaluation/ROCEvaluation.h> 00015 00016 namespace shogun 00017 { 00018 00024 class CMultitaskROCEvaluation: public CROCEvaluation 00025 { 00026 public: 00028 CMultitaskROCEvaluation() : 00029 CROCEvaluation(), m_task_relation(NULL), m_tasks_indices(NULL), 00030 m_num_tasks(0) 00031 { 00032 } 00033 00035 CMultitaskROCEvaluation(CTaskRelation* task_relation) : 00036 CROCEvaluation(), m_task_relation(NULL), m_tasks_indices(NULL), 00037 m_num_tasks(0) 00038 { 00039 set_task_relation(task_relation); 00040 } 00041 00043 virtual ~CMultitaskROCEvaluation() 00044 { 00045 SG_FREE(m_tasks_indices); 00046 } 00047 00049 void set_task_relation(CTaskRelation* task_relation) 00050 { 00051 SG_REF(task_relation); 00052 SG_UNREF(m_task_relation); 00053 m_task_relation = task_relation; 00054 } 00055 00057 CTaskRelation* get_task_relation() const 00058 { 00059 SG_REF(m_task_relation); 00060 return m_task_relation; 00061 } 00062 00068 virtual void set_indices(SGVector<index_t> indices); 00069 00071 virtual const char* get_name() const { return "MultitaskROCEvaluation"; }; 00072 00078 virtual float64_t evaluate(CLabels* predicted, CLabels* ground_truth); 00079 00081 virtual EEvaluationDirection get_evaluation_direction() const 00082 { 00083 return ED_MAXIMIZE; 00084 } 00085 00086 protected: 00087 00089 CTaskRelation* m_task_relation; 00090 00092 SGVector<index_t>* m_tasks_indices; 00093 00095 int32_t m_num_tasks; 00096 }; 00097 00098 } 00099 00100 #endif /* MULTITASKROCEVALUATION_H_ */