SHOGUN
v2.0.0
Main Page
Related Pages
Modules
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
src
shogun
kernel
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
>
17
#include <
shogun/kernel/DotKernel.h
>
18
#include <
shogun/features/Features.h
>
19
#include <
shogun/features/DenseFeatures.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
55
CANOVAKernel
(
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
inline
virtual
EKernelType
get_kernel_type
() {
return
K_ANOVA
; }
71
75
inline
virtual
EFeatureType
get_feature_type
() {
return
F_DREAL
; }
76
80
inline
virtual
EFeatureClass
get_feature_class
() {
return
C_DENSE
; }
81
85
inline
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);
108
float64_t
compute_rec2
(int32_t idx_a, int32_t idx_b);
109
protected
:
110
118
virtual
float64_t
compute
(int32_t idx_a, int32_t idx_b);
119
121
void
init
();
122
124
void
allocate_arrays
();
125
127
virtual
void
cleanup
();
128
130
void
register_params
();
131
140
virtual
void
load_serializable_post
() throw (
ShogunException
);
141
142
private:
143
float64_t
compute_recursive1(
float64_t
* avec,
float64_t
* bvec, int32_t len);
144
float64_t
compute_recursive2(
float64_t
* avec,
float64_t
* bvec, int32_t len);
145
146
protected:
148
int32_t
cardinality
;
149
151
float64_t
*
DP
;
153
int32_t
DP_len
;
154
156
float64_t
*
KD
;
158
float64_t
*
KS
;
160
float64_t
*
vec_pow
;
161
};
162
}
163
164
#endif
/* ANOVAKERNEL_H_ */
SHOGUN
Machine Learning Toolbox - Documentation