SHOGUN  v2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
18 #include <shogun/machine/Machine.h>
21 
22 namespace shogun
23 {
24 
25 class CInferenceMethod;
26 class CFeatures;
27 class CLabels;
28 
35 {
36 
37  public:
40 
43  {
47  };
48 
56  CFeatures* data, CLabels* lab);
57 
60 
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 
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 
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 
144  {
146  }
147 
153 
159 
161  inline virtual const char* get_name() const
162  {
163  return "GaussianProcessRegression";
164  }
165 
171  {
172  m_return = t;
173  };
174 
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