14#ifndef MLPACK_METHODS_GMM_DIAGONAL_GMM_HPP
15#define MLPACK_METHODS_GMM_DIAGONAL_GMM_HPP
80 size_t dimensionality;
83 std::vector<distribution::DiagonalGaussianDistribution> dists;
99 Log::Debug <<
"DiagonalGMM::DiagonalGMM(): no parameters given;"
100 "Estimate() may fail " <<
"unless parameters are set." << std::endl;
118 DiagonalGMM(
const std::vector<distribution::DiagonalGaussianDistribution>&
119 dists,
const arma::vec& weights) :
120 gaussians(dists.size()),
121 dimensionality((!dists.empty()) ? dists[0].Mean().n_elem : 0),
157 const arma::vec&
Weights()
const {
return weights; }
185 const size_t component)
const;
195 const size_t component)
const;
226 template<
typename FittingType = EMFit<kmeans::KMeans<>, DiagonalConstra
int,
227 distribution::DiagonalGaussianDistribution>>
228 double Train(
const arma::mat& observations,
229 const size_t trials = 1,
230 const bool useExistingModel =
false,
231 FittingType fitter = FittingType());
258 template<
typename FittingType = EMFit<kmeans::KMeans<>, DiagonalConstra
int,
259 distribution::DiagonalGaussianDistribution>>
260 double Train(
const arma::mat& observations,
261 const arma::vec& probabilities,
262 const size_t trials = 1,
263 const bool useExistingModel =
false,
264 FittingType fitter = FittingType());
284 arma::Row<size_t>& labels)
const;
289 template<
typename Archive>
302 double LogLikelihood(
303 const arma::mat& observations,
304 const std::vector<distribution::DiagonalGaussianDistribution>& dists,
305 const arma::vec& weights)
const;
312#include "diagonal_gmm_impl.hpp"
static MLPACK_EXPORT util::NullOutStream Debug
MLPACK_EXPORT is required for global variables, so that they are properly exported by the Windows com...
A single multivariate Gaussian distribution with diagonal covariance.
A Diagonal Gaussian Mixture Model.
size_t Gaussians() const
Return the number of Gaussians in the model.
DiagonalGMM & operator=(const DiagonalGMM &other)
Copy operator for DiagonalGMMs.
arma::vec Random() const
Return a randomly generated observation according to the probability distribution defined by this obj...
distribution::DiagonalGaussianDistribution & Component(size_t i)
Return a reference to a component distribution.
void Classify(const arma::mat &observations, arma::Row< size_t > &labels) const
Classify the given observations as being from an individual component in this DiagonalGMM.
arma::vec & Weights()
Return a reference to the a priori weights of each Gaussian.
double LogProbability(const arma::vec &observation, const size_t component) const
Return the log probability that the given observation came from the given Gaussian component in this ...
const arma::vec & Weights() const
Return a const reference to the a priori weights of each Gaussian.
double Train(const arma::mat &observations, const arma::vec &probabilities, const size_t trials=1, const bool useExistingModel=false, FittingType fitter=FittingType())
Estimate the probability distribution directly from the given observations, taking into account the p...
double LogProbability(const arma::vec &observation) const
Return the log probability that the given observation came from this distribution.
DiagonalGMM()
Create an empty Diagonal Gaussian Mixture Model, with zero gaussians.
size_t Dimensionality() const
Return the dimensionality of the model.
DiagonalGMM(const size_t gaussians, const size_t dimensionality)
Create a GMM with the given number of Gaussians, each of which have the specified dimensionality.
double Probability(const arma::vec &observation) const
Return the probability that the given observation came from this distribution.
double Train(const arma::mat &observations, const size_t trials=1, const bool useExistingModel=false, FittingType fitter=FittingType())
Estimate the probability distribution directly from the given observations, using the given algorithm...
DiagonalGMM(const DiagonalGMM &other)
Copy constructor for DiagonalGMMs.
void serialize(Archive &ar, const unsigned int)
Serialize the DiagonalGMM.
const distribution::DiagonalGaussianDistribution & Component(size_t i) const
Return a const reference to a component distribution.
DiagonalGMM(const std::vector< distribution::DiagonalGaussianDistribution > &dists, const arma::vec &weights)
Create a DiagonalGMM with the given dists and weights.
double Probability(const arma::vec &observation, const size_t component) const
Return the probability that the given observation came from the given Gaussian component in this dist...
Linear algebra utility functions, generally performed on matrices or vectors.
The core includes that mlpack expects; standard C++ includes and Armadillo.