SYNOPSIS

Public Member Functions

LogisticRegressionFunction (const arma::mat &predictors, const arma::vec &responses, const double lambda=0)

LogisticRegressionFunction (const arma::mat &predictors, const arma::vec &responses, const arma::mat &initialPoint, const double lambda=0)

double Evaluate (const arma::mat ¶meters) const

Evaluate the logistic regression log-likelihood function with the given parameters. double Evaluate (const arma::mat ¶meters, const size_t i) const

Evaluate the logistic regression log-likelihood function with the given parameters, but using only one data point. const arma::mat & GetInitialPoint () const

Return the initial point for the optimization. void Gradient (const arma::mat ¶meters, arma::mat &gradient) const

Evaluate the gradient of the logistic regression log-likelihood function with the given parameters. void Gradient (const arma::mat ¶meters, const size_t i, arma::mat &gradient) const

Evaluate the gradient of the logistic regression log-likelihood function with the given parameters, and with respect to only one point in the dataset. const arma::mat & InitialPoint () const

Return the initial point for the optimization. arma::mat & InitialPoint ()

Modify the initial point for the optimization. const double & Lambda () const

Return the regularization parameter (lambda). double & Lambda ()

Modify the regularization parameter (lambda). size_t NumFunctions () const

Return the number of separable functions (the number of predictor points). const arma::mat & Predictors () const

Return the matrix of predictors. const arma::vec & Responses () const

Return the vector of responses.

Private Attributes

arma::mat initialPoint

The initial point, from which to start the optimization. double lambda

The regularization parameter for L2-regularization. const arma::mat & predictors

The matrix of data points (predictors). const arma::vec & responses

The vector of responses to the input data points.

Detailed Description

The log-likelihood function for the logistic regression objective function.

This is used by various mlpack optimizers to train a logistic regression model.

Definition at line 37 of file logistic_regression_function.hpp.

Constructor & Destructor Documentation

mlpack::regression::LogisticRegressionFunction::LogisticRegressionFunction (const arma::mat &predictors, const arma::vec &responses, const doublelambda = \fC0\fP)

mlpack::regression::LogisticRegressionFunction::LogisticRegressionFunction (const arma::mat &predictors, const arma::vec &responses, const arma::mat &initialPoint, const doublelambda = \fC0\fP)

Member Function Documentation

double mlpack::regression::LogisticRegressionFunction::Evaluate (const arma::mat ¶meters) const

Evaluate the logistic regression log-likelihood function with the given parameters. Note that if a point has 0 probability of being classified directly with the given parameters, then Evaluate() will return nan (this is kind of a corner case and should not happen for reasonable models).

The optimum (minimum) of this function is 0.0, and occurs when each point is classified correctly with very high probability.

Parameters:

parameters Vector of logistic regression parameters.

double mlpack::regression::LogisticRegressionFunction::Evaluate (const arma::mat ¶meters, const size_ti) const

Evaluate the logistic regression log-likelihood function with the given parameters, but using only one data point. This is useful for optimizers such as SGD, which require a separable objective function. Note that if the point has 0 probability of being classified correctly with the given parameters, then Evaluate() will return nan (this is kind of a corner case and should not happen for reasonable models).

The optimum (minimum) of this function is 0.0, and occurs when the point is classified correctly with very high probability.

Parameters:

parameters Vector of logistic regression parameters.

i Index of point to use for objective function evaluation.

const arma::mat& mlpack::regression::LogisticRegressionFunction::GetInitialPoint () const\fC [inline]\fP

Return the initial point for the optimization.

Definition at line 117 of file logistic_regression_function.hpp.

References initialPoint.

void mlpack::regression::LogisticRegressionFunction::Gradient (const arma::mat ¶meters, arma::mat &gradient) const

Evaluate the gradient of the logistic regression log-likelihood function with the given parameters.

Parameters:

parameters Vector of logistic regression parameters.

gradient Vector to output gradient into.

void mlpack::regression::LogisticRegressionFunction::Gradient (const arma::mat ¶meters, const size_ti, arma::mat &gradient) const

Evaluate the gradient of the logistic regression log-likelihood function with the given parameters, and with respect to only one point in the dataset. This is useful for optimizers such as SGD, which require a separable objective function.

Parameters:

parameters Vector of logistic regression parameters.

i Index of points to use for objective function gradient evaluation.

gradient Vector to output gradient into.

const arma::mat& mlpack::regression::LogisticRegressionFunction::InitialPoint () const\fC [inline]\fP

Return the initial point for the optimization.

Definition at line 50 of file logistic_regression_function.hpp.

References initialPoint.

arma::mat& mlpack::regression::LogisticRegressionFunction::InitialPoint ()\fC [inline]\fP

Modify the initial point for the optimization.

Definition at line 52 of file logistic_regression_function.hpp.

References initialPoint.

const double& mlpack::regression::LogisticRegressionFunction::Lambda () const\fC [inline]\fP

Return the regularization parameter (lambda).

Definition at line 55 of file logistic_regression_function.hpp.

References lambda.

double& mlpack::regression::LogisticRegressionFunction::Lambda ()\fC [inline]\fP

Modify the regularization parameter (lambda).

Definition at line 57 of file logistic_regression_function.hpp.

References lambda.

size_t mlpack::regression::LogisticRegressionFunction::NumFunctions () const\fC [inline]\fP

Return the number of separable functions (the number of predictor points).

Definition at line 120 of file logistic_regression_function.hpp.

const arma::mat& mlpack::regression::LogisticRegressionFunction::Predictors () const\fC [inline]\fP

Return the matrix of predictors.

Definition at line 60 of file logistic_regression_function.hpp.

References predictors.

const arma::vec& mlpack::regression::LogisticRegressionFunction::Responses () const\fC [inline]\fP

Return the vector of responses.

Definition at line 62 of file logistic_regression_function.hpp.

References responses.

Member Data Documentation

arma::mat mlpack::regression::LogisticRegressionFunction::initialPoint\fC [private]\fP

The initial point, from which to start the optimization.

Definition at line 124 of file logistic_regression_function.hpp.

Referenced by GetInitialPoint(), and InitialPoint().

double mlpack::regression::LogisticRegressionFunction::lambda\fC [private]\fP

The regularization parameter for L2-regularization.

Definition at line 130 of file logistic_regression_function.hpp.

Referenced by Lambda().

const arma::mat& mlpack::regression::LogisticRegressionFunction::predictors\fC [private]\fP

The matrix of data points (predictors).

Definition at line 126 of file logistic_regression_function.hpp.

Referenced by Predictors().

const arma::vec& mlpack::regression::LogisticRegressionFunction::responses\fC [private]\fP

The vector of responses to the input data points.

Definition at line 128 of file logistic_regression_function.hpp.

Referenced by Responses().

Author

Generated automatically by Doxygen for MLPACK from the source code.