\section{Softmax\+Regression Class Reference}
\label{classmlpack_1_1regression_1_1SoftmaxRegression}\index{Softmax\+Regression@{Softmax\+Regression}}


Softmax Regression is a classifier which can be used for classification when the data available can take two or more class values.  


\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\textbf{ Softmax\+Regression} (const size\+\_\+t input\+Size=0, const size\+\_\+t num\+Classes=0, const bool fit\+Intercept=false)
\begin{DoxyCompactList}\small\item\em Initialize the \doxyref{Softmax\+Regression}{p.}{classmlpack_1_1regression_1_1SoftmaxRegression} without performing training. \end{DoxyCompactList}\item 
{\footnotesize template$<$typename Optimizer\+Type  = ens\+::\+L\+\_\+\+B\+F\+GS$>$ }\\\textbf{ Softmax\+Regression} (const arma\+::mat \&data, const arma\+::\+Row$<$ size\+\_\+t $>$ \&labels, const size\+\_\+t num\+Classes, const double lambda=0.\+0001, const bool fit\+Intercept=false, Optimizer\+Type optimizer=Optimizer\+Type())
\begin{DoxyCompactList}\small\item\em Construct the \doxyref{Softmax\+Regression}{p.}{classmlpack_1_1regression_1_1SoftmaxRegression} class with the provided data and labels. \end{DoxyCompactList}\item 
{\footnotesize template$<$typename Optimizer\+Type , typename... Callback\+Types$>$ }\\\textbf{ Softmax\+Regression} (const arma\+::mat \&data, const arma\+::\+Row$<$ size\+\_\+t $>$ \&labels, const size\+\_\+t num\+Classes, const double lambda, const bool fit\+Intercept, Optimizer\+Type optimizer, Callback\+Types \&\&... callbacks)
\begin{DoxyCompactList}\small\item\em Construct the \doxyref{Softmax\+Regression}{p.}{classmlpack_1_1regression_1_1SoftmaxRegression} class with the provided data and labels. \end{DoxyCompactList}\item 
void \textbf{ Classify} (const arma\+::mat \&dataset, 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 
{\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 
void \textbf{ Classify} (const arma\+::mat \&dataset, arma\+::\+Row$<$ size\+\_\+t $>$ \&labels, arma\+::mat \&probabilities) const
\begin{DoxyCompactList}\small\item\em Classify the given points, returning class probabilities and predicted class label for each point. \end{DoxyCompactList}\item 
void \textbf{ Classify} (const arma\+::mat \&dataset, arma\+::mat \&probabilities) const
\begin{DoxyCompactList}\small\item\em Classify the given points, returning class probabilities for each point. \end{DoxyCompactList}\item 
double \textbf{ Compute\+Accuracy} (const arma\+::mat \&test\+Data, const arma\+::\+Row$<$ size\+\_\+t $>$ \&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 
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} () const
\begin{DoxyCompactList}\small\item\em Gets the intercept term flag. We can\textquotesingle{}t change this after training. \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 Get 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{Softmax\+Regression}{p.}{classmlpack_1_1regression_1_1SoftmaxRegression} model. \end{DoxyCompactList}\item 
{\footnotesize template$<$typename Optimizer\+Type  = ens\+::\+L\+\_\+\+B\+F\+GS$>$ }\\double \textbf{ Train} (const arma\+::mat \&data, const arma\+::\+Row$<$ size\+\_\+t $>$ \&labels, const size\+\_\+t num\+Classes, Optimizer\+Type optimizer=Optimizer\+Type())
\begin{DoxyCompactList}\small\item\em Train the softmax regression with the given training data. \end{DoxyCompactList}\item 
{\footnotesize template$<$typename Optimizer\+Type  = ens\+::\+L\+\_\+\+B\+F\+GS, typename... Callback\+Types$>$ }\\double \textbf{ Train} (const arma\+::mat \&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 softmax regression with the given training data. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Softmax Regression is a classifier which can be used for classification when the data available can take two or more class values. 

It is a generalization of Logistic Regression (which is used only for binary classification). The model has a different set of parameters for each class, but can be easily converted into a vectorized implementation as has been done in this module. The model can be used for direct classification of feature data or in conjunction with unsupervised learning methods. More technical details about the model can be found on the following webpage\+:

{\tt http\+://ufldl.\+stanford.\+edu/wiki/index.\+php/\+Softmax\+\_\+\+Regression}

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


\begin{DoxyCode}
arma::mat trainData; \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 = 10; \textcolor{comment}{// Number of classes.}
\textcolor{keyword}{const} \textcolor{keywordtype}{double} lambda = 0.0001; \textcolor{comment}{// L2-Regularization parameter.}

\textcolor{keyword}{const} \textcolor{keywordtype}{size\_t} numBasis = 5; \textcolor{comment}{// Parameter required for L-BFGS algorithm.}
\textcolor{keyword}{const} \textcolor{keywordtype}{size\_t} numIterations = 100; \textcolor{comment}{// Maximum number of iterations.}

\textcolor{comment}{// Train the model using an instantiated optimizer for the training.}
SoftmaxRegression regressor(trainData.n\_rows, numClasses);
ens::L\_BFGS optimizer(numBasis, numIterations);
regressor.Train(trainData, labels, numClasses, std::move(optimizer));

arma::mat testData; \textcolor{comment}{// Test data matrix.}
arma::Row<size\_t> predictions; \textcolor{comment}{// Vectors to store predictions in.}

\textcolor{comment}{// Obtain predictions from both the learned models.}
regressor.Classify(testData, predictions);
\end{DoxyCode}
 

Definition at line 59 of file softmax\+\_\+regression.\+hpp.



\subsection{Constructor \& Destructor Documentation}
\mbox{\label{classmlpack_1_1regression_1_1SoftmaxRegression_ac58494dce3a8588ef3eab8a2a768a9b7}} 
\index{mlpack\+::regression\+::\+Softmax\+Regression@{mlpack\+::regression\+::\+Softmax\+Regression}!Softmax\+Regression@{Softmax\+Regression}}
\index{Softmax\+Regression@{Softmax\+Regression}!mlpack\+::regression\+::\+Softmax\+Regression@{mlpack\+::regression\+::\+Softmax\+Regression}}
\subsubsection{Softmax\+Regression()\hspace{0.1cm}{\footnotesize\ttfamily [1/3]}}
{\footnotesize\ttfamily \textbf{ Softmax\+Regression} (\begin{DoxyParamCaption}\item[{const size\+\_\+t}]{input\+Size = {\ttfamily 0},  }\item[{const size\+\_\+t}]{num\+Classes = {\ttfamily 0},  }\item[{const bool}]{fit\+Intercept = {\ttfamily false} }\end{DoxyParamCaption})}



Initialize the \doxyref{Softmax\+Regression}{p.}{classmlpack_1_1regression_1_1SoftmaxRegression} without performing training. 

Default value of lambda is 0.\+0001. Be sure to use \doxyref{Train()}{p.}{classmlpack_1_1regression_1_1SoftmaxRegression_a38907cc8f0a90a02d12c7675a49dc924} before calling \doxyref{Classify()}{p.}{classmlpack_1_1regression_1_1SoftmaxRegression_a25d8b43bbbdabff816a6769ab7b35557} or \doxyref{Compute\+Accuracy()}{p.}{classmlpack_1_1regression_1_1SoftmaxRegression_af5c25234688c75c84a65607e820985d1}, 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 fit\+Intercept} & add intercept term or not. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1regression_1_1SoftmaxRegression_a9a597e9981cdce3d51df072db082ee44}} 
\index{mlpack\+::regression\+::\+Softmax\+Regression@{mlpack\+::regression\+::\+Softmax\+Regression}!Softmax\+Regression@{Softmax\+Regression}}
\index{Softmax\+Regression@{Softmax\+Regression}!mlpack\+::regression\+::\+Softmax\+Regression@{mlpack\+::regression\+::\+Softmax\+Regression}}
\subsubsection{Softmax\+Regression()\hspace{0.1cm}{\footnotesize\ttfamily [2/3]}}
{\footnotesize\ttfamily \textbf{ Softmax\+Regression} (\begin{DoxyParamCaption}\item[{const arma\+::mat \&}]{data,  }\item[{const arma\+::\+Row$<$ size\+\_\+t $>$ \&}]{labels,  }\item[{const size\+\_\+t}]{num\+Classes,  }\item[{const double}]{lambda = {\ttfamily 0.0001},  }\item[{const bool}]{fit\+Intercept = {\ttfamily false},  }\item[{Optimizer\+Type}]{optimizer = {\ttfamily OptimizerType()} }\end{DoxyParamCaption})}



Construct the \doxyref{Softmax\+Regression}{p.}{classmlpack_1_1regression_1_1SoftmaxRegression} 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 optimizer type. \\
\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 lambda} & L2-\/regularization constant. \\
\hline
{\em fit\+Intercept} & add intercept term or not. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1regression_1_1SoftmaxRegression_a8f923481e4c78c1b0a7d50cf6aed2bfe}} 
\index{mlpack\+::regression\+::\+Softmax\+Regression@{mlpack\+::regression\+::\+Softmax\+Regression}!Softmax\+Regression@{Softmax\+Regression}}
\index{Softmax\+Regression@{Softmax\+Regression}!mlpack\+::regression\+::\+Softmax\+Regression@{mlpack\+::regression\+::\+Softmax\+Regression}}
\subsubsection{Softmax\+Regression()\hspace{0.1cm}{\footnotesize\ttfamily [3/3]}}
{\footnotesize\ttfamily \textbf{ Softmax\+Regression} (\begin{DoxyParamCaption}\item[{const arma\+::mat \&}]{data,  }\item[{const arma\+::\+Row$<$ size\+\_\+t $>$ \&}]{labels,  }\item[{const size\+\_\+t}]{num\+Classes,  }\item[{const double}]{lambda,  }\item[{const bool}]{fit\+Intercept,  }\item[{Optimizer\+Type}]{optimizer,  }\item[{Callback\+Types \&\&...}]{callbacks }\end{DoxyParamCaption})}



Construct the \doxyref{Softmax\+Regression}{p.}{classmlpack_1_1regression_1_1SoftmaxRegression} 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 optimizer type. \\
\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 fit\+Intercept} & add intercept term or not. \\
\hline
{\em optimizer} & Desired optimizer. \\
\hline
{\em callbacks} & Callback function for ensmallen optimizer {\ttfamily Optimizer\+Type}. See {\tt https\+://www.\+ensmallen.\+org/docs.\+html\#callback-\/documentation}. \\
\hline
\end{DoxyParams}


\subsection{Member Function Documentation}
\mbox{\label{classmlpack_1_1regression_1_1SoftmaxRegression_a25d8b43bbbdabff816a6769ab7b35557}} 
\index{mlpack\+::regression\+::\+Softmax\+Regression@{mlpack\+::regression\+::\+Softmax\+Regression}!Classify@{Classify}}
\index{Classify@{Classify}!mlpack\+::regression\+::\+Softmax\+Regression@{mlpack\+::regression\+::\+Softmax\+Regression}}
\subsubsection{Classify()\hspace{0.1cm}{\footnotesize\ttfamily [1/4]}}
{\footnotesize\ttfamily void Classify (\begin{DoxyParamCaption}\item[{const arma\+::mat \&}]{dataset,  }\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 dataset} & Set of points to classify. \\
\hline
{\em labels} & Predicted labels for each point. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1regression_1_1SoftmaxRegression_aa610310b354b7badd88041ca07883569}} 
\index{mlpack\+::regression\+::\+Softmax\+Regression@{mlpack\+::regression\+::\+Softmax\+Regression}!Classify@{Classify}}
\index{Classify@{Classify}!mlpack\+::regression\+::\+Softmax\+Regression@{mlpack\+::regression\+::\+Softmax\+Regression}}
\subsubsection{Classify()\hspace{0.1cm}{\footnotesize\ttfamily [2/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 probabilites 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_1regression_1_1SoftmaxRegression_a5ad08eb2229120c150692a9a72acbc78}} 
\index{mlpack\+::regression\+::\+Softmax\+Regression@{mlpack\+::regression\+::\+Softmax\+Regression}!Classify@{Classify}}
\index{Classify@{Classify}!mlpack\+::regression\+::\+Softmax\+Regression@{mlpack\+::regression\+::\+Softmax\+Regression}}
\subsubsection{Classify()\hspace{0.1cm}{\footnotesize\ttfamily [3/4]}}
{\footnotesize\ttfamily void Classify (\begin{DoxyParamCaption}\item[{const arma\+::mat \&}]{dataset,  }\item[{arma\+::\+Row$<$ size\+\_\+t $>$ \&}]{labels,  }\item[{arma\+::mat \&}]{probabilities }\end{DoxyParamCaption}) const}



Classify the given points, returning class probabilities and predicted class label 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 dataset} & Matrix of data points to be classified. \\
\hline
{\em labels} & Predicted labels for each point. \\
\hline
{\em probabilities} & Class probabilities for each point. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1regression_1_1SoftmaxRegression_a69f3901bd0cb524d727a5273609456aa}} 
\index{mlpack\+::regression\+::\+Softmax\+Regression@{mlpack\+::regression\+::\+Softmax\+Regression}!Classify@{Classify}}
\index{Classify@{Classify}!mlpack\+::regression\+::\+Softmax\+Regression@{mlpack\+::regression\+::\+Softmax\+Regression}}
\subsubsection{Classify()\hspace{0.1cm}{\footnotesize\ttfamily [4/4]}}
{\footnotesize\ttfamily void Classify (\begin{DoxyParamCaption}\item[{const arma\+::mat \&}]{dataset,  }\item[{arma\+::mat \&}]{probabilities }\end{DoxyParamCaption}) const}



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


\begin{DoxyParams}{Parameters}
{\em dataset} & Matrix of data points to be classified. \\
\hline
{\em probabilities} & Class probabilities for each point. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1regression_1_1SoftmaxRegression_af5c25234688c75c84a65607e820985d1}} 
\index{mlpack\+::regression\+::\+Softmax\+Regression@{mlpack\+::regression\+::\+Softmax\+Regression}!Compute\+Accuracy@{Compute\+Accuracy}}
\index{Compute\+Accuracy@{Compute\+Accuracy}!mlpack\+::regression\+::\+Softmax\+Regression@{mlpack\+::regression\+::\+Softmax\+Regression}}
\subsubsection{Compute\+Accuracy()}
{\footnotesize\ttfamily double Compute\+Accuracy (\begin{DoxyParamCaption}\item[{const arma\+::mat \&}]{test\+Data,  }\item[{const arma\+::\+Row$<$ size\+\_\+t $>$ \&}]{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 labels} & Vector of labels associated with the data. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1regression_1_1SoftmaxRegression_a71c4a6c2db59e7a14196cc6e9846a29b}} 
\index{mlpack\+::regression\+::\+Softmax\+Regression@{mlpack\+::regression\+::\+Softmax\+Regression}!Feature\+Size@{Feature\+Size}}
\index{Feature\+Size@{Feature\+Size}!mlpack\+::regression\+::\+Softmax\+Regression@{mlpack\+::regression\+::\+Softmax\+Regression}}
\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 227 of file softmax\+\_\+regression.\+hpp.

\mbox{\label{classmlpack_1_1regression_1_1SoftmaxRegression_a2878e0828ecdc1d486b0f43a81f95059}} 
\index{mlpack\+::regression\+::\+Softmax\+Regression@{mlpack\+::regression\+::\+Softmax\+Regression}!Fit\+Intercept@{Fit\+Intercept}}
\index{Fit\+Intercept@{Fit\+Intercept}!mlpack\+::regression\+::\+Softmax\+Regression@{mlpack\+::regression\+::\+Softmax\+Regression}}
\subsubsection{Fit\+Intercept()}
{\footnotesize\ttfamily bool Fit\+Intercept (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Gets the intercept term flag. We can\textquotesingle{}t change this after training. 



Definition at line 219 of file softmax\+\_\+regression.\+hpp.

\mbox{\label{classmlpack_1_1regression_1_1SoftmaxRegression_aaf66629b989a326453647f42443c6a0c}} 
\index{mlpack\+::regression\+::\+Softmax\+Regression@{mlpack\+::regression\+::\+Softmax\+Regression}!Lambda@{Lambda}}
\index{Lambda@{Lambda}!mlpack\+::regression\+::\+Softmax\+Regression@{mlpack\+::regression\+::\+Softmax\+Regression}}
\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 214 of file softmax\+\_\+regression.\+hpp.

\mbox{\label{classmlpack_1_1regression_1_1SoftmaxRegression_a53535041275cedd0ec3de67ca032aa94}} 
\index{mlpack\+::regression\+::\+Softmax\+Regression@{mlpack\+::regression\+::\+Softmax\+Regression}!Lambda@{Lambda}}
\index{Lambda@{Lambda}!mlpack\+::regression\+::\+Softmax\+Regression@{mlpack\+::regression\+::\+Softmax\+Regression}}
\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 216 of file softmax\+\_\+regression.\+hpp.

\mbox{\label{classmlpack_1_1regression_1_1SoftmaxRegression_ac9b6fde1dc1604ba744b1e6ab5b1d499}} 
\index{mlpack\+::regression\+::\+Softmax\+Regression@{mlpack\+::regression\+::\+Softmax\+Regression}!Num\+Classes@{Num\+Classes}}
\index{Num\+Classes@{Num\+Classes}!mlpack\+::regression\+::\+Softmax\+Regression@{mlpack\+::regression\+::\+Softmax\+Regression}}
\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 209 of file softmax\+\_\+regression.\+hpp.

\mbox{\label{classmlpack_1_1regression_1_1SoftmaxRegression_a088ebfdf3c7a9e7eea81716d0c55b5a3}} 
\index{mlpack\+::regression\+::\+Softmax\+Regression@{mlpack\+::regression\+::\+Softmax\+Regression}!Num\+Classes@{Num\+Classes}}
\index{Num\+Classes@{Num\+Classes}!mlpack\+::regression\+::\+Softmax\+Regression@{mlpack\+::regression\+::\+Softmax\+Regression}}
\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 211 of file softmax\+\_\+regression.\+hpp.

\mbox{\label{classmlpack_1_1regression_1_1SoftmaxRegression_a043f0ccd62e6711a18e0d81047be9a0a}} 
\index{mlpack\+::regression\+::\+Softmax\+Regression@{mlpack\+::regression\+::\+Softmax\+Regression}!Parameters@{Parameters}}
\index{Parameters@{Parameters}!mlpack\+::regression\+::\+Softmax\+Regression@{mlpack\+::regression\+::\+Softmax\+Regression}}
\subsubsection{Parameters()\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily arma\+::mat\& Parameters (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Get the model parameters. 



Definition at line 222 of file softmax\+\_\+regression.\+hpp.

\mbox{\label{classmlpack_1_1regression_1_1SoftmaxRegression_aa68d74dc1e86e4352e00a3cab83a0e4a}} 
\index{mlpack\+::regression\+::\+Softmax\+Regression@{mlpack\+::regression\+::\+Softmax\+Regression}!Parameters@{Parameters}}
\index{Parameters@{Parameters}!mlpack\+::regression\+::\+Softmax\+Regression@{mlpack\+::regression\+::\+Softmax\+Regression}}
\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 224 of file softmax\+\_\+regression.\+hpp.

\mbox{\label{classmlpack_1_1regression_1_1SoftmaxRegression_af0dd9205158ccf7bcfcd8ff81f79c927}} 
\index{mlpack\+::regression\+::\+Softmax\+Regression@{mlpack\+::regression\+::\+Softmax\+Regression}!serialize@{serialize}}
\index{serialize@{serialize}!mlpack\+::regression\+::\+Softmax\+Regression@{mlpack\+::regression\+::\+Softmax\+Regression}}
\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{Softmax\+Regression}{p.}{classmlpack_1_1regression_1_1SoftmaxRegression} model. 



Definition at line 235 of file softmax\+\_\+regression.\+hpp.

\mbox{\label{classmlpack_1_1regression_1_1SoftmaxRegression_a38907cc8f0a90a02d12c7675a49dc924}} 
\index{mlpack\+::regression\+::\+Softmax\+Regression@{mlpack\+::regression\+::\+Softmax\+Regression}!Train@{Train}}
\index{Train@{Train}!mlpack\+::regression\+::\+Softmax\+Regression@{mlpack\+::regression\+::\+Softmax\+Regression}}
\subsubsection{Train()\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily double Train (\begin{DoxyParamCaption}\item[{const arma\+::mat \&}]{data,  }\item[{const arma\+::\+Row$<$ size\+\_\+t $>$ \&}]{labels,  }\item[{const size\+\_\+t}]{num\+Classes,  }\item[{Optimizer\+Type}]{optimizer = {\ttfamily OptimizerType()} }\end{DoxyParamCaption})}



Train the softmax regression with the given training data. 


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

\begin{DoxyParams}{Parameters}
{\em data} & Input data with each column as one example. \\
\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}
\mbox{\label{classmlpack_1_1regression_1_1SoftmaxRegression_ad62fd3ac08f393bfea5ee854bfc582a0}} 
\index{mlpack\+::regression\+::\+Softmax\+Regression@{mlpack\+::regression\+::\+Softmax\+Regression}!Train@{Train}}
\index{Train@{Train}!mlpack\+::regression\+::\+Softmax\+Regression@{mlpack\+::regression\+::\+Softmax\+Regression}}
\subsubsection{Train()\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily double Train (\begin{DoxyParamCaption}\item[{const arma\+::mat \&}]{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 softmax regression with the given training data. 


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

\begin{DoxyParams}{Parameters}
{\em data} & Input data with each column as one example. \\
\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 function for ensmallen optimizer {\ttfamily Optimizer\+Type}. See {\tt https\+://www.\+ensmallen.\+org/docs.\+html\#callback-\/documentation}. \\
\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-\/git/src/mlpack/methods/softmax\+\_\+regression/\textbf{ softmax\+\_\+regression.\+hpp}\end{DoxyCompactItemize}
