13 #ifndef MLPACK_METHODS_SOFTMAX_REGRESSION_SOFTMAX_REGRESSION_FUNCTION_HPP 14 #define MLPACK_METHODS_SOFTMAX_REGRESSION_SOFTMAX_REGRESSION_FUNCTION_HPP 19 namespace regression {
36 const arma::Row<size_t>& labels,
38 const double lambda = 0.0001,
54 const size_t numClasses,
67 const size_t featureSize,
68 const size_t numClasses,
90 arma::mat& probabilities)
const;
101 double Evaluate(
const arma::mat& parameters)
const;
112 void Gradient(
const arma::mat& parameters, arma::mat& gradient)
const;
double & Lambda()
Sets the regularization parameter.
Linear algebra utility functions, generally performed on matrices or vectors.
void GetProbabilitiesMatrix(const arma::mat ¶meters, arma::mat &probabilities) const
Evaluate the probabilities matrix with the passed parameters.
The core includes that mlpack expects; standard C++ includes and Armadillo.
bool fitIntercept
Intercept term flag.
double Evaluate(const arma::mat ¶meters) const
Evaluates the objective function of the softmax regression model using the given parameters.
size_t NumClasses() const
Gets the number of classes.
const arma::mat & data
Training data matrix.
const arma::mat & GetInitialPoint() const
Return the initial point for the optimization.
const arma::mat InitializeWeights()
Initializes the parameters of the model to suitable values.
double lambda
L2-regularization constant.
size_t FeatureSize() const
Gets the features size of the training data.
arma::sp_mat groundTruth
Label matrix for the provided data.
bool FitIntercept() const
Gets the intercept flag.
SoftmaxRegressionFunction(const arma::mat &data, const arma::Row< size_t > &labels, const size_t numClasses, const double lambda=0.0001, const bool fitIntercept=false)
Construct the Softmax Regression objective function with the given parameters.
void GetGroundTruthMatrix(const arma::Row< size_t > &labels, arma::sp_mat &groundTruth)
Constructs the ground truth label matrix with the passed labels.
void Gradient(const arma::mat ¶meters, arma::mat &gradient) const
Evaluates the gradient values of the objective function given the current set of parameters.
double Lambda() const
Gets the regularization parameter.
arma::mat initialPoint
Initial parameter point.
size_t numClasses
Number of classes.