SHOGUN
v3.2.0
|
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 #include <shogun/structure/SequenceLabels.h> 00012 00013 using namespace shogun; 00014 00015 CSequenceLabels::CSequenceLabels() 00016 : CStructuredLabels() 00017 { 00018 } 00019 00020 CSequenceLabels::CSequenceLabels(int32_t num_labels, int32_t num_states) 00021 : CStructuredLabels(num_labels), m_num_states(num_states) 00022 { 00023 init(); 00024 } 00025 00026 CSequenceLabels::CSequenceLabels(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_vector_label(SGVector< int32_t >( 00037 SGVector< int32_t >::clone_vector(labels.vector+i, label_length), 00038 label_length)); 00039 } 00040 } 00041 00042 CSequenceLabels::~CSequenceLabels() 00043 { 00044 } 00045 00046 void CSequenceLabels::add_vector_label(SGVector< int32_t > label) 00047 { 00048 CStructuredLabels::add_label( new CSequence(label) ); 00049 } 00050 00051 void CSequenceLabels::init() 00052 { 00053 SG_ADD(&m_num_states, "m_num_states", "Number of states", MS_NOT_AVAILABLE); 00054 }