\section{Diagonal\+G\+MM Class Reference}
\label{classmlpack_1_1gmm_1_1DiagonalGMM}\index{Diagonal\+G\+MM@{Diagonal\+G\+MM}}


A Diagonal Gaussian Mixture Model.  


\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\textbf{ Diagonal\+G\+MM} ()
\begin{DoxyCompactList}\small\item\em Create an empty Diagonal Gaussian Mixture Model, with zero gaussians. \end{DoxyCompactList}\item 
\textbf{ Diagonal\+G\+MM} (const size\+\_\+t gaussians, const size\+\_\+t dimensionality)
\begin{DoxyCompactList}\small\item\em Create a \doxyref{G\+MM}{p.}{classmlpack_1_1gmm_1_1GMM} with the given number of Gaussians, each of which have the specified dimensionality. \end{DoxyCompactList}\item 
\textbf{ Diagonal\+G\+MM} (const std\+::vector$<$ \textbf{ distribution\+::\+Diagonal\+Gaussian\+Distribution} $>$ \&dists, const arma\+::vec \&weights)
\begin{DoxyCompactList}\small\item\em Create a \doxyref{Diagonal\+G\+MM}{p.}{classmlpack_1_1gmm_1_1DiagonalGMM} with the given dists and weights. \end{DoxyCompactList}\item 
\textbf{ Diagonal\+G\+MM} (const \textbf{ Diagonal\+G\+MM} \&other)
\begin{DoxyCompactList}\small\item\em Copy constructor for Diagonal\+G\+M\+Ms. \end{DoxyCompactList}\item 
void \textbf{ Classify} (const arma\+::mat \&observations, arma\+::\+Row$<$ size\+\_\+t $>$ \&labels) const
\begin{DoxyCompactList}\small\item\em Classify the given observations as being from an individual component in this \doxyref{Diagonal\+G\+MM}{p.}{classmlpack_1_1gmm_1_1DiagonalGMM}. \end{DoxyCompactList}\item 
const \textbf{ distribution\+::\+Diagonal\+Gaussian\+Distribution} \& \textbf{ Component} (size\+\_\+t i) const
\begin{DoxyCompactList}\small\item\em Return a const reference to a component distribution. \end{DoxyCompactList}\item 
\textbf{ distribution\+::\+Diagonal\+Gaussian\+Distribution} \& \textbf{ Component} (size\+\_\+t i)
\begin{DoxyCompactList}\small\item\em Return a reference to a component distribution. \end{DoxyCompactList}\item 
size\+\_\+t \textbf{ Dimensionality} () const
\begin{DoxyCompactList}\small\item\em Return the dimensionality of the model. \end{DoxyCompactList}\item 
size\+\_\+t \textbf{ Gaussians} () const
\begin{DoxyCompactList}\small\item\em Return the number of Gaussians in the model. \end{DoxyCompactList}\item 
double \textbf{ Log\+Probability} (const arma\+::vec \&observation) const
\begin{DoxyCompactList}\small\item\em Return the log probability that the given observation came from this distribution. \end{DoxyCompactList}\item 
double \textbf{ Log\+Probability} (const arma\+::vec \&observation, const size\+\_\+t component) const
\begin{DoxyCompactList}\small\item\em Return the log probability that the given observation came from the given Gaussian component in this distribution. \end{DoxyCompactList}\item 
\textbf{ Diagonal\+G\+MM} \& \textbf{ operator=} (const \textbf{ Diagonal\+G\+MM} \&other)
\begin{DoxyCompactList}\small\item\em Copy operator for Diagonal\+G\+M\+Ms. \end{DoxyCompactList}\item 
double \textbf{ Probability} (const arma\+::vec \&observation) const
\begin{DoxyCompactList}\small\item\em Return the probability that the given observation came from this distribution. \end{DoxyCompactList}\item 
double \textbf{ Probability} (const arma\+::vec \&observation, const size\+\_\+t component) const
\begin{DoxyCompactList}\small\item\em Return the probability that the given observation came from the given Gaussian component in this distribution. \end{DoxyCompactList}\item 
arma\+::vec \textbf{ Random} () const
\begin{DoxyCompactList}\small\item\em Return a randomly generated observation according to the probability distribution defined by this object. \end{DoxyCompactList}\item 
{\footnotesize template$<$typename Archive $>$ }\\void \textbf{ serialize} (Archive \&ar, const unsigned int)
\begin{DoxyCompactList}\small\item\em Serialize the \doxyref{Diagonal\+G\+MM}{p.}{classmlpack_1_1gmm_1_1DiagonalGMM}. \end{DoxyCompactList}\item 
{\footnotesize template$<$typename Fitting\+Type  = E\+M\+Fit$<$kmeans\+::\+K\+Means$<$$>$, Diagonal\+Constraint,      distribution\+::\+Diagonal\+Gaussian\+Distribution$>$$>$ }\\double \textbf{ Train} (const arma\+::mat \&observations, const size\+\_\+t trials=1, const bool use\+Existing\+Model=false, Fitting\+Type fitter=Fitting\+Type())
\begin{DoxyCompactList}\small\item\em Estimate the probability distribution directly from the given observations, using the given algorithm in the Fitting\+Type class to fit the data. \end{DoxyCompactList}\item 
{\footnotesize template$<$typename Fitting\+Type  = E\+M\+Fit$<$kmeans\+::\+K\+Means$<$$>$, Diagonal\+Constraint,      distribution\+::\+Diagonal\+Gaussian\+Distribution$>$$>$ }\\double \textbf{ Train} (const arma\+::mat \&observations, const arma\+::vec \&probabilities, const size\+\_\+t trials=1, const bool use\+Existing\+Model=false, Fitting\+Type fitter=Fitting\+Type())
\begin{DoxyCompactList}\small\item\em Estimate the probability distribution directly from the given observations, taking into account the probability of each observation actually being from this distribution, and using the given algorithm in the Fitting\+Type class to fit the data. \end{DoxyCompactList}\item 
const arma\+::vec \& \textbf{ Weights} () const
\begin{DoxyCompactList}\small\item\em Return a const reference to the a priori weights of each Gaussian. \end{DoxyCompactList}\item 
arma\+::vec \& \textbf{ Weights} ()
\begin{DoxyCompactList}\small\item\em Return a reference to the a priori weights of each Gaussian. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
A Diagonal Gaussian Mixture Model. 

This class uses maximum likelihood loss functions to estimate the parameters of the \doxyref{Diagonal\+G\+MM}{p.}{classmlpack_1_1gmm_1_1DiagonalGMM} on a given dataset via the given fitting mechanism, defined by the Fitting\+Type template parameter. The \doxyref{Diagonal\+G\+MM}{p.}{classmlpack_1_1gmm_1_1DiagonalGMM} can be trained using normal data, or data with probabilities of being from this \doxyref{G\+MM}{p.}{classmlpack_1_1gmm_1_1GMM} (see \doxyref{Diagonal\+G\+M\+M\+::\+Train()}{p.}{classmlpack_1_1gmm_1_1DiagonalGMM_ad33ec5cf10980e0b315280ea51ef41ed} for more information). The \doxyref{Diagonal\+G\+MM}{p.}{classmlpack_1_1gmm_1_1DiagonalGMM} is the same as \doxyref{G\+MM}{p.}{classmlpack_1_1gmm_1_1GMM} except for wrapping gmm\+\_\+diag class.

The \doxyref{Train()}{p.}{classmlpack_1_1gmm_1_1DiagonalGMM_ad33ec5cf10980e0b315280ea51ef41ed} method uses a template type \textquotesingle{}Fitting\+Type\textquotesingle{}. The Fitting\+Type template class must provide a way for the \doxyref{Diagonal\+G\+MM}{p.}{classmlpack_1_1gmm_1_1DiagonalGMM} to train on data. It must provide the following two functions\+:


\begin{DoxyCode}
\textcolor{keywordtype}{void} Estimate(
    \textcolor{keyword}{const} arma::mat& observations,
    std::vector<distribution::DiagonalGaussianDistribution>& dists,
    arma::vec& weights);

\textcolor{keywordtype}{void} Estimate(
    \textcolor{keyword}{const} arma::mat& observations,
    \textcolor{keyword}{const} arma::vec& probabilities,
    std::vector<distribution::DiagonalGaussianDistribution>& dists,
    arma::vec& weights);
\end{DoxyCode}


Example use\+:


\begin{DoxyCode}
\textcolor{comment}{// Set up a mixture of 5 gaussians in a 4-dimensional space.}
DiagonalGMM g(5, 4);

\textcolor{comment}{// Train the DiagonalGMM given the data observations, using the default}
\textcolor{comment}{// EM fitting mechanism.}

g.Train(data);

\textcolor{comment}{// Get the probability of 'observation' being observed from this}
\textcolor{comment}{// DiagoanlGMM.}
\textcolor{keywordtype}{double} probability = g.Probability(observation);

\textcolor{comment}{// Get a random observation from the DiagonalGMM.}
arma::vec observation = g.Random();
\end{DoxyCode}
 

Definition at line 74 of file diagonal\+\_\+gmm.\+hpp.



\subsection{Constructor \& Destructor Documentation}
\mbox{\label{classmlpack_1_1gmm_1_1DiagonalGMM_a789ea6c102741e2b8305042a12b933fb}} 
\index{mlpack\+::gmm\+::\+Diagonal\+G\+MM@{mlpack\+::gmm\+::\+Diagonal\+G\+MM}!Diagonal\+G\+MM@{Diagonal\+G\+MM}}
\index{Diagonal\+G\+MM@{Diagonal\+G\+MM}!mlpack\+::gmm\+::\+Diagonal\+G\+MM@{mlpack\+::gmm\+::\+Diagonal\+G\+MM}}
\subsubsection{Diagonal\+G\+M\+M()\hspace{0.1cm}{\footnotesize\ttfamily [1/4]}}
{\footnotesize\ttfamily \textbf{ Diagonal\+G\+MM} (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Create an empty Diagonal Gaussian Mixture Model, with zero gaussians. 



Definition at line 92 of file diagonal\+\_\+gmm.\+hpp.



References Log\+::\+Debug.



Referenced by Diagonal\+G\+M\+M\+::\+Diagonal\+G\+M\+M().

\mbox{\label{classmlpack_1_1gmm_1_1DiagonalGMM_aa4f5bdc8cf6f346d6cad2643cb0eb095}} 
\index{mlpack\+::gmm\+::\+Diagonal\+G\+MM@{mlpack\+::gmm\+::\+Diagonal\+G\+MM}!Diagonal\+G\+MM@{Diagonal\+G\+MM}}
\index{Diagonal\+G\+MM@{Diagonal\+G\+MM}!mlpack\+::gmm\+::\+Diagonal\+G\+MM@{mlpack\+::gmm\+::\+Diagonal\+G\+MM}}
\subsubsection{Diagonal\+G\+M\+M()\hspace{0.1cm}{\footnotesize\ttfamily [2/4]}}
{\footnotesize\ttfamily \textbf{ Diagonal\+G\+MM} (\begin{DoxyParamCaption}\item[{const size\+\_\+t}]{gaussians,  }\item[{const size\+\_\+t}]{dimensionality }\end{DoxyParamCaption})}



Create a \doxyref{G\+MM}{p.}{classmlpack_1_1gmm_1_1GMM} with the given number of Gaussians, each of which have the specified dimensionality. 

The means and covariances will be set to 0.


\begin{DoxyParams}{Parameters}
{\em gaussians} & Number of Gaussians in this \doxyref{Diagonal\+G\+MM}{p.}{classmlpack_1_1gmm_1_1DiagonalGMM}. \\
\hline
{\em dimensionality} & Dimensionality of each Gaussian. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1gmm_1_1DiagonalGMM_af7d5a7ba750481b1183248c762058196}} 
\index{mlpack\+::gmm\+::\+Diagonal\+G\+MM@{mlpack\+::gmm\+::\+Diagonal\+G\+MM}!Diagonal\+G\+MM@{Diagonal\+G\+MM}}
\index{Diagonal\+G\+MM@{Diagonal\+G\+MM}!mlpack\+::gmm\+::\+Diagonal\+G\+MM@{mlpack\+::gmm\+::\+Diagonal\+G\+MM}}
\subsubsection{Diagonal\+G\+M\+M()\hspace{0.1cm}{\footnotesize\ttfamily [3/4]}}
{\footnotesize\ttfamily \textbf{ Diagonal\+G\+MM} (\begin{DoxyParamCaption}\item[{const std\+::vector$<$ \textbf{ distribution\+::\+Diagonal\+Gaussian\+Distribution} $>$ \&}]{dists,  }\item[{const arma\+::vec \&}]{weights }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Create a \doxyref{Diagonal\+G\+MM}{p.}{classmlpack_1_1gmm_1_1DiagonalGMM} with the given dists and weights. 


\begin{DoxyParams}{Parameters}
{\em dists} & Distributions of the model. \\
\hline
{\em weights} & Weights of the model. \\
\hline
\end{DoxyParams}


Definition at line 118 of file diagonal\+\_\+gmm.\+hpp.



References Diagonal\+G\+M\+M\+::\+Diagonal\+G\+M\+M(), and Diagonal\+G\+M\+M\+::operator=().

\mbox{\label{classmlpack_1_1gmm_1_1DiagonalGMM_ae557e17efa07cd2c68c29174f2f64dfb}} 
\index{mlpack\+::gmm\+::\+Diagonal\+G\+MM@{mlpack\+::gmm\+::\+Diagonal\+G\+MM}!Diagonal\+G\+MM@{Diagonal\+G\+MM}}
\index{Diagonal\+G\+MM@{Diagonal\+G\+MM}!mlpack\+::gmm\+::\+Diagonal\+G\+MM@{mlpack\+::gmm\+::\+Diagonal\+G\+MM}}
\subsubsection{Diagonal\+G\+M\+M()\hspace{0.1cm}{\footnotesize\ttfamily [4/4]}}
{\footnotesize\ttfamily \textbf{ Diagonal\+G\+MM} (\begin{DoxyParamCaption}\item[{const \textbf{ Diagonal\+G\+MM} \&}]{other }\end{DoxyParamCaption})}



Copy constructor for Diagonal\+G\+M\+Ms. 



\subsection{Member Function Documentation}
\mbox{\label{classmlpack_1_1gmm_1_1DiagonalGMM_a4e6c4f4110899f4f4fd18b46d3d141c6}} 
\index{mlpack\+::gmm\+::\+Diagonal\+G\+MM@{mlpack\+::gmm\+::\+Diagonal\+G\+MM}!Classify@{Classify}}
\index{Classify@{Classify}!mlpack\+::gmm\+::\+Diagonal\+G\+MM@{mlpack\+::gmm\+::\+Diagonal\+G\+MM}}
\subsubsection{Classify()}
{\footnotesize\ttfamily void Classify (\begin{DoxyParamCaption}\item[{const arma\+::mat \&}]{observations,  }\item[{arma\+::\+Row$<$ size\+\_\+t $>$ \&}]{labels }\end{DoxyParamCaption}) const}



Classify the given observations as being from an individual component in this \doxyref{Diagonal\+G\+MM}{p.}{classmlpack_1_1gmm_1_1DiagonalGMM}. 

The resultant classifications are stored in the \textquotesingle{}labels\textquotesingle{} object, and each label will be between 0 and (\doxyref{Gaussians()}{p.}{classmlpack_1_1gmm_1_1DiagonalGMM_a130ce966c49ab36f847f8fac950f1e39} -\/ 1). Supposing that a point was classified with label 2, and that our \doxyref{Diagonal\+G\+MM}{p.}{classmlpack_1_1gmm_1_1DiagonalGMM} object was called \textquotesingle{}dgmm\textquotesingle{}, one could access the relevant Gaussian distribution as follows\+:


\begin{DoxyCode}
arma::vec mean = dgmm.Means()[2];
arma::mat covariance = dgmm.Covariances()[2];
\textcolor{keywordtype}{double} priorWeight = dgmm.Weights()[2];
\end{DoxyCode}



\begin{DoxyParams}{Parameters}
{\em observations} & Matrix of observations to classify. \\
\hline
{\em labels} & Object which will be filled with labels. \\
\hline
\end{DoxyParams}


Referenced by Diagonal\+G\+M\+M\+::\+Weights().

\mbox{\label{classmlpack_1_1gmm_1_1DiagonalGMM_ac426d44a14e21af69f260506ad7b9793}} 
\index{mlpack\+::gmm\+::\+Diagonal\+G\+MM@{mlpack\+::gmm\+::\+Diagonal\+G\+MM}!Component@{Component}}
\index{Component@{Component}!mlpack\+::gmm\+::\+Diagonal\+G\+MM@{mlpack\+::gmm\+::\+Diagonal\+G\+MM}}
\subsubsection{Component()\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily const \textbf{ distribution\+::\+Diagonal\+Gaussian\+Distribution}\& Component (\begin{DoxyParamCaption}\item[{size\+\_\+t}]{i }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Return a const reference to a component distribution. 


\begin{DoxyParams}{Parameters}
{\em i} & Index of component. \\
\hline
\end{DoxyParams}


Definition at line 141 of file diagonal\+\_\+gmm.\+hpp.

\mbox{\label{classmlpack_1_1gmm_1_1DiagonalGMM_a283969670b4d2ed4bb7394e2bc30c3a7}} 
\index{mlpack\+::gmm\+::\+Diagonal\+G\+MM@{mlpack\+::gmm\+::\+Diagonal\+G\+MM}!Component@{Component}}
\index{Component@{Component}!mlpack\+::gmm\+::\+Diagonal\+G\+MM@{mlpack\+::gmm\+::\+Diagonal\+G\+MM}}
\subsubsection{Component()\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily \textbf{ distribution\+::\+Diagonal\+Gaussian\+Distribution}\& Component (\begin{DoxyParamCaption}\item[{size\+\_\+t}]{i }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Return a reference to a component distribution. 


\begin{DoxyParams}{Parameters}
{\em i} & Index of component. \\
\hline
\end{DoxyParams}


Definition at line 151 of file diagonal\+\_\+gmm.\+hpp.

\mbox{\label{classmlpack_1_1gmm_1_1DiagonalGMM_a78eda6bfb9e9462afa0fc85e32abe1af}} 
\index{mlpack\+::gmm\+::\+Diagonal\+G\+MM@{mlpack\+::gmm\+::\+Diagonal\+G\+MM}!Dimensionality@{Dimensionality}}
\index{Dimensionality@{Dimensionality}!mlpack\+::gmm\+::\+Diagonal\+G\+MM@{mlpack\+::gmm\+::\+Diagonal\+G\+MM}}
\subsubsection{Dimensionality()}
{\footnotesize\ttfamily size\+\_\+t Dimensionality (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Return the dimensionality of the model. 



Definition at line 134 of file diagonal\+\_\+gmm.\+hpp.

\mbox{\label{classmlpack_1_1gmm_1_1DiagonalGMM_a130ce966c49ab36f847f8fac950f1e39}} 
\index{mlpack\+::gmm\+::\+Diagonal\+G\+MM@{mlpack\+::gmm\+::\+Diagonal\+G\+MM}!Gaussians@{Gaussians}}
\index{Gaussians@{Gaussians}!mlpack\+::gmm\+::\+Diagonal\+G\+MM@{mlpack\+::gmm\+::\+Diagonal\+G\+MM}}
\subsubsection{Gaussians()}
{\footnotesize\ttfamily size\+\_\+t Gaussians (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Return the number of Gaussians in the model. 



Definition at line 132 of file diagonal\+\_\+gmm.\+hpp.

\mbox{\label{classmlpack_1_1gmm_1_1DiagonalGMM_a7063c1fb92f512f32bf44542c7528739}} 
\index{mlpack\+::gmm\+::\+Diagonal\+G\+MM@{mlpack\+::gmm\+::\+Diagonal\+G\+MM}!Log\+Probability@{Log\+Probability}}
\index{Log\+Probability@{Log\+Probability}!mlpack\+::gmm\+::\+Diagonal\+G\+MM@{mlpack\+::gmm\+::\+Diagonal\+G\+MM}}
\subsubsection{Log\+Probability()\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily double Log\+Probability (\begin{DoxyParamCaption}\item[{const arma\+::vec \&}]{observation }\end{DoxyParamCaption}) const}



Return the log probability that the given observation came from this distribution. 


\begin{DoxyParams}{Parameters}
{\em observation} & Observation to evaluate the probability of. \\
\hline
\end{DoxyParams}


Referenced by Diagonal\+G\+M\+M\+::\+Weights().

\mbox{\label{classmlpack_1_1gmm_1_1DiagonalGMM_a5df8a8ba219eda2fb45a1f24e18a6320}} 
\index{mlpack\+::gmm\+::\+Diagonal\+G\+MM@{mlpack\+::gmm\+::\+Diagonal\+G\+MM}!Log\+Probability@{Log\+Probability}}
\index{Log\+Probability@{Log\+Probability}!mlpack\+::gmm\+::\+Diagonal\+G\+MM@{mlpack\+::gmm\+::\+Diagonal\+G\+MM}}
\subsubsection{Log\+Probability()\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily double Log\+Probability (\begin{DoxyParamCaption}\item[{const arma\+::vec \&}]{observation,  }\item[{const size\+\_\+t}]{component }\end{DoxyParamCaption}) const}



Return the log probability that the given observation came from the given Gaussian component in this distribution. 


\begin{DoxyParams}{Parameters}
{\em observation} & Observation to evaluate the probability of. \\
\hline
{\em component} & Index of the component of the \doxyref{Diagonal\+G\+MM}{p.}{classmlpack_1_1gmm_1_1DiagonalGMM}. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1gmm_1_1DiagonalGMM_a19d53bdafcc58b3e441a7b9ab72f322d}} 
\index{mlpack\+::gmm\+::\+Diagonal\+G\+MM@{mlpack\+::gmm\+::\+Diagonal\+G\+MM}!operator=@{operator=}}
\index{operator=@{operator=}!mlpack\+::gmm\+::\+Diagonal\+G\+MM@{mlpack\+::gmm\+::\+Diagonal\+G\+MM}}
\subsubsection{operator=()}
{\footnotesize\ttfamily \textbf{ Diagonal\+G\+MM}\& operator= (\begin{DoxyParamCaption}\item[{const \textbf{ Diagonal\+G\+MM} \&}]{other }\end{DoxyParamCaption})}



Copy operator for Diagonal\+G\+M\+Ms. 



Referenced by Diagonal\+G\+M\+M\+::\+Diagonal\+G\+M\+M().

\mbox{\label{classmlpack_1_1gmm_1_1DiagonalGMM_ab72935d592516e77511d0b5e703c0d41}} 
\index{mlpack\+::gmm\+::\+Diagonal\+G\+MM@{mlpack\+::gmm\+::\+Diagonal\+G\+MM}!Probability@{Probability}}
\index{Probability@{Probability}!mlpack\+::gmm\+::\+Diagonal\+G\+MM@{mlpack\+::gmm\+::\+Diagonal\+G\+MM}}
\subsubsection{Probability()\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily double Probability (\begin{DoxyParamCaption}\item[{const arma\+::vec \&}]{observation }\end{DoxyParamCaption}) const}



Return the probability that the given observation came from this distribution. 


\begin{DoxyParams}{Parameters}
{\em observation} & Observation to evaluate the probability of. \\
\hline
\end{DoxyParams}


Referenced by Diagonal\+G\+M\+M\+::\+Weights().

\mbox{\label{classmlpack_1_1gmm_1_1DiagonalGMM_afcd98507a97e8592a6e10b2794285224}} 
\index{mlpack\+::gmm\+::\+Diagonal\+G\+MM@{mlpack\+::gmm\+::\+Diagonal\+G\+MM}!Probability@{Probability}}
\index{Probability@{Probability}!mlpack\+::gmm\+::\+Diagonal\+G\+MM@{mlpack\+::gmm\+::\+Diagonal\+G\+MM}}
\subsubsection{Probability()\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily double Probability (\begin{DoxyParamCaption}\item[{const arma\+::vec \&}]{observation,  }\item[{const size\+\_\+t}]{component }\end{DoxyParamCaption}) const}



Return the probability that the given observation came from the given Gaussian component in this distribution. 


\begin{DoxyParams}{Parameters}
{\em observation} & Observation to evaluate the probability of. \\
\hline
{\em component} & Index of the component of the \doxyref{Diagonal\+G\+MM}{p.}{classmlpack_1_1gmm_1_1DiagonalGMM}. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1gmm_1_1DiagonalGMM_a2c6f8d5bb4eacf7de767d2172b320756}} 
\index{mlpack\+::gmm\+::\+Diagonal\+G\+MM@{mlpack\+::gmm\+::\+Diagonal\+G\+MM}!Random@{Random}}
\index{Random@{Random}!mlpack\+::gmm\+::\+Diagonal\+G\+MM@{mlpack\+::gmm\+::\+Diagonal\+G\+MM}}
\subsubsection{Random()}
{\footnotesize\ttfamily arma\+::vec Random (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const}



Return a randomly generated observation according to the probability distribution defined by this object. 

\begin{DoxyReturn}{Returns}
Random observation from this \doxyref{Diagonal\+G\+MM}{p.}{classmlpack_1_1gmm_1_1DiagonalGMM}. 
\end{DoxyReturn}


Referenced by Diagonal\+G\+M\+M\+::\+Weights().

\mbox{\label{classmlpack_1_1gmm_1_1DiagonalGMM_af0dd9205158ccf7bcfcd8ff81f79c927}} 
\index{mlpack\+::gmm\+::\+Diagonal\+G\+MM@{mlpack\+::gmm\+::\+Diagonal\+G\+MM}!serialize@{serialize}}
\index{serialize@{serialize}!mlpack\+::gmm\+::\+Diagonal\+G\+MM@{mlpack\+::gmm\+::\+Diagonal\+G\+MM}}
\subsubsection{serialize()}
{\footnotesize\ttfamily void serialize (\begin{DoxyParamCaption}\item[{Archive \&}]{ar,  }\item[{const unsigned}]{int }\end{DoxyParamCaption})}



Serialize the \doxyref{Diagonal\+G\+MM}{p.}{classmlpack_1_1gmm_1_1DiagonalGMM}. 



Referenced by Diagonal\+G\+M\+M\+::\+Weights().

\mbox{\label{classmlpack_1_1gmm_1_1DiagonalGMM_ad33ec5cf10980e0b315280ea51ef41ed}} 
\index{mlpack\+::gmm\+::\+Diagonal\+G\+MM@{mlpack\+::gmm\+::\+Diagonal\+G\+MM}!Train@{Train}}
\index{Train@{Train}!mlpack\+::gmm\+::\+Diagonal\+G\+MM@{mlpack\+::gmm\+::\+Diagonal\+G\+MM}}
\subsubsection{Train()\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily double Train (\begin{DoxyParamCaption}\item[{const arma\+::mat \&}]{observations,  }\item[{const size\+\_\+t}]{trials = {\ttfamily 1},  }\item[{const bool}]{use\+Existing\+Model = {\ttfamily false},  }\item[{Fitting\+Type}]{fitter = {\ttfamily FittingType()} }\end{DoxyParamCaption})}



Estimate the probability distribution directly from the given observations, using the given algorithm in the Fitting\+Type class to fit the data. 

The fitting will be performed \textquotesingle{}trials\textquotesingle{} times; from these trials, the model with the greatest log-\/likelihood will be selected. By default, only one trial is performed. The log-\/likelihood of the best fitting is returned.

Optionally, the existing model can be used as an initial model for the estimation by setting \textquotesingle{}use\+Existing\+Model\textquotesingle{} to true. If the fitting procedure is deterministic after the initial position is given, then \textquotesingle{}trials\textquotesingle{} should be set to 1.


\begin{DoxyParams}{Parameters}
{\em observations} & Observations of the model. \\
\hline
{\em trials} & Number of trials to perform; the model in these trials with the greatest log-\/likelihood will be selected. \\
\hline
{\em use\+Existing\+Model} & If true, the existing model is used as an initial model for the estimation. \\
\hline
{\em fitter} & Fitting type that estimates observations. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The log-\/likelihood of the best fit. 
\end{DoxyReturn}


Referenced by Diagonal\+G\+M\+M\+::\+Weights().

\mbox{\label{classmlpack_1_1gmm_1_1DiagonalGMM_a6c28af6823c03973003fefdf026b2b53}} 
\index{mlpack\+::gmm\+::\+Diagonal\+G\+MM@{mlpack\+::gmm\+::\+Diagonal\+G\+MM}!Train@{Train}}
\index{Train@{Train}!mlpack\+::gmm\+::\+Diagonal\+G\+MM@{mlpack\+::gmm\+::\+Diagonal\+G\+MM}}
\subsubsection{Train()\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily double Train (\begin{DoxyParamCaption}\item[{const arma\+::mat \&}]{observations,  }\item[{const arma\+::vec \&}]{probabilities,  }\item[{const size\+\_\+t}]{trials = {\ttfamily 1},  }\item[{const bool}]{use\+Existing\+Model = {\ttfamily false},  }\item[{Fitting\+Type}]{fitter = {\ttfamily FittingType()} }\end{DoxyParamCaption})}



Estimate the probability distribution directly from the given observations, taking into account the probability of each observation actually being from this distribution, and using the given algorithm in the Fitting\+Type class to fit the data. 

The fitting will be performed \textquotesingle{}trials\textquotesingle{} times; from these trials, the model with the greatest log-\/likelihood will be selected. By default, only one trial is performed. The log-\/likelihood of the best fitting is returned.

Optionally, the existing model can be used as an initial model for the estimation by setting \textquotesingle{}use\+Existing\+Model\textquotesingle{} to true. If the fitting procedure is deterministic after the initial position is given, then \textquotesingle{}trials\textquotesingle{} should be set to 1.


\begin{DoxyParams}{Parameters}
{\em observations} & Observations of the model. \\
\hline
{\em probabilities} & Probability of each observation being from this distribution. \\
\hline
{\em trials} & Number of trials to perform; the model in these trials with the greatest log-\/likelihood will be selected. \\
\hline
{\em use\+Existing\+Model} & If true, the existing model is used as an initial model for the estimation. \\
\hline
{\em fitter} & Fitting type that estimates observations. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The log-\/likelihood of the best fit. 
\end{DoxyReturn}
\mbox{\label{classmlpack_1_1gmm_1_1DiagonalGMM_ab2c1e663a100784ff6753e3eec8453dd}} 
\index{mlpack\+::gmm\+::\+Diagonal\+G\+MM@{mlpack\+::gmm\+::\+Diagonal\+G\+MM}!Weights@{Weights}}
\index{Weights@{Weights}!mlpack\+::gmm\+::\+Diagonal\+G\+MM@{mlpack\+::gmm\+::\+Diagonal\+G\+MM}}
\subsubsection{Weights()\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily const arma\+::vec\& Weights (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Return a const reference to the a priori weights of each Gaussian. 



Definition at line 157 of file diagonal\+\_\+gmm.\+hpp.

\mbox{\label{classmlpack_1_1gmm_1_1DiagonalGMM_a8361070d4a9097e29c005dd5dc6ca54d}} 
\index{mlpack\+::gmm\+::\+Diagonal\+G\+MM@{mlpack\+::gmm\+::\+Diagonal\+G\+MM}!Weights@{Weights}}
\index{Weights@{Weights}!mlpack\+::gmm\+::\+Diagonal\+G\+MM@{mlpack\+::gmm\+::\+Diagonal\+G\+MM}}
\subsubsection{Weights()\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily arma\+::vec\& Weights (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Return a reference to the a priori weights of each Gaussian. 



Definition at line 159 of file diagonal\+\_\+gmm.\+hpp.



References Diagonal\+G\+M\+M\+::\+Classify(), Diagonal\+G\+M\+M\+::\+Log\+Probability(), Diagonal\+G\+M\+M\+::\+Probability(), Diagonal\+G\+M\+M\+::\+Random(), Diagonal\+G\+M\+M\+::serialize(), and Diagonal\+G\+M\+M\+::\+Train().



The documentation for this class was generated from the following file\+:\begin{DoxyCompactItemize}
\item 
/var/www/mlpack.\+ratml.\+org/mlpack.\+org/\+\_\+src/mlpack-\/3.\+3.\+0/src/mlpack/methods/gmm/\textbf{ diagonal\+\_\+gmm.\+hpp}\end{DoxyCompactItemize}
