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 for (int32_t i=0; i<m_num_tasks; i++) 00046 m_tasks_indices[i].~SGVector<index_t>(); 00047 SG_FREE(m_tasks_indices); 00048 } 00049 00051 void set_task_relation(CTaskRelation* task_relation) 00052 { 00053 SG_REF(task_relation); 00054 SG_UNREF(m_task_relation); 00055 m_task_relation = task_relation; 00056 } 00057 00059 CTaskRelation* get_task_relation() const 00060 { 00061 SG_REF(m_task_relation); 00062 return m_task_relation; 00063 } 00064 00070 virtual void set_indices(SGVector<index_t> indices); 00071 00073 virtual const char* get_name() const { return "MultitaskROCEvaluation"; }; 00074 00080 virtual float64_t evaluate(CLabels* predicted, CLabels* ground_truth); 00081 00083 virtual EEvaluationDirection get_evaluation_direction() 00084 { 00085 return ED_MAXIMIZE; 00086 } 00087 00088 protected: 00089 00091 CTaskRelation* m_task_relation; 00092 00094 SGVector<index_t>* m_tasks_indices; 00095 00097 int32_t m_num_tasks; 00098 }; 00099 00100 } 00101 00102 #endif /* MULTITASKROCEVALUATION_H_ */