gaussian_distribution.hpp

Go to the documentation of this file.
00001 
00022 #ifndef __MLPACK_METHODS_HMM_DISTRIBUTIONS_GAUSSIAN_DISTRIBUTION_HPP
00023 #define __MLPACK_METHODS_HMM_DISTRIBUTIONS_GAUSSIAN_DISTRIBUTION_HPP
00024 
00025 #include <mlpack/core.hpp>
00026 // Should be somewhere else, maybe in core.
00027 #include <mlpack/methods/gmm/phi.hpp>
00028 
00029 namespace mlpack {
00030 namespace distribution {
00031 
00035 class GaussianDistribution
00036 {
00037  private:
00039   arma::vec mean;
00041   arma::mat covariance;
00042 
00043  public:
00047   GaussianDistribution() { /* nothing to do */ }
00048 
00053   GaussianDistribution(const size_t dimension) :
00054       mean(arma::zeros<arma::vec>(dimension)),
00055       covariance(arma::eye<arma::mat>(dimension, dimension))
00056   { /* Nothing to do. */ }
00057 
00061   GaussianDistribution(const arma::vec& mean, const arma::mat& covariance) :
00062       mean(mean), covariance(covariance) { /* Nothing to do. */ }
00063 
00065   size_t Dimensionality() const { return mean.n_elem; }
00066 
00070   double Probability(const arma::vec& observation) const
00071   {
00072     return mlpack::gmm::phi(observation, mean, covariance);
00073   }
00074 
00081   arma::vec Random() const;
00082 
00088   void Estimate(const arma::mat& observations);
00089 
00095   void Estimate(const arma::mat& observations,
00096                 const arma::vec& probabilities);
00097 
00101   const arma::vec& Mean() const { return mean; }
00102 
00106   arma::vec& Mean() { return mean; }
00107 
00111   const arma::mat& Covariance() const { return covariance; }
00112 
00116   arma::mat& Covariance() { return covariance; }
00117 
00121   std::string ToString() const;
00122 };
00123 
00124 }; // namespace distribution
00125 }; // namespace mlpack
00126 
00127 #endif

Generated on 29 Sep 2016 for MLPACK by  doxygen 1.6.1