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
DotFeatures.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) 2009-2010 Soeren Sonnenburg
8
* Copyright (C) 2009 Fraunhofer Institute FIRST and Max-Planck-Society
9
* Copyright (C) 2010 Berlin Institute of Technology
10
*/
11
12
#ifndef _DOTFEATURES_H___
13
#define _DOTFEATURES_H___
14
15
#include <
shogun/lib/common.h
>
16
#include <
shogun/features/Features.h
>
17
18
namespace
shogun
19
{
41
class
CDotFeatures
:
public
CFeatures
42
{
43
public
:
44
49
CDotFeatures
(int32_t size=0);
50
52
CDotFeatures
(
const
CDotFeatures
& orig);
53
58
CDotFeatures
(
CFile
* loader);
59
60
virtual
~CDotFeatures
() { }
61
69
virtual
int32_t
get_dim_feature_space
()
const
=0;
70
78
virtual
float64_t
dot
(int32_t vec_idx1,
CDotFeatures
* df, int32_t vec_idx2)=0;
79
85
virtual
float64_t
dense_dot_sgvec
(int32_t vec_idx1,
const
SGVector<float64_t>
vec2);
86
93
virtual
float64_t
dense_dot
(int32_t vec_idx1,
const
float64_t
* vec2, int32_t vec2_len)=0;
94
103
virtual
void
add_to_dense_vec
(
float64_t
alpha, int32_t vec_idx1,
float64_t
* vec2, int32_t vec2_len,
bool
abs_val=
false
)=0;
104
118
virtual
void
dense_dot_range
(
float64_t
* output, int32_t start, int32_t stop,
float64_t
* alphas,
float64_t
* vec, int32_t dim,
float64_t
b);
119
131
virtual
void
dense_dot_range_subset
(int32_t* sub_index, int32_t num,
132
float64_t
* output,
float64_t
* alphas,
float64_t
* vec, int32_t dim,
float64_t
b);
133
136
static
void
*
dense_dot_range_helper
(
void
* p);
137
145
virtual
int32_t
get_nnz_features_for_vector
(int32_t num)=0;
146
151
inline
float64_t
get_combined_feature_weight
() {
return
combined_weight
; }
152
157
inline
void
set_combined_feature_weight
(
float64_t
nw) {
combined_weight
=nw; }
158
163
SGMatrix<float64_t>
get_computed_dot_feature_matrix
();
164
169
SGVector<float64_t>
get_computed_dot_feature_vector
(int32_t num);
170
172
void
benchmark_add_to_dense_vector
(int32_t repeats=5);
173
175
void
benchmark_dense_dot_range
(int32_t repeats=5);
176
186
virtual
void
*
get_feature_iterator
(int32_t vector_index)=0;
187
198
virtual
bool
get_next_feature
(int32_t& index,
float64_t
& value,
void
* iterator)=0;
199
205
virtual
void
free_feature_iterator
(
void
* iterator)=0;
206
211
virtual
SGVector<float64_t>
get_mean
();
212
217
static
SGVector<float64_t>
get_mean
(
CDotFeatures
* lhs,
CDotFeatures
* rhs);
218
223
virtual
SGMatrix<float64_t>
get_cov
();
224
229
static
SGMatrix<float64_t>
compute_cov
(
CDotFeatures
* lhs,
CDotFeatures
* rhs);
230
231
protected
:
238
void
display_progress
(int32_t start, int32_t stop, int32_t v);
239
240
private
:
241
void
init();
242
243
protected
:
244
246
float64_t
combined_weight
;
247
};
248
}
249
#endif // _DOTFEATURES_H___
SHOGUN
Machine Learning Toolbox - Documentation