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


An implementation of Pelleg-\/\+Moore\textquotesingle{}s \textquotesingle{}blacklist\textquotesingle{} algorithm for k-\/means clustering.  


\subsection*{Public Types}
\begin{DoxyCompactItemize}
\item 
typedef \textbf{ tree\+::\+K\+D\+Tree}$<$ Metric\+Type, \textbf{ Pelleg\+Moore\+K\+Means\+Statistic}, Mat\+Type $>$ \textbf{ Tree\+Type}
\begin{DoxyCompactList}\small\item\em Convenience typedef for the tree. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\textbf{ Pelleg\+Moore\+K\+Means} (const Mat\+Type \&dataset, Metric\+Type \&metric)
\begin{DoxyCompactList}\small\item\em Construct the \doxyref{Pelleg\+Moore\+K\+Means}{p.}{classmlpack_1_1kmeans_1_1PellegMooreKMeans} object, which must construct a tree. \end{DoxyCompactList}\item 
\textbf{ $\sim$\+Pelleg\+Moore\+K\+Means} ()
\begin{DoxyCompactList}\small\item\em Delete the tree constructed by the \doxyref{Pelleg\+Moore\+K\+Means}{p.}{classmlpack_1_1kmeans_1_1PellegMooreKMeans} object. \end{DoxyCompactList}\item 
size\+\_\+t \textbf{ Distance\+Calculations} () const
\begin{DoxyCompactList}\small\item\em Return the number of distance calculations. \end{DoxyCompactList}\item 
size\+\_\+t \& \textbf{ Distance\+Calculations} ()
\begin{DoxyCompactList}\small\item\em Modify the number of distance calculations. \end{DoxyCompactList}\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 Pelleg-\/\+Moore blacklist 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\+::\+Pelleg\+Moore\+K\+Means$<$ Metric\+Type, Mat\+Type $>$}

An implementation of Pelleg-\/\+Moore\textquotesingle{}s \textquotesingle{}blacklist\textquotesingle{} algorithm for k-\/means clustering. 

This algorithm builds a kd-\/tree on the data points and traverses it in order to determine the closest clusters to each point.

For more information on the algorithm, see


\begin{DoxyCode}
@inproceedings\{pelleg1999accelerating,
    title=\{Accelerating exact k-means algorithms with geometric reasoning\},
    author=\{Pelleg, Dan and Moore, Andrew W.\},
    booktitle=\{Proceedings of the Fifth ACM SIGKDD International Conference
      on Knowledge Discovery and Data Mining (KDD \textcolor{stringliteral}{'99)\},}
\textcolor{stringliteral}{pages=\{277--281\},}
\textcolor{stringliteral}{year=\{1999\},}
\textcolor{stringliteral}{organization=\{ACM\}}
\textcolor{stringliteral}{\}}
\end{DoxyCode}
 

Definition at line 42 of file pelleg\+\_\+moore\+\_\+kmeans.\+hpp.



\subsection{Member Typedef Documentation}
\mbox{\label{classmlpack_1_1kmeans_1_1PellegMooreKMeans_a6f90f3418e8e229000af1c059d5a10f0}} 
\index{mlpack\+::kmeans\+::\+Pelleg\+Moore\+K\+Means@{mlpack\+::kmeans\+::\+Pelleg\+Moore\+K\+Means}!Tree\+Type@{Tree\+Type}}
\index{Tree\+Type@{Tree\+Type}!mlpack\+::kmeans\+::\+Pelleg\+Moore\+K\+Means@{mlpack\+::kmeans\+::\+Pelleg\+Moore\+K\+Means}}
\subsubsection{Tree\+Type}
{\footnotesize\ttfamily typedef \textbf{ tree\+::\+K\+D\+Tree}$<$Metric\+Type, \textbf{ Pelleg\+Moore\+K\+Means\+Statistic}, Mat\+Type$>$ \textbf{ Tree\+Type}}



Convenience typedef for the tree. 



Definition at line 74 of file pelleg\+\_\+moore\+\_\+kmeans.\+hpp.



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



Construct the \doxyref{Pelleg\+Moore\+K\+Means}{p.}{classmlpack_1_1kmeans_1_1PellegMooreKMeans} object, which must construct a tree. 

\mbox{\label{classmlpack_1_1kmeans_1_1PellegMooreKMeans_af785532dcaf17b9cc1ee7e548baf6651}} 
\index{mlpack\+::kmeans\+::\+Pelleg\+Moore\+K\+Means@{mlpack\+::kmeans\+::\+Pelleg\+Moore\+K\+Means}!````~Pelleg\+Moore\+K\+Means@{$\sim$\+Pelleg\+Moore\+K\+Means}}
\index{````~Pelleg\+Moore\+K\+Means@{$\sim$\+Pelleg\+Moore\+K\+Means}!mlpack\+::kmeans\+::\+Pelleg\+Moore\+K\+Means@{mlpack\+::kmeans\+::\+Pelleg\+Moore\+K\+Means}}
\subsubsection{$\sim$\+Pelleg\+Moore\+K\+Means()}
{\footnotesize\ttfamily $\sim$\textbf{ Pelleg\+Moore\+K\+Means} (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Delete the tree constructed by the \doxyref{Pelleg\+Moore\+K\+Means}{p.}{classmlpack_1_1kmeans_1_1PellegMooreKMeans} object. 



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



Return the number of distance calculations. 



Definition at line 68 of file pelleg\+\_\+moore\+\_\+kmeans.\+hpp.

\mbox{\label{classmlpack_1_1kmeans_1_1PellegMooreKMeans_a7fd6d18544595d62025c4b740f8664ab}} 
\index{mlpack\+::kmeans\+::\+Pelleg\+Moore\+K\+Means@{mlpack\+::kmeans\+::\+Pelleg\+Moore\+K\+Means}!Distance\+Calculations@{Distance\+Calculations}}
\index{Distance\+Calculations@{Distance\+Calculations}!mlpack\+::kmeans\+::\+Pelleg\+Moore\+K\+Means@{mlpack\+::kmeans\+::\+Pelleg\+Moore\+K\+Means}}
\subsubsection{Distance\+Calculations()\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily size\+\_\+t\& Distance\+Calculations (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Modify the number of distance calculations. 



Definition at line 70 of file pelleg\+\_\+moore\+\_\+kmeans.\+hpp.

\mbox{\label{classmlpack_1_1kmeans_1_1PellegMooreKMeans_a1618db5fb0d2893a50f0c8614d970453}} 
\index{mlpack\+::kmeans\+::\+Pelleg\+Moore\+K\+Means@{mlpack\+::kmeans\+::\+Pelleg\+Moore\+K\+Means}!Iterate@{Iterate}}
\index{Iterate@{Iterate}!mlpack\+::kmeans\+::\+Pelleg\+Moore\+K\+Means@{mlpack\+::kmeans\+::\+Pelleg\+Moore\+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 Pelleg-\/\+Moore blacklist algorithm, updating the given centroids into the new\+Centroids matrix. 


\begin{DoxyParams}{Parameters}
{\em centroids} & Current cluster centroids. \\
\hline
{\em new\+Centroids} & New cluster centroids. \\
\hline
{\em counts} & Current counts, to be overwritten with new counts. \\
\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.\+0/src/mlpack/methods/kmeans/\textbf{ pelleg\+\_\+moore\+\_\+kmeans.\+hpp}\end{DoxyCompactItemize}
