SHOGUN  3.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HistogramWordStringKernel.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 _HISTOGRAMWORDKERNEL_H___
13 #define _HISTOGRAMWORDKERNEL_H___
14 
15 #include <shogun/lib/config.h>
16 
17 #include <shogun/lib/common.h>
21 
22 namespace shogun
23 {
24  class CPluginEstimate;
25  template <class T> class CStringFeatures;
29 {
30  public:
33 
39  CHistogramWordStringKernel(int32_t size, CPluginEstimate* pie);
40 
49  CPluginEstimate* pie);
50 
52 
59  virtual bool init(CFeatures* l, CFeatures* r);
60 
62  virtual void cleanup();
63 
68  virtual EKernelType get_kernel_type() { return K_HISTOGRAM; }
69 
74  virtual const char* get_name() const { return "HistogramWordStringKernel" ; }
75 
76  protected:
85  float64_t compute(int32_t idx_a, int32_t idx_b);
86 
93  inline int32_t compute_index(int32_t position, uint16_t symbol)
94  {
95  return position*num_symbols+symbol+1;
96  }
97 
98  private:
99  void init();
100 
101  protected:
104 
109 
114 
119 
124 
126  int32_t num_params;
128  int32_t num_params2;
130  int32_t num_symbols;
133 
136 };
137 }
138 #endif /* _HISTOGRAMWORDKERNEL_H__ */

SHOGUN Machine Learning Toolbox - Documentation