SHOGUN
v3.0.0
Main Page
Related Pages
Modules
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
src
shogun
labels
DenseLabels.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
* Written (W) 2011 Heiko Strathmann
10
* Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society
11
*/
12
13
#ifndef _DENSE_LABELS__H__
14
#define _DENSE_LABELS__H__
15
16
#include <
shogun/lib/common.h
>
17
#include <
shogun/io/File.h
>
18
#include <
shogun/labels/Labels.h
>
19
#include <
shogun/features/SubsetStack.h
>
20
21
namespace
shogun
22
{
23
class
CFile;
24
33
class
CDenseLabels
:
public
CLabels
34
{
35
public
:
37
CDenseLabels
();
38
43
CDenseLabels
(int32_t num_labels);
44
49
CDenseLabels
(
CFile
* loader);
50
52
virtual
~CDenseLabels
();
53
60
virtual
void
ensure_valid
(
const
char
* context=NULL);
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
120
SGVector<float64_t>
get_labels
();
121
128
SGVector<float64_t>
get_labels_copy
();
129
136
void
set_labels
(
SGVector<float64_t>
v);
137
143
void
set_to_one
();
144
150
void
zero
();
151
159
void
set_to_const
(
float64_t
c);
160
167
SGVector<int32_t>
get_int_labels
();
168
175
void
set_int_labels
(
SGVector<int32_t>
labels);
176
177
#if !defined(SWIGJAVA) && !defined(SWIGCSHARP)
178
184
void
set_int_labels
(
SGVector<int64_t>
labels);
185
#endif
186
191
virtual
int32_t
get_num_labels
()
const
;
192
197
virtual
ELabelType
get_label_type
()
const
=0;
198
199
public
:
201
static
const
int32_t
REJECTION_LABEL
= -2;
202
203
private
:
204
void
init();
205
206
protected
:
208
SGVector<float64_t>
m_labels
;
209
};
210
}
211
#endif
SHOGUN
Machine Learning Toolbox - Documentation