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
BinnedDotFeatures.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
* Copyright (C) 2012 Soeren Sonnenburg
8
*/
9
10
#ifndef _BINNED_DOTFEATURES_H___
11
#define _BINNED_DOTFEATURES_H___
12
13
#include <
shogun/lib/common.h
>
14
#include <
shogun/features/DotFeatures.h
>
15
#include <
shogun/features/DenseFeatures.h
>
16
17
namespace
shogun
18
{
19
template
<
class
T>
class
CDenseFeatures;
20
41
class
CBinnedDotFeatures
:
public
CDotFeatures
42
{
43
public
:
48
CBinnedDotFeatures
(int32_t size=0);
49
51
CBinnedDotFeatures
(
const
CBinnedDotFeatures
& orig);
52
59
CBinnedDotFeatures
(
CDenseFeatures<float64_t>
* sf,
SGMatrix<float64_t>
bins);
60
61
virtual
~CBinnedDotFeatures
();
62
70
virtual
int32_t
get_dim_feature_space
()
const
;
71
79
virtual
float64_t
dot
(int32_t vec_idx1,
CDotFeatures
* df, int32_t vec_idx2);
80
87
virtual
float64_t
dense_dot
(int32_t vec_idx1,
const
float64_t
* vec2, int32_t vec2_len);
88
97
virtual
void
add_to_dense_vec
(
float64_t
alpha, int32_t vec_idx1,
float64_t
* vec2, int32_t vec2_len,
bool
abs_val=
false
);
98
106
virtual
int32_t
get_nnz_features_for_vector
(int32_t num);
107
117
virtual
void
*
get_feature_iterator
(int32_t vector_index);
118
129
virtual
bool
get_next_feature
(int32_t& index,
float64_t
& value,
void
* iterator);
130
136
virtual
void
free_feature_iterator
(
void
* iterator);
137
138
143
bool
get_fill
();
144
149
void
set_fill
(
bool
fill);
150
155
bool
get_norm_one
();
156
161
void
set_norm_one
(
bool
norm_one);
162
167
void
set_simple_features
(
CDenseFeatures<float64_t>
* features);
168
173
CDenseFeatures<float64_t>
*
get_simple_features
();
174
184
void
set_bins
(
SGMatrix<float64_t>
bins);
185
190
SGMatrix<float64_t>
get_bins
();
191
195
virtual
const
char
*
get_name
()
const
;
196
201
virtual
CFeatures
*
duplicate
()
const
;
202
207
virtual
EFeatureType
get_feature_type
()
const
;
208
213
virtual
EFeatureClass
get_feature_class
()
const
;
214
219
virtual
int32_t
get_num_vectors
()
const
;
220
225
virtual
int32_t
get_size
()
const
;
226
227
private
:
228
void
init();
229
234
void
assert_shape(int32_t vec2_len);
235
236
protected
:
238
CDenseFeatures<float64_t>
*
m_features
;
239
241
SGMatrix<float64_t>
m_bins
;
242
244
bool
m_fill
;
245
247
bool
m_norm_one
;
248
};
249
}
250
#endif // _BINNED_DOTFEATURES_H___
251
SHOGUN
Machine Learning Toolbox - Documentation