/usr/include/shogun/structure/SequenceLabels.h is in libshogun-dev 3.2.0-7.3build4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | /*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* Written (W) 2012-2013 Fernando José Iglesias García
* Copyright (C) 2012-2013 Fernando José Iglesias García
*/
#ifndef _SEQUENCE_LABELS__H__
#define _SEQUENCE_LABELS__H__
#include <shogun/labels/StructuredLabels.h>
#include <shogun/lib/SGVector.h>
#include <shogun/lib/StructuredData.h>
#include <shogun/lib/StructuredDataTypes.h>
namespace shogun
{
class CSequenceLabels;
/** @brief Class CSequence to be used in the application of Structured Output
* (SO) learning to Hidden Markov Support Vector Machines (HM-SVM). */
class CSequence : public CStructuredData
{
public:
/** data type */
STRUCTURED_DATA_TYPE(SDT_SEQUENCE);
/** constructor
*
* @param seq data sequence
*/
CSequence(SGVector< int32_t > seq = SGVector<int32_t>()) : CStructuredData(), data(seq) { }
/** destructor */
~CSequence() { }
/** helper method used to specialize a base class instance
*
* @param base_data its dynamic type must be CSequence
*/
static CSequence* obtain_from_generic(CStructuredData* base_data)
{
if ( base_data->get_structured_data_type() == SDT_SEQUENCE )
return (CSequence*) base_data;
else
SG_SERROR("base_data must be of dynamic type CSequence\n")
return NULL;
}
/** @return name of SGSerializable */
virtual const char* get_name() const { return "Sequence"; }
/** returns data */
SGVector<int32_t> get_data() const { return data; }
protected:
/** data sequence */
SGVector< int32_t > data;
};
/** @brief Class CSequenceLabels used e.g. in the application of Structured Output
* (SO) learning to Hidden Markov Support Vector Machines (HM-SVM). Each of the
* labels is represented by a sequence of integers. Each label is of type
* CSequence and all of them are stored in a CDynamicObjectArray. */
class CSequenceLabels : public CStructuredLabels
{
public:
/** default constructor */
CSequenceLabels();
/** standard constructor
*
* @param num_labels number of labels
* @param num_states number of states
*/
CSequenceLabels(int32_t num_labels, int32_t num_states);
/**
* constructor using the data of all the labels concatenated. All the
* labels are assumed to have the same length. The length of labels must
* be equal to label_length times num_labels.
*
* @param labels concatenation of the labels
* @param label_length number of elements in each label
* @param num_labels number of labels
* @param num_states number of states
*/
CSequenceLabels(SGVector< int32_t > labels, int32_t label_length, int32_t num_labels, int32_t num_states);
/** destructor */
virtual ~CSequenceLabels();
/** @return object name */
virtual const char* get_name() const { return "SequenceLabels"; }
/**
* add a new label to the vector of labels, effectively
* increasing the number of elements of the structure. This
* method should be used when inserting labels for the first
* time. NOTE: the elements of the labels have to be in the
* interval [0, 1, ..., num_states-1].
*
* @param label label to add
*/
void add_vector_label(SGVector< int32_t > label);
/** get the number of states
*
* @return the number of states
*/
inline int32_t get_num_states() const { return m_num_states; };
private:
/** internal initialization */
void init();
private:
/**
* the number of possible values taken by the elements of
* the sequences
*/
int32_t m_num_states;
}; /* CSequenceLabels */
} /* namespace shogun */
#endif /* _SEQUENCE_LABELS__H__ */
|