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


The rules class for the single-\/tree Pelleg-\/\+Moore kd-\/tree traversal for k-\/means clustering.  


\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\textbf{ Pelleg\+Moore\+K\+Means\+Rules} (const typename Tree\+Type\+::\+Mat \&dataset, const arma\+::mat \&centroids, arma\+::mat \&new\+Centroids, arma\+::\+Col$<$ size\+\_\+t $>$ \&counts, Metric\+Type \&metric)
\begin{DoxyCompactList}\small\item\em Create the \doxyref{Pelleg\+Moore\+K\+Means\+Rules}{p.}{classmlpack_1_1kmeans_1_1PellegMooreKMeansRules} object. \end{DoxyCompactList}\item 
double \textbf{ Base\+Case} (const size\+\_\+t query\+Index, const size\+\_\+t reference\+Index)
\begin{DoxyCompactList}\small\item\em The \doxyref{Base\+Case()}{p.}{classmlpack_1_1kmeans_1_1PellegMooreKMeansRules_abac50f780bb5e1bc12dd0d16d850cacc} function for this single-\/tree algorithm does nothing. \end{DoxyCompactList}\item 
size\+\_\+t \textbf{ Distance\+Calculations} () const
\begin{DoxyCompactList}\small\item\em Get the number of distance calculations that have been performed. \end{DoxyCompactList}\item 
size\+\_\+t \& \textbf{ Distance\+Calculations} ()
\begin{DoxyCompactList}\small\item\em Modify the number of distance calculations that have been performed. \end{DoxyCompactList}\item 
double \textbf{ Rescore} (const size\+\_\+t query\+Index, Tree\+Type \&reference\+Node, const double old\+Score)
\begin{DoxyCompactList}\small\item\em Rescore to determine if a node can be pruned. \end{DoxyCompactList}\item 
double \textbf{ Score} (const size\+\_\+t query\+Index, Tree\+Type \&reference\+Node)
\begin{DoxyCompactList}\small\item\em Determine if a cluster can be pruned, and if not, perform point-\/to-\/cluster comparisons. \end{DoxyCompactList}\end{DoxyCompactItemize}


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

The rules class for the single-\/tree Pelleg-\/\+Moore kd-\/tree traversal for k-\/means clustering. 

Although Tree\+Type is a free template parameter, this particular implementation is specialized to trees with hyper-\/rectangle bounds due to the pruning rule used to determine if one cluster dominates a node with respect to another cluster.

Our implementation here abuses the single-\/tree algorithm abstractions a little bit. Instead of doing a traversal for a particular query point, in this case we consider all clusters at once---so the query point is entirely ignored during in \doxyref{Base\+Case()}{p.}{classmlpack_1_1kmeans_1_1PellegMooreKMeansRules_abac50f780bb5e1bc12dd0d16d850cacc} and \doxyref{Score()}{p.}{classmlpack_1_1kmeans_1_1PellegMooreKMeansRules_a53d373b7aeee359b0e686f823c602b1c}. 

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



\subsection{Constructor \& Destructor Documentation}
\mbox{\label{classmlpack_1_1kmeans_1_1PellegMooreKMeansRules_a28420bc0b2f82c299c32c547d1be0ed1}} 
\index{mlpack\+::kmeans\+::\+Pelleg\+Moore\+K\+Means\+Rules@{mlpack\+::kmeans\+::\+Pelleg\+Moore\+K\+Means\+Rules}!Pelleg\+Moore\+K\+Means\+Rules@{Pelleg\+Moore\+K\+Means\+Rules}}
\index{Pelleg\+Moore\+K\+Means\+Rules@{Pelleg\+Moore\+K\+Means\+Rules}!mlpack\+::kmeans\+::\+Pelleg\+Moore\+K\+Means\+Rules@{mlpack\+::kmeans\+::\+Pelleg\+Moore\+K\+Means\+Rules}}
\subsubsection{Pelleg\+Moore\+K\+Means\+Rules()}
{\footnotesize\ttfamily \textbf{ Pelleg\+Moore\+K\+Means\+Rules} (\begin{DoxyParamCaption}\item[{const typename Tree\+Type\+::\+Mat \&}]{dataset,  }\item[{const arma\+::mat \&}]{centroids,  }\item[{arma\+::mat \&}]{new\+Centroids,  }\item[{arma\+::\+Col$<$ size\+\_\+t $>$ \&}]{counts,  }\item[{Metric\+Type \&}]{metric }\end{DoxyParamCaption})}



Create the \doxyref{Pelleg\+Moore\+K\+Means\+Rules}{p.}{classmlpack_1_1kmeans_1_1PellegMooreKMeansRules} object. 


\begin{DoxyParams}{Parameters}
{\em dataset} & The dataset that the tree is built on. \\
\hline
{\em centroids} & The current centroids. \\
\hline
{\em new\+Centroids} & New centroids after this iteration (output). \\
\hline
{\em counts} & Current cluster counts, to be replaced with new cluster counts. \\
\hline
{\em metric} & Instantiated metric. \\
\hline
\end{DoxyParams}


\subsection{Member Function Documentation}
\mbox{\label{classmlpack_1_1kmeans_1_1PellegMooreKMeansRules_abac50f780bb5e1bc12dd0d16d850cacc}} 
\index{mlpack\+::kmeans\+::\+Pelleg\+Moore\+K\+Means\+Rules@{mlpack\+::kmeans\+::\+Pelleg\+Moore\+K\+Means\+Rules}!Base\+Case@{Base\+Case}}
\index{Base\+Case@{Base\+Case}!mlpack\+::kmeans\+::\+Pelleg\+Moore\+K\+Means\+Rules@{mlpack\+::kmeans\+::\+Pelleg\+Moore\+K\+Means\+Rules}}
\subsubsection{Base\+Case()}
{\footnotesize\ttfamily double Base\+Case (\begin{DoxyParamCaption}\item[{const size\+\_\+t}]{query\+Index,  }\item[{const size\+\_\+t}]{reference\+Index }\end{DoxyParamCaption})}



The \doxyref{Base\+Case()}{p.}{classmlpack_1_1kmeans_1_1PellegMooreKMeansRules_abac50f780bb5e1bc12dd0d16d850cacc} function for this single-\/tree algorithm does nothing. 

Instead, point-\/to-\/cluster comparisons are handled as necessary in \doxyref{Score()}{p.}{classmlpack_1_1kmeans_1_1PellegMooreKMeansRules_a53d373b7aeee359b0e686f823c602b1c}.


\begin{DoxyParams}{Parameters}
{\em query\+Index} & Index of query point (fake, will be ignored). \\
\hline
{\em reference\+Index} & Index of reference point. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1kmeans_1_1PellegMooreKMeansRules_a6ab05a40f496b49e405530a1d39120ef}} 
\index{mlpack\+::kmeans\+::\+Pelleg\+Moore\+K\+Means\+Rules@{mlpack\+::kmeans\+::\+Pelleg\+Moore\+K\+Means\+Rules}!Distance\+Calculations@{Distance\+Calculations}}
\index{Distance\+Calculations@{Distance\+Calculations}!mlpack\+::kmeans\+::\+Pelleg\+Moore\+K\+Means\+Rules@{mlpack\+::kmeans\+::\+Pelleg\+Moore\+K\+Means\+Rules}}
\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]}}



Get the number of distance calculations that have been performed. 



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

\mbox{\label{classmlpack_1_1kmeans_1_1PellegMooreKMeansRules_a7fd6d18544595d62025c4b740f8664ab}} 
\index{mlpack\+::kmeans\+::\+Pelleg\+Moore\+K\+Means\+Rules@{mlpack\+::kmeans\+::\+Pelleg\+Moore\+K\+Means\+Rules}!Distance\+Calculations@{Distance\+Calculations}}
\index{Distance\+Calculations@{Distance\+Calculations}!mlpack\+::kmeans\+::\+Pelleg\+Moore\+K\+Means\+Rules@{mlpack\+::kmeans\+::\+Pelleg\+Moore\+K\+Means\+Rules}}
\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 that have been performed. 



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

\mbox{\label{classmlpack_1_1kmeans_1_1PellegMooreKMeansRules_a6f97dd07745e07a2d7ff3d4a42347e48}} 
\index{mlpack\+::kmeans\+::\+Pelleg\+Moore\+K\+Means\+Rules@{mlpack\+::kmeans\+::\+Pelleg\+Moore\+K\+Means\+Rules}!Rescore@{Rescore}}
\index{Rescore@{Rescore}!mlpack\+::kmeans\+::\+Pelleg\+Moore\+K\+Means\+Rules@{mlpack\+::kmeans\+::\+Pelleg\+Moore\+K\+Means\+Rules}}
\subsubsection{Rescore()}
{\footnotesize\ttfamily double Rescore (\begin{DoxyParamCaption}\item[{const size\+\_\+t}]{query\+Index,  }\item[{Tree\+Type \&}]{reference\+Node,  }\item[{const double}]{old\+Score }\end{DoxyParamCaption})}



Rescore to determine if a node can be pruned. 

In this case, a node can never be pruned during rescoring, so this just returns old\+Score.


\begin{DoxyParams}{Parameters}
{\em query\+Index} & Index of query point (fake, will be ignored). \\
\hline
{\em reference\+Node} & Node containing points in the dataset. \\
\hline
{\em old\+Score} & Resulting score from \doxyref{Score()}{p.}{classmlpack_1_1kmeans_1_1PellegMooreKMeansRules_a53d373b7aeee359b0e686f823c602b1c}. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1kmeans_1_1PellegMooreKMeansRules_a53d373b7aeee359b0e686f823c602b1c}} 
\index{mlpack\+::kmeans\+::\+Pelleg\+Moore\+K\+Means\+Rules@{mlpack\+::kmeans\+::\+Pelleg\+Moore\+K\+Means\+Rules}!Score@{Score}}
\index{Score@{Score}!mlpack\+::kmeans\+::\+Pelleg\+Moore\+K\+Means\+Rules@{mlpack\+::kmeans\+::\+Pelleg\+Moore\+K\+Means\+Rules}}
\subsubsection{Score()}
{\footnotesize\ttfamily double Score (\begin{DoxyParamCaption}\item[{const size\+\_\+t}]{query\+Index,  }\item[{Tree\+Type \&}]{reference\+Node }\end{DoxyParamCaption})}



Determine if a cluster can be pruned, and if not, perform point-\/to-\/cluster comparisons. 

The point-\/to-\/cluster comparisons are performed here and not in \doxyref{Base\+Case()}{p.}{classmlpack_1_1kmeans_1_1PellegMooreKMeansRules_abac50f780bb5e1bc12dd0d16d850cacc} because of the complexity of managing the blacklist.


\begin{DoxyParams}{Parameters}
{\em query\+Index} & Index of query point (fake, will be ignored). \\
\hline
{\em reference\+Node} & Node containing points in the dataset. \\
\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.\+1/src/mlpack/methods/kmeans/\textbf{ pelleg\+\_\+moore\+\_\+kmeans\+\_\+rules.\+hpp}\end{DoxyCompactItemize}
