/usr/include/shogun/features/Labels.h is in libshogun-dev 1.1.0-4ubuntu2.
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 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 | /*
* 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) 1999-2009 Soeren Sonnenburg
* Written (W) 1999-2008 Gunnar Raetsch
* Subset support written (W) 2011 Heiko Strathmann
* Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society
*/
#ifndef _LABELS__H__
#define _LABELS__H__
#include <shogun/lib/common.h>
#include <shogun/io/File.h>
#include <shogun/base/SGObject.h>
#include <shogun/features/Subset.h>
namespace shogun
{
class CFile;
/** @brief The class Labels models labels, i.e. class assignments of objects.
*
* Labels here are always real-valued and thus applicable to classification
* (cf. CClassifier) and regression (cf. CRegression) problems.
*
* (Partly) subset access is supported.
* Simple use the set_subset(), remove_subset() functions.
* If done, all calls that work with features are translated to the subset.
* See comments to find out whether it is supported for that method
*/
class CLabels : public CSGObject
{
public:
/** default constructor */
CLabels();
/** constructor
*
* @param num_labels number of labels
*/
CLabels(int32_t num_labels);
/** constructor
*
* @param src labels to set
*/
CLabels(SGVector<float64_t> src);
/** constructor
*
* @param loader File object via which to load data
*/
CLabels(CFile* loader);
/** destructor */
virtual ~CLabels();
/** load labels from file
*
* any subset is removed before
*
* @param loader File object via which to load data
*/
virtual void load(CFile* loader);
/** save labels to file
*
* not possible with subset
*
* @param writer File object via which to save data
*/
virtual void save(CFile* writer);
/** set label
*
* possible with subset
*
* @param idx index of label to set
* @param label value of label
* @return if setting was successful
*/
bool set_label(int32_t idx, float64_t label);
/** set INT label
*
* possible with subset
*
* @param idx index of label to set
* @param label INT value of label
* @return if setting was successful
*/
bool set_int_label(int32_t idx, int32_t label);
/** get label
*
* possible with subset
*
* @param idx index of label to get
* @return value of label
*/
float64_t get_label(int32_t idx);
/** get INT label
*
* possible with subset
*
* @param idx index of label to get
* @return INT value of label
*/
int32_t get_int_label(int32_t idx);
/** is two-class labeling
*
* possible with subset
*
* @return if this is two-class labeling
*/
bool is_two_class_labeling();
/** return number of classes (for multiclass)
*
* possible with subset
*
* @return number of classes
*/
int32_t get_num_classes();
/** get labels
*
* not possible with subset
*
* @return labels
*/
SGVector<float64_t> get_labels();
/** set labels
*
* not possible with subset
*
* @param v labels
*/
void set_labels(SGVector<float64_t> v);
/**
* set all labels to +1
*
* possible with subset
* */
void set_to_one();
/** get INT label vector
* caller has to clean up
*
* possible with subset
*
* @return INT labels
*/
SGVector<int32_t> get_int_labels();
/** get classes of labels
* Caller has to clean up
*
* possible with subset
*
* @return classes of labels
*/
SGVector<float64_t> get_classes();
/** set INT labels
* caller has to clean up
*
* not possible on subset
*
* @param labels INT labels
*/
void set_int_labels(SGVector<int32_t> labels);
/** get number of labels, depending on whether a subset is set
*
* @return number of labels
*/
int32_t get_num_labels();
/** @return object name */
inline virtual const char* get_name() const { return "Labels"; }
/** setter for subset variable, deletes old one
*
* @param subset subset instance to set
*/
virtual void set_subset(CSubset* subset);
/** deletes any set subset */
virtual void remove_subset();
/** does subset index conversion with the underlying subset if possible
*
* @param idx index to convert
* @return converted index
*/
index_t subset_idx_conversion(index_t idx) const;
private:
void init();
protected:
/** the label vector */
SGVector<float64_t> labels;
/** number of classes */
int32_t m_num_classes;
private:
/* subset class to enable subset support for this class */
CSubset* m_subset;
};
}
#endif
|