SHOGUN  4.1.0
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义  
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/config.h>
15 
16 #include <shogun/lib/common.h>
19 
20 namespace shogun
21 {
22 template <class ST> class CStringFeatures;
23 
29 class CSNPFeatures : public CDotFeatures
30 {
31  public:
33  CSNPFeatures();
34 
40 
42  CSNPFeatures(const CSNPFeatures & orig);
43 
45  virtual ~CSNPFeatures();
46 
54  virtual int32_t get_dim_feature_space() const;
55 
63  virtual float64_t dot(int32_t vec_idx1, CDotFeatures* df, int32_t vec_idx2);
64 
71  virtual float64_t dense_dot(int32_t vec_idx1, const float64_t* vec2, int32_t vec2_len);
72 
81  virtual void add_to_dense_vec(float64_t alpha, int32_t vec_idx1,
82  float64_t* vec2, int32_t vec2_len, bool abs_val=false);
83 
89  virtual int32_t get_nnz_features_for_vector(int32_t num);
90 
100  virtual void* get_feature_iterator(int32_t vector_index);
101 
112  virtual bool get_next_feature(int32_t& index, float64_t& value, void* iterator);
113 
119  virtual void free_feature_iterator(void* iterator);
120 
125  virtual CFeatures* duplicate() const;
126 
131  virtual EFeatureType get_feature_type() const;
132 
137  virtual EFeatureClass get_feature_class() const;
138 
143  virtual int32_t get_num_vectors() const;
144 
148 
151 
156  void set_minor_base_string(const char* str);
157 
162  void set_major_base_string(const char* str);
163 
168  char* get_minor_base_string();
169 
174  char* get_major_base_string();
175 
181  void obtain_base_strings(CSNPFeatures* snp=NULL);
182 
184  virtual const char* get_name() const { return "SNPFeatures"; }
185 
188  virtual SGMatrix<float64_t> get_histogram(bool normalize=true);
189 
194 
195  private:
202  void find_minor_major_strings(uint8_t* minor, uint8_t* major);
203 
204  protected:
207 
209  int32_t string_length;
211  int32_t num_strings;
213  int32_t w_dim;
214 
217 
219  uint8_t* m_str_min;
221  uint8_t* m_str_maj;
222 };
223 }
224 #endif // _SNPFEATURES_H___
virtual void add_to_dense_vec(float64_t alpha, int32_t vec_idx1, float64_t *vec2, int32_t vec2_len, bool abs_val=false)
virtual void free_feature_iterator(void *iterator)
virtual int32_t get_num_vectors() const
float64_t get_normalization_const()
virtual bool get_next_feature(int32_t &index, float64_t &value, void *iterator)
virtual int32_t get_nnz_features_for_vector(int32_t num)
Definition: SNPFeatures.cpp:89
void set_major_base_string(const char *str)
void obtain_base_strings(CSNPFeatures *snp=NULL)
virtual int32_t get_dim_feature_space() const
Definition: SNPFeatures.cpp:84
char * get_major_base_string()
Features that support dot products among other operations.
Definition: DotFeatures.h:44
virtual void * get_feature_iterator(int32_t vector_index)
EFeatureClass
shogun feature class
Definition: FeatureTypes.h:38
virtual EFeatureType get_feature_type() const
Definition: SNPFeatures.cpp:94
char * get_minor_base_string()
virtual const char * get_name() const
Definition: SNPFeatures.h:184
double float64_t
Definition: common.h:50
virtual CFeatures * duplicate() const
EFeatureType
shogun feature type
Definition: FeatureTypes.h:19
CStringFeatures< uint8_t > * strings
Definition: SNPFeatures.h:206
float64_t normalization_const
Definition: SNPFeatures.h:216
Features that compute the Weighted Degreee Kernel feature space explicitly.
Definition: SNPFeatures.h:29
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
void set_minor_base_string(const char *str)
virtual float64_t dense_dot(int32_t vec_idx1, const float64_t *vec2, int32_t vec2_len)
virtual SGMatrix< float64_t > get_histogram(bool normalize=true)
The class Features is the base class of all feature objects.
Definition: Features.h:68
void set_normalization_const(float64_t n=0)
static SGMatrix< float64_t > get_2x3_table(CSNPFeatures *pos, CSNPFeatures *neg)
virtual EFeatureClass get_feature_class() const
Definition: SNPFeatures.cpp:99
virtual float64_t dot(int32_t vec_idx1, CDotFeatures *df, int32_t vec_idx2)

SHOGUN 机器学习工具包 - 项目文档