/usr/include/shogun/labels/StructuredLabels.h is in libshogun-dev 3.2.0-7.5.
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 | /*
* 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 Fernando José Iglesias García
* Copyright (C) 2012 Fernando José Iglesias García
*/
#ifndef _STRUCTURED_LABELS__H__
#define _STRUCTURED_LABELS__H__
#include <shogun/labels/Labels.h>
#include <shogun/labels/LabelTypes.h>
#include <shogun/lib/DynamicObjectArray.h>
#include <shogun/lib/StructuredData.h>
#include <shogun/lib/StructuredDataTypes.h>
namespace shogun {
/** @brief Base class of the labels used in Structured Output (SO) problems */
class CStructuredLabels : public CLabels
{
public:
/** default constructor */
CStructuredLabels();
/** constructor
*
* This method reserves memory to store num_labels without the
* need of allocating more memory in the future when inserting
* labels with other method, e.g. add_label.
*
* @param num_labels number of labels to pre-allocate
*/
CStructuredLabels(int32_t num_labels);
/** destructor */
virtual ~CStructuredLabels();
/** check if labeling is valid
*
* possible with subset
*
* @return if labeling is valid
*/
virtual void ensure_valid(const char* context = NULL);
/**
* 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.
*
* @param label label to add
*/
virtual void add_label(CStructuredData* label);
/** get labels
*
* not possible with subset
*
* @return labels
*/
CDynamicObjectArray* get_labels() const;
/** get label object for specified index
*
* @param idx index of the label
*
* @return label object
*/
virtual CStructuredData* get_label(int32_t idx);
/**
* set label, possible with subset. This method should be used
* when substituting labels previously inserted. To insert new
* labels, use the method add_label.
*
* @param idx index of label to set
* @param label value of label
*
* @return if setting was successful
*/
virtual bool set_label(int32_t idx, CStructuredData* label);
/** get number of labels, depending on wheter a subset is set
*
* @return number of labels
*/
virtual int32_t get_num_labels() const;
/** @return object name */
virtual const char* get_name() const { return "StructuredLabels"; }
/** get label type
*
* @return label type LT_STRUCTURED
*/
virtual ELabelType get_label_type() const { return LT_STRUCTURED; }
/** get structured data type the labels are composed of
*
* @return structured data type
*/
inline EStructuredDataType get_structured_data_type() { return m_sdt; }
private:
/** internal initialization */
void init();
/** ensure that the correct structured data type is used */
void ensure_valid_sdt(CStructuredData* label);
protected:
/** the vector of labels */
CDynamicObjectArray* m_labels;
/** the structured data type the labels are composed of */
EStructuredDataType m_sdt;
}; /* class CStructuredLabels */
} /* namespace shogun */
#endif /* _STRUCTUREDLABELS_H__ */
|