/usr/include/shogun/labels/DenseLabels.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 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 | /*
* 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
* Written (W) 2011 Heiko Strathmann
* Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society
*/
#ifndef _DENSE_LABELS__H__
#define _DENSE_LABELS__H__
#include <shogun/lib/common.h>
#include <shogun/io/File.h>
#include <shogun/labels/Labels.h>
#include <shogun/features/SubsetStack.h>
namespace shogun
{
class CFile;
/** @brief Dense integer or floating point labels
*
* DenseLabels here are always real-valued and thus applicable to classification
* (cf. CClassifier) and regression (cf. CRegression) problems.
*
* This class implements the shared functions for storing, and accessing label
* (vectors).
*/
class CDenseLabels : public CLabels
{
public:
/** default constructor */
CDenseLabels();
/** constructor
*
* @param num_labels number of labels
*/
CDenseLabels(int32_t num_labels);
/** constructor
*
* @param loader File object via which to load data
*/
CDenseLabels(CFile* loader);
/** destructor */
virtual ~CDenseLabels();
/** Make sure the label is valid, otherwise raise SG_ERROR.
*
* possible with subset
*
* @param context optional message to convey the context
*/
virtual void ensure_valid(const char* context=NULL);
/** 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);
/** Getter for labels
*
* @return labels, a copy if a subset is set
*/
SGVector<float64_t> get_labels();
/** get copy of labels.
*
* possible with subset
*
* @return labels
*/
SGVector<float64_t> get_labels_copy();
/** 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();
/**
* set all labels to zero
*
* possible with subset
* */
void zero();
/**
* set all labels to a const value
*
* possible with subset
*
* @param c const to set labels to
* */
void set_to_const(float64_t c);
/** get INT label vector
*
* possible with subset
*
* @return INT labels
*/
SGVector<int32_t> get_int_labels();
/** set INT labels
*
* not possible on subset
*
* @param labels INT labels
*/
void set_int_labels(SGVector<int32_t> labels);
#if !defined(SWIGJAVA) && !defined(SWIGCSHARP)
/** set INT64 labels
*
* not possible on subset
*
* @param labels INT labels
*/
void set_int_labels(SGVector<int64_t> labels);
#endif
/** get number of labels, depending on whether a subset is set
*
* @return number of labels
*/
virtual int32_t get_num_labels() const;
/** get label type
*
* @return label type (binary, multiclass, ...)
*/
virtual ELabelType get_label_type() const=0;
public:
/** label designates classify reject */
static const int32_t REJECTION_LABEL = -2;
private:
void init();
protected:
/** the label vector */
SGVector<float64_t> m_labels;
};
}
#endif
|