SHOGUN
v2.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
features
streaming
StreamingDenseFeatures.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) 2011 Shashwat Lal Das
8
* Copyright (C) 2011 Berlin Institute of Technology and Max-Planck-Society
9
*/
10
#ifndef _STREAMINGDENSEFEATURES__H__
11
#define _STREAMINGDENSEFEATURES__H__
12
13
#include <
shogun/lib/common.h
>
14
#include <
shogun/features/streaming/StreamingDotFeatures.h
>
15
#include <
shogun/features/DenseFeatures.h
>
16
#include <
shogun/lib/DataType.h
>
17
#include <
shogun/io/streaming/InputParser.h
>
18
19
namespace
shogun
20
{
26
template
<
class
T>
class
CStreamingDenseFeatures
:
public
CStreamingDotFeatures
27
{
28
public
:
29
37
CStreamingDenseFeatures
();
38
47
CStreamingDenseFeatures
(
CStreamingFile
* file,
48
bool
is_labelled, int32_t size);
49
57
CStreamingDenseFeatures
(
CDenseFeatures<T>
* dense_features,
58
float64_t
* lab=NULL);
59
65
~CStreamingDenseFeatures
();
66
76
virtual
void
set_vector_reader
();
77
87
virtual
void
set_vector_and_label_reader
();
88
94
virtual
void
start_parser
();
95
101
virtual
void
end_parser
();
102
107
virtual
void
reset_stream
();
108
117
virtual
bool
get_next_example
();
118
124
SGVector<T>
get_vector
();
125
133
virtual
float64_t
get_label
();
134
141
virtual
void
release_example
();
142
150
virtual
int32_t
get_dim_feature_space
()
const
;
151
159
virtual
float32_t
dot
(
SGVector<T>
vec);
160
171
virtual
float32_t
dot
(
CStreamingDotFeatures
*df);
172
180
virtual
float32_t
dense_dot
(
const
float32_t
* vec2, int32_t vec2_len);
181
189
virtual
float64_t
dense_dot
(
const
float64_t
* vec2, int32_t vec2_len);
190
200
virtual
void
add_to_dense_vec
(
float32_t
alpha,
float32_t
* vec2, int32_t vec2_len ,
bool
abs_val=
false
);
201
211
virtual
void
add_to_dense_vec
(
float64_t
alpha,
float64_t
* vec2, int32_t vec2_len ,
bool
abs_val=
false
);
212
217
virtual
inline
int32_t
get_nnz_features_for_vector
();
218
224
int32_t
get_num_features
();
225
231
virtual
inline
EFeatureType
get_feature_type
()
const
;
232
238
virtual
EFeatureClass
get_feature_class
()
const
;
239
245
virtual
CFeatures
*
duplicate
()
const
;
246
252
inline
virtual
const
char
*
get_name
()
const
{
return
"StreamingDenseFeatures"
; }
253
259
inline
virtual
int32_t
get_num_vectors
()
const
;
260
266
virtual
int32_t
get_size
()
const
;
267
268
private
:
273
void
init();
274
282
void
init(
CStreamingFile
*file,
bool
is_labelled, int32_t size);
283
284
protected
:
285
287
float32_t
combined_weight
;
288
290
CInputParser<T>
parser
;
291
293
SGVector<T>
current_sgvector
;
294
296
T*
current_vector
;
297
299
float64_t
current_label
;
300
302
int32_t
current_length
;
303
};
304
}
305
#endif // _STREAMINGDENSEFEATURES__H__
SHOGUN
Machine Learning Toolbox - Documentation