SHOGUN
3.2.1
首页
相关页面
模块
类
文件
文件列表
文件成员
全部
类
命名空间
文件
函数
变量
类型定义
枚举
枚举值
友元
宏定义
组
页
src
shogun
features
SNPFeatures.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) 2010 Soeren Sonnenburg
8
* Copyright (C) 2010 Berlin Institute of Technology
9
*/
10
11
#ifndef _SNPFEATURES_H___
12
#define _SNPFEATURES_H___
13
14
#include <
shogun/lib/common.h
>
15
#include <
shogun/features/DotFeatures.h
>
16
#include <
shogun/features/StringFeatures.h
>
17
18
namespace
shogun
19
{
20
template
<
class
ST>
class
CStringFeatures;
21
27
class
CSNPFeatures
:
public
CDotFeatures
28
{
29
public
:
31
CSNPFeatures
();
32
37
CSNPFeatures
(
CStringFeatures<uint8_t>
* str);
38
40
CSNPFeatures
(
const
CSNPFeatures
& orig);
41
43
virtual
~CSNPFeatures
();
44
52
virtual
int32_t
get_dim_feature_space
()
const
;
53
61
virtual
float64_t
dot
(int32_t vec_idx1,
CDotFeatures
* df, int32_t vec_idx2);
62
69
virtual
float64_t
dense_dot
(int32_t vec_idx1,
const
float64_t
* vec2, int32_t vec2_len);
70
79
virtual
void
add_to_dense_vec
(
float64_t
alpha, int32_t vec_idx1,
80
float64_t
* vec2, int32_t vec2_len,
bool
abs_val=
false
);
81
87
virtual
int32_t
get_nnz_features_for_vector
(int32_t num);
88
98
virtual
void
*
get_feature_iterator
(int32_t vector_index);
99
110
virtual
bool
get_next_feature
(int32_t& index,
float64_t
& value,
void
* iterator);
111
117
virtual
void
free_feature_iterator
(
void
* iterator);
118
123
virtual
CFeatures
*
duplicate
()
const
;
124
129
virtual
EFeatureType
get_feature_type
()
const
;
130
135
virtual
EFeatureClass
get_feature_class
()
const
;
136
141
virtual
int32_t
get_num_vectors
()
const
;
142
145
void
set_normalization_const
(
float64_t
n=0);
146
148
float64_t
get_normalization_const
();
149
154
void
set_minor_base_string
(
const
char
* str);
155
160
void
set_major_base_string
(
const
char
* str);
161
166
char
*
get_minor_base_string
();
167
172
char
*
get_major_base_string
();
173
179
void
obtain_base_strings
(
CSNPFeatures
* snp=NULL);
180
182
virtual
const
char
*
get_name
()
const
{
return
"SNPFeatures"
; }
183
186
virtual
SGMatrix<float64_t>
get_histogram
(
bool
normalize=
true
);
187
191
static
SGMatrix<float64_t>
get_2x3_table
(
CSNPFeatures
* pos,
CSNPFeatures
* neg);
192
193
private
:
200
void
find_minor_major_strings(uint8_t* minor, uint8_t* major);
201
202
protected
:
204
CStringFeatures<uint8_t>
*
strings
;
205
207
int32_t
string_length
;
209
int32_t
num_strings
;
211
int32_t
w_dim
;
212
214
float64_t
normalization_const
;
215
217
uint8_t*
m_str_min
;
219
uint8_t*
m_str_maj
;
220
};
221
}
222
#endif // _SNPFEATURES_H___
SHOGUN
机器学习工具包 - 项目文档