SHOGUN  5.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules
GaussianKernel.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-2010 Soeren Sonnenburg
8  * Written (W) 2011 Abhinav Maurya
9  * Written (W) 2012 Heiko Strathmann
10  * Written (W) 2016 Soumyajit De
11  * Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society
12  * Copyright (C) 2010 Berlin Institute of Technology
13  */
14 
15 #ifndef GAUSSIANKERNEL_H
16 #define GAUSSIANKERNEL_H
17 
18 #include <shogun/lib/config.h>
20 
21 namespace shogun
22 {
23 
24 class CFeatures;
25 class CDotFeatures;
26 
40 {
41 public:
44 
50 
56  CGaussianKernel(int32_t size, float64_t width);
57 
65  CGaussianKernel(CDotFeatures* l, CDotFeatures* r, float64_t width, int32_t size=10);
66 
68  virtual ~CGaussianKernel();
69 
75 
77  virtual CSGObject* shallow_copy() const;
78 
85  virtual bool init(CFeatures* l, CFeatures* r);
86 
88  virtual void cleanup();
89 
95  {
96  return K_GAUSSIAN;
97  }
98 
101  {
102  return F_ANY;
103  }
104 
107  {
108  return C_ANY;
109  }
110 
115  virtual const char* get_name() const { return "GaussianKernel"; }
116 
121  virtual void set_width(float64_t w);
122 
127  virtual float64_t get_width() const;
128 
136  virtual SGMatrix<float64_t> get_parameter_gradient(const TParameter* param, index_t index=-1);
137 
138 protected:
147  virtual float64_t compute(int32_t idx_a, int32_t idx_b);
148 
155  virtual void load_serializable_post() throw (ShogunException);
156 
171  virtual float64_t distance(int32_t idx_a, int32_t idx_b) const;
172 
173 private:
175  void register_params();
176 
177 protected:
180 };
181 
182 }
183 #endif /* _GAUSSIANKERNEL_H__ */
Base class for the family of kernel functions that only depend on the difference of the inputs...
EKernelType
Definition: Kernel.h:57
int32_t index_t
Definition: common.h:62
virtual void load_serializable_post()
Class ShogunException defines an exception which is thrown whenever an error inside of shogun occurs...
parameter struct
float64_t kernel(int32_t idx_a, int32_t idx_b)
Definition: Kernel.h:207
virtual float64_t compute(int32_t idx_a, int32_t idx_b)
Features that support dot products among other operations.
Definition: DotFeatures.h:44
EFeatureClass
shogun feature class
Definition: FeatureTypes.h:38
Class SGObject is the base class of all shogun objects.
Definition: SGObject.h:115
virtual EKernelType get_kernel_type()
virtual SGMatrix< float64_t > get_parameter_gradient(const TParameter *param, index_t index=-1)
double float64_t
Definition: common.h:50
virtual CSGObject * shallow_copy() const
The well known Gaussian kernel (swiss army knife for SVMs) computed on CDotFeatures.
virtual float64_t distance(int32_t idx_a, int32_t idx_b) const
EFeatureType
shogun feature type
Definition: FeatureTypes.h:19
static CGaussianKernel * obtain_from_generic(CKernel *kernel)
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
The class Features is the base class of all feature objects.
Definition: Features.h:68
virtual const char * get_name() const
virtual EFeatureClass get_feature_class()
The Kernel base class.
Definition: Kernel.h:159
virtual bool init(CFeatures *l, CFeatures *r)
virtual void set_width(float64_t w)
virtual float64_t get_width() const
virtual EFeatureType get_feature_type()

SHOGUN Machine Learning Toolbox - Documentation