SHOGUN
v3.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
RandomKitchenSinksDotFeatures.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 Evangelos Anagnostopoulos
8
* Copyright (C) 2013 Evangelos Anagnostopoulos
9
*/
10
11
#ifndef _RANDOMKITCHENSINKS_DOT_FEATURES_H__
12
#define _RANDOMKITCHENSINKS_DOT_FEATURES_H__
13
14
#include <
shogun/features/DotFeatures.h
>
15
16
namespace
shogun
17
{
18
44
class
CRandomKitchenSinksDotFeatures
:
public
CDotFeatures
45
{
46
public
:
47
49
CRandomKitchenSinksDotFeatures
();
50
58
CRandomKitchenSinksDotFeatures
(
CDotFeatures
* dataset, int32_t K);
59
66
CRandomKitchenSinksDotFeatures
(
CDotFeatures
* dataset, int32_t K,
67
SGMatrix<float64_t>
coeff);
68
73
CRandomKitchenSinksDotFeatures
(
CFile
* loader);
74
76
CRandomKitchenSinksDotFeatures
(
const
CRandomKitchenSinksDotFeatures
& orig);
77
79
virtual
CFeatures
*
duplicate
()
const
;
80
82
virtual
~CRandomKitchenSinksDotFeatures
();
83
91
virtual
int32_t
get_dim_feature_space
()
const
;
92
102
virtual
float64_t
dot
(int32_t vec_idx1,
CDotFeatures
* df,
103
int32_t vec_idx2);
104
113
virtual
float64_t
dense_dot
(int32_t vec_idx1,
const
float64_t
* vec2,
114
int32_t vec2_len);
115
126
virtual
void
add_to_dense_vec
(
float64_t
alpha, int32_t vec_idx1,
127
float64_t
* vec2, int32_t vec2_len,
bool
abs_val =
false
);
128
134
virtual
int32_t
get_nnz_features_for_vector
(int32_t num);
135
147
virtual
void
*
get_feature_iterator
(int32_t vector_index);
148
161
virtual
bool
get_next_feature
(int32_t& index,
float64_t
& value,
162
void
* iterator);
163
169
virtual
void
free_feature_iterator
(
void
* iterator);
170
175
virtual
EFeatureType
get_feature_type
()
const
;
176
181
virtual
EFeatureClass
get_feature_class
()
const
;
182
187
virtual
int32_t
get_num_vectors
()
const
;
188
194
SGMatrix<float64_t>
generate_random_coefficients
();
195
200
SGMatrix<float64_t>
get_random_coefficients
();
201
203
const
char
*
get_name
()
const
;
204
205
protected
:
212
virtual
float64_t
dot
(
index_t
vec_idx,
index_t
par_idx);
213
221
virtual
float64_t
post_dot
(
float64_t
dot_result,
index_t
par_idx);
222
227
virtual
SGVector<float64_t>
generate_random_parameter_vector
()=0;
228
private
:
229
void
init(
CDotFeatures
* dataset, int32_t K);
230
231
protected
:
232
234
CDotFeatures
*
feats
;
235
237
int32_t
num_samples
;
238
240
SGMatrix<float64_t>
random_coeff
;
241
};
242
}
243
244
#endif // _RANDOMKITCHENSINKS_DOT_FEATURES_H__
245
SHOGUN
Machine Learning Toolbox - Documentation