SHOGUN  4.1.0
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义  
PeriodicKernel.h
浏览该文件的文档.
1 /*
2  * Copyright (c) The Shogun Machine Learning Toolbox
3  * Written (w) 2015 Esben Soerig
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are met:
8  *
9  * 1. Redistributions of source code must retain the above copyright notice, this
10  * list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright notice,
12  * this list of conditions and the following disclaimer in the documentation
13  * and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
19  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25  *
26  * The views and conclusions contained in the software and documentation are those
27  * of the authors and should not be interpreted as representing official policies,
28  * either expressed or implied, of the Shogun Development Team.
29  */
30 
31 #ifndef PERIODICKERNEL_H
32 #define PERIODICKERNEL_H
33 
35 
36 namespace shogun
37 {
38  class CDotFeatures;
39 
54 {
55  public:
58 
65  CPeriodicKernel(float64_t length_scale, float64_t period, int32_t size=10);
66 
76  float64_t length_scale, float64_t period, int32_t size=10);
77 
78  virtual ~CPeriodicKernel() { };
79 
86  virtual bool init(CFeatures* l, CFeatures* r);
87 
92  virtual EKernelType get_kernel_type() { return K_PERIODIC; }
93 
98  virtual const char* get_name() const { return "PeriodicKernel"; }
99 
104  virtual void set_length_scale(float64_t length_scale) { m_length_scale=length_scale; }
105 
110  virtual float64_t get_length_scale() const { return m_length_scale; }
111 
116  virtual void set_period(float64_t period) { m_period=period; }
117 
122  virtual float64_t get_period() const { return m_period; }
123 
132  const TParameter* param, index_t index=-1);
133 
134  protected:
143  virtual float64_t compute(int32_t idx_a, int32_t idx_b);
144 
145 
159  virtual float64_t distance(int32_t idx_a, int32_t idx_b);
160  private:
164  void precompute_squared();
165 
172  void precompute_squared_helper(SGVector<float64_t>& buf, CDotFeatures* df);
173 
174  void init();
175 
176  protected:
185 };
186 }
187 #endif /* _PERIODICKERNEL_H__ */
SGVector< float64_t > m_sq_lhs
EKernelType
Definition: Kernel.h:57
int32_t index_t
Definition: common.h:62
parameter struct
The periodic kernel as described in The Kernel Cookbook by David Duvenaud: http://people.seas.harvard.edu/~dduvenaud/cookbook/.
Features that support dot products among other operations.
Definition: DotFeatures.h:44
virtual float64_t get_length_scale() const
Template class DotKernel is the base class for kernels working on DotFeatures.
Definition: DotKernel.h:31
virtual EKernelType get_kernel_type()
double float64_t
Definition: common.h:50
virtual float64_t get_period() const
virtual SGMatrix< float64_t > get_parameter_gradient(const TParameter *param, index_t index=-1)
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
virtual void set_period(float64_t period)
The class Features is the base class of all feature objects.
Definition: Features.h:68
virtual float64_t compute(int32_t idx_a, int32_t idx_b)
virtual float64_t distance(int32_t idx_a, int32_t idx_b)
SGVector< float64_t > m_sq_rhs
virtual void set_length_scale(float64_t length_scale)
virtual const char * get_name() const

SHOGUN 机器学习工具包 - 项目文档