SHOGUN  v1.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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 
21 #include <shogun/lib/Array.h>
22 #include <shogun/lib/Array2.h>
23 
24 #include <vector> // profile
25 #include <string> // profile
26 
27 namespace shogun
28 {
29 
31 class CSpectrumRBFKernel: public CStringKernel<char>
32 {
33  public:
36 
43  CSpectrumRBFKernel(int32_t size, float64_t* AA_matrix, int32_t degree, float64_t width);
44 
55  CStringFeatures<char>* l, CStringFeatures<char>* r, int32_t size, float64_t* AA_matrix, int32_t degree, float64_t width);
56 
58  virtual ~CSpectrumRBFKernel();
59 
66  virtual bool init(CFeatures* l, CFeatures* r);
67 
69  virtual void cleanup();
70 
75  int32_t get_degree() const
76  {
77  return degree;
78  }
79 
85 
90  virtual const char* get_name() const { return "SpectrumRBFKernel"; }
91 
97  inline bool set_degree(int32_t deg) { degree=deg; return true; }
98 
103  inline int32_t get_degree() { return degree; }
104 
108  bool set_AA_matrix(float64_t* AA_matrix_);
109 
110  protected:
111 
118  float64_t AA_helper(const char* path, const int degree, const char* joint_seq, unsigned int index);
119 
122 
131  float64_t compute(int32_t idx_a, int32_t idx_b);
132 
134  virtual void remove_lhs();
136  virtual void register_param();
138  void register_alphabet();
139 
140 
141  protected:
145  int32_t degree;
147  int32_t max_mismatch;
154 
155  //int32_t* aa_to_index; // profile
156 
157  //double background[20]; // profile
159  std::vector< std::vector<float64_t> > profiles; //profile
161  std::vector<std::string> sequence_labels; // profile
167  int32_t nof_sequences;
170 
177 
178  private:
179  void init();
180 };
181 
182 }
183 
184 
185 
186 #endif /* _SPECTRUMMISMATCHRBFKERNEL_H__ */

SHOGUN Machine Learning Toolbox - Documentation