SHOGUN  3.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HomogeneousKernelMap.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) 2012 Viktor Gal
8  * Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson.
9  */
10 
11 #ifndef _CHOMOGENEOUKERNELMAP__H__
12 #define _CHOMOGENEOUKERNELMAP__H__
13 
14 #include <shogun/lib/config.h>
15 
18 #include <shogun/lib/common.h>
19 
20 
21 namespace shogun
22 {
28  };
29 
34  };
35 
55  class CHomogeneousKernelMap : public CDensePreprocessor<float64_t>
56  {
57  public:
60 
70  float64_t gamma = 1.0, uint64_t order = 1, float64_t period = -1);
71 
73  virtual ~CHomogeneousKernelMap();
74 
76  virtual bool init(CFeatures* features);
77 
79  virtual void cleanup();
80 
86 
92 
94  virtual const char* get_name() const { return "HomogeneousKernelMap"; }
95 
98 
107 
116 
120  void set_gamma(float64_t g);
124  float64_t get_gamma(float64_t g) const;
125 
129  void set_order(uint64_t o);
133  uint64_t get_order() const;
134 
138  void set_period(float64_t p);
142  float64_t get_period() const;
143 
144  private:
145  void init ();
146  void register_params ();
147  inline float64_t get_smooth_spectrum (float64_t omega) const;
148  inline float64_t sinc (float64_t x) const;
149  inline float64_t get_spectrum (float64_t omega) const;
150  SGVector<float64_t> apply_to_vector(const SGVector<float64_t>& in_v) const;
151 
152  private:
153  HomogeneousKernelType m_kernel;
155  float64_t m_gamma;
156  float64_t m_period;
157  uint64_t m_numSubdivisions;
158  float64_t m_subdivision;
159  uint64_t m_order;
160  int64_t m_minExponent;
161  int64_t m_maxExponent;
162  SGVector<float64_t> m_table;
163  };
164 }
165 #endif /* _CHOMOGENEOUKERNELMAP__H__ */

SHOGUN Machine Learning Toolbox - Documentation