SHOGUN
3.2.1
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
structure
MulticlassSOLabels.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) 2013 Thoralf Klein
8
* Written (W) 2012 Fernando José Iglesias García
9
* Copyright (C) 2012 Fernando José Iglesias García
10
*/
11
12
#ifndef _MULTICLASS_SO_LABELS__H__
13
#define _MULTICLASS_SO_LABELS__H__
14
15
#include <
shogun/labels/StructuredLabels.h
>
16
#include <
shogun/lib/SGVector.h
>
17
#include <
shogun/lib/StructuredData.h
>
18
#include <
shogun/lib/StructuredDataTypes.h
>
19
20
namespace
shogun
21
{
22
23
class
CStructuredLabels;
24
class
CMulticlassSOLabels;
25
31
struct
CRealNumber
:
public
CStructuredData
32
{
34
STRUCTURED_DATA_TYPE
(
SDT_REAL
);
35
40
CRealNumber
(
float64_t
val) :
CStructuredData
(),
value
(val) { }
41
46
static
CRealNumber
*
obtain_from_generic
(
CStructuredData
* base_data)
47
{
48
if
( base_data->
get_structured_data_type
() ==
SDT_REAL
)
49
return
(
CRealNumber
*) base_data;
50
else
51
SG_SERROR
(
"base_data must be of dynamic type CRealNumber\n"
)
52
53
return
NULL;
54
}
55
57
virtual
const
char
*
get_name
()
const
{
return
"RealNumber"
; }
58
60
float64_t
value
;
61
};
62
68
class
CMulticlassSOLabels
:
public
CStructuredLabels
69
{
70
public
:
72
CMulticlassSOLabels
();
73
78
CMulticlassSOLabels
(int32_t num_labels);
79
84
CMulticlassSOLabels
(
SGVector< float64_t >
const
src);
85
87
virtual
~CMulticlassSOLabels
();
88
93
inline
int32_t
get_num_classes
() {
return
m_num_classes; }
94
103
virtual
void
add_label
(
CStructuredData
* label);
104
111
virtual
CStructuredData
*
get_label
(int32_t idx);
112
123
virtual
bool
set_label
(int32_t idx,
CStructuredData
* label);
124
129
virtual
int32_t
get_num_labels
()
const
;
130
132
virtual
const
char
*
get_name
()
const
{
return
"MulticlassSOLabels"
; }
133
134
private
:
135
void
init();
136
137
private
:
139
int32_t m_num_classes;
140
141
SGVector< float64_t >
m_labels_vector;
142
int32_t m_num_labels_set;
143
144
};
/* CMulticlassSOLabels */
145
146
}
/* namespace shogun */
147
148
#endif
/* _MULTICLASS_SO_LABELS__H__ */
SHOGUN
Machine Learning Toolbox - Documentation