SHOGUN
3.2.1
首页
相关页面
模块
类
文件
文件列表
文件成员
全部
类
命名空间
文件
函数
变量
类型定义
枚举
枚举值
友元
宏定义
组
页
src
shogun
features
streaming
StreamingDenseFeatures.h
浏览该文件的文档.
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) 2011 Shashwat Lal Das
8
* Written (W) 2012 Heiko Strathmann
9
* Copyright (C) 2011 Berlin Institute of Technology and Max-Planck-Society
10
*/
11
#ifndef _STREAMINGDENSEFEATURES__H__
12
#define _STREAMINGDENSEFEATURES__H__
13
14
#include <
shogun/lib/common.h
>
15
#include <
shogun/features/streaming/StreamingDotFeatures.h
>
16
#include <
shogun/features/DenseFeatures.h
>
17
#include <
shogun/lib/DataType.h
>
18
#include <
shogun/io/streaming/InputParser.h
>
19
20
namespace
shogun
21
{
28
template
<
class
T>
class
CStreamingDenseFeatures
:
29
public
CStreamingDotFeatures
30
{
31
public
:
32
40
CStreamingDenseFeatures
();
41
50
CStreamingDenseFeatures
(
CStreamingFile
* file,
bool
is_labelled,
51
int32_t size);
52
60
CStreamingDenseFeatures
(
CDenseFeatures<T>
* dense_features,
float64_t
* lab=
61
NULL);
62
68
~CStreamingDenseFeatures
();
69
79
virtual
void
set_vector_reader
();
80
90
virtual
void
set_vector_and_label_reader
();
91
97
virtual
void
start_parser
();
98
104
virtual
void
end_parser
();
105
110
virtual
void
reset_stream
();
111
120
virtual
bool
get_next_example
();
121
127
SGVector<T>
get_vector
();
128
136
virtual
float64_t
get_label
();
137
144
virtual
void
release_example
();
145
153
virtual
int32_t
get_dim_feature_space
()
const
;
154
162
virtual
float32_t
dot
(
SGVector<T>
vec);
163
174
virtual
float32_t
dot
(
CStreamingDotFeatures
*df);
175
183
virtual
float32_t
dense_dot
(
const
float32_t
* vec2, int32_t vec2_len);
184
192
virtual
float64_t
dense_dot
(
const
float64_t
* vec2, int32_t vec2_len);
193
203
virtual
void
add_to_dense_vec
(
float32_t
alpha,
float32_t
* vec2,
204
int32_t vec2_len,
bool
abs_val=
false
);
205
215
virtual
void
add_to_dense_vec
(
float64_t
alpha,
float64_t
* vec2,
216
int32_t vec2_len,
bool
abs_val=
false
);
217
222
virtual
int32_t
get_nnz_features_for_vector
();
223
229
int32_t
get_num_features
();
230
236
virtual
EFeatureType
get_feature_type
()
const
;
237
243
virtual
EFeatureClass
get_feature_class
()
const
;
244
250
virtual
CFeatures
*
duplicate
()
const
;
251
257
virtual
const
char
*
get_name
()
const
258
{
259
return
"StreamingDenseFeatures"
;
260
}
261
267
virtual
int32_t
get_num_vectors
()
const
;
268
275
virtual
CFeatures
*
get_streamed_features
(
index_t
num_elements);
276
277
private
:
282
void
init();
283
291
void
init(
CStreamingFile
*file,
bool
is_labelled, int32_t size);
292
293
protected
:
294
296
float32_t
combined_weight
;
297
299
CInputParser<T>
parser
;
300
302
SGVector<T>
current_vector
;
303
305
float64_t
current_label
;
306
};
307
}
308
#endif // _STREAMINGDENSEFEATURES__H__
SHOGUN
机器学习工具包 - 项目文档