\section{Linear\+S\+VM$<$ Mat\+Type $>$ Class Template Reference}
\label{classmlpack_1_1svm_1_1LinearSVM}\index{Linear\+S\+V\+M$<$ Mat\+Type $>$@{Linear\+S\+V\+M$<$ Mat\+Type $>$}}


The \doxyref{Linear\+S\+VM}{p.}{classmlpack_1_1svm_1_1LinearSVM} class implements an L2-\/regularized support vector machine model, and supports training with multiple optimizers and classification.  


\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
{\footnotesize template$<$typename Optimizer\+Type , typename... Callback\+Types$>$ }\\\textbf{ Linear\+S\+VM} (const Mat\+Type \&data, const arma\+::\+Row$<$ size\+\_\+t $>$ \&labels, const size\+\_\+t num\+Classes, const double lambda, const double delta, const bool fit\+Intercept, Optimizer\+Type optimizer, Callback\+Types \&\&... callbacks)
\begin{DoxyCompactList}\small\item\em Construct the \doxyref{Linear\+S\+VM}{p.}{classmlpack_1_1svm_1_1LinearSVM} class with the provided data and labels. \end{DoxyCompactList}\item 
{\footnotesize template$<$typename Optimizer\+Type  = ens\+::\+L\+\_\+\+B\+F\+GS$>$ }\\\textbf{ Linear\+S\+VM} (const Mat\+Type \&data, const arma\+::\+Row$<$ size\+\_\+t $>$ \&labels, const size\+\_\+t num\+Classes=2, const double lambda=0.\+0001, const double delta=1.\+0, const bool fit\+Intercept=false, Optimizer\+Type optimizer=Optimizer\+Type())
\begin{DoxyCompactList}\small\item\em Construct the \doxyref{Linear\+S\+VM}{p.}{classmlpack_1_1svm_1_1LinearSVM} class with the provided data and labels. \end{DoxyCompactList}\item 
\textbf{ Linear\+S\+VM} (const size\+\_\+t input\+Size, const size\+\_\+t num\+Classes=0, const double lambda=0.\+0001, const double delta=1.\+0, const bool fit\+Intercept=false)
\begin{DoxyCompactList}\small\item\em Initialize the Linear S\+VM without performing training. \end{DoxyCompactList}\item 
\textbf{ Linear\+S\+VM} (const size\+\_\+t num\+Classes=0, const double lambda=0.\+0001, const double delta=1.\+0, const bool fit\+Intercept=false)
\begin{DoxyCompactList}\small\item\em Initialize the Linear S\+VM without performing training. \end{DoxyCompactList}\item 
void \textbf{ Classify} (const Mat\+Type \&data, arma\+::\+Row$<$ size\+\_\+t $>$ \&labels) const
\begin{DoxyCompactList}\small\item\em Classify the given points, returning the predicted labels for each point. \end{DoxyCompactList}\item 
void \textbf{ Classify} (const Mat\+Type \&data, arma\+::\+Row$<$ size\+\_\+t $>$ \&labels, arma\+::mat \&scores) const
\begin{DoxyCompactList}\small\item\em Classify the given points, returning class scores and predicted class label for each point. \end{DoxyCompactList}\item 
void \textbf{ Classify} (const Mat\+Type \&data, arma\+::mat \&scores) const
\begin{DoxyCompactList}\small\item\em Classify the given points, returning class scores for each point. \end{DoxyCompactList}\item 
{\footnotesize template$<$typename Vec\+Type $>$ }\\size\+\_\+t \textbf{ Classify} (const Vec\+Type \&point) const
\begin{DoxyCompactList}\small\item\em Classify the given point. \end{DoxyCompactList}\item 
double \textbf{ Compute\+Accuracy} (const Mat\+Type \&test\+Data, const arma\+::\+Row$<$ size\+\_\+t $>$ \&test\+Labels) const
\begin{DoxyCompactList}\small\item\em Computes accuracy of the learned model given the feature data and the labels associated with each data point. \end{DoxyCompactList}\item 
double \& \textbf{ Delta} ()
\begin{DoxyCompactList}\small\item\em Sets the margin between the correct class and all other classes. \end{DoxyCompactList}\item 
double \textbf{ Delta} () const
\begin{DoxyCompactList}\small\item\em Gets the margin between the correct class and all other classes. \end{DoxyCompactList}\item 
size\+\_\+t \textbf{ Feature\+Size} () const
\begin{DoxyCompactList}\small\item\em Gets the features size of the training data. \end{DoxyCompactList}\item 
bool \& \textbf{ Fit\+Intercept} ()
\begin{DoxyCompactList}\small\item\em Sets the intercept term flag. \end{DoxyCompactList}\item 
double \& \textbf{ Lambda} ()
\begin{DoxyCompactList}\small\item\em Sets the regularization parameter. \end{DoxyCompactList}\item 
double \textbf{ Lambda} () const
\begin{DoxyCompactList}\small\item\em Gets the regularization parameter. \end{DoxyCompactList}\item 
size\+\_\+t \& \textbf{ Num\+Classes} ()
\begin{DoxyCompactList}\small\item\em Sets the number of classes. \end{DoxyCompactList}\item 
size\+\_\+t \textbf{ Num\+Classes} () const
\begin{DoxyCompactList}\small\item\em Gets the number of classes. \end{DoxyCompactList}\item 
arma\+::mat \& \textbf{ Parameters} ()
\begin{DoxyCompactList}\small\item\em Set the model parameters. \end{DoxyCompactList}\item 
const arma\+::mat \& \textbf{ Parameters} () const
\begin{DoxyCompactList}\small\item\em Get the model parameters. \end{DoxyCompactList}\item 
{\footnotesize template$<$typename Archive $>$ }\\void \textbf{ serialize} (Archive \&ar, const unsigned int)
\begin{DoxyCompactList}\small\item\em Serialize the \doxyref{Linear\+S\+VM}{p.}{classmlpack_1_1svm_1_1LinearSVM} model. \end{DoxyCompactList}\item 
{\footnotesize template$<$typename Optimizer\+Type , typename... Callback\+Types$>$ }\\double \textbf{ Train} (const Mat\+Type \&data, const arma\+::\+Row$<$ size\+\_\+t $>$ \&labels, const size\+\_\+t num\+Classes, Optimizer\+Type optimizer, Callback\+Types \&\&... callbacks)
\begin{DoxyCompactList}\small\item\em Train the Linear S\+VM with the given training data. \end{DoxyCompactList}\item 
{\footnotesize template$<$typename Optimizer\+Type  = ens\+::\+L\+\_\+\+B\+F\+GS$>$ }\\double \textbf{ Train} (const Mat\+Type \&data, const arma\+::\+Row$<$ size\+\_\+t $>$ \&labels, const size\+\_\+t num\+Classes=2, Optimizer\+Type optimizer=Optimizer\+Type())
\begin{DoxyCompactList}\small\item\em Train the Linear S\+VM with the given training data. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
\subsubsection*{template$<$typename Mat\+Type = arma\+::mat$>$\newline
class mlpack\+::svm\+::\+Linear\+S\+V\+M$<$ Mat\+Type $>$}

The \doxyref{Linear\+S\+VM}{p.}{classmlpack_1_1svm_1_1LinearSVM} class implements an L2-\/regularized support vector machine model, and supports training with multiple optimizers and classification. 

The class supports different observation types via the Mat\+Type template parameter; for instance, support vector classification can be performed on sparse datasets by specifying arma\+::sp\+\_\+mat as the Mat\+Type parameter.

Linear S\+VM can be used for general classification tasks which will work on multiclass classification. More technical details about the model can be found from the following\+:


\begin{DoxyCode}
@inproceedings\{weston1999support,
title        = \{Support vector machines \textcolor{keywordflow}{for} multi-\textcolor{keyword}{class }pattern
                recognition.\},
author       = \{Weston, Jason and Watkins, Chris\},
booktitle    = \{Proceedings of the 7th European Symposium on Artifical Neural
                Networks (ESANN \textcolor{stringliteral}{'99)\},}
\textcolor{stringliteral}{volume       = \{99\},}
\textcolor{stringliteral}{pages        = \{219--224\},}
\textcolor{stringliteral}{year         = \{1999\}}
\textcolor{stringliteral}{\}}
\end{DoxyCode}



\begin{DoxyCode}
@article\{cortes1995support,
title        = \{Support-vector networks\},
author       = \{Cortes, Corinna and Vapnik, Vladimir\},
journal      = \{Machine Learning\},
volume       = \{20\},
number       = \{3\},
pages        = \{273--297\},
year         = \{1995\},
publisher    = \{Springer\}
\}
\end{DoxyCode}


An example on how to use the interface is shown below\+:


\begin{DoxyCode}
arma::mat train\_data; \textcolor{comment}{// Training data matrix.}
arma::Row<size\_t> labels; \textcolor{comment}{// Labels associated with the data.}
\textcolor{keyword}{const} \textcolor{keywordtype}{size\_t} inputSize = 1000; \textcolor{comment}{// Size of input feature vector.}
\textcolor{keyword}{const} \textcolor{keywordtype}{size\_t} numClasses = 5; \textcolor{comment}{// Number of classes.}

\textcolor{comment}{// Train the model using default options.}
LinearSVM<> lsvm(train\_data, labels, inputSize, numClasses, lambda,
    delta, L\_BFGS());

arma::mat test\_data;
arma::Row<size\_t> predictions;
lsvm.Classify(test\_data, predictions);
\end{DoxyCode}



\begin{DoxyTemplParams}{Template Parameters}
{\em Mat\+Type} & Type of data matrix. \\
\hline
\end{DoxyTemplParams}


Definition at line 80 of file linear\+\_\+svm.\+hpp.



\subsection{Constructor \& Destructor Documentation}
\mbox{\label{classmlpack_1_1svm_1_1LinearSVM_aefdb800e39c4b1aa0e39dc7fd3ccee44}} 
\index{mlpack\+::svm\+::\+Linear\+S\+VM@{mlpack\+::svm\+::\+Linear\+S\+VM}!Linear\+S\+VM@{Linear\+S\+VM}}
\index{Linear\+S\+VM@{Linear\+S\+VM}!mlpack\+::svm\+::\+Linear\+S\+VM@{mlpack\+::svm\+::\+Linear\+S\+VM}}
\subsubsection{Linear\+S\+V\+M()\hspace{0.1cm}{\footnotesize\ttfamily [1/4]}}
{\footnotesize\ttfamily \textbf{ Linear\+S\+VM} (\begin{DoxyParamCaption}\item[{const Mat\+Type \&}]{data,  }\item[{const arma\+::\+Row$<$ size\+\_\+t $>$ \&}]{labels,  }\item[{const size\+\_\+t}]{num\+Classes,  }\item[{const double}]{lambda,  }\item[{const double}]{delta,  }\item[{const bool}]{fit\+Intercept,  }\item[{Optimizer\+Type}]{optimizer,  }\item[{Callback\+Types \&\&...}]{callbacks }\end{DoxyParamCaption})}



Construct the \doxyref{Linear\+S\+VM}{p.}{classmlpack_1_1svm_1_1LinearSVM} class with the provided data and labels. 

This will train the model. Optionally, the parameter \textquotesingle{}lambda\textquotesingle{} can be passed, which controls the amount of L2-\/regularization in the objective function. By default, the model takes a small value.


\begin{DoxyTemplParams}{Template Parameters}
{\em Optimizer\+Type} & Desired differentiable separable optimizer \\
\hline
{\em Callback\+Types} & Types of callback functions. \\
\hline
\end{DoxyTemplParams}

\begin{DoxyParams}{Parameters}
{\em data} & Input training features. Each column associate with one sample \\
\hline
{\em labels} & Labels associated with the feature data. \\
\hline
{\em num\+Classes} & Number of classes for classification. \\
\hline
{\em lambda} & L2-\/regularization constant. \\
\hline
{\em delta} & Margin of difference between correct class and other classes. \\
\hline
{\em fit\+Intercept} & add intercept term or not. \\
\hline
{\em optimizer} & Desired optimizer. \\
\hline
{\em callbacks} & Callback functions. See {\tt https\+://www.\+ensmallen.\+org/docs.\+html\#callback-\/documentation}. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1svm_1_1LinearSVM_a1e14e0ede00adc904ff2b9010e68b95e}} 
\index{mlpack\+::svm\+::\+Linear\+S\+VM@{mlpack\+::svm\+::\+Linear\+S\+VM}!Linear\+S\+VM@{Linear\+S\+VM}}
\index{Linear\+S\+VM@{Linear\+S\+VM}!mlpack\+::svm\+::\+Linear\+S\+VM@{mlpack\+::svm\+::\+Linear\+S\+VM}}
\subsubsection{Linear\+S\+V\+M()\hspace{0.1cm}{\footnotesize\ttfamily [2/4]}}
{\footnotesize\ttfamily \textbf{ Linear\+S\+VM} (\begin{DoxyParamCaption}\item[{const Mat\+Type \&}]{data,  }\item[{const arma\+::\+Row$<$ size\+\_\+t $>$ \&}]{labels,  }\item[{const size\+\_\+t}]{num\+Classes = {\ttfamily 2},  }\item[{const double}]{lambda = {\ttfamily 0.0001},  }\item[{const double}]{delta = {\ttfamily 1.0},  }\item[{const bool}]{fit\+Intercept = {\ttfamily false},  }\item[{Optimizer\+Type}]{optimizer = {\ttfamily OptimizerType()} }\end{DoxyParamCaption})}



Construct the \doxyref{Linear\+S\+VM}{p.}{classmlpack_1_1svm_1_1LinearSVM} class with the provided data and labels. 

This will train the model. Optionally, the parameter \textquotesingle{}lambda\textquotesingle{} can be passed, which controls the amount of L2-\/regularization in the objective function. By default, the model takes a small value.


\begin{DoxyTemplParams}{Template Parameters}
{\em Optimizer\+Type} & Desired differentiable separable optimizer \\
\hline
\end{DoxyTemplParams}

\begin{DoxyParams}{Parameters}
{\em data} & Input training features. Each column associate with one sample \\
\hline
{\em labels} & Labels associated with the feature data. \\
\hline
{\em num\+Classes} & Number of classes for classification. \\
\hline
{\em lambda} & L2-\/regularization constant.  delta Margin of difference between correct class and other classes. \\
\hline
{\em fit\+Intercept} & add intercept term or not. \\
\hline
{\em optimizer} & Desired optimizer. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1svm_1_1LinearSVM_abff71f40e686b9ebb2f146fe5bb22fbf}} 
\index{mlpack\+::svm\+::\+Linear\+S\+VM@{mlpack\+::svm\+::\+Linear\+S\+VM}!Linear\+S\+VM@{Linear\+S\+VM}}
\index{Linear\+S\+VM@{Linear\+S\+VM}!mlpack\+::svm\+::\+Linear\+S\+VM@{mlpack\+::svm\+::\+Linear\+S\+VM}}
\subsubsection{Linear\+S\+V\+M()\hspace{0.1cm}{\footnotesize\ttfamily [3/4]}}
{\footnotesize\ttfamily \textbf{ Linear\+S\+VM} (\begin{DoxyParamCaption}\item[{const size\+\_\+t}]{input\+Size,  }\item[{const size\+\_\+t}]{num\+Classes = {\ttfamily 0},  }\item[{const double}]{lambda = {\ttfamily 0.0001},  }\item[{const double}]{delta = {\ttfamily 1.0},  }\item[{const bool}]{fit\+Intercept = {\ttfamily false} }\end{DoxyParamCaption})}



Initialize the Linear S\+VM without performing training. 

Default value of lambda is 0.\+0001. Be sure to use \doxyref{Train()}{p.}{classmlpack_1_1svm_1_1LinearSVM_a8944b0e0826ea837bc05f1a8df82abc7} before calling \doxyref{Classify()}{p.}{classmlpack_1_1svm_1_1LinearSVM_a9cf32d6ddee61625f9e8aead727db5fd} or \doxyref{Compute\+Accuracy()}{p.}{classmlpack_1_1svm_1_1LinearSVM_a697a12b762e4fc2cd730987074e262bd}, otherwise the results may be meaningless.


\begin{DoxyParams}{Parameters}
{\em input\+Size} & Size of the input feature vector. \\
\hline
{\em num\+Classes} & Number of classes for classification. \\
\hline
{\em lambda} & L2-\/regularization constant.  delta Margin of difference between correct class and other classes. \\
\hline
{\em fit\+Intercept} & add intercept term or not. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1svm_1_1LinearSVM_a38859740fdb69aa79fdde2aff515d680}} 
\index{mlpack\+::svm\+::\+Linear\+S\+VM@{mlpack\+::svm\+::\+Linear\+S\+VM}!Linear\+S\+VM@{Linear\+S\+VM}}
\index{Linear\+S\+VM@{Linear\+S\+VM}!mlpack\+::svm\+::\+Linear\+S\+VM@{mlpack\+::svm\+::\+Linear\+S\+VM}}
\subsubsection{Linear\+S\+V\+M()\hspace{0.1cm}{\footnotesize\ttfamily [4/4]}}
{\footnotesize\ttfamily \textbf{ Linear\+S\+VM} (\begin{DoxyParamCaption}\item[{const size\+\_\+t}]{num\+Classes = {\ttfamily 0},  }\item[{const double}]{lambda = {\ttfamily 0.0001},  }\item[{const double}]{delta = {\ttfamily 1.0},  }\item[{const bool}]{fit\+Intercept = {\ttfamily false} }\end{DoxyParamCaption})}



Initialize the Linear S\+VM without performing training. 

Default value of lambda is 0.\+0001. Be sure to use \doxyref{Train()}{p.}{classmlpack_1_1svm_1_1LinearSVM_a8944b0e0826ea837bc05f1a8df82abc7} before calling \doxyref{Classify()}{p.}{classmlpack_1_1svm_1_1LinearSVM_a9cf32d6ddee61625f9e8aead727db5fd} or \doxyref{Compute\+Accuracy()}{p.}{classmlpack_1_1svm_1_1LinearSVM_a697a12b762e4fc2cd730987074e262bd}, otherwise the results may be meaningless.


\begin{DoxyParams}{Parameters}
{\em num\+Classes} & Number of classes for classification. \\
\hline
{\em lambda} & L2-\/regularization constant.  delta Margin of difference between correct class and other classes. \\
\hline
{\em fit\+Intercept} & add intercept term or not. \\
\hline
\end{DoxyParams}


\subsection{Member Function Documentation}
\mbox{\label{classmlpack_1_1svm_1_1LinearSVM_a9cf32d6ddee61625f9e8aead727db5fd}} 
\index{mlpack\+::svm\+::\+Linear\+S\+VM@{mlpack\+::svm\+::\+Linear\+S\+VM}!Classify@{Classify}}
\index{Classify@{Classify}!mlpack\+::svm\+::\+Linear\+S\+VM@{mlpack\+::svm\+::\+Linear\+S\+VM}}
\subsubsection{Classify()\hspace{0.1cm}{\footnotesize\ttfamily [1/4]}}
{\footnotesize\ttfamily void Classify (\begin{DoxyParamCaption}\item[{const Mat\+Type \&}]{data,  }\item[{arma\+::\+Row$<$ size\+\_\+t $>$ \&}]{labels }\end{DoxyParamCaption}) const}



Classify the given points, returning the predicted labels for each point. 

The function calculates the probabilities for every class, given a data point. It then chooses the class which has the highest probability among all.


\begin{DoxyParams}{Parameters}
{\em data} & Set of points to classify. \\
\hline
{\em labels} & Predicted labels for each point. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1svm_1_1LinearSVM_a8f598aa53127469e38b569c81366e2ec}} 
\index{mlpack\+::svm\+::\+Linear\+S\+VM@{mlpack\+::svm\+::\+Linear\+S\+VM}!Classify@{Classify}}
\index{Classify@{Classify}!mlpack\+::svm\+::\+Linear\+S\+VM@{mlpack\+::svm\+::\+Linear\+S\+VM}}
\subsubsection{Classify()\hspace{0.1cm}{\footnotesize\ttfamily [2/4]}}
{\footnotesize\ttfamily void Classify (\begin{DoxyParamCaption}\item[{const Mat\+Type \&}]{data,  }\item[{arma\+::\+Row$<$ size\+\_\+t $>$ \&}]{labels,  }\item[{arma\+::mat \&}]{scores }\end{DoxyParamCaption}) const}



Classify the given points, returning class scores and predicted class label for each point. 

The function calculates the scores for every class, given a data point. It then chooses the class which has the highest probability among all.


\begin{DoxyParams}{Parameters}
{\em data} & Matrix of data points to be classified. \\
\hline
{\em labels} & Predicted labels for each point. \\
\hline
{\em scores} & Class probabilities for each point. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1svm_1_1LinearSVM_a5b66a913c48f241d0e675c88a843a621}} 
\index{mlpack\+::svm\+::\+Linear\+S\+VM@{mlpack\+::svm\+::\+Linear\+S\+VM}!Classify@{Classify}}
\index{Classify@{Classify}!mlpack\+::svm\+::\+Linear\+S\+VM@{mlpack\+::svm\+::\+Linear\+S\+VM}}
\subsubsection{Classify()\hspace{0.1cm}{\footnotesize\ttfamily [3/4]}}
{\footnotesize\ttfamily void Classify (\begin{DoxyParamCaption}\item[{const Mat\+Type \&}]{data,  }\item[{arma\+::mat \&}]{scores }\end{DoxyParamCaption}) const}



Classify the given points, returning class scores for each point. 


\begin{DoxyParams}{Parameters}
{\em data} & Matrix of data points to be classified. \\
\hline
{\em scores} & Class scores for each point. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1svm_1_1LinearSVM_aa610310b354b7badd88041ca07883569}} 
\index{mlpack\+::svm\+::\+Linear\+S\+VM@{mlpack\+::svm\+::\+Linear\+S\+VM}!Classify@{Classify}}
\index{Classify@{Classify}!mlpack\+::svm\+::\+Linear\+S\+VM@{mlpack\+::svm\+::\+Linear\+S\+VM}}
\subsubsection{Classify()\hspace{0.1cm}{\footnotesize\ttfamily [4/4]}}
{\footnotesize\ttfamily size\+\_\+t Classify (\begin{DoxyParamCaption}\item[{const Vec\+Type \&}]{point }\end{DoxyParamCaption}) const}



Classify the given point. 

The predicted class label is returned. The function calculates the scores for every class, given the point. It then chooses the class which has the highest probability among all.


\begin{DoxyParams}{Parameters}
{\em point} & Point to be classified. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Predicted class label of the point. 
\end{DoxyReturn}
\mbox{\label{classmlpack_1_1svm_1_1LinearSVM_a697a12b762e4fc2cd730987074e262bd}} 
\index{mlpack\+::svm\+::\+Linear\+S\+VM@{mlpack\+::svm\+::\+Linear\+S\+VM}!Compute\+Accuracy@{Compute\+Accuracy}}
\index{Compute\+Accuracy@{Compute\+Accuracy}!mlpack\+::svm\+::\+Linear\+S\+VM@{mlpack\+::svm\+::\+Linear\+S\+VM}}
\subsubsection{Compute\+Accuracy()}
{\footnotesize\ttfamily double Compute\+Accuracy (\begin{DoxyParamCaption}\item[{const Mat\+Type \&}]{test\+Data,  }\item[{const arma\+::\+Row$<$ size\+\_\+t $>$ \&}]{test\+Labels }\end{DoxyParamCaption}) const}



Computes accuracy of the learned model given the feature data and the labels associated with each data point. 

Predictions are made using the provided data and are compared with the actual labels.


\begin{DoxyParams}{Parameters}
{\em test\+Data} & Matrix of data points using which predictions are made. \\
\hline
{\em test\+Labels} & Vector of labels associated with the data. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Accuracy of the model. 
\end{DoxyReturn}
\mbox{\label{classmlpack_1_1svm_1_1LinearSVM_a9fcb8a5caa7165245d5aa803b0a94a7c}} 
\index{mlpack\+::svm\+::\+Linear\+S\+VM@{mlpack\+::svm\+::\+Linear\+S\+VM}!Delta@{Delta}}
\index{Delta@{Delta}!mlpack\+::svm\+::\+Linear\+S\+VM@{mlpack\+::svm\+::\+Linear\+S\+VM}}
\subsubsection{Delta()\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily double\& Delta (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Sets the margin between the correct class and all other classes. 



Definition at line 273 of file linear\+\_\+svm.\+hpp.

\mbox{\label{classmlpack_1_1svm_1_1LinearSVM_acb1f7d73ed8ec9121d6d0e45b560d8fa}} 
\index{mlpack\+::svm\+::\+Linear\+S\+VM@{mlpack\+::svm\+::\+Linear\+S\+VM}!Delta@{Delta}}
\index{Delta@{Delta}!mlpack\+::svm\+::\+Linear\+S\+VM@{mlpack\+::svm\+::\+Linear\+S\+VM}}
\subsubsection{Delta()\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily double Delta (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Gets the margin between the correct class and all other classes. 



Definition at line 275 of file linear\+\_\+svm.\+hpp.

\mbox{\label{classmlpack_1_1svm_1_1LinearSVM_a71c4a6c2db59e7a14196cc6e9846a29b}} 
\index{mlpack\+::svm\+::\+Linear\+S\+VM@{mlpack\+::svm\+::\+Linear\+S\+VM}!Feature\+Size@{Feature\+Size}}
\index{Feature\+Size@{Feature\+Size}!mlpack\+::svm\+::\+Linear\+S\+VM@{mlpack\+::svm\+::\+Linear\+S\+VM}}
\subsubsection{Feature\+Size()}
{\footnotesize\ttfamily size\+\_\+t Feature\+Size (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Gets the features size of the training data. 



Definition at line 286 of file linear\+\_\+svm.\+hpp.

\mbox{\label{classmlpack_1_1svm_1_1LinearSVM_a7d4773fa79c43c5e1935ff9c8439c352}} 
\index{mlpack\+::svm\+::\+Linear\+S\+VM@{mlpack\+::svm\+::\+Linear\+S\+VM}!Fit\+Intercept@{Fit\+Intercept}}
\index{Fit\+Intercept@{Fit\+Intercept}!mlpack\+::svm\+::\+Linear\+S\+VM@{mlpack\+::svm\+::\+Linear\+S\+VM}}
\subsubsection{Fit\+Intercept()}
{\footnotesize\ttfamily bool\& Fit\+Intercept (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Sets the intercept term flag. 



Definition at line 278 of file linear\+\_\+svm.\+hpp.

\mbox{\label{classmlpack_1_1svm_1_1LinearSVM_aaf66629b989a326453647f42443c6a0c}} 
\index{mlpack\+::svm\+::\+Linear\+S\+VM@{mlpack\+::svm\+::\+Linear\+S\+VM}!Lambda@{Lambda}}
\index{Lambda@{Lambda}!mlpack\+::svm\+::\+Linear\+S\+VM@{mlpack\+::svm\+::\+Linear\+S\+VM}}
\subsubsection{Lambda()\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily double\& Lambda (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Sets the regularization parameter. 



Definition at line 268 of file linear\+\_\+svm.\+hpp.

\mbox{\label{classmlpack_1_1svm_1_1LinearSVM_a53535041275cedd0ec3de67ca032aa94}} 
\index{mlpack\+::svm\+::\+Linear\+S\+VM@{mlpack\+::svm\+::\+Linear\+S\+VM}!Lambda@{Lambda}}
\index{Lambda@{Lambda}!mlpack\+::svm\+::\+Linear\+S\+VM@{mlpack\+::svm\+::\+Linear\+S\+VM}}
\subsubsection{Lambda()\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily double Lambda (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Gets the regularization parameter. 



Definition at line 270 of file linear\+\_\+svm.\+hpp.

\mbox{\label{classmlpack_1_1svm_1_1LinearSVM_ac9b6fde1dc1604ba744b1e6ab5b1d499}} 
\index{mlpack\+::svm\+::\+Linear\+S\+VM@{mlpack\+::svm\+::\+Linear\+S\+VM}!Num\+Classes@{Num\+Classes}}
\index{Num\+Classes@{Num\+Classes}!mlpack\+::svm\+::\+Linear\+S\+VM@{mlpack\+::svm\+::\+Linear\+S\+VM}}
\subsubsection{Num\+Classes()\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily size\+\_\+t\& Num\+Classes (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Sets the number of classes. 



Definition at line 263 of file linear\+\_\+svm.\+hpp.

\mbox{\label{classmlpack_1_1svm_1_1LinearSVM_a088ebfdf3c7a9e7eea81716d0c55b5a3}} 
\index{mlpack\+::svm\+::\+Linear\+S\+VM@{mlpack\+::svm\+::\+Linear\+S\+VM}!Num\+Classes@{Num\+Classes}}
\index{Num\+Classes@{Num\+Classes}!mlpack\+::svm\+::\+Linear\+S\+VM@{mlpack\+::svm\+::\+Linear\+S\+VM}}
\subsubsection{Num\+Classes()\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily size\+\_\+t Num\+Classes (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Gets the number of classes. 



Definition at line 265 of file linear\+\_\+svm.\+hpp.

\mbox{\label{classmlpack_1_1svm_1_1LinearSVM_a043f0ccd62e6711a18e0d81047be9a0a}} 
\index{mlpack\+::svm\+::\+Linear\+S\+VM@{mlpack\+::svm\+::\+Linear\+S\+VM}!Parameters@{Parameters}}
\index{Parameters@{Parameters}!mlpack\+::svm\+::\+Linear\+S\+VM@{mlpack\+::svm\+::\+Linear\+S\+VM}}
\subsubsection{Parameters()\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily arma\+::mat\& Parameters (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Set the model parameters. 



Definition at line 281 of file linear\+\_\+svm.\+hpp.

\mbox{\label{classmlpack_1_1svm_1_1LinearSVM_aa68d74dc1e86e4352e00a3cab83a0e4a}} 
\index{mlpack\+::svm\+::\+Linear\+S\+VM@{mlpack\+::svm\+::\+Linear\+S\+VM}!Parameters@{Parameters}}
\index{Parameters@{Parameters}!mlpack\+::svm\+::\+Linear\+S\+VM@{mlpack\+::svm\+::\+Linear\+S\+VM}}
\subsubsection{Parameters()\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily const arma\+::mat\& Parameters (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Get the model parameters. 



Definition at line 283 of file linear\+\_\+svm.\+hpp.

\mbox{\label{classmlpack_1_1svm_1_1LinearSVM_af0dd9205158ccf7bcfcd8ff81f79c927}} 
\index{mlpack\+::svm\+::\+Linear\+S\+VM@{mlpack\+::svm\+::\+Linear\+S\+VM}!serialize@{serialize}}
\index{serialize@{serialize}!mlpack\+::svm\+::\+Linear\+S\+VM@{mlpack\+::svm\+::\+Linear\+S\+VM}}
\subsubsection{serialize()}
{\footnotesize\ttfamily void serialize (\begin{DoxyParamCaption}\item[{Archive \&}]{ar,  }\item[{const unsigned}]{int }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Serialize the \doxyref{Linear\+S\+VM}{p.}{classmlpack_1_1svm_1_1LinearSVM} model. 



Definition at line 294 of file linear\+\_\+svm.\+hpp.

\mbox{\label{classmlpack_1_1svm_1_1LinearSVM_a8944b0e0826ea837bc05f1a8df82abc7}} 
\index{mlpack\+::svm\+::\+Linear\+S\+VM@{mlpack\+::svm\+::\+Linear\+S\+VM}!Train@{Train}}
\index{Train@{Train}!mlpack\+::svm\+::\+Linear\+S\+VM@{mlpack\+::svm\+::\+Linear\+S\+VM}}
\subsubsection{Train()\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily double Train (\begin{DoxyParamCaption}\item[{const Mat\+Type \&}]{data,  }\item[{const arma\+::\+Row$<$ size\+\_\+t $>$ \&}]{labels,  }\item[{const size\+\_\+t}]{num\+Classes,  }\item[{Optimizer\+Type}]{optimizer,  }\item[{Callback\+Types \&\&...}]{callbacks }\end{DoxyParamCaption})}



Train the Linear S\+VM with the given training data. 


\begin{DoxyTemplParams}{Template Parameters}
{\em Optimizer\+Type} & Desired optimizer. \\
\hline
{\em Callback\+Types} & Types of Callback Functions. \\
\hline
\end{DoxyTemplParams}

\begin{DoxyParams}{Parameters}
{\em data} & Input training features. Each column associate with one sample. \\
\hline
{\em labels} & Labels associated with the feature data. \\
\hline
{\em num\+Classes} & Number of classes for classification. \\
\hline
{\em optimizer} & Desired optimizer. \\
\hline
{\em callbacks} & Callback Functions. See {\tt https\+://www.\+ensmallen.\+org/docs.\+html\#callback-\/documentation}. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Objective value of the final point. 
\end{DoxyReturn}
\mbox{\label{classmlpack_1_1svm_1_1LinearSVM_a9073fc80751696f6541dd50096b77a56}} 
\index{mlpack\+::svm\+::\+Linear\+S\+VM@{mlpack\+::svm\+::\+Linear\+S\+VM}!Train@{Train}}
\index{Train@{Train}!mlpack\+::svm\+::\+Linear\+S\+VM@{mlpack\+::svm\+::\+Linear\+S\+VM}}
\subsubsection{Train()\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily double Train (\begin{DoxyParamCaption}\item[{const Mat\+Type \&}]{data,  }\item[{const arma\+::\+Row$<$ size\+\_\+t $>$ \&}]{labels,  }\item[{const size\+\_\+t}]{num\+Classes = {\ttfamily 2},  }\item[{Optimizer\+Type}]{optimizer = {\ttfamily OptimizerType()} }\end{DoxyParamCaption})}



Train the Linear S\+VM with the given training data. 


\begin{DoxyTemplParams}{Template Parameters}
{\em Optimizer\+Type} & Desired optimizer. \\
\hline
\end{DoxyTemplParams}

\begin{DoxyParams}{Parameters}
{\em data} & Input training features. Each column associate with one sample. \\
\hline
{\em labels} & Labels associated with the feature data. \\
\hline
{\em num\+Classes} & Number of classes for classification. \\
\hline
{\em optimizer} & Desired optimizer. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Objective value of the final point. 
\end{DoxyReturn}


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/linear\+\_\+svm/\textbf{ linear\+\_\+svm.\+hpp}\end{DoxyCompactItemize}
