14 #ifndef MLPACK_METHODS_LOGISTIC_REGRESSION_LOGISTIC_REGRESSION_FUNCTION_HPP 15 #define MLPACK_METHODS_LOGISTIC_REGRESSION_LOGISTIC_REGRESSION_FUNCTION_HPP 22 namespace regression {
29 template<
typename MatType = arma::mat>
41 const arma::Row<size_t>& responses,
42 const double lambda = 0);
53 const arma::Row<size_t>& responses,
54 const arma::vec& initialPoint,
55 const double lambda = 0);
63 const double&
Lambda()
const {
return lambda; }
70 const arma::Row<size_t>&
Responses()
const {
return responses; }
88 double Evaluate(
const arma::mat& parameters)
const;
107 double Evaluate(
const arma::mat& parameters,
109 const size_t batchSize = 1)
const;
118 void Gradient(
const arma::mat& parameters, arma::mat& gradient)
const;
133 template<
typename GradType>
134 void Gradient(
const arma::mat& parameters,
137 const size_t batchSize = 1)
const;
152 arma::sp_mat& gradient)
const;
158 template<
typename GradType>
160 GradType& gradient)
const;
167 template<
typename GradType>
171 const size_t batchSize = 1)
const;
184 arma::mat initialPoint;
190 arma::Row<size_t> responses;
199 #include "logistic_regression_function_impl.hpp" 201 #endif // MLPACK_METHODS_LOGISTIC_REGRESSION_LOGISTIC_REGRESSION_FUNCTION_HPP LogisticRegressionFunction(const MatType &predictors, const arma::Row< size_t > &responses, const double lambda=0)
Creates the LogisticRegressionFunction.
The log-likelihood function for the logistic regression objective function.
double Evaluate(const arma::mat ¶meters) const
Evaluate the logistic regression log-likelihood function with the given parameters.
The core includes that mlpack expects; standard C++ includes and Armadillo.
const double & Lambda() const
Return the regularization parameter (lambda).
double EvaluateWithGradient(const arma::mat ¶meters, GradType &gradient) const
Evaluate the objective function and gradient of the logistic regression log-likelihood function simul...
const arma::mat & GetInitialPoint() const
Return the initial point for the optimization.
size_t NumFunctions() const
Return the number of separable functions (the number of predictor points).
void Shuffle()
Shuffle the order of function visitation.
arma::mat & InitialPoint()
Modify the initial point for the optimization.
const arma::mat & InitialPoint() const
Return the initial point for the optimization.
const MatType & Predictors() const
Return the matrix of predictors.
const arma::Row< size_t > & Responses() const
Return the vector of responses.
double & Lambda()
Modify the regularization parameter (lambda).
void PartialGradient(const arma::mat ¶meters, const size_t j, arma::sp_mat &gradient) const
Evaluate the gradient of the logistic regression log-likelihood function with the given parameters...
size_t NumFeatures() const
Return the number of features(add 1 for the intercept term).
void Gradient(const arma::mat ¶meters, arma::mat &gradient) const
Evaluate the gradient of the logistic regression log-likelihood function with the given parameters...