SHOGUN  v3.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
SequenceLabels.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  * Written (W) 2012-2013 Fernando José Iglesias García
00008  * Copyright (C) 2012-2013 Fernando José Iglesias García
00009  */
00010 
00011 #ifndef _SEQUENCE_LABELS__H__
00012 #define _SEQUENCE_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 CSequenceLabels;
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:
00063     SGVector< int32_t > data;
00064 
00065 };
00066 
00071 class CSequenceLabels : public CStructuredLabels
00072 {
00073     public:
00075         CSequenceLabels();
00076 
00082         CSequenceLabels(int32_t num_labels, int32_t num_states);
00083 
00094         CSequenceLabels(SGVector< int32_t > labels, int32_t label_length, int32_t num_labels, int32_t num_states);
00095 
00097         virtual ~CSequenceLabels();
00098 
00100         virtual const char* get_name() const { return "SequenceLabels"; }
00101 
00111         void add_vector_label(SGVector< int32_t > label);
00112 
00117         inline int32_t get_num_states() const { return m_num_states; };
00118 
00119     private:
00121         void init();
00122 
00123     private:
00128         int32_t m_num_states;
00129 
00130 }; /* CSequenceLabels */
00131 
00132 } /* namespace shogun */
00133 
00134 #endif /* _SEQUENCE_LABELS__H__ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation