14#ifndef MLPACK_METHODS_LOGISTIC_REGRESSION_LOGISTIC_REGRESSION_FUNCTION_HPP
15#define MLPACK_METHODS_LOGISTIC_REGRESSION_LOGISTIC_REGRESSION_FUNCTION_HPP
29template<
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;
91 const size_t batchSize = 1)
const;
100 void Gradient(
const arma::mat& parameters, arma::mat& gradient)
const;
115 template<
typename GradType>
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"
The log-likelihood function for the logistic regression objective function.
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.
size_t NumFeatures() const
Return the number of features(add 1 for the intercept term).
const double & Lambda() const
Return the regularization parameter (lambda).
void Gradient(const arma::mat ¶meters, const size_t begin, GradType &gradient, const size_t batchSize=1) const
Evaluate the gradient of the logistic regression log-likelihood function with the given parameters,...
double & Lambda()
Modify the regularization parameter (lambda).
const MatType & Predictors() const
Return the matrix of predictors.
double Evaluate(const arma::mat ¶meters) const
Evaluate the logistic regression log-likelihood function with the given parameters.
LogisticRegressionFunction(const MatType &predictors, const arma::Row< size_t > &responses, const double lambda=0)
Creates the LogisticRegressionFunction.
double Evaluate(const arma::mat ¶meters, const size_t begin, const size_t batchSize=1) const
Evaluate the logistic regression log-likelihood function with the given parameters using the given ba...
void Gradient(const arma::mat ¶meters, arma::mat &gradient) const
Evaluate the gradient of the logistic regression log-likelihood function with the given parameters.
const arma::Row< size_t > & Responses() const
Return the vector of responses.
double EvaluateWithGradient(const arma::mat ¶meters, const size_t begin, GradType &gradient, const size_t batchSize=1) const
Evaluate the objective function and gradient of the logistic regression log-likelihood function simul...
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,...
Linear algebra utility functions, generally performed on matrices or vectors.
The core includes that mlpack expects; standard C++ includes and Armadillo.