SHOGUN  6.1.3
SingleLaplaceInferenceMethod.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) 2013 Roman Votyakov
8  * Copyright (C) 2012 Jacob Walker
9  * Copyright (C) 2013 Roman Votyakov
10  *
11  * Code adapted from Gaussian Process Machine Learning Toolbox
12  * http://www.gaussianprocess.org/gpml/code/matlab/doc/
13  */
14 
15 #ifndef CSINGLELAPLACEINFERENCEMETHOD_H_
16 #define CSINGLELAPLACEINFERENCEMETHOD_H_
17 
18 #include <shogun/lib/config.h>
21 
22 namespace shogun
23 {
41 {
44 public:
47 
57  CMeanFunction* mean, CLabels* labels, CLikelihoodModel* model);
58 
60 
65  virtual const char* get_name() const { return "SingleLaplaceInferenceMethod"; }
66 
72 
79 
92 
97  virtual bool supports_regression() const
98  {
99  check_members();
100  return m_model->supports_regression();
101  }
102 
107  virtual bool supports_binary() const
108  {
109  check_members();
110  return m_model->supports_binary();
111  }
112 
125 
127  virtual void update();
128 
142 
143 
148  virtual void register_minimizer(Minimizer* minimizer);
149 protected:
150 
152  virtual void update_init();
153 
155  virtual void update_alpha();
156 
158  virtual void update_chol();
159 
161  virtual void update_approx_cov();
162 
166  virtual void update_deriv();
167 
176  const TParameter* param);
177 
186  const TParameter* param);
187 
196  const TParameter* param);
197 
206  const TParameter* param);
207 
213 
219 
220 private:
221  void init();
222 
223 protected:
226 
229 
232 
235 
238 
241 
244 
247 };
248 
249 
252 {
253 public:
255 
256  virtual const char* get_name() const { return "SingleLaplaceNewtonOptimizer"; }
257 
259 
263  void set_target(CSingleLaplaceInferenceMethod *obj);
264 
268  void unset_target(bool is_unref);
269 
274  virtual float64_t minimize();
275 
280  virtual void set_minimization_max(float64_t max) { m_opt_max=max; }
281 
286  virtual void set_minimization_tolerance(float64_t tol) { m_opt_tolerance=tol; }
287 
292  virtual void set_newton_iterations(int32_t iter) { m_iter=iter; }
293 
298  virtual void set_newton_tolerance(float64_t tol) { m_tolerance=tol; }
299 
300 private:
301  void init();
302 
305 
307  float64_t m_tolerance;
308 
310  index_t m_iter;
311 
313  float64_t m_opt_tolerance;
314 
316  float64_t m_opt_max;
317 };
318 
319 }
320 #endif /* CSINGLELAPLACEINFERENCEMETHOD_H_ */
virtual void set_minimization_tolerance(float64_t tol)
int32_t index_t
Definition: common.h:72
The class Labels models labels, i.e. class assignments of objects.
Definition: Labels.h:43
The build-in minimizer for SingleLaplaceInference.
parameter struct
virtual SGVector< float64_t > get_derivative_wrt_inference_method(const TParameter *param)
An abstract class of the mean function.
Definition: MeanFunction.h:49
std::enable_if<!std::is_same< T, complex128_t >::value, float64_t >::type mean(const Container< T > &a)
static CSingleLaplaceInferenceMethod * obtain_from_generic(CInference *inference)
virtual SGVector< float64_t > get_derivative_wrt_mean(const TParameter *param)
double float64_t
Definition: common.h:60
virtual bool supports_regression() const
EInferenceType
Definition: Inference.h:53
virtual SGVector< float64_t > get_diagonal_vector()
virtual bool supports_binary() const
virtual EInferenceType get_inference_type() const
virtual SGVector< float64_t > get_posterior_mean()
virtual SGVector< float64_t > get_derivative_wrt_kernel(const TParameter *param)
#define SG_UNREF(x)
Definition: SGObject.h:53
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
The Laplace approximation inference method base class.
The Inference Method base class.
Definition: Inference.h:81
The class Features is the base class of all feature objects.
Definition: Features.h:69
The Kernel base class.
The minimizer base class.
Definition: Minimizer.h:43
T max(const Container< T > &a)
The SingleLaplace approximation inference method class for regression and binary Classification.
CLikelihoodModel * m_model
Definition: Inference.h:470
The Likelihood model base class.
virtual SGVector< float64_t > get_derivative_wrt_likelihood_model(const TParameter *param)
void get_gradient_wrt_alpha(SGVector< float64_t > gradient)
virtual void register_minimizer(Minimizer *minimizer)
virtual void check_members() const
Definition: Inference.cpp:249

SHOGUN Machine Learning Toolbox - Documentation