SHOGUN  v3.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules
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 register_param();
135  void register_alphabet();
136 
137 
138  protected:
142  int32_t degree;
144  int32_t max_mismatch;
149 
150  //int32_t* aa_to_index; // profile
151 
152  //double background[20]; // profile
154  std::vector< std::vector<float64_t> > profiles; //profile
156  std::vector<std::string> sequence_labels; // profile
162  int32_t nof_sequences;
165 
172 
173  private:
174  void init();
175 };
176 
177 }
178 
179 
180 
181 #endif /* _SPECTRUMMISMATCHRBFKERNEL_H__ */
EKernelType
Definition: Kernel.h:51
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:88
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:48
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:16
The class Features is the base class of all feature objects.
Definition: Features.h:62
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:24
SGMatrix< float64_t > AA_matrix
std::vector< std::string > sequence_labels

SHOGUN Machine Learning Toolbox - Documentation