SHOGUN
v1.1.0
Main Page
Related Pages
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
src
shogun
features
Labels.h
Go to the documentation of this file.
1
/*
2
* This program is free software; you can redistribute it and/or modify
3
* it under the terms of the GNU General Public License as published by
4
* the Free Software Foundation; either version 3 of the License, or
5
* (at your option) any later version.
6
*
7
* Written (W) 1999-2009 Soeren Sonnenburg
8
* Written (W) 1999-2008 Gunnar Raetsch
9
* Subset support written (W) 2011 Heiko Strathmann
10
* Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society
11
*/
12
13
#ifndef _LABELS__H__
14
#define _LABELS__H__
15
16
#include <
shogun/lib/common.h
>
17
#include <
shogun/io/File.h
>
18
#include <
shogun/base/SGObject.h
>
19
#include <
shogun/features/Subset.h
>
20
21
namespace
shogun
22
{
23
class
CFile;
24
35
class
CLabels
:
public
CSGObject
36
{
37
public
:
39
CLabels
();
40
45
CLabels
(int32_t num_labels);
46
51
CLabels
(
SGVector<float64_t>
src);
52
57
CLabels
(
CFile
* loader);
58
60
virtual
~CLabels
();
61
68
virtual
void
load
(
CFile
* loader);
69
76
virtual
void
save
(
CFile
* writer);
77
86
bool
set_label
(int32_t idx,
float64_t
label);
87
96
bool
set_int_label
(int32_t idx, int32_t label);
97
105
float64_t
get_label
(int32_t idx);
106
114
int32_t
get_int_label
(int32_t idx);
115
122
bool
is_two_class_labeling
();
123
130
int32_t
get_num_classes
();
131
138
SGVector<float64_t>
get_labels
();
139
146
void
set_labels
(
SGVector<float64_t>
v);
147
153
void
set_to_one
();
154
162
SGVector<int32_t>
get_int_labels
();
163
171
SGVector<float64_t>
get_classes
();
172
180
void
set_int_labels
(
SGVector<int32_t>
labels
);
181
186
int32_t
get_num_labels
();
187
189
inline
virtual
const
char
*
get_name
()
const
{
return
"Labels"
; }
190
195
virtual
void
set_subset
(
CSubset
* subset);
196
198
virtual
void
remove_subset
();
199
205
index_t
subset_idx_conversion
(
index_t
idx)
const
;
206
207
private
:
208
void
init();
209
210
protected
:
212
SGVector<float64_t>
labels
;
213
215
int32_t
m_num_classes
;
216
217
private
:
218
/* subset class to enable subset support for this class */
219
CSubset
* m_subset;
220
};
221
}
222
#endif
SHOGUN
Machine Learning Toolbox - Documentation