\section{Margin\+Ranking\+Loss$<$ Input\+Data\+Type, Output\+Data\+Type $>$ Class Template Reference}
\label{classmlpack_1_1ann_1_1MarginRankingLoss}\index{Margin\+Ranking\+Loss$<$ Input\+Data\+Type, Output\+Data\+Type $>$@{Margin\+Ranking\+Loss$<$ Input\+Data\+Type, Output\+Data\+Type $>$}}


Margin ranking loss measures the loss given inputs and a label vector with values of 1 or -\/1.  


\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\textbf{ Margin\+Ranking\+Loss} (const double margin=1.\+0)
\begin{DoxyCompactList}\small\item\em Create the \doxyref{Margin\+Ranking\+Loss}{p.}{classmlpack_1_1ann_1_1MarginRankingLoss} object with Hyperparameter margin. \end{DoxyCompactList}\item 
{\footnotesize template$<$typename Input\+Type , typename Target\+Type , typename Output\+Type $>$ }\\void \textbf{ Backward} (const Input\+Type \&input, const Target\+Type \&target, Output\+Type \&output)
\begin{DoxyCompactList}\small\item\em Ordinary feed backward pass of a neural network. \end{DoxyCompactList}\item 
{\footnotesize template$<$typename Input\+Type , typename Target\+Type $>$ }\\Input\+Type\+::elem\+\_\+type \textbf{ Forward} (const Input\+Type \&input, const Target\+Type \&target)
\begin{DoxyCompactList}\small\item\em Computes the Margin Ranking Loss function. \end{DoxyCompactList}\item 
double \textbf{ Margin} () const
\begin{DoxyCompactList}\small\item\em Get the margin parameter. \end{DoxyCompactList}\item 
double \& \textbf{ Margin} ()
\begin{DoxyCompactList}\small\item\em Modify the margin parameter. \end{DoxyCompactList}\item 
Output\+Data\+Type \& \textbf{ Output\+Parameter} () const
\begin{DoxyCompactList}\small\item\em Get the output parameter. \end{DoxyCompactList}\item 
Output\+Data\+Type \& \textbf{ Output\+Parameter} ()
\begin{DoxyCompactList}\small\item\em Modify the output parameter. \end{DoxyCompactList}\item 
{\footnotesize template$<$typename Archive $>$ }\\void \textbf{ serialize} (Archive \&ar, const unsigned int)
\begin{DoxyCompactList}\small\item\em Serialize the layer. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
\subsubsection*{template$<$typename Input\+Data\+Type = arma\+::mat, typename Output\+Data\+Type = arma\+::mat$>$\newline
class mlpack\+::ann\+::\+Margin\+Ranking\+Loss$<$ Input\+Data\+Type, Output\+Data\+Type $>$}

Margin ranking loss measures the loss given inputs and a label vector with values of 1 or -\/1. 

If the label is 1 then the first input should be ranked higher than the second input at a distance larger than a margin, and vice-\/ versa if the label is -\/1.


\begin{DoxyTemplParams}{Template Parameters}
{\em Input\+Data\+Type} & Type of the input data (arma\+::colvec, arma\+::mat, arma\+::sp\+\_\+mat or arma\+::cube). \\
\hline
{\em Output\+Data\+Type} & Type of the output data (arma\+::colvec, arma\+::mat, arma\+::sp\+\_\+mat or arma\+::cube). \\
\hline
\end{DoxyTemplParams}


Definition at line 35 of file margin\+\_\+ranking\+\_\+loss.\+hpp.



\subsection{Constructor \& Destructor Documentation}
\mbox{\label{classmlpack_1_1ann_1_1MarginRankingLoss_a28d56cfc63a5a75cd5479f335c65df0c}} 
\index{mlpack\+::ann\+::\+Margin\+Ranking\+Loss@{mlpack\+::ann\+::\+Margin\+Ranking\+Loss}!Margin\+Ranking\+Loss@{Margin\+Ranking\+Loss}}
\index{Margin\+Ranking\+Loss@{Margin\+Ranking\+Loss}!mlpack\+::ann\+::\+Margin\+Ranking\+Loss@{mlpack\+::ann\+::\+Margin\+Ranking\+Loss}}
\subsubsection{Margin\+Ranking\+Loss()}
{\footnotesize\ttfamily \textbf{ Margin\+Ranking\+Loss} (\begin{DoxyParamCaption}\item[{const double}]{margin = {\ttfamily 1.0} }\end{DoxyParamCaption})}



Create the \doxyref{Margin\+Ranking\+Loss}{p.}{classmlpack_1_1ann_1_1MarginRankingLoss} object with Hyperparameter margin. 

Hyperparameter margin defines a minimum distance between correctly ranked samples. 

\subsection{Member Function Documentation}
\mbox{\label{classmlpack_1_1ann_1_1MarginRankingLoss_a7a5e88245fe9cf5644f846902393e97a}} 
\index{mlpack\+::ann\+::\+Margin\+Ranking\+Loss@{mlpack\+::ann\+::\+Margin\+Ranking\+Loss}!Backward@{Backward}}
\index{Backward@{Backward}!mlpack\+::ann\+::\+Margin\+Ranking\+Loss@{mlpack\+::ann\+::\+Margin\+Ranking\+Loss}}
\subsubsection{Backward()}
{\footnotesize\ttfamily void Backward (\begin{DoxyParamCaption}\item[{const Input\+Type \&}]{input,  }\item[{const Target\+Type \&}]{target,  }\item[{Output\+Type \&}]{output }\end{DoxyParamCaption})}



Ordinary feed backward pass of a neural network. 


\begin{DoxyParams}{Parameters}
{\em input} & The propagated concatenated input activation. \\
\hline
{\em target} & The label vector which contains -\/1 or 1 values. \\
\hline
{\em output} & The calculated error. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1ann_1_1MarginRankingLoss_aad9536a75d4ecfe220d313adc47f38fa}} 
\index{mlpack\+::ann\+::\+Margin\+Ranking\+Loss@{mlpack\+::ann\+::\+Margin\+Ranking\+Loss}!Forward@{Forward}}
\index{Forward@{Forward}!mlpack\+::ann\+::\+Margin\+Ranking\+Loss@{mlpack\+::ann\+::\+Margin\+Ranking\+Loss}}
\subsubsection{Forward()}
{\footnotesize\ttfamily Input\+Type\+::elem\+\_\+type Forward (\begin{DoxyParamCaption}\item[{const Input\+Type \&}]{input,  }\item[{const Target\+Type \&}]{target }\end{DoxyParamCaption})}



Computes the Margin Ranking Loss function. 


\begin{DoxyParams}{Parameters}
{\em input} & Concatenation of the two inputs for evaluating the specified function. \\
\hline
{\em target} & The label vector which contains values of -\/1 or 1. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1ann_1_1MarginRankingLoss_ac29c2c851ff367f45f9ec075352c5b83}} 
\index{mlpack\+::ann\+::\+Margin\+Ranking\+Loss@{mlpack\+::ann\+::\+Margin\+Ranking\+Loss}!Margin@{Margin}}
\index{Margin@{Margin}!mlpack\+::ann\+::\+Margin\+Ranking\+Loss@{mlpack\+::ann\+::\+Margin\+Ranking\+Loss}}
\subsubsection{Margin()\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily double Margin (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Get the margin parameter. 



Definition at line 78 of file margin\+\_\+ranking\+\_\+loss.\+hpp.

\mbox{\label{classmlpack_1_1ann_1_1MarginRankingLoss_ab8c4d252f686cdc9c5972df28e65dcab}} 
\index{mlpack\+::ann\+::\+Margin\+Ranking\+Loss@{mlpack\+::ann\+::\+Margin\+Ranking\+Loss}!Margin@{Margin}}
\index{Margin@{Margin}!mlpack\+::ann\+::\+Margin\+Ranking\+Loss@{mlpack\+::ann\+::\+Margin\+Ranking\+Loss}}
\subsubsection{Margin()\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily double\& Margin (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Modify the margin parameter. 



Definition at line 80 of file margin\+\_\+ranking\+\_\+loss.\+hpp.



References Margin\+Ranking\+Loss$<$ Input\+Data\+Type, Output\+Data\+Type $>$\+::serialize().

\mbox{\label{classmlpack_1_1ann_1_1MarginRankingLoss_a8bae962cc603d1cab8d80ec78f8d505d}} 
\index{mlpack\+::ann\+::\+Margin\+Ranking\+Loss@{mlpack\+::ann\+::\+Margin\+Ranking\+Loss}!Output\+Parameter@{Output\+Parameter}}
\index{Output\+Parameter@{Output\+Parameter}!mlpack\+::ann\+::\+Margin\+Ranking\+Loss@{mlpack\+::ann\+::\+Margin\+Ranking\+Loss}}
\subsubsection{Output\+Parameter()\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily Output\+Data\+Type\& Output\+Parameter (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Get the output parameter. 



Definition at line 73 of file margin\+\_\+ranking\+\_\+loss.\+hpp.

\mbox{\label{classmlpack_1_1ann_1_1MarginRankingLoss_a21d5f745f02c709625a4ee0907f004a5}} 
\index{mlpack\+::ann\+::\+Margin\+Ranking\+Loss@{mlpack\+::ann\+::\+Margin\+Ranking\+Loss}!Output\+Parameter@{Output\+Parameter}}
\index{Output\+Parameter@{Output\+Parameter}!mlpack\+::ann\+::\+Margin\+Ranking\+Loss@{mlpack\+::ann\+::\+Margin\+Ranking\+Loss}}
\subsubsection{Output\+Parameter()\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily Output\+Data\+Type\& Output\+Parameter (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Modify the output parameter. 



Definition at line 75 of file margin\+\_\+ranking\+\_\+loss.\+hpp.

\mbox{\label{classmlpack_1_1ann_1_1MarginRankingLoss_af0dd9205158ccf7bcfcd8ff81f79c927}} 
\index{mlpack\+::ann\+::\+Margin\+Ranking\+Loss@{mlpack\+::ann\+::\+Margin\+Ranking\+Loss}!serialize@{serialize}}
\index{serialize@{serialize}!mlpack\+::ann\+::\+Margin\+Ranking\+Loss@{mlpack\+::ann\+::\+Margin\+Ranking\+Loss}}
\subsubsection{serialize()}
{\footnotesize\ttfamily void serialize (\begin{DoxyParamCaption}\item[{Archive \&}]{ar,  }\item[{const unsigned}]{int }\end{DoxyParamCaption})}



Serialize the layer. 



Referenced by Margin\+Ranking\+Loss$<$ Input\+Data\+Type, Output\+Data\+Type $>$\+::\+Margin().



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/ann/loss\+\_\+functions/\textbf{ margin\+\_\+ranking\+\_\+loss.\+hpp}\end{DoxyCompactItemize}
