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) 2012 Fernando José Iglesias García 00008 * Copyright (C) 2012 Fernando José Iglesias García 00009 */ 00010 00011 #ifndef _MULTICLASS_SO_LABELS__H__ 00012 #define _MULTICLASS_SO_LABELS__H__ 00013 00014 #include <shogun/labels/StructuredLabels.h> 00015 #include <shogun/lib/SGVector.h> 00016 #include <shogun/lib/StructuredData.h> 00017 #include <shogun/lib/StructuredDataTypes.h> 00018 00019 namespace shogun 00020 { 00021 00022 class CMulticlassSOLabels; 00023 00029 struct CRealNumber : public CStructuredData 00030 { 00032 STRUCTURED_DATA_TYPE(SDT_REAL); 00033 00038 CRealNumber(float64_t val) : CStructuredData(), value(val) { } 00039 00044 static CRealNumber* obtain_from_generic(CStructuredData* base_data) 00045 { 00046 if ( base_data->get_structured_data_type() == SDT_REAL ) 00047 return (CRealNumber*) base_data; 00048 else 00049 SG_SERROR("base_data must be of dynamic type CRealNumber\n"); 00050 00051 return NULL; 00052 } 00053 00055 virtual const char* get_name() const { return "RealNumber"; } 00056 00058 float64_t value; 00059 }; 00060 00066 class CMulticlassSOLabels : public CStructuredLabels 00067 { 00068 public: 00070 CMulticlassSOLabels(); 00071 00076 CMulticlassSOLabels(SGVector< float64_t > const src); 00077 00079 virtual ~CMulticlassSOLabels(); 00080 00085 inline int32_t get_num_classes() { return m_num_classes; } 00086 00088 virtual const char* get_name() const { return "MulticlassSOLabels"; } 00089 00090 private: 00091 void init(); 00092 00093 private: 00095 int32_t m_num_classes; 00096 00097 }; /* CMulticlassSOLabels */ 00098 00099 } /* namespace shogun */ 00100 00101 #endif /* _MULTICLASS_SO_LABELS__H__ */