SHOGUN  3.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Gaussian.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 Alesis Novik
8  * Copyright (C) 2011 Berlin Institute of Technology and Max-Planck-Society
9  */
10 
11 #ifndef _GAUSSIAN_H__
12 #define _GAUSSIAN_H__
13 
14 #include <shogun/lib/config.h>
15 
16 #ifdef HAVE_LAPACK
17 
20 #include <shogun/lib/common.h>
23 
24 #include <shogun/lib/SGVector.h>
25 #include <shogun/lib/SGMatrix.h>
26 
27 namespace shogun
28 {
29 class CDotFeatures;
30 
33 {
40 };
41 
49 class CGaussian : public CDistribution
50 {
51  public:
53  CGaussian();
61  virtual ~CGaussian();
62 
64  void init();
65 
72  virtual bool train(CFeatures* data=NULL);
73 
78  virtual int32_t get_num_model_parameters();
79 
85  virtual float64_t get_log_model_parameter(int32_t num_param);
86 
94  int32_t num_param, int32_t num_example);
95 
103  virtual float64_t get_log_likelihood_example(int32_t num_example);
104 
111  {
112  return CMath::exp(compute_log_PDF(point));
113  }
114 
121 
126  virtual SGVector<float64_t> get_mean();
127 
132  virtual void set_mean(const SGVector<float64_t> mean);
133 
138  virtual SGMatrix<float64_t> get_cov();
139 
146  virtual void set_cov(SGMatrix<float64_t> cov);
147 
153  {
154  return m_cov_type;
155  }
156 
163  inline void set_cov_type(ECovType cov_type)
164  {
165  m_cov_type = cov_type;
166  }
167 
173  {
174  return m_d;
175  }
176 
181  void set_d(const SGVector<float64_t> d);
182 
188  {
189  return m_u;
190  }
191 
196  inline void set_u(SGMatrix<float64_t> u)
197  {
198  m_u = u;
199  }
200 
206 
211  static CGaussian* obtain_from_generic(CDistribution* distribution);
212 
214  virtual const char* get_name() const { return "Gaussian"; }
215 
216  private:
218  void register_params();
219 
224  void decompose_cov(SGMatrix<float64_t> cov);
225 
226  protected:
237 };
238 }
239 #endif //HAVE_LAPACK
240 #endif //_GAUSSIAN_H__

SHOGUN Machine Learning Toolbox - Documentation