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);
45 const double&
Lambda()
const {
return lambda; }
52 const arma::Row<size_t>&
Responses()
const {
return responses; }
70 double Evaluate(
const arma::mat& parameters)
const;
89 double Evaluate(
const arma::mat& parameters,
91 const size_t batchSize = 1)
const;
100 void Gradient(
const arma::mat& parameters, arma::mat& gradient)
const;
115 template<
typename GradType>
116 void Gradient(
const arma::mat& parameters,
119 const size_t batchSize = 1)
const;
134 arma::sp_mat& gradient)
const;
140 template<
typename GradType>
142 GradType& gradient)
const;
149 template<
typename GradType>
153 const size_t batchSize = 1)
const;
167 arma::Row<size_t> responses;
176 #include "logistic_regression_function_impl.hpp" 178 #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.
Linear algebra utility functions, generally performed on matrices or vectors.
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...
size_t NumFunctions() const
Return the number of separable functions (the number of predictor points).
void Shuffle()
Shuffle the order of function visitation.
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...