Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include <shogun/structure/HMSVMLabels.h>
00012
00013 using namespace shogun;
00014
00015 CHMSVMLabels::CHMSVMLabels()
00016 : CStructuredLabels()
00017 {
00018 }
00019
00020 CHMSVMLabels::CHMSVMLabels(int32_t num_labels, int32_t num_states)
00021 : CStructuredLabels(num_labels), m_num_states(num_states)
00022 {
00023 init();
00024 }
00025
00026 CHMSVMLabels::CHMSVMLabels(SGVector< int32_t > labels, int32_t label_length,
00027 int32_t num_labels, int32_t num_states)
00028 : CStructuredLabels(num_labels), m_num_states(num_states)
00029 {
00030 REQUIRE(labels.vlen == label_length*num_labels, "The length of the labels must be "
00031 "equal to label_length times num_labels\n");
00032 init();
00033
00034 for ( int32_t i = 0 ; i < labels.vlen ; i += label_length )
00035 {
00036 add_label(SGVector< int32_t >(
00037 SGVector< int32_t >::clone_vector(labels.vector+i, label_length),
00038 label_length));
00039 }
00040 }
00041
00042 CHMSVMLabels::~CHMSVMLabels()
00043 {
00044 }
00045
00046 void CHMSVMLabels::add_label(SGVector< int32_t > label)
00047 {
00048 CStructuredLabels::add_label( new CSequence(label) );
00049 }
00050
00051 void CHMSVMLabels::init()
00052 {
00053 SG_ADD(&m_num_states, "m_num_states", "Number of states", MS_NOT_AVAILABLE);
00054 }