SHOGUN  4.1.0
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义  
SNPStringKernel.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-2010 Berlin Institute of Technology
9  */
10 
11 #ifndef _SNPSTRINGKERNEL_H___
12 #define _SNPSTRINGKERNEL_H___
13 
14 #include <shogun/lib/config.h>
15 
16 #include <shogun/lib/common.h>
17 #include <shogun/lib/memory.h>
19 
20 namespace shogun
21 {
39 class CSNPStringKernel: public CStringKernel<char>
40 {
41  public:
44 
52  CSNPStringKernel(int32_t size, int32_t degree, int32_t win_len, bool inhomogene);
53 
64  int32_t degree, int32_t win_len, bool inhomogene);
65 
66  virtual ~CSNPStringKernel();
67 
74  virtual bool init(CFeatures* l, CFeatures* r);
75 
77  virtual void cleanup();
78 
84  {
85  return K_POLYMATCH;
86  }
87 
92  void set_minor_base_string(const char* str)
93  {
94  m_str_min=get_strdup(str);
95  }
96 
101  void set_major_base_string(const char* str)
102  {
103  m_str_maj=get_strdup(str);
104  }
105 
111  {
112  return m_str_min;
113  }
114 
120  {
121  return m_str_maj;
122  }
123 
125  void obtain_base_strings();
126 
131  virtual const char* get_name() const { return "SNPStringKernel"; }
132 
133  /* register the parameters
134  */
135  virtual void register_params();
136 
137  protected:
146  virtual float64_t compute(int32_t idx_a, int32_t idx_b);
147 
148  protected:
150  int32_t m_degree;
152  int32_t m_win_len;
153 
156 
159  int32_t m_str_len;
160 
162  char* m_str_min;
164  char* m_str_maj;
165 
166  private:
167  void init();
168 };
169 }
170 #endif /* _SNPSTRINGKERNEL_H___ */
EKernelType
Definition: Kernel.h:57
virtual float64_t compute(int32_t idx_a, int32_t idx_b)
virtual EKernelType get_kernel_type()
The class SNPStringKernel computes a variant of the polynomial kernel on strings of same length...
virtual bool init(CFeatures *l, CFeatures *r)
double float64_t
Definition: common.h:50
virtual const char * get_name() const
void set_major_base_string(const char *str)
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
The class Features is the base class of all feature objects.
Definition: Features.h:68
Template class StringKernel, is the base class of all String Kernels.
Definition: StringKernel.h:26
void set_minor_base_string(const char *str)

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