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;
178 #endif // MLPACK_METHODS_LOGISTIC_REGRESSION_LOGISTIC_REGRESSION_FUNCTION_HPP The log-likelihood function for the logistic regression objective function.
Definition: logistic_regression_function.hpp:30
void Gradient(const arma::mat ¶meters, arma::mat &gradient) const
Evaluate the gradient of the logistic regression log-likelihood function with the given parameters...
Definition: logistic_regression_function_impl.hpp:137
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
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...
Definition: logistic_regression_function_impl.hpp:188
size_t NumFunctions() const
Return the number of separable functions (the number of predictor points).
Definition: logistic_regression_function.hpp:156
The core includes that mlpack expects; standard C++ includes and Armadillo.
double Evaluate(const arma::mat ¶meters) const
Evaluate the logistic regression log-likelihood function with the given parameters.
Definition: logistic_regression_function_impl.hpp:69
double & Lambda()
Modify the regularization parameter (lambda).
Definition: logistic_regression_function.hpp:47
double EvaluateWithGradient(const arma::mat ¶meters, GradType &gradient) const
Evaluate the objective function and gradient of the logistic regression log-likelihood function simul...
Definition: logistic_regression_function_impl.hpp:211
const double & Lambda() const
Return the regularization parameter (lambda).
Definition: logistic_regression_function.hpp:45
void Shuffle()
Shuffle the order of function visitation.
Definition: logistic_regression_function_impl.hpp:48
const MatType & Predictors() const
Return the matrix of predictors.
Definition: logistic_regression_function.hpp:50
const arma::Row< size_t > & Responses() const
Return the vector of responses.
Definition: logistic_regression_function.hpp:52
size_t NumFeatures() const
Return the number of features(add 1 for the intercept term).
Definition: logistic_regression_function.hpp:159
LogisticRegressionFunction(const MatType &predictors, const arma::Row< size_t > &responses, const double lambda=0)
Creates the LogisticRegressionFunction.
Definition: logistic_regression_function_impl.hpp:24