\section{Constraints$<$ Metric\+Type $>$ Class Template Reference}
\label{classmlpack_1_1lmnn_1_1Constraints}\index{Constraints$<$ Metric\+Type $>$@{Constraints$<$ Metric\+Type $>$}}


Interface for generating distance based constraints on a given dataset, provided corresponding true labels and a quantity parameter (k) are specified.  


\subsection*{Public Types}
\begin{DoxyCompactItemize}
\item 
typedef \textbf{ neighbor\+::\+Neighbor\+Search}$<$ \textbf{ neighbor\+::\+Nearest\+Neighbor\+Sort}, Metric\+Type $>$ \textbf{ K\+NN}
\begin{DoxyCompactList}\small\item\em Convenience typedef. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\textbf{ Constraints} (const arma\+::mat \&dataset, const arma\+::\+Row$<$ size\+\_\+t $>$ \&labels, const size\+\_\+t k)
\begin{DoxyCompactList}\small\item\em Constructor for creating a \doxyref{Constraints}{p.}{classmlpack_1_1lmnn_1_1Constraints} instance. \end{DoxyCompactList}\item 
void \textbf{ Impostors} (arma\+::\+Mat$<$ size\+\_\+t $>$ \&output\+Matrix, const arma\+::mat \&dataset, const arma\+::\+Row$<$ size\+\_\+t $>$ \&labels, const arma\+::vec \&norms)
\begin{DoxyCompactList}\small\item\em Calculates k differently labeled nearest neighbors for each datapoint and writes them back to passed matrix. \end{DoxyCompactList}\item 
void \textbf{ Impostors} (arma\+::\+Mat$<$ size\+\_\+t $>$ \&output\+Neighbors, arma\+::mat \&output\+Distance, const arma\+::mat \&dataset, const arma\+::\+Row$<$ size\+\_\+t $>$ \&labels, const arma\+::vec \&norms)
\begin{DoxyCompactList}\small\item\em Calculates k differently labeled nearest neighbors \& distances to impostors for each datapoint and writes them back to passed matrices. \end{DoxyCompactList}\item 
void \textbf{ Impostors} (arma\+::\+Mat$<$ size\+\_\+t $>$ \&output\+Matrix, const arma\+::mat \&dataset, const arma\+::\+Row$<$ size\+\_\+t $>$ \&labels, const arma\+::vec \&norms, const size\+\_\+t begin, const size\+\_\+t batch\+Size)
\begin{DoxyCompactList}\small\item\em Calculates k differently labeled nearest neighbors for a batch of dataset and writes them back to passed matrix. \end{DoxyCompactList}\item 
void \textbf{ Impostors} (arma\+::\+Mat$<$ size\+\_\+t $>$ \&output\+Neighbors, arma\+::mat \&output\+Distance, const arma\+::mat \&dataset, const arma\+::\+Row$<$ size\+\_\+t $>$ \&labels, const arma\+::vec \&norms, const size\+\_\+t begin, const size\+\_\+t batch\+Size)
\begin{DoxyCompactList}\small\item\em Calculates k differently labeled nearest neighbors \& distances to impostors for a batch of dataset and writes them back to passed matrices. \end{DoxyCompactList}\item 
void \textbf{ Impostors} (arma\+::\+Mat$<$ size\+\_\+t $>$ \&output\+Neighbors, arma\+::mat \&output\+Distance, const arma\+::mat \&dataset, const arma\+::\+Row$<$ size\+\_\+t $>$ \&labels, const arma\+::vec \&norms, const arma\+::uvec \&points, const size\+\_\+t num\+Points)
\begin{DoxyCompactList}\small\item\em Calculates k differently labeled nearest neighbors \& distances to impostors for some points of dataset and writes them back to passed matrices. \end{DoxyCompactList}\item 
const size\+\_\+t \& \textbf{ K} () const
\begin{DoxyCompactList}\small\item\em Get the number of target neighbors (k). \end{DoxyCompactList}\item 
size\+\_\+t \& \textbf{ K} ()
\begin{DoxyCompactList}\small\item\em Modify the number of target neighbors (k). \end{DoxyCompactList}\item 
const bool \& \textbf{ Pre\+Calulated} () const
\begin{DoxyCompactList}\small\item\em Access the boolean value of precalculated. \end{DoxyCompactList}\item 
bool \& \textbf{ Pre\+Calulated} ()
\begin{DoxyCompactList}\small\item\em Modify the value of precalculated. \end{DoxyCompactList}\item 
void \textbf{ Target\+Neighbors} (arma\+::\+Mat$<$ size\+\_\+t $>$ \&output\+Matrix, const arma\+::mat \&dataset, const arma\+::\+Row$<$ size\+\_\+t $>$ \&labels, const arma\+::vec \&norms)
\begin{DoxyCompactList}\small\item\em Calculates k similar labeled nearest neighbors and stores them into the passed matrix. \end{DoxyCompactList}\item 
void \textbf{ Target\+Neighbors} (arma\+::\+Mat$<$ size\+\_\+t $>$ \&output\+Matrix, const arma\+::mat \&dataset, const arma\+::\+Row$<$ size\+\_\+t $>$ \&labels, const arma\+::vec \&norms, const size\+\_\+t begin, const size\+\_\+t batch\+Size)
\begin{DoxyCompactList}\small\item\em Calculates k similar labeled nearest neighbors for a batch of dataset and stores them into the passed matrix. \end{DoxyCompactList}\item 
void \textbf{ Triplets} (arma\+::\+Mat$<$ size\+\_\+t $>$ \&output\+Matrix, const arma\+::mat \&dataset, const arma\+::\+Row$<$ size\+\_\+t $>$ \&labels, const arma\+::vec \&norms)
\begin{DoxyCompactList}\small\item\em Generate triplets \{i, j, l\} for each datapoint i and writes back generated triplets to matrix passed. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
\subsubsection*{template$<$typename Metric\+Type = metric\+::\+Squared\+Euclidean\+Distance$>$\newline
class mlpack\+::lmnn\+::\+Constraints$<$ Metric\+Type $>$}

Interface for generating distance based constraints on a given dataset, provided corresponding true labels and a quantity parameter (k) are specified. 

Class provides \doxyref{Target\+Neighbors()}{p.}{classmlpack_1_1lmnn_1_1Constraints_aaae5fe77efd8a79d315f0979afe789dd} (Used for calculating target neighbors of each data point), \doxyref{Impostors()}{p.}{classmlpack_1_1lmnn_1_1Constraints_abfcabe22bfb83c6bb991cc2b388936e6} (used for calculating impostors of each data point) and \doxyref{Triplets()}{p.}{classmlpack_1_1lmnn_1_1Constraints_ad333e36741acf647d22926dc5bd80522} (Generates sets of \{dataset, target neighbors, impostors\} tripltets.) 

Definition at line 31 of file constraints.\+hpp.



\subsection{Member Typedef Documentation}
\mbox{\label{classmlpack_1_1lmnn_1_1Constraints_aa08fb5680ff446140b3272f720a96fda}} 
\index{mlpack\+::lmnn\+::\+Constraints@{mlpack\+::lmnn\+::\+Constraints}!K\+NN@{K\+NN}}
\index{K\+NN@{K\+NN}!mlpack\+::lmnn\+::\+Constraints@{mlpack\+::lmnn\+::\+Constraints}}
\subsubsection{K\+NN}
{\footnotesize\ttfamily typedef \textbf{ neighbor\+::\+Neighbor\+Search}$<$\textbf{ neighbor\+::\+Nearest\+Neighbor\+Sort}, Metric\+Type$>$ \textbf{ K\+NN}}



Convenience typedef. 



Definition at line 36 of file constraints.\+hpp.



\subsection{Constructor \& Destructor Documentation}
\mbox{\label{classmlpack_1_1lmnn_1_1Constraints_adac15935bbabb85cd3485c18808ba141}} 
\index{mlpack\+::lmnn\+::\+Constraints@{mlpack\+::lmnn\+::\+Constraints}!Constraints@{Constraints}}
\index{Constraints@{Constraints}!mlpack\+::lmnn\+::\+Constraints@{mlpack\+::lmnn\+::\+Constraints}}
\subsubsection{Constraints()}
{\footnotesize\ttfamily \textbf{ Constraints} (\begin{DoxyParamCaption}\item[{const arma\+::mat \&}]{dataset,  }\item[{const arma\+::\+Row$<$ size\+\_\+t $>$ \&}]{labels,  }\item[{const size\+\_\+t}]{k }\end{DoxyParamCaption})}



Constructor for creating a \doxyref{Constraints}{p.}{classmlpack_1_1lmnn_1_1Constraints} instance. 


\begin{DoxyParams}{Parameters}
{\em dataset} & Input dataset. \\
\hline
{\em labels} & Input dataset labels. \\
\hline
{\em k} & Number of target neighbors, impostors \& triplets. \\
\hline
\end{DoxyParams}


\subsection{Member Function Documentation}
\mbox{\label{classmlpack_1_1lmnn_1_1Constraints_abfcabe22bfb83c6bb991cc2b388936e6}} 
\index{mlpack\+::lmnn\+::\+Constraints@{mlpack\+::lmnn\+::\+Constraints}!Impostors@{Impostors}}
\index{Impostors@{Impostors}!mlpack\+::lmnn\+::\+Constraints@{mlpack\+::lmnn\+::\+Constraints}}
\subsubsection{Impostors()\hspace{0.1cm}{\footnotesize\ttfamily [1/5]}}
{\footnotesize\ttfamily void Impostors (\begin{DoxyParamCaption}\item[{arma\+::\+Mat$<$ size\+\_\+t $>$ \&}]{output\+Matrix,  }\item[{const arma\+::mat \&}]{dataset,  }\item[{const arma\+::\+Row$<$ size\+\_\+t $>$ \&}]{labels,  }\item[{const arma\+::vec \&}]{norms }\end{DoxyParamCaption})}



Calculates k differently labeled nearest neighbors for each datapoint and writes them back to passed matrix. 


\begin{DoxyParams}{Parameters}
{\em output\+Matrix} & Coordinates matrix to store impostors. \\
\hline
{\em dataset} & Input dataset. \\
\hline
{\em labels} & Input dataset labels. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1lmnn_1_1Constraints_a10979b62f55833b0167713eea90fb7aa}} 
\index{mlpack\+::lmnn\+::\+Constraints@{mlpack\+::lmnn\+::\+Constraints}!Impostors@{Impostors}}
\index{Impostors@{Impostors}!mlpack\+::lmnn\+::\+Constraints@{mlpack\+::lmnn\+::\+Constraints}}
\subsubsection{Impostors()\hspace{0.1cm}{\footnotesize\ttfamily [2/5]}}
{\footnotesize\ttfamily void Impostors (\begin{DoxyParamCaption}\item[{arma\+::\+Mat$<$ size\+\_\+t $>$ \&}]{output\+Neighbors,  }\item[{arma\+::mat \&}]{output\+Distance,  }\item[{const arma\+::mat \&}]{dataset,  }\item[{const arma\+::\+Row$<$ size\+\_\+t $>$ \&}]{labels,  }\item[{const arma\+::vec \&}]{norms }\end{DoxyParamCaption})}



Calculates k differently labeled nearest neighbors \& distances to impostors for each datapoint and writes them back to passed matrices. 


\begin{DoxyParams}{Parameters}
{\em output\+Neighbors} & Coordinates matrix to store impostors. \\
\hline
{\em output\+Distance} & matrix to store distance. \\
\hline
{\em dataset} & Input dataset. \\
\hline
{\em labels} & Input dataset labels. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1lmnn_1_1Constraints_a91e83b8342dc413edbf0bb84b3626c1a}} 
\index{mlpack\+::lmnn\+::\+Constraints@{mlpack\+::lmnn\+::\+Constraints}!Impostors@{Impostors}}
\index{Impostors@{Impostors}!mlpack\+::lmnn\+::\+Constraints@{mlpack\+::lmnn\+::\+Constraints}}
\subsubsection{Impostors()\hspace{0.1cm}{\footnotesize\ttfamily [3/5]}}
{\footnotesize\ttfamily void Impostors (\begin{DoxyParamCaption}\item[{arma\+::\+Mat$<$ size\+\_\+t $>$ \&}]{output\+Matrix,  }\item[{const arma\+::mat \&}]{dataset,  }\item[{const arma\+::\+Row$<$ size\+\_\+t $>$ \&}]{labels,  }\item[{const arma\+::vec \&}]{norms,  }\item[{const size\+\_\+t}]{begin,  }\item[{const size\+\_\+t}]{batch\+Size }\end{DoxyParamCaption})}



Calculates k differently labeled nearest neighbors for a batch of dataset and writes them back to passed matrix. 


\begin{DoxyParams}{Parameters}
{\em output\+Matrix} & Coordinates matrix to store impostors. \\
\hline
{\em dataset} & Input dataset. \\
\hline
{\em labels} & Input dataset labels. \\
\hline
{\em begin} & Index of the initial point of dataset. \\
\hline
{\em batch\+Size} & Number of data points to use. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1lmnn_1_1Constraints_aa0e4d7d906ba2d35ae73addd2f16fc58}} 
\index{mlpack\+::lmnn\+::\+Constraints@{mlpack\+::lmnn\+::\+Constraints}!Impostors@{Impostors}}
\index{Impostors@{Impostors}!mlpack\+::lmnn\+::\+Constraints@{mlpack\+::lmnn\+::\+Constraints}}
\subsubsection{Impostors()\hspace{0.1cm}{\footnotesize\ttfamily [4/5]}}
{\footnotesize\ttfamily void Impostors (\begin{DoxyParamCaption}\item[{arma\+::\+Mat$<$ size\+\_\+t $>$ \&}]{output\+Neighbors,  }\item[{arma\+::mat \&}]{output\+Distance,  }\item[{const arma\+::mat \&}]{dataset,  }\item[{const arma\+::\+Row$<$ size\+\_\+t $>$ \&}]{labels,  }\item[{const arma\+::vec \&}]{norms,  }\item[{const size\+\_\+t}]{begin,  }\item[{const size\+\_\+t}]{batch\+Size }\end{DoxyParamCaption})}



Calculates k differently labeled nearest neighbors \& distances to impostors for a batch of dataset and writes them back to passed matrices. 


\begin{DoxyParams}{Parameters}
{\em output\+Neighbors} & Coordinates matrix to store impostors. \\
\hline
{\em output\+Distance} & matrix to store distance. \\
\hline
{\em dataset} & Input dataset. \\
\hline
{\em labels} & Input dataset labels. \\
\hline
{\em begin} & Index of the initial point of dataset. \\
\hline
{\em batch\+Size} & Number of data points to use. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1lmnn_1_1Constraints_a3ed52fc4ae78ae736b87d011e4b4539e}} 
\index{mlpack\+::lmnn\+::\+Constraints@{mlpack\+::lmnn\+::\+Constraints}!Impostors@{Impostors}}
\index{Impostors@{Impostors}!mlpack\+::lmnn\+::\+Constraints@{mlpack\+::lmnn\+::\+Constraints}}
\subsubsection{Impostors()\hspace{0.1cm}{\footnotesize\ttfamily [5/5]}}
{\footnotesize\ttfamily void Impostors (\begin{DoxyParamCaption}\item[{arma\+::\+Mat$<$ size\+\_\+t $>$ \&}]{output\+Neighbors,  }\item[{arma\+::mat \&}]{output\+Distance,  }\item[{const arma\+::mat \&}]{dataset,  }\item[{const arma\+::\+Row$<$ size\+\_\+t $>$ \&}]{labels,  }\item[{const arma\+::vec \&}]{norms,  }\item[{const arma\+::uvec \&}]{points,  }\item[{const size\+\_\+t}]{num\+Points }\end{DoxyParamCaption})}



Calculates k differently labeled nearest neighbors \& distances to impostors for some points of dataset and writes them back to passed matrices. 


\begin{DoxyParams}{Parameters}
{\em output\+Neighbors} & Coordinates matrix to store impostors. \\
\hline
{\em output\+Distance} & matrix to store distance. \\
\hline
{\em dataset} & Input dataset. \\
\hline
{\em labels} & Input dataset labels. \\
\hline
{\em points} & Indices of data points to calculate impostors on. \\
\hline
{\em num\+Points} & Number of points to actually calculate impostors on. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1lmnn_1_1Constraints_ab749ea30c4c3d750ef3a619f32dc3e75}} 
\index{mlpack\+::lmnn\+::\+Constraints@{mlpack\+::lmnn\+::\+Constraints}!K@{K}}
\index{K@{K}!mlpack\+::lmnn\+::\+Constraints@{mlpack\+::lmnn\+::\+Constraints}}
\subsubsection{K()\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily const size\+\_\+t\& K (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Get the number of target neighbors (k). 



Definition at line 177 of file constraints.\+hpp.

\mbox{\label{classmlpack_1_1lmnn_1_1Constraints_af80ea69c69c6463691509f509f3bff05}} 
\index{mlpack\+::lmnn\+::\+Constraints@{mlpack\+::lmnn\+::\+Constraints}!K@{K}}
\index{K@{K}!mlpack\+::lmnn\+::\+Constraints@{mlpack\+::lmnn\+::\+Constraints}}
\subsubsection{K()\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily size\+\_\+t\& K (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Modify the number of target neighbors (k). 



Definition at line 179 of file constraints.\+hpp.

\mbox{\label{classmlpack_1_1lmnn_1_1Constraints_a790fcea11094af39bfaf56648b567bb3}} 
\index{mlpack\+::lmnn\+::\+Constraints@{mlpack\+::lmnn\+::\+Constraints}!Pre\+Calulated@{Pre\+Calulated}}
\index{Pre\+Calulated@{Pre\+Calulated}!mlpack\+::lmnn\+::\+Constraints@{mlpack\+::lmnn\+::\+Constraints}}
\subsubsection{Pre\+Calulated()\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily const bool\& Pre\+Calulated (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Access the boolean value of precalculated. 



Definition at line 182 of file constraints.\+hpp.

\mbox{\label{classmlpack_1_1lmnn_1_1Constraints_ab742fe13e365d0697626650901699a03}} 
\index{mlpack\+::lmnn\+::\+Constraints@{mlpack\+::lmnn\+::\+Constraints}!Pre\+Calulated@{Pre\+Calulated}}
\index{Pre\+Calulated@{Pre\+Calulated}!mlpack\+::lmnn\+::\+Constraints@{mlpack\+::lmnn\+::\+Constraints}}
\subsubsection{Pre\+Calulated()\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily bool\& Pre\+Calulated (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Modify the value of precalculated. 



Definition at line 184 of file constraints.\+hpp.

\mbox{\label{classmlpack_1_1lmnn_1_1Constraints_aaae5fe77efd8a79d315f0979afe789dd}} 
\index{mlpack\+::lmnn\+::\+Constraints@{mlpack\+::lmnn\+::\+Constraints}!Target\+Neighbors@{Target\+Neighbors}}
\index{Target\+Neighbors@{Target\+Neighbors}!mlpack\+::lmnn\+::\+Constraints@{mlpack\+::lmnn\+::\+Constraints}}
\subsubsection{Target\+Neighbors()\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily void Target\+Neighbors (\begin{DoxyParamCaption}\item[{arma\+::\+Mat$<$ size\+\_\+t $>$ \&}]{output\+Matrix,  }\item[{const arma\+::mat \&}]{dataset,  }\item[{const arma\+::\+Row$<$ size\+\_\+t $>$ \&}]{labels,  }\item[{const arma\+::vec \&}]{norms }\end{DoxyParamCaption})}



Calculates k similar labeled nearest neighbors and stores them into the passed matrix. 


\begin{DoxyParams}{Parameters}
{\em output\+Matrix} & Coordinates matrix to store target neighbors. \\
\hline
{\em dataset} & Input dataset. \\
\hline
{\em labels} & Input dataset labels. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1lmnn_1_1Constraints_a3ca672253666af68bdc44a76077dd233}} 
\index{mlpack\+::lmnn\+::\+Constraints@{mlpack\+::lmnn\+::\+Constraints}!Target\+Neighbors@{Target\+Neighbors}}
\index{Target\+Neighbors@{Target\+Neighbors}!mlpack\+::lmnn\+::\+Constraints@{mlpack\+::lmnn\+::\+Constraints}}
\subsubsection{Target\+Neighbors()\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily void Target\+Neighbors (\begin{DoxyParamCaption}\item[{arma\+::\+Mat$<$ size\+\_\+t $>$ \&}]{output\+Matrix,  }\item[{const arma\+::mat \&}]{dataset,  }\item[{const arma\+::\+Row$<$ size\+\_\+t $>$ \&}]{labels,  }\item[{const arma\+::vec \&}]{norms,  }\item[{const size\+\_\+t}]{begin,  }\item[{const size\+\_\+t}]{batch\+Size }\end{DoxyParamCaption})}



Calculates k similar labeled nearest neighbors for a batch of dataset and stores them into the passed matrix. 


\begin{DoxyParams}{Parameters}
{\em output\+Matrix} & Coordinates matrix to store target neighbors. \\
\hline
{\em dataset} & Input dataset. \\
\hline
{\em labels} & Input dataset labels. \\
\hline
{\em begin} & Index of the initial point of dataset. \\
\hline
{\em batch\+Size} & Number of data points to use. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1lmnn_1_1Constraints_ad333e36741acf647d22926dc5bd80522}} 
\index{mlpack\+::lmnn\+::\+Constraints@{mlpack\+::lmnn\+::\+Constraints}!Triplets@{Triplets}}
\index{Triplets@{Triplets}!mlpack\+::lmnn\+::\+Constraints@{mlpack\+::lmnn\+::\+Constraints}}
\subsubsection{Triplets()}
{\footnotesize\ttfamily void Triplets (\begin{DoxyParamCaption}\item[{arma\+::\+Mat$<$ size\+\_\+t $>$ \&}]{output\+Matrix,  }\item[{const arma\+::mat \&}]{dataset,  }\item[{const arma\+::\+Row$<$ size\+\_\+t $>$ \&}]{labels,  }\item[{const arma\+::vec \&}]{norms }\end{DoxyParamCaption})}



Generate triplets \{i, j, l\} for each datapoint i and writes back generated triplets to matrix passed. 


\begin{DoxyParams}{Parameters}
{\em output\+Matrix} & Coordinates matrix to store triplets. \\
\hline
{\em dataset} & Input dataset. \\
\hline
{\em labels} & Input dataset labels. \\
\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/lmnn/\textbf{ constraints.\+hpp}\end{DoxyCompactItemize}
