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  * Written (W) 2014 Parijat Mazumdar
9  * Copyright (C) 2011 Berlin Institute of Technology and Max-Planck-Society
10  */
11 
12 #ifndef _GAUSSIAN_H__
13 #define _GAUSSIAN_H__
14 
15 #include <shogun/lib/config.h>
16 
17 #ifdef HAVE_LAPACK
18 
21 #include <shogun/lib/common.h>
24 
25 #include <shogun/lib/SGVector.h>
26 #include <shogun/lib/SGMatrix.h>
27 
28 namespace shogun
29 {
30 class CDotFeatures;
31 
34 {
41 };
42 
50 class CGaussian : public CDistribution
51 {
52  public:
54  CGaussian();
62  virtual ~CGaussian();
63 
65  void init();
66 
73  virtual bool train(CFeatures* data=NULL);
74 
79  virtual int32_t get_num_model_parameters();
80 
86  virtual float64_t get_log_model_parameter(int32_t num_param);
87 
95  int32_t num_param, int32_t num_example);
96 
104  virtual float64_t get_log_likelihood_example(int32_t num_example);
105 
113  virtual float64_t update_params_em(float64_t* alpha_k, int32_t len);
114 
121  {
122  return CMath::exp(compute_log_PDF(point));
123  }
124 
131 
136  virtual SGVector<float64_t> get_mean();
137 
142  virtual void set_mean(const SGVector<float64_t> mean);
143 
148  virtual SGMatrix<float64_t> get_cov();
149 
156  virtual void set_cov(SGMatrix<float64_t> cov);
157 
163  {
164  return m_cov_type;
165  }
166 
173  inline void set_cov_type(ECovType cov_type)
174  {
175  m_cov_type = cov_type;
176  }
177 
183  {
184  return m_d;
185  }
186 
191  void set_d(const SGVector<float64_t> d);
192 
198  {
199  return m_u;
200  }
201 
206  inline void set_u(SGMatrix<float64_t> u)
207  {
208  m_u = u;
209  }
210 
216 
221  static CGaussian* obtain_from_generic(CDistribution* distribution);
222 
224  virtual const char* get_name() const { return "Gaussian"; }
225 
226  private:
228  void register_params();
229 
234  void decompose_cov(SGMatrix<float64_t> cov);
235 
236  protected:
247 };
248 }
249 #endif //HAVE_LAPACK
250 #endif //_GAUSSIAN_H__

SHOGUN Machine Learning Toolbox - Documentation