yat  0.15.2pre
GaussianMixture.h
1 #ifndef _theplu_yat_statistics_gaussian_mixture_
2 #define _theplu_yat_statistics_gaussian_mixture_
3 
4 // $Id: GaussianMixture.h 3644 2017-05-11 06:07:31Z peter $
5 
6 /*
7  Copyright (C) 2017 Peter Johansson
8 
9  This file is part of the yat library, http://dev.thep.lu.se/yat
10 
11  The yat library is free software; you can redistribute it and/or
12  modify it under the terms of the GNU General Public License as
13  published by the Free Software Foundation; either version 3 of the
14  License, or (at your option) any later version.
15 
16  The yat library is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  General Public License for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with yat. If not, see <http://www.gnu.org/licenses/>.
23 */
24 
25 #include <yat/utility/Vector.h>
26 
27 #include <cstddef>
28 #include <vector>
29 
30 namespace theplu {
31 namespace yat {
32 namespace utility {
33  class Matrix;
34 }
35 namespace statistics {
36 
46  {
47  public:
51  void add(double x, unsigned long int n=1);
52 
56  double alpha(size_t i) const;
57 
61  double cdf_P(double x) const;
62 
66  void clear(void);
67 
73  void fit(size_t n);
74 
78  double mean(void) const;
79 
83  double mean(size_t i) const;
84 
88  double pdf(double x) const;
89 
93  double std(size_t i) const;
94 
95  private:
96  struct data_type
97  {
98  data_type(double x, unsigned long int n);
99  double x;
100  unsigned long int n;
101  };
102  std::vector<data_type> data_;
103 
104  utility::Vector alpha_;
105  utility::Vector mean_;
106  utility::Vector sigma_;
107 
108  void calculate_posterior(utility::Matrix& h) const;
109  void update_model(const utility::Matrix& h);
110  };
111 
112 }}} // of namespace statistics, yat, and theplu
113 
114 #endif
The Department of Theoretical Physics namespace as we define it.
Data modelled as mixture of Gaussian distributions.
Definition: GaussianMixture.h:45
Definition: stl_utility.h:64
void clear(std::vector< T > &vec)
reduce size and capacity to zero
Definition: stl_utility.h:493
This is the yat interface to GSL vector.
Definition: Vector.h:59
void add(T &o, ForwardIterator first, ForwardIterator last, const classifier::Target &target)
Definition: utility.h:304
Interface to GSL matrix.
Definition: Matrix.h:74

Generated on Fri Jul 13 2018 02:33:27 for yat by  doxygen 1.8.11