SHOGUN  4.1.0
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义  
SpectrumRBFKernel.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) 1999-2009 Soeren Sonnenburg
8  * Written (W) 1999-2008 Gunnar Raetsch
9  * Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society
10  */
11 
12 #ifndef _SPECTRUMRBFKERNEL_H___
13 #define _SPECTRUMRBFKERNEL_H___
14 
15 #include <shogun/lib/config.h>
16 
17 #include <shogun/lib/common.h>
18 #include <shogun/lib/Trie.h>
21 
22 
24 
25 #include <vector> // profile
26 #include <string> // profile
27 
28 namespace shogun
29 {
30 
32 class CSpectrumRBFKernel: public CStringKernel<char>
33 {
34  public:
37 
44  CSpectrumRBFKernel(int32_t size, float64_t* AA_matrix, int32_t degree, float64_t width);
45 
56  CStringFeatures<char>* l, CStringFeatures<char>* r, int32_t size, float64_t* AA_matrix, int32_t degree, float64_t width);
57 
59  virtual ~CSpectrumRBFKernel();
60 
67  virtual bool init(CFeatures* l, CFeatures* r);
68 
70  virtual void cleanup();
71 
76  int32_t get_degree() const
77  {
78  return degree;
79  }
80 
86 
91  virtual const char* get_name() const { return "SpectrumRBFKernel"; }
92 
98  inline bool set_degree(int32_t deg) { degree=deg; return true; }
99 
104  inline int32_t get_degree() { return degree; }
105 
109  bool set_AA_matrix(float64_t* AA_matrix_);
110 
111  protected:
112 
119  float64_t AA_helper(const char* path, const int degree, const char* joint_seq, unsigned int index);
120 
123 
132  float64_t compute(int32_t idx_a, int32_t idx_b);
133 
135  virtual void register_param();
137  void register_alphabet();
138 
139 
140  protected:
144  int32_t degree;
146  int32_t max_mismatch;
151 
152  //int32_t* aa_to_index; // profile
153 
154  //double background[20]; // profile
156  std::vector< std::vector<float64_t> > profiles; //profile
158  std::vector<std::string> sequence_labels; // profile
164  int32_t nof_sequences;
167 
174 
175  private:
176  void init();
177 };
178 
179 }
180 
181 
182 
183 #endif /* _SPECTRUMMISMATCHRBFKERNEL_H__ */
EKernelType
Definition: Kernel.h:57
virtual bool init(CFeatures *l, CFeatures *r)
virtual const char * get_name() const
spectrum rbf kernel
The class Alphabet implements an alphabet and alphabet utility functions.
Definition: Alphabet.h:91
float64_t AA_helper(const char *path, const int degree, const char *joint_seq, unsigned int index)
CStringFeatures< char > * string_features
bool set_AA_matrix(float64_t *AA_matrix_)
SGString< char > * sequences
std::vector< std::vector< float64_t > > profiles
double float64_t
Definition: common.h:50
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
bool set_degree(int32_t deg)
virtual EKernelType get_kernel_type()
CDynamicArray< float64_t > kernel_matrix
float64_t compute(int32_t idx_a, int32_t idx_b)
Template class StringKernel, is the base class of all String Kernels.
Definition: StringKernel.h:26
SGMatrix< float64_t > AA_matrix
std::vector< std::string > sequence_labels

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