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 #include <stdio.h>
21 
22 namespace shogun
23 {
29  };
30 
35  };
36 
56  class CHomogeneousKernelMap : public CDensePreprocessor<float64_t>
57  {
58  public:
61 
71  float64_t gamma = 1.0, uint64_t order = 1, float64_t period = -1);
72 
74  virtual ~CHomogeneousKernelMap();
75 
77  virtual bool init(CFeatures* features);
78 
80  virtual void cleanup();
81 
87 
93 
95  virtual const char* get_name() const { return "HomogeneousKernelMap"; }
96 
99 
108 
117 
121  void set_gamma(float64_t g);
125  float64_t get_gamma(float64_t g) const;
126 
130  void set_order(uint64_t o);
134  uint64_t get_order() const;
135 
139  void set_period(float64_t p);
143  float64_t get_period() const;
144 
145  private:
146  void init ();
147  void register_params ();
148  inline float64_t get_smooth_spectrum (float64_t omega) const;
149  inline float64_t sinc (float64_t x) const;
150  inline float64_t get_spectrum (float64_t omega) const;
151  SGVector<float64_t> apply_to_vector(const SGVector<float64_t>& in_v) const;
152 
153  private:
154  HomogeneousKernelType m_kernel;
156  float64_t m_gamma;
157  float64_t m_period;
158  uint64_t m_numSubdivisions;
159  float64_t m_subdivision;
160  uint64_t m_order;
161  int64_t m_minExponent;
162  int64_t m_maxExponent;
163  SGVector<float64_t> m_table;
164  };
165 }
166 #endif /* _CHOMOGENEOUKERNELMAP__H__ */

SHOGUN Machine Learning Toolbox - Documentation