SHOGUN
v3.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
preprocessor
HomogeneousKernelMap.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) 2012 Viktor Gal
8
* Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson.
9
*/
10
11
#ifndef _CHOMOGENEOUKERNELMAP__H__
12
#define _CHOMOGENEOUKERNELMAP__H__
13
14
#include <
shogun/preprocessor/DensePreprocessor.h
>
15
#include <
shogun/features/Features.h
>
16
#include <
shogun/lib/common.h
>
17
18
#include <stdio.h>
19
20
namespace
shogun
21
{
23
enum
HomogeneousKernelType
{
24
HomogeneousKernelIntersection
= 0,
25
HomogeneousKernelChi2
,
26
HomogeneousKernelJS
27
};
28
30
enum
HomogeneousKernelMapWindowType
{
31
HomogeneousKernelMapWindowUniform
= 0,
32
HomogeneousKernelMapWindowRectangular
= 1,
33
};
34
54
class
CHomogeneousKernelMap
:
public
CDensePreprocessor
<float64_t>
55
{
56
public
:
58
CHomogeneousKernelMap
();
59
68
CHomogeneousKernelMap
(
HomogeneousKernelType
kernel,
HomogeneousKernelMapWindowType
wType,
69
float64_t
gamma = 1.0, uint64_t order = 1,
float64_t
period = -1);
70
72
virtual
~CHomogeneousKernelMap
();
73
75
virtual
bool
init
(
CFeatures
* features);
76
78
virtual
void
cleanup
();
79
84
virtual
SGMatrix<float64_t>
apply_to_feature_matrix
(
CFeatures
* features);
85
90
virtual
SGVector<float64_t>
apply_to_feature_vector
(
SGVector<float64_t>
vector);
91
93
virtual
const
char
*
get_name
()
const
{
return
"HomogeneousKernelMap"
; }
94
96
virtual
EPreprocessorType
get_type
()
const
{
return
P_HOMOGENEOUSKERNELMAP
; }
97
101
void
set_kernel_type
(
HomogeneousKernelType
k);
105
HomogeneousKernelType
get_kernel_type
()
const
;
106
110
void
set_window_type
(
HomogeneousKernelMapWindowType
w);
114
HomogeneousKernelMapWindowType
get_window_type
()
const
;
115
119
void
set_gamma
(
float64_t
g);
123
float64_t
get_gamma
(
float64_t
g)
const
;
124
128
void
set_order
(uint64_t o);
132
uint64_t
get_order
()
const
;
133
137
void
set_period
(
float64_t
p);
141
float64_t
get_period
()
const
;
142
143
private
:
144
void
init ();
145
void
register_params ();
146
inline
float64_t
get_smooth_spectrum (
float64_t
omega)
const
;
147
inline
float64_t
sinc (
float64_t
x)
const
;
148
inline
float64_t
get_spectrum (
float64_t
omega)
const
;
149
SGVector<float64_t>
apply_to_vector(
const
SGVector<float64_t>
& in_v)
const
;
150
151
private
:
152
HomogeneousKernelType
m_kernel;
153
HomogeneousKernelMapWindowType
m_window;
154
float64_t
m_gamma;
155
float64_t
m_period;
156
uint64_t m_numSubdivisions;
157
float64_t
m_subdivision;
158
uint64_t m_order;
159
int64_t m_minExponent;
160
int64_t m_maxExponent;
161
SGVector<float64_t>
m_table;
162
};
163
}
164
#endif
/* _CHOMOGENEOUKERNELMAP__H__ */
SHOGUN
Machine Learning Toolbox - Documentation