SHOGUN
3.2.1
首页
相关页面
模块
类
文件
文件列表
文件成员
全部
类
命名空间
文件
函数
变量
类型定义
枚举
枚举值
友元
宏定义
组
页
src
shogun
labels
MultilabelLabels.h
浏览该文件的文档.
1
/*
2
* Copyright (C) 2013 Zuse-Institute-Berlin (ZIB)
3
* Copyright (C) 2013-2014 Thoralf Klein
4
* Written (W) 2013-2014 Thoralf Klein
5
* All rights reserved.
6
*
7
* Redistribution and use in source and binary forms, with or without
8
* modification, are permitted provided that the following conditions are met:
9
*
10
* 1. Redistributions of source code must retain the above copyright notice, this
11
* list of conditions and the following disclaimer.
12
* 2. Redistributions in binary form must reproduce the above copyright notice,
13
* this list of conditions and the following disclaimer in the documentation
14
* and/or other materials provided with the distribution.
15
*
16
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
20
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
*
27
* The views and conclusions contained in the software and documentation are those
28
* of the authors and should not be interpreted as representing official policies,
29
* either expressed or implied, of the Shogun Development Team.
30
*/
31
32
#ifndef _MULTILABEL_LABELS__H__
33
#define _MULTILABEL_LABELS__H__
34
35
#include <
shogun/lib/common.h
>
36
#include <
shogun/labels/LabelTypes.h
>
37
#include <
shogun/labels/Labels.h
>
38
#include <
shogun/labels/BinaryLabels.h
>
39
#include <
shogun/lib/SGVector.h
>
40
41
namespace
shogun
42
{
43
49
class
CMultilabelLabels
:
public
CLabels
50
{
51
public
:
53
CMultilabelLabels
();
54
59
CMultilabelLabels
(int16_t num_classes);
60
66
CMultilabelLabels
(int32_t num_labels, int16_t num_classes);
67
69
~CMultilabelLabels
();
70
77
void
ensure_valid
(
const
char
* context = NULL);
78
83
virtual
ELabelType
get_label_type
()
const
84
{
85
return
LT_SPARSE_MULTILABEL
;
86
}
87
89
virtual
const
char
*
get_name
()
const
90
{
91
return
"MultilabelLabels"
;
92
}
93
98
virtual
int32_t
get_num_labels
()
const
;
99
104
virtual
int16_t
get_num_classes
()
const
;
105
110
void
set_labels
(
SGVector<int16_t>
* labels);
111
116
SGVector<int32_t>
**
get_class_labels
()
const
;
117
122
SGVector<int16_t>
get_label
(int32_t j);
123
135
template
<
class
S,
class
D>
136
static
SGVector<D>
to_dense
(
SGVector<S>
* sparse, int32_t dense_len, D d_true, D d_false);
137
143
void
set_label
(int32_t j,
SGVector<int16_t>
label);
144
146
void
set_class_labels
(
SGVector <int32_t>
** labels_list);
147
149
void
display
()
const
;
150
151
private
:
152
void
init(int32_t num_labels, int16_t num_classes);
153
154
protected
:
155
156
int32_t
m_num_labels
;
157
int16_t
m_num_classes
;
158
SGVector<int16_t>
*
m_labels
;
159
};
160
161
}
162
163
#endif
SHOGUN
机器学习工具包 - 项目文档