SHOGUN
3.2.1
首页
相关页面
模块
类
文件
文件列表
文件成员
全部
类
命名空间
文件
函数
变量
类型定义
枚举
枚举值
友元
宏定义
组
页
src
shogun
features
WDFeatures.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) 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 _WDFEATURES_H___
13
#define _WDFEATURES_H___
14
15
#include <
shogun/lib/common.h
>
16
#include <
shogun/features/DotFeatures.h
>
17
#include <
shogun/features/StringFeatures.h
>
18
19
namespace
shogun
20
{
21
template
<
class
ST>
class
CStringFeatures;
22
28
class
CWDFeatures
:
public
CDotFeatures
29
{
30
public
:
32
CWDFeatures
();
33
40
CWDFeatures
(
CStringFeatures<uint8_t>
* str, int32_t order, int32_t from_order);
41
43
CWDFeatures
(
const
CWDFeatures
& orig);
44
46
virtual
~CWDFeatures
();
47
55
virtual
int32_t
get_dim_feature_space
()
const
;
56
64
virtual
float64_t
dot
(int32_t vec_idx1,
CDotFeatures
* df, int32_t vec_idx2);
65
72
virtual
float64_t
dense_dot
(int32_t vec_idx1,
const
float64_t
* vec2, int32_t vec2_len);
73
82
virtual
void
add_to_dense_vec
(
float64_t
alpha, int32_t vec_idx1,
83
float64_t
* vec2, int32_t vec2_len,
bool
abs_val=
false
);
84
90
virtual
int32_t
get_nnz_features_for_vector
(int32_t num);
91
92
#ifndef DOXYGEN_SHOULD_SKIP_THIS
93
94
struct
wd_feature_iterator
95
{
97
uint8_t* vec;
99
int32_t vidx;
101
int32_t vlen;
103
bool
vfree;
104
109
int32_t lim;
110
int32_t* val;
111
int32_t asize;
112
int32_t asizem1;
113
int32_t offs;
114
int32_t k;
115
int32_t i;
116
int32_t o;
118
};
119
#endif
120
130
virtual
void
*
get_feature_iterator
(int32_t vector_index);
131
142
virtual
bool
get_next_feature
(int32_t& index,
float64_t
& value,
void
* iterator);
143
149
virtual
void
free_feature_iterator
(
void
* iterator);
150
155
virtual
CFeatures
*
duplicate
()
const
;
156
161
virtual
EFeatureType
get_feature_type
()
const
;
162
167
virtual
EFeatureClass
get_feature_class
()
const
;
168
169
virtual
int32_t
get_num_vectors
()
const
;
170
173
void
set_normalization_const
(
float64_t
n=0);
174
176
float64_t
get_normalization_const
();
177
179
virtual
const
char
*
get_name
()
const
{
return
"WDFeatures"
; }
180
185
void
set_wd_weights
(
SGVector<float64_t>
weights);
186
188
void
set_wd_weights
();
189
190
protected
:
192
CStringFeatures<uint8_t>
*
strings
;
193
195
int32_t
degree
;
197
int32_t
from_degree
;
199
int32_t
string_length
;
201
int32_t
num_strings
;
203
int32_t
alphabet_size
;
205
int32_t
w_dim
;
207
float64_t
*
wd_weights
;
208
210
float64_t
normalization_const
;
211
212
};
213
}
214
#endif // _WDFEATURES_H___
SHOGUN
机器学习工具包 - 项目文档