SHOGUN  4.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ANOVAKernel.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) 2011 Andrew Tereskin
8  * Copyright (C) 2011 Berlin Institute of Technology and Max-Planck-Society
9  */
10 
11 #include <shogun/lib/config.h>
12 
13 #ifndef ANOVAKERNEL_H_
14 #define ANOVAKERNEL_H_
15 
16 #include <shogun/lib/common.h>
20 
21 namespace shogun
22 {
23 
24 class CDistance;
25 
37 class CANOVAKernel: public CDotKernel
38 {
39 public:
41  CANOVAKernel();
42 
47  CANOVAKernel(int32_t cache, int32_t d);
48 
56  CDenseFeatures<float64_t>* l, CDenseFeatures<float64_t>* r, int32_t d, int32_t cache);
57 
58  virtual ~CANOVAKernel();
59 
65  virtual bool init(CFeatures* l, CFeatures* r);
66 
70  virtual EKernelType get_kernel_type() { return K_ANOVA; }
71 
75  virtual EFeatureType get_feature_type() { return F_DREAL; }
76 
80  virtual EFeatureClass get_feature_class() { return C_DENSE; }
81 
85  virtual const char* get_name() const { return "ANOVAKernel"; }
86 
90  inline int32_t get_cardinality() { return this->cardinality; }
91 
95  inline void set_cardinality(int32_t value) { this->cardinality = value; }
96 
102  float64_t compute_rec1(int32_t idx_a, int32_t idx_b);
103 
109  float64_t compute_rec2(int32_t idx_a, int32_t idx_b);
110 
116 protected:
117 
125  virtual float64_t compute(int32_t idx_a, int32_t idx_b);
126 
128  void register_params();
129 
130 private:
131  float64_t compute_recursive1(float64_t* avec, float64_t* bvec, int32_t len);
132  float64_t compute_recursive2(float64_t* avec, float64_t* bvec, int32_t len);
133 
134 protected:
136  int32_t cardinality;
137 };
138 }
139 
140 #endif /* ANOVAKERNEL_H_ */
void set_cardinality(int32_t value)
Definition: ANOVAKernel.h:95
int32_t cardinality
degree parameter of kernel
Definition: ANOVAKernel.h:136
EKernelType
Definition: Kernel.h:57
virtual const char * get_name() const
Definition: ANOVAKernel.h:85
virtual EFeatureType get_feature_type()
Definition: ANOVAKernel.h:75
int32_t get_cardinality()
Definition: ANOVAKernel.h:90
virtual float64_t compute(int32_t idx_a, int32_t idx_b)
Definition: ANOVAKernel.cpp:51
ANOVA (ANalysis Of VAriances) kernel.
Definition: ANOVAKernel.h:37
float64_t kernel(int32_t idx_a, int32_t idx_b)
Definition: Kernel.h:206
float64_t compute_rec2(int32_t idx_a, int32_t idx_b)
Definition: ANOVAKernel.cpp:75
EFeatureClass
shogun feature class
Definition: FeatureTypes.h:38
Template class DotKernel is the base class for kernels working on DotFeatures.
Definition: DotKernel.h:31
double float64_t
Definition: common.h:50
virtual bool init(CFeatures *l, CFeatures *r)
Definition: ANOVAKernel.cpp:41
static CANOVAKernel * obtain_from_generic(CKernel *kernel)
virtual EFeatureClass get_feature_class()
Definition: ANOVAKernel.h:80
EFeatureType
shogun feature type
Definition: FeatureTypes.h:19
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
The Kernel base class.
Definition: Kernel.h:158
virtual EKernelType get_kernel_type()
Definition: ANOVAKernel.h:70
float64_t compute_rec1(int32_t idx_a, int32_t idx_b)
Definition: ANOVAKernel.cpp:56

SHOGUN Machine Learning Toolbox - Documentation