mlpack_softmax_regression(1) | User Commands | mlpack_softmax_regression(1) |
mlpack_softmax_regression - softmax regression
mlpack_softmax_regression [-m unknown] [-l string] [-r double] [-n int] [-N bool] [-c int] [-T string] [-L string] [-t string] [-V bool] [-M unknown] [-p string] [-h -v]
This program performs softmax regression, a generalization of logistic regression to the multiclass case, and has support for L2 regularization. The program is able to train a model, load an existing model, and give predictions (and optionally their accuracy) for test data.
Training a softmax regression model is done by giving a file of training points with the '--training_file (-t)' parameter and their corresponding labels with the '--labels_file (-l)' parameter. The number of classes can be manually specified with the '--number_of_classes (-c)' parameter, and the maximum number of iterations of the L-BFGS optimizer can be specified with the ’--max_iterations (-n)' parameter. The L2 regularization constant can be specified with the '--lambda (-r)' parameter and if an intercept term is not desired in the model, the '--no_intercept (-N)' parameter can be specified.
The trained model can be saved with the '--output_model_file (-M)' output parameter. If training is not desired, but only testing is, a model can be loaded with the '--input_model_file (-m)' parameter. At the current time, a loaded model cannot be trained further, so specifying both '--input_model_file (-m)' and '--training_file (-t)' is not allowed.
The program is also able to evaluate a model on test data. A test dataset can be specified with the '--test_file (-T)' parameter. Class predictions can be saved with the '--predictions_file (-p)' output parameter. If labels are specified for the test data with the '--test_labels_file (-L)' parameter, then the program will print the accuracy of the predictions on the given test set and its corresponding labels.
For example, to train a softmax regression model on the data
'dataset.csv' with labels 'labels.csv' with a maximum of 1000 iterations for
training, saving the trained model to 'sr_model.bin', the following command
can be used:
Then, to use 'sr_model.bin' to classify the test points in 'test_points.csv', saving the output predictions to 'predictions.csv', the following command can be used:
$ mlpack_softmax_regression --input_model_file sr_model.bin --test_file test_points.csv --predictions_file predictions.csv
For further information, including relevant papers, citations, and theory, consult the documentation found at http://www.mlpack.org or included with your distribution of mlpack.
12 December 2020 | mlpack-3.4.2 |