15 #ifndef __MLPACK_METHODS_LOGISTIC_REGRESSION_LOGISTIC_REGRESSION_HPP
16 #define __MLPACK_METHODS_LOGISTIC_REGRESSION_LOGISTIC_REGRESSION_HPP
24 namespace regression {
35 template<
typename MatType = arma::mat>
55 const arma::Row<size_t>& responses,
75 const arma::Row<size_t>& responses,
76 const arma::vec& initialPoint,
103 template<
template<
typename>
class OptimizerType>
123 void Train(
const MatType& predictors,
124 const arma::Row<size_t>& responses);
166 void Predict(
const MatType& predictors,
167 arma::Row<size_t>& responses,
168 const double decisionBoundary = 0.5)
const;
185 const arma::Row<size_t>& responses,
186 const double decisionBoundary = 0.5)
const;
197 const arma::Row<size_t>& responses)
const;
200 template<
typename Archive>
201 void Serialize(Archive& ar,
const unsigned int );
214 #include "logistic_regression_impl.hpp"
216 #endif // __MLPACK_METHODS_LOGISTIC_REGRESSION_LOGISTIC_REGRESSION_HPP
void Predict(const MatType &predictors, arma::Row< size_t > &responses, const double decisionBoundary=0.5) const
Predict the responses to a given set of predictors.
The log-likelihood function for the logistic regression objective function.
Linear algebra utility functions, generally performed on matrices or vectors.
void Train(const MatType &predictors, const arma::Row< size_t > &responses)
Train the LogisticRegression model on the given input data.
void Serialize(Archive &ar, const unsigned int)
Serialize the model.
const double & Lambda() const
Return the lambda value for L2-regularization.
double ComputeError(const MatType &predictors, const arma::Row< size_t > &responses) const
Compute the error of the model.
double ComputeAccuracy(const MatType &predictors, const arma::Row< size_t > &responses, const double decisionBoundary=0.5) const
Compute the accuracy of the model on the given predictors and responses, optionally using the given d...
double & Lambda()
Modify the lambda value for L2-regularization.
const arma::vec & Parameters() const
Return the parameters (the b vector).
double lambda
L2-regularization penalty parameter.
arma::vec & Parameters()
Modify the parameters (the b vector).
LogisticRegression(const MatType &predictors, const arma::Row< size_t > &responses, const double lambda=0)
Construct the LogisticRegression class with the given labeled training data.
Include all of the base components required to write MLPACK methods, and the main MLPACK Doxygen docu...
The generic L-BFGS optimizer, which uses a back-tracking line search algorithm to minimize a function...
arma::vec parameters
Vector of trained parameters (size: dimensionality plus one).
The LogisticRegression class implements an L2-regularized logistic regression model, and supports training with multiple optimizers and classification.