SHOGUN  4.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
LocalAlignmentStringKernel.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  * Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society
9  */
10 
11 #ifndef _LOCALALIGNMENTSTRINGKERNEL_H___
12 #define _LOCALALIGNMENTSTRINGKERNEL_H___
13 
14 #include <shogun/lib/config.h>
15 
16 #include <shogun/lib/common.h>
18 
19 namespace shogun
20 {
21 
23 const int32_t LOGSUM_TBL=10000;
24 
32 {
33  public:
37  CLocalAlignmentStringKernel(int32_t size=0);
38 
48  float64_t opening=10, float64_t extension=2);
49 
51 
58  virtual bool init(CFeatures* l, CFeatures* r);
59 
61  virtual void cleanup();
62 
68  {
69  return K_LOCALALIGNMENT;
70  }
71 
76  virtual const char* get_name() const
77  {
78  return "LocalAlignmentStringKernel";
79  }
80 
81  protected:
90  virtual float64_t compute(int32_t idx_a, int32_t idx_b);
91 
92 
93  private:
95  void init_logsum();
96 
103  int32_t LogSum(int32_t p1, int32_t p2);
104 
111  float32_t LogSum2(float32_t p1, float32_t p2);
112 
121  float64_t LAkernelcompute(
122  int32_t* aaX, int32_t* aaY, int32_t nX, int32_t nY);
123 
126  void init_static_variables();
127 
128  void init();
129 
130  protected:
133 
135  int32_t *isAA;
137  int32_t *aaIndex;
138 
140  int32_t m_opening;
142  int32_t m_extension;
143 
145  static int32_t logsum_lookup[LOGSUM_TBL];
147  static const int32_t blosum[];
149  int32_t* scaled_blosum;
151  static const char* aaList;
152 };
153 }
154 #endif /* _LOCALALIGNMENTSTRINGKERNEL_H__ */
EKernelType
Definition: Kernel.h:57
const int32_t LOGSUM_TBL
double float64_t
Definition: common.h:50
float float32_t
Definition: common.h:49
virtual float64_t compute(int32_t idx_a, int32_t idx_b)
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
virtual bool init(CFeatures *l, CFeatures *r)
The class Features is the base class of all feature objects.
Definition: Features.h:68
The LocalAlignmentString kernel compares two sequences through all possible local alignments between ...
Template class StringKernel, is the base class of all String Kernels.
Definition: StringKernel.h:26

SHOGUN Machine Learning Toolbox - Documentation