mlpack_perceptron(1) | User Commands | mlpack_perceptron(1) |
mlpack_perceptron - perceptron
mlpack_perceptron [-m unknown] [-l string] [-n int] [-T string] [-t string] [-V bool] [-o string] [-M unknown] [-P string] [-h -v]
This program implements a perceptron, which is a single level neural network. The perceptron makes its predictions based on a linear predictor function combining a set of weights with the feature vector. The perceptron learning rule is able to converge, given enough iterations (specified using the ’--max_iterations (-n)' parameter), if the data supplied is linearly separable. The perceptron is parameterized by a matrix of weight vectors that denote the numerical weights of the neural network.
This program allows loading a perceptron from a model (via the ’--input_model_file (-m)' parameter) or training a perceptron given training data (via the '--training_file (-t)' parameter), or both those things at once. In addition, this program allows classification on a test dataset (via the ’--test_file (-T)' parameter) and the classification results on the test set may be saved with the '--predictions_file (-P)' output parameter. The perceptron model may be saved with the '--output_model_file (-M)' output parameter.
Note: the following parameter is deprecated and will be removed in mlpack 4.0.0: '--output_file (-o)'. Use '--predictions_file (-P)' instead of '--output_file (-o)'.
The training data given with the '--training_file (-t)' option may have class labels as its last dimension (so, if the training data is in CSV format, labels should be the last column). Alternately, the '--labels_file (-l)' parameter may be used to specify a separate matrix of labels.
All these options make it easy to train a perceptron, and then re-use that perceptron for later classification. The invocation below trains a perceptron on 'training_data.csv' with labels 'training_labels.csv', and saves the model to 'perceptron_model.bin'.
$ mlpack_perceptron --training_file training_data.csv --labels_file training_labels.csv --output_model_file perceptron_model.bin
Then, this model can be re-used for classification on the test data ’test_data.csv'. The example below does precisely that, saving the predicted classes to 'predictions.csv'.
$ mlpack_perceptron --input_model_file perceptron_model.bin --test_file test_data.csv --predictions_file predictions.csv
Note that all of the options may be specified at once: predictions may be calculated right after training a model, and model training can occur even if an existing perceptron model is passed with the '--input_model_file (-m)' parameter. However, note that the number of classes and the dimensionality of all data must match. So you cannot pass a perceptron model trained on 2 classes and then re-train with a 4-class dataset. Similarly, attempting classification on a 3-dimensional dataset with a perceptron that has been trained on 8 dimensions will cause an error.
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 |