SHOGUN  3.2.1
 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/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__ */

SHOGUN Machine Learning Toolbox - Documentation