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 _HMSVM_LABELS__H__ 00012 #define _HMSVM_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 CHMSVMLabels; 00023 00026 class CSequence : public CStructuredData 00027 { 00028 public: 00030 STRUCTURED_DATA_TYPE(SDT_SEQUENCE); 00031 00036 CSequence(SGVector< int32_t > seq = SGVector<int32_t>()) : CStructuredData(), data(seq) { } 00037 00039 ~CSequence() { } 00040 00045 static CSequence* obtain_from_generic(CStructuredData* base_data) 00046 { 00047 if ( base_data->get_structured_data_type() == SDT_SEQUENCE ) 00048 return (CSequence*) base_data; 00049 else 00050 SG_SERROR("base_data must be of dynamic type CSequence\n"); 00051 00052 return NULL; 00053 } 00054 00056 virtual const char* get_name() const { return "Sequence"; } 00057 00059 SGVector<int32_t> get_data() const { return data; } 00060 00061 protected: 00062 00064 SGVector< int32_t > data; 00065 00066 }; 00067 00072 class CHMSVMLabels : public CStructuredLabels 00073 { 00074 public: 00076 CHMSVMLabels(); 00077 00083 CHMSVMLabels(int32_t num_labels, int32_t num_states); 00084 00095 CHMSVMLabels(SGVector< int32_t > labels, int32_t label_length, int32_t num_labels, int32_t num_states); 00096 00098 virtual ~CHMSVMLabels(); 00099 00101 virtual const char* get_name() const { return "HMSVMLabels"; } 00102 00112 void add_label(SGVector< int32_t > label); 00113 00118 inline int32_t get_num_states() const { return m_num_states; }; 00119 00120 private: 00122 void init(); 00123 00124 private: 00129 int32_t m_num_states; 00130 00131 }; /* CHMSVMLabels */ 00132 00133 } /* namespace shogun */ 00134 00135 #endif /* _HMSVM_LABELS__H__ */