\section{Naive\+K\+Means$<$ Metric\+Type, Mat\+Type $>$ Class Template Reference}
\label{classmlpack_1_1kmeans_1_1NaiveKMeans}\index{Naive\+K\+Means$<$ Metric\+Type, Mat\+Type $>$@{Naive\+K\+Means$<$ Metric\+Type, Mat\+Type $>$}}


This is an implementation of a single iteration of Lloyd\textquotesingle{}s algorithm for k-\/means.  


\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\textbf{ Naive\+K\+Means} (const Mat\+Type \&dataset, Metric\+Type \&metric)
\begin{DoxyCompactList}\small\item\em Construct the \doxyref{Naive\+K\+Means}{p.}{classmlpack_1_1kmeans_1_1NaiveKMeans} object with the given dataset and metric. \end{DoxyCompactList}\item 
size\+\_\+t \textbf{ Distance\+Calculations} () const
\item 
double \textbf{ Iterate} (const arma\+::mat \&centroids, arma\+::mat \&new\+Centroids, arma\+::\+Col$<$ size\+\_\+t $>$ \&counts)
\begin{DoxyCompactList}\small\item\em Run a single iteration of the Lloyd algorithm, updating the given centroids into the new\+Centroids matrix. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
\subsubsection*{template$<$typename Metric\+Type, typename Mat\+Type$>$\newline
class mlpack\+::kmeans\+::\+Naive\+K\+Means$<$ Metric\+Type, Mat\+Type $>$}

This is an implementation of a single iteration of Lloyd\textquotesingle{}s algorithm for k-\/means. 

If your intention is to run the full k-\/means algorithm, you are looking for the \doxyref{mlpack\+::kmeans\+::\+K\+Means}{p.}{classmlpack_1_1kmeans_1_1KMeans} class instead of this one. This class is used by \doxyref{K\+Means}{p.}{classmlpack_1_1kmeans_1_1KMeans} as the actual implementation of the Lloyd iteration.


\begin{DoxyParams}{Parameters}
{\em Metric\+Type} & Type of metric used with this implementation. \\
\hline
{\em Mat\+Type} & Matrix type (arma\+::mat or arma\+::sp\+\_\+mat). \\
\hline
\end{DoxyParams}


Definition at line 32 of file naive\+\_\+kmeans.\+hpp.



\subsection{Constructor \& Destructor Documentation}
\mbox{\label{classmlpack_1_1kmeans_1_1NaiveKMeans_a57f99ec425eb8601cec180071a581bb3}} 
\index{mlpack\+::kmeans\+::\+Naive\+K\+Means@{mlpack\+::kmeans\+::\+Naive\+K\+Means}!Naive\+K\+Means@{Naive\+K\+Means}}
\index{Naive\+K\+Means@{Naive\+K\+Means}!mlpack\+::kmeans\+::\+Naive\+K\+Means@{mlpack\+::kmeans\+::\+Naive\+K\+Means}}
\subsubsection{Naive\+K\+Means()}
{\footnotesize\ttfamily \textbf{ Naive\+K\+Means} (\begin{DoxyParamCaption}\item[{const Mat\+Type \&}]{dataset,  }\item[{Metric\+Type \&}]{metric }\end{DoxyParamCaption})}



Construct the \doxyref{Naive\+K\+Means}{p.}{classmlpack_1_1kmeans_1_1NaiveKMeans} object with the given dataset and metric. 


\begin{DoxyParams}{Parameters}
{\em dataset} & Dataset. \\
\hline
{\em metric} & Instantiated metric. \\
\hline
\end{DoxyParams}


\subsection{Member Function Documentation}
\mbox{\label{classmlpack_1_1kmeans_1_1NaiveKMeans_a6ab05a40f496b49e405530a1d39120ef}} 
\index{mlpack\+::kmeans\+::\+Naive\+K\+Means@{mlpack\+::kmeans\+::\+Naive\+K\+Means}!Distance\+Calculations@{Distance\+Calculations}}
\index{Distance\+Calculations@{Distance\+Calculations}!mlpack\+::kmeans\+::\+Naive\+K\+Means@{mlpack\+::kmeans\+::\+Naive\+K\+Means}}
\subsubsection{Distance\+Calculations()}
{\footnotesize\ttfamily size\+\_\+t Distance\+Calculations (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Definition at line 57 of file naive\+\_\+kmeans.\+hpp.

\mbox{\label{classmlpack_1_1kmeans_1_1NaiveKMeans_a1618db5fb0d2893a50f0c8614d970453}} 
\index{mlpack\+::kmeans\+::\+Naive\+K\+Means@{mlpack\+::kmeans\+::\+Naive\+K\+Means}!Iterate@{Iterate}}
\index{Iterate@{Iterate}!mlpack\+::kmeans\+::\+Naive\+K\+Means@{mlpack\+::kmeans\+::\+Naive\+K\+Means}}
\subsubsection{Iterate()}
{\footnotesize\ttfamily double Iterate (\begin{DoxyParamCaption}\item[{const arma\+::mat \&}]{centroids,  }\item[{arma\+::mat \&}]{new\+Centroids,  }\item[{arma\+::\+Col$<$ size\+\_\+t $>$ \&}]{counts }\end{DoxyParamCaption})}



Run a single iteration of the Lloyd algorithm, updating the given centroids into the new\+Centroids matrix. 

If any cluster is empty (that is, if any cluster has no points assigned to it), then the centroid associated with that cluster may be filled with invalid data (it will be corrected later).


\begin{DoxyParams}{Parameters}
{\em centroids} & Current cluster centroids. \\
\hline
{\em new\+Centroids} & New cluster centroids. \\
\hline
{\em counts} & Number of points in each cluster at the end of the iteration. \\
\hline
\end{DoxyParams}


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.\+2/src/mlpack/methods/kmeans/\textbf{ naive\+\_\+kmeans.\+hpp}\end{DoxyCompactItemize}
