SHOGUN  3.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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 protected:
111 
119  virtual float64_t compute(int32_t idx_a, int32_t idx_b);
120 
122  void register_params();
123 
124 private:
125  float64_t compute_recursive1(float64_t* avec, float64_t* bvec, int32_t len);
126  float64_t compute_recursive2(float64_t* avec, float64_t* bvec, int32_t len);
127 
128 protected:
130  int32_t cardinality;
131 };
132 }
133 
134 #endif /* ANOVAKERNEL_H_ */

SHOGUN Machine Learning Toolbox - Documentation