\hypertarget{classnntrainer_1_1CentroidKNN}{}\doxysection{nntrainer\+::Centroid\+K\+NN Class Reference}
\label{classnntrainer_1_1CentroidKNN}\index{nntrainer::CentroidKNN@{nntrainer::CentroidKNN}}


Centroid K\+NN layer which takes centroid and do k-\/nearest neighbor classification.  




{\ttfamily \#include $<$centroid\+\_\+knn.\+h$>$}



Inheritance diagram for nntrainer\+::Centroid\+K\+NN\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=210pt]{classnntrainer_1_1CentroidKNN__inherit__graph}
\end{center}
\end{figure}


Collaboration diagram for nntrainer\+::Centroid\+K\+NN\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=210pt]{classnntrainer_1_1CentroidKNN__coll__graph}
\end{center}
\end{figure}
\doxysubsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{classnntrainer_1_1CentroidKNN_a8c3677e562e8ff01f209c5654e97a68d}\label{classnntrainer_1_1CentroidKNN_a8c3677e562e8ff01f209c5654e97a68d}} 
\mbox{\hyperlink{classnntrainer_1_1CentroidKNN_a8c3677e562e8ff01f209c5654e97a68d}{Centroid\+K\+NN}} ()
\begin{DoxyCompactList}\small\item\em Construct a new Nearest\+Neighbors \mbox{\hyperlink{classLayer}{Layer}} object that does elementwise subtraction from mean feature vector. \end{DoxyCompactList}\item 
\mbox{\hyperlink{classnntrainer_1_1CentroidKNN_a1b074b9390af71a07bab9eff0b9f3393}{Centroid\+K\+NN}} (\mbox{\hyperlink{classnntrainer_1_1CentroidKNN}{Centroid\+K\+NN}} \&\&rhs) noexcept=default
\begin{DoxyCompactList}\small\item\em Move constructor. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{classnntrainer_1_1CentroidKNN_ae7473d36ef3ca069297c57eb10cefdd0}\label{classnntrainer_1_1CentroidKNN_ae7473d36ef3ca069297c57eb10cefdd0}} 
\mbox{\hyperlink{classnntrainer_1_1CentroidKNN}{Centroid\+K\+NN}} \& \mbox{\hyperlink{classnntrainer_1_1CentroidKNN_ae7473d36ef3ca069297c57eb10cefdd0}{operator=}} (\mbox{\hyperlink{classnntrainer_1_1CentroidKNN}{Centroid\+K\+NN}} \&\&rhs) noexcept=default
\begin{DoxyCompactList}\small\item\em Move assignment operator. @parma\mbox{[}in\mbox{]} rhs \mbox{\hyperlink{classnntrainer_1_1CentroidKNN}{Centroid\+K\+NN}} to be moved. \end{DoxyCompactList}\item 
\mbox{\hyperlink{classnntrainer_1_1CentroidKNN_a05b60099b3a74c459e9bb6023d8c79f9}{$\sim$\+Centroid\+K\+NN}} ()
\begin{DoxyCompactList}\small\item\em Destroy the Nearest\+Neighbors \mbox{\hyperlink{classLayer}{Layer}} object. \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{classnntrainer_1_1CentroidKNN_aefc23a356b7ae267b096221f8bafc364}{require\+Label}} () const override
\item 
void \mbox{\hyperlink{classnntrainer_1_1CentroidKNN_ade3b8903d5ab11e8319dadbff63c9214}{finalize}} (\mbox{\hyperlink{classnntrainer_1_1InitLayerContext}{nntrainer\+::\+Init\+Layer\+Context}} \&context) override
\item 
void \mbox{\hyperlink{classnntrainer_1_1CentroidKNN_aa974e6a7af413ca0677294fe9f06bcb4}{forwarding}} (\mbox{\hyperlink{classnntrainer_1_1RunLayerContext}{nntrainer\+::\+Run\+Layer\+Context}} \&context, bool training) override
\item 
void \mbox{\hyperlink{classnntrainer_1_1CentroidKNN_a0f556bfdcb09fa0845f58f9b527a721e}{calc\+Derivative}} (\mbox{\hyperlink{classnntrainer_1_1RunLayerContext}{nntrainer\+::\+Run\+Layer\+Context}} \&context) override
\item 
bool \mbox{\hyperlink{classnntrainer_1_1CentroidKNN_ad6541b530d43159f7d43dce33ec53437}{support\+Backwarding}} () const override
\begin{DoxyCompactList}\small\item\em \mbox{\hyperlink{classnntrainer_1_1CentroidKNN_ad6541b530d43159f7d43dce33ec53437}{support\+Backwarding() const}} \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classnntrainer_1_1CentroidKNN_a0c6e986c0c2087417d00a72c42d31129}{export\+To}} (\mbox{\hyperlink{classnntrainer_1_1Exporter}{nntrainer\+::\+Exporter}} \&exporter, const ml\+::train\+::\+Export\+Methods \&method) const override
\item 
const std\+::string \mbox{\hyperlink{classnntrainer_1_1CentroidKNN_a4bb113f4e31b648ef89eaedacb9b521d}{get\+Type}} () const override
\item 
void \mbox{\hyperlink{classnntrainer_1_1CentroidKNN_a37c9a305d7b3383ed220d09e49ac4023}{set\+Property}} (const std\+::vector$<$ std\+::string $>$ \&values) override
\end{DoxyCompactItemize}
\doxysubsection*{Static Public Attributes}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{classnntrainer_1_1CentroidKNN_ac3757aecba17a79eb9547d23419281fb}\label{classnntrainer_1_1CentroidKNN_ac3757aecba17a79eb9547d23419281fb}} 
static const std\+::string {\bfseries type} = \char`\"{}centroid\+\_\+knn\char`\"{}
\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
Centroid K\+NN layer which takes centroid and do k-\/nearest neighbor classification. 

Definition at line 27 of file centroid\+\_\+knn.\+h.



\doxysubsection{Constructor \& Destructor Documentation}
\mbox{\Hypertarget{classnntrainer_1_1CentroidKNN_a1b074b9390af71a07bab9eff0b9f3393}\label{classnntrainer_1_1CentroidKNN_a1b074b9390af71a07bab9eff0b9f3393}} 
\index{nntrainer::CentroidKNN@{nntrainer::CentroidKNN}!CentroidKNN@{CentroidKNN}}
\index{CentroidKNN@{CentroidKNN}!nntrainer::CentroidKNN@{nntrainer::CentroidKNN}}
\doxysubsubsection{\texorpdfstring{CentroidKNN()}{CentroidKNN()}}
{\footnotesize\ttfamily nntrainer\+::\+Centroid\+K\+N\+N\+::\+Centroid\+K\+NN (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{classnntrainer_1_1CentroidKNN}{Centroid\+K\+NN}} \&\&}]{rhs }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [default]}, {\ttfamily [noexcept]}}



Move constructor. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em \mbox{\hyperlink{classnntrainer_1_1CentroidKNN}{Centroid\+K\+NN}}} & \&\& \\
\hline
\end{DoxyParams}
\mbox{\Hypertarget{classnntrainer_1_1CentroidKNN_a05b60099b3a74c459e9bb6023d8c79f9}\label{classnntrainer_1_1CentroidKNN_a05b60099b3a74c459e9bb6023d8c79f9}} 
\index{nntrainer::CentroidKNN@{nntrainer::CentroidKNN}!````~CentroidKNN@{$\sim$CentroidKNN}}
\index{````~CentroidKNN@{$\sim$CentroidKNN}!nntrainer::CentroidKNN@{nntrainer::CentroidKNN}}
\doxysubsubsection{\texorpdfstring{$\sim$CentroidKNN()}{~CentroidKNN()}}
{\footnotesize\ttfamily nntrainer\+::\+Centroid\+K\+N\+N\+::$\sim$\+Centroid\+K\+NN (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Destroy the Nearest\+Neighbors \mbox{\hyperlink{classLayer}{Layer}} object. 



Definition at line 38 of file centroid\+\_\+knn.\+cpp.



\doxysubsection{Member Function Documentation}
\mbox{\Hypertarget{classnntrainer_1_1CentroidKNN_a0f556bfdcb09fa0845f58f9b527a721e}\label{classnntrainer_1_1CentroidKNN_a0f556bfdcb09fa0845f58f9b527a721e}} 
\index{nntrainer::CentroidKNN@{nntrainer::CentroidKNN}!calcDerivative@{calcDerivative}}
\index{calcDerivative@{calcDerivative}!nntrainer::CentroidKNN@{nntrainer::CentroidKNN}}
\doxysubsubsection{\texorpdfstring{calcDerivative()}{calcDerivative()}}
{\footnotesize\ttfamily void nntrainer\+::\+Centroid\+K\+N\+N\+::calc\+Derivative (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{classnntrainer_1_1RunLayerContext}{nntrainer\+::\+Run\+Layer\+Context}} \&}]{context }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [override]}}







Definition at line 128 of file centroid\+\_\+knn.\+cpp.

\mbox{\Hypertarget{classnntrainer_1_1CentroidKNN_a0c6e986c0c2087417d00a72c42d31129}\label{classnntrainer_1_1CentroidKNN_a0c6e986c0c2087417d00a72c42d31129}} 
\index{nntrainer::CentroidKNN@{nntrainer::CentroidKNN}!exportTo@{exportTo}}
\index{exportTo@{exportTo}!nntrainer::CentroidKNN@{nntrainer::CentroidKNN}}
\doxysubsubsection{\texorpdfstring{exportTo()}{exportTo()}}
{\footnotesize\ttfamily void nntrainer\+::\+Centroid\+K\+N\+N\+::export\+To (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{classnntrainer_1_1Exporter}{nntrainer\+::\+Exporter}} \&}]{exporter,  }\item[{const ml\+::train\+::\+Export\+Methods \&}]{method }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [override]}}







Definition at line 133 of file centroid\+\_\+knn.\+cpp.

Here is the call graph for this function\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classnntrainer_1_1CentroidKNN_a0c6e986c0c2087417d00a72c42d31129_cgraph}
\end{center}
\end{figure}
\mbox{\Hypertarget{classnntrainer_1_1CentroidKNN_ade3b8903d5ab11e8319dadbff63c9214}\label{classnntrainer_1_1CentroidKNN_ade3b8903d5ab11e8319dadbff63c9214}} 
\index{nntrainer::CentroidKNN@{nntrainer::CentroidKNN}!finalize@{finalize}}
\index{finalize@{finalize}!nntrainer::CentroidKNN@{nntrainer::CentroidKNN}}
\doxysubsubsection{\texorpdfstring{finalize()}{finalize()}}
{\footnotesize\ttfamily void nntrainer\+::\+Centroid\+K\+N\+N\+::finalize (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{classnntrainer_1_1InitLayerContext}{nntrainer\+::\+Init\+Layer\+Context}} \&}]{context }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [override]}}





weight is a distance map that contains centroid of features of each class

samples seen for the current run to calculate the centroid

Definition at line 46 of file centroid\+\_\+knn.\+cpp.

Here is the call graph for this function\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classnntrainer_1_1CentroidKNN_ade3b8903d5ab11e8319dadbff63c9214_cgraph}
\end{center}
\end{figure}
\mbox{\Hypertarget{classnntrainer_1_1CentroidKNN_aa974e6a7af413ca0677294fe9f06bcb4}\label{classnntrainer_1_1CentroidKNN_aa974e6a7af413ca0677294fe9f06bcb4}} 
\index{nntrainer::CentroidKNN@{nntrainer::CentroidKNN}!forwarding@{forwarding}}
\index{forwarding@{forwarding}!nntrainer::CentroidKNN@{nntrainer::CentroidKNN}}
\doxysubsubsection{\texorpdfstring{forwarding()}{forwarding()}}
{\footnotesize\ttfamily void nntrainer\+::\+Centroid\+K\+N\+N\+::forwarding (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{classnntrainer_1_1RunLayerContext}{nntrainer\+::\+Run\+Layer\+Context}} \&}]{context,  }\item[{bool}]{training }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [override]}}







Definition at line 73 of file centroid\+\_\+knn.\+cpp.

Here is the call graph for this function\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classnntrainer_1_1CentroidKNN_aa974e6a7af413ca0677294fe9f06bcb4_cgraph}
\end{center}
\end{figure}
\mbox{\Hypertarget{classnntrainer_1_1CentroidKNN_a4bb113f4e31b648ef89eaedacb9b521d}\label{classnntrainer_1_1CentroidKNN_a4bb113f4e31b648ef89eaedacb9b521d}} 
\index{nntrainer::CentroidKNN@{nntrainer::CentroidKNN}!getType@{getType}}
\index{getType@{getType}!nntrainer::CentroidKNN@{nntrainer::CentroidKNN}}
\doxysubsubsection{\texorpdfstring{getType()}{getType()}}
{\footnotesize\ttfamily const std\+::string nntrainer\+::\+Centroid\+K\+N\+N\+::get\+Type (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [override]}}







Definition at line 87 of file centroid\+\_\+knn.\+h.

\mbox{\Hypertarget{classnntrainer_1_1CentroidKNN_aefc23a356b7ae267b096221f8bafc364}\label{classnntrainer_1_1CentroidKNN_aefc23a356b7ae267b096221f8bafc364}} 
\index{nntrainer::CentroidKNN@{nntrainer::CentroidKNN}!requireLabel@{requireLabel}}
\index{requireLabel@{requireLabel}!nntrainer::CentroidKNN@{nntrainer::CentroidKNN}}
\doxysubsubsection{\texorpdfstring{requireLabel()}{requireLabel()}}
{\footnotesize\ttfamily bool nntrainer\+::\+Centroid\+K\+N\+N\+::require\+Label (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [override]}}







Definition at line 56 of file centroid\+\_\+knn.\+h.

\mbox{\Hypertarget{classnntrainer_1_1CentroidKNN_a37c9a305d7b3383ed220d09e49ac4023}\label{classnntrainer_1_1CentroidKNN_a37c9a305d7b3383ed220d09e49ac4023}} 
\index{nntrainer::CentroidKNN@{nntrainer::CentroidKNN}!setProperty@{setProperty}}
\index{setProperty@{setProperty}!nntrainer::CentroidKNN@{nntrainer::CentroidKNN}}
\doxysubsubsection{\texorpdfstring{setProperty()}{setProperty()}}
{\footnotesize\ttfamily void nntrainer\+::\+Centroid\+K\+N\+N\+::set\+Property (\begin{DoxyParamCaption}\item[{const std\+::vector$<$ std\+::string $>$ \&}]{values }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [override]}}







Definition at line 40 of file centroid\+\_\+knn.\+cpp.

Here is the call graph for this function\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classnntrainer_1_1CentroidKNN_a37c9a305d7b3383ed220d09e49ac4023_cgraph}
\end{center}
\end{figure}
\mbox{\Hypertarget{classnntrainer_1_1CentroidKNN_ad6541b530d43159f7d43dce33ec53437}\label{classnntrainer_1_1CentroidKNN_ad6541b530d43159f7d43dce33ec53437}} 
\index{nntrainer::CentroidKNN@{nntrainer::CentroidKNN}!supportBackwarding@{supportBackwarding}}
\index{supportBackwarding@{supportBackwarding}!nntrainer::CentroidKNN@{nntrainer::CentroidKNN}}
\doxysubsubsection{\texorpdfstring{supportBackwarding()}{supportBackwarding()}}
{\footnotesize\ttfamily bool nntrainer\+::\+Centroid\+K\+N\+N\+::support\+Backwarding (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [override]}}



\mbox{\hyperlink{classnntrainer_1_1CentroidKNN_ad6541b530d43159f7d43dce33ec53437}{support\+Backwarding() const}} 

\mbox{\hyperlink{classnntrainer_1_1CentroidKNN_ad6541b530d43159f7d43dce33ec53437}{support\+Backwarding() const}} 

Definition at line 76 of file centroid\+\_\+knn.\+h.



The documentation for this class was generated from the following files\+:\begin{DoxyCompactItemize}
\item 
layers/\mbox{\hyperlink{centroid__knn_8h}{centroid\+\_\+knn.\+h}}\item 
layers/\mbox{\hyperlink{centroid__knn_8cpp}{centroid\+\_\+knn.\+cpp}}\end{DoxyCompactItemize}
