SHOGUN  v2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SpectrumRBFKernel.h
Go to the documentation of this file.
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/common.h>
16 #include <shogun/lib/Trie.h>
19 
20 
22 
23 #include <vector> // profile
24 #include <string> // profile
25 
26 namespace shogun
27 {
28 
30 class CSpectrumRBFKernel: public CStringKernel<char>
31 {
32  public:
35 
42  CSpectrumRBFKernel(int32_t size, float64_t* AA_matrix, int32_t degree, float64_t width);
43 
54  CStringFeatures<char>* l, CStringFeatures<char>* r, int32_t size, float64_t* AA_matrix, int32_t degree, float64_t width);
55 
57  virtual ~CSpectrumRBFKernel();
58 
65  virtual bool init(CFeatures* l, CFeatures* r);
66 
68  virtual void cleanup();
69 
74  int32_t get_degree() const
75  {
76  return degree;
77  }
78 
84 
89  virtual const char* get_name() const { return "SpectrumRBFKernel"; }
90 
96  inline bool set_degree(int32_t deg) { degree=deg; return true; }
97 
102  inline int32_t get_degree() { return degree; }
103 
107  bool set_AA_matrix(float64_t* AA_matrix_);
108 
109  protected:
110 
117  float64_t AA_helper(const char* path, const int degree, const char* joint_seq, unsigned int index);
118 
121 
130  float64_t compute(int32_t idx_a, int32_t idx_b);
131 
133  virtual void remove_lhs();
135  virtual void register_param();
137  void register_alphabet();
138 
139 
140  protected:
144  int32_t degree;
146  int32_t max_mismatch;
153 
154  //int32_t* aa_to_index; // profile
155 
156  //double background[20]; // profile
158  std::vector< std::vector<float64_t> > profiles; //profile
160  std::vector<std::string> sequence_labels; // profile
166  int32_t nof_sequences;
169 
176 
177  private:
178  void init();
179 };
180 
181 }
182 
183 
184 
185 #endif /* _SPECTRUMMISMATCHRBFKERNEL_H__ */

SHOGUN Machine Learning Toolbox - Documentation