Mlpack::regression::logisticregression optimizertype -
LogisticRegression (const arma::mat &predictors, const arma::vec &responses, const double lambda=0)
Construct the LogisticRegression class with the given labeled training data. LogisticRegression (const arma::mat &predictors, const arma::vec &responses, const arma::mat &initialPoint, const double lambda=0)
Construct the LogisticRegression class with the given labeled training data. LogisticRegression (OptimizerType< LogisticRegressionFunction > &optimizer)
Construct the LogisticRegression class with the given labeled training data. LogisticRegression (const arma::vec ¶meters, const double lambda=0)
Construct a logistic regression model from the given parameters, without performing any training. double ComputeAccuracy (const arma::mat &predictors, const arma::vec &responses, const double decisionBoundary=0.5) const
Compute the accuracy of the model on the given predictors and responses, optionally using the given decision boundary. double ComputeError (const arma::mat &predictors, const arma::vec &responses) const
Compute the error of the model. const double & Lambda () const
Return the lambda value for L2-regularization. double & Lambda ()
Modify the lambda value for L2-regularization. const arma::vec & Parameters () const
Return the parameters (the b vector). arma::vec & Parameters ()
Modify the parameters (the b vector). void Predict (const arma::mat &predictors, arma::vec &responses, const double decisionBoundary=0.5) const
Predict the responses to a given set of predictors. std::string ToString () const
double lambda
L2-regularization penalty parameter. arma::vec parameters
Vector of trained parameters.
Definition at line 37 of file logistic_regression.hpp.
Construct the LogisticRegression class with the given labeled training data. This will train the model. Optionally, specify lambda, which is the penalty parameter for L2-regularization. If not specified, it is set to 0, which results in standard (unregularized) logistic regression.
Parameters:
predictors Input training variables.
responses Outputs resulting from input training variables.
lambda L2-regularization parameter.
Construct the LogisticRegression class with the given labeled training data. This will train the model. Optionally, specify lambda, which is the penalty parameter for L2-regularization. If not specified, it is set to 0, which results in standard (unregularized) logistic regression.
Parameters:
predictors Input training variables.
responses Outputs results from input training variables.
initialPoint Initial model to train with.
lambda L2-regularization parameter.
Construct the LogisticRegression class with the given labeled training data. This will train the model. This overload takes an already instantiated optimizer (which holds the LogisticRegressionFunction error function, which must also be instantiated), so that the optimizer can be configured before the training is run by this constructor. The predictors and responses and initial point are all taken from the error function contained in the optimizer.
Parameters:
optimizer Instantiated optimizer with instantiated error function.
Construct a logistic regression model from the given parameters, without performing any training. The lambda parameter is used for the ComputeAccuracy() and ComputeError() functions; this constructor does not train the model itself.
Parameters:
parameters Parameters making up the model.
lambda L2-regularization penalty parameter.
Compute the accuracy of the model on the given predictors and responses, optionally using the given decision boundary. The responses should be either 0 or 1. Logistic regression returns a value between 0 and 1. If the value is greater than the decision boundary, the response is taken to be 1; otherwise, it is 0. By default, the decision boundary is 0.5.
The accuracy is returned as a percentage, between 0 and 100.
Parameters:
predictors Input predictors.
responses Vector of responses.
decisionBoundary Decision boundary (default 0.5).
Returns:
Percentage of responses that are predicted correctly.
Compute the error of the model. This returns the negative objective function of the logistic regression log-likelihood function. For the model to be optimal, the negative log-likelihood function should be minimized.
Parameters:
predictors Input predictors.
responses Vector of responses.
Return the lambda value for L2-regularization.
Definition at line 100 of file logistic_regression.hpp.
References mlpack::regression::LogisticRegression< OptimizerType >::lambda.
Modify the lambda value for L2-regularization.
Definition at line 102 of file logistic_regression.hpp.
References mlpack::regression::LogisticRegression< OptimizerType >::lambda.
Return the parameters (the b vector).
Definition at line 95 of file logistic_regression.hpp.
References mlpack::regression::LogisticRegression< OptimizerType >::parameters.
Modify the parameters (the b vector).
Definition at line 97 of file logistic_regression.hpp.
References mlpack::regression::LogisticRegression< OptimizerType >::parameters.
Predict the responses to a given set of predictors. The responses will be either 0 or 1. Optionally, specify the decision boundary; logistic regression returns a value between 0 and 1. If the value is greater than the decision boundary, the response is taken to be 1; otherwise, it is 0. By default the decision boundary is 0.5.
Parameters:
predictors Input predictors.
responses Vector to put output predictions of responses into.
decisionBoundary Decision boundary (default 0.5).
L2-regularization penalty parameter.
Definition at line 155 of file logistic_regression.hpp.
Referenced by mlpack::regression::LogisticRegression< OptimizerType >::Lambda().
Vector of trained parameters.
Definition at line 153 of file logistic_regression.hpp.
Referenced by mlpack::regression::LogisticRegression< OptimizerType >::Parameters().
Generated automatically by Doxygen for MLPACK from the source code.