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
regression
GaussianProcessRegression.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
* Copyright (C) 2012 Jacob Walker
8
*/
9
10
#ifndef _GAUSSIANPROCESSREGRESSION_H__
11
#define _GAUSSIANPROCESSREGRESSION_H__
12
13
#include <
shogun/lib/config.h
>
14
#ifdef HAVE_EIGEN3
15
#ifdef HAVE_LAPACK
16
17
#include <
shogun/regression/Regression.h
>
18
#include <
shogun/machine/Machine.h
>
19
#include <
shogun/features/DenseFeatures.h
>
20
#include <
shogun/regression/gp/InferenceMethod.h
>
21
22
namespace
shogun
23
{
24
25
class
CInferenceMethod;
26
class
CFeatures;
27
class
CLabels;
28
34
class
CGaussianProcessRegression
:
public
CMachine
35
{
36
37
public
:
39
MACHINE_PROBLEM_TYPE
(
PT_REGRESSION
);
40
42
enum
EGPReturnType
43
{
44
GP_RETURN_MEANS
,
45
GP_RETURN_COV
,
46
GP_RETURN_BOTH
47
};
48
55
CGaussianProcessRegression
(
CInferenceMethod
* inf,
56
CFeatures
* data,
CLabels
* lab);
57
59
CGaussianProcessRegression
();
60
61
virtual
~CGaussianProcessRegression
();
62
67
virtual
inline
void
set_features
(
CFeatures
* feat)
68
{
69
SG_UNREF
(m_features);
70
SG_REF
(feat);
71
m_features = feat;
72
update_kernel_matrices();
73
}
74
79
virtual
CFeatures
*
get_features
()
80
{
81
SG_REF
(m_features);
82
return
m_features;
83
}
84
89
inline
void
set_method
(
CInferenceMethod
* inf)
90
{
91
SG_UNREF
(m_method);
92
SG_REF
(inf);
93
m_method = inf;
94
};
95
100
inline
CInferenceMethod
*
get_method
()
101
{
102
SG_REF
(m_method);
103
return
m_method;
104
};
105
111
virtual
bool
load
(FILE* srcfile);
112
118
virtual
bool
save
(FILE* dstfile);
119
124
void
set_kernel
(
CKernel
* k);
125
130
CKernel
*
get_kernel
();
131
137
virtual
CRegressionLabels
*
apply_regression
(
CFeatures
* data = NULL);
138
143
inline
virtual
EMachineType
get_classifier_type
()
144
{
145
return
CT_GAUSSIANPROCESSREGRESSION
;
146
}
147
152
SGVector<float64_t>
get_covariance_vector
();
153
158
SGVector<float64_t>
get_mean_vector
();
159
161
inline
virtual
const
char
*
get_name
()
const
162
{
163
return
"GaussianProcessRegression"
;
164
}
165
170
inline
void
set_return_type
(
EGPReturnType
t)
171
{
172
m_return = t;
173
};
174
180
inline
EGPReturnType
get_return_type
()
181
{
182
return
m_return;
183
};
184
185
186
protected
:
193
virtual
bool
train_machine
(
CFeatures
* data = NULL);
194
private
:
195
197
void
init();
198
199
/* Update kernel matrices */
200
void
update_kernel_matrices();
201
202
private
:
203
205
CFeatures
* m_features;
206
208
CFeatures
* m_data;
209
210
/*Kernel matrix from testing and training
211
* features
212
*/
213
SGMatrix<float64_t>
m_k_trts;
214
215
/*Kernel matrix from testing
216
* features
217
*/
218
SGMatrix<float64_t>
m_k_tsts;
219
221
CInferenceMethod
* m_method;
222
223
/*What should apply_regression return?*/
224
EGPReturnType
m_return;
225
};
226
227
}
228
229
#endif
230
#endif
231
#endif
/* _GAUSSIANPROCESSREGRESSION_H__ */
SHOGUN
Machine Learning Toolbox - Documentation