13 #ifndef MLPACK_METHODS_LOGISTIC_REGRESSION_LOGISTIC_REGRESSION_HPP
14 #define MLPACK_METHODS_LOGISTIC_REGRESSION_LOGISTIC_REGRESSION_HPP
22 namespace regression {
33 template<
typename MatType = arma::mat>
53 const arma::Row<size_t>& responses,
54 const double lambda = 0);
73 const arma::Row<size_t>& responses,
74 const arma::vec& initialPoint,
75 const double lambda = 0);
88 const double lambda = 0);
101 template<
template<
typename>
class OptimizerType>
121 void Train(
const MatType& predictors,
122 const arma::Row<size_t>& responses);
149 const double&
Lambda()
const {
return lambda; }
167 arma::Row<size_t>& responses,
168 const double decisionBoundary = 0.5)
const;
181 template<
typename VecType>
182 size_t Classify(
const VecType& point,
183 const double decisionBoundary = 0.5)
const;
196 void Classify(
const MatType& dataset,
197 arma::Row<size_t>& labels,
198 const double decisionBoundary = 0.5)
const;
206 void Classify(
const MatType& dataset,
207 arma::mat& probabilities)
const;
224 const arma::Row<size_t>& responses,
225 const double decisionBoundary = 0.5)
const;
236 const arma::Row<size_t>& responses)
const;
239 template<
typename Archive>
240 void Serialize(Archive& ar,
const unsigned int );
244 arma::vec parameters;
253 #include "logistic_regression_impl.hpp"
255 #endif // MLPACK_METHODS_LOGISTIC_REGRESSION_LOGISTIC_REGRESSION_HPP
The log-likelihood function for the logistic regression objective function.
size_t Classify(const VecType &point, const double decisionBoundary=0.5) const
Classify the given point.
The core includes that mlpack expects; standard C++ includes and Armadillo.
void Serialize(Archive &ar, const unsigned int)
Serialize the model.
#define mlpack_deprecated
LogisticRegression(const MatType &predictors, const arma::Row< size_t > &responses, const double lambda=0)
Construct the LogisticRegression class with the given labeled training data.
double ComputeError(const MatType &predictors, const arma::Row< size_t > &responses) const
Compute the error of the model.
arma::vec & Parameters()
Modify the parameters (the b vector).
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...
const arma::vec & Parameters() const
Return the parameters (the b vector).
double & Lambda()
Modify the lambda value for L2-regularization.
The generic L-BFGS optimizer, which uses a back-tracking line search algorithm to minimize a function...
void Train(const MatType &predictors, const arma::Row< size_t > &responses)
Train the LogisticRegression model on the given input data.
const double & Lambda() const
Return the lambda value for L2-regularization.
The LogisticRegression class implements an L2-regularized logistic regression model, and supports training with multiple optimizers and classification.
mlpack_deprecated 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.