An implementation of L2-regularized logistic regression using either the
L-BFGS optimizer or SGD (stochastic gradient descent). This solves the
regression problem
y = (1 / 1 + e^-(X * b)).
In this setting, y corresponds to class labels and X corresponds to data.
This implementation can train a logistic regression model given training data
(specified with the "training" parameter). A trained logistic regression
model can then be used to perform classification on a test dataset (specified
with the "test" parameter). Alternatively, classification probabilities can
be computed and saved with the "probabilities" parameter.
The training data, if specified, may have class labels as its last dimension.
Alternately, the "labels" parameter may be used to specify a separate matrix
of labels.
When a model is being trained, there are many options. L2 regularization (to
prevent overfitting) can be specified with the "lambda" option, and the
optimizer used to train the model can be specified with the "optimizer"
parameter. Available options are 'sgd' (stochastic gradient descent) and
'lbfgs' (the L-BFGS optimizer). There are also various parameters for the
optimizer; the "max_iterations" parameter specifies the maximum number of
allowed iterations, and the "tolerance" parameter specifies the tolerance for
convergence. For the SGD optimizer, the "step_size" parameter controls the
step size taken at each iteration by the optimizer. The batch size for SGD
is controlled with the "batch_size" parameter. If the objective function for
your data is oscillating between Inf and 0, the step size is probably too
large. There are more parameters for the optimizers, but the C++ interface
must be used to access these.
For SGD, an iteration refers to a single point. So to take a single pass over
the dataset with SGD, "max_iterations" should be set to the number of points
in the dataset.
This implementation of logistic regression does not support the general
multi-class case but instead only the two-class case. Any labels must be
either 0 or 1. For more classes, see the softmax regression implementation.