14 #ifndef MLPACK_METHODS_LOGISTIC_REGRESSION_LOGISTIC_REGRESSION_FUNCTION_HPP 15 #define MLPACK_METHODS_LOGISTIC_REGRESSION_LOGISTIC_REGRESSION_FUNCTION_HPP 20 namespace regression {
27 template<
typename MatType = arma::mat>
32 const arma::Row<size_t>& responses,
33 const double lambda = 0);
36 const arma::Row<size_t>& responses,
37 const arma::vec& initialPoint,
38 const double lambda = 0);
46 const double&
Lambda()
const {
return lambda; }
53 const arma::Row<size_t>&
Responses()
const {
return responses; }
71 double Evaluate(
const arma::mat& parameters)
const;
90 double Evaluate(
const arma::mat& parameters,
92 const size_t batchSize = 1)
const;
101 void Gradient(
const arma::mat& parameters, arma::mat& gradient)
const;
116 template<
typename GradType>
117 void Gradient(
const arma::mat& parameters,
120 const size_t batchSize = 1)
const;
135 arma::sp_mat& gradient)
const;
141 template<
typename GradType>
143 GradType& gradient)
const;
145 template<
typename GradType>
149 const size_t batchSize = 1)
const;
162 arma::mat initialPoint;
168 arma::Row<size_t> responses;
177 #include "logistic_regression_function_impl.hpp" 179 #endif // MLPACK_METHODS_LOGISTIC_REGRESSION_LOGISTIC_REGRESSION_FUNCTION_HPP LogisticRegressionFunction(const MatType &predictors, const arma::Row< size_t > &responses, const double lambda=0)
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...