1mlpack_perceptron(1) User Commands mlpack_perceptron(1)
2
3
4
6 mlpack_perceptron - perceptron
7
9 mlpack_perceptron [-m unknown] [-l string] [-n int] [-T string] [-t string] [-V bool] [-o string] [-M unknown] [-h -v]
10
12 This program implements a perceptron, which is a single level neural
13 network. The perceptron makes its predictions based on a linear pre‐
14 dictor function combining a set of weights with the feature vector. The
15 perceptron learning rule is able to converge, given enough iterations
16 (specified using the ’--max_iterations (-n)' parameter), if the data
17 supplied is linearly separable. The perceptron is parameterized by a
18 matrix of weight vectors that denote the numerical weights of the neu‐
19 ral network.
20
21 This program allows loading a perceptron from a model (via the
22 ’--input_model_file (-m)' parameter) or training a perceptron given
23 training data (via the '--training_file (-t)' parameter), or both those
24 things at once. In addition, this program allows classification on a
25 test dataset (via the ’--test_file (-T)' parameter) and the classifica‐
26 tion results on the test set may be saved with the '--output_file
27 (-o)'output parameter. The perceptron model may be saved with the
28 '--output_model_file (-M)' output parameter.
29
30 The training data given with the '--training_file (-t)' option may have
31 class labels as its last dimension (so, if the training data is in CSV
32 format, labels should be the last column). Alternately, the
33 '--labels_file (-l)' parameter may be used to specify a separate matrix
34 of labels.
35
36 All these options make it easy to train a perceptron, and then re-use
37 that perceptron for later classification. The invocation below trains a
38 perceptron on 'training_data.csv' with labels 'training_labels.csv',
39 and saves the model to 'perceptron_model.bin'.
40
41 $ perceptron --training_file training_data.csv --labels_file train‐
42 ing_labels.csv --output_model_file perceptron_model.bin
43
44 Then, this model can be re-used for classification on the test data
45 ’test_data.csv'. The example below does precisely that, saving the pre‐
46 dicted classes to 'predictions.csv'.
47
48 $ perceptron --input_model_file perceptron_model.bin --test_file
49 test_data.csv --output_file predictions.csv
50
51 Note that all of the options may be specified at once: predictions may
52 be calculated right after training a model, and model training can
53 occur even if an existing perceptron model is passed with the
54 '--input_model_file (-m)' parameter. However, note that the number of
55 classes and the dimensionality of all data must match. So you cannot
56 pass a perceptron model trained on 2 classes and then re-train with a
57 4-class dataset. Similarly, attempting classification on a 3-dimen‐
58 sional dataset with a perceptron that has been trained on 8 dimensions
59 will cause an error.
60
62 --help (-h) [bool]
63 Default help info.
64
65 --info [string]
66 Get help on a specific module or option. Default value ''.
67
68 --input_model_file (-m) [unknown]
69 Input perceptron model. Default value ''.
70
71 --labels_file (-l) [string]
72 A matrix containing labels for the training set. Default value
73 ''.
74
75 --max_iterations (-n) [int]
76 The maximum number of iterations the perceptron is to be run
77 Default value 1000.
78
79 --test_file (-T) [string]
80 A matrix containing the test set. Default value ''.
81
82 --training_file (-t) [string]
83 A matrix containing the training set. Default value ''.
84
85 --verbose (-v) [bool]
86 Display informational messages and the full list of parameters
87 and timers at the end of execution.
88
89 --version (-V) [bool]
90 Display the version of mlpack.
91
93 --output_file (-o) [string]
94 The matrix in which the predicted labels for the test set will
95 be written. Default value ''.
96
97 --output_model_file (-M) [unknown]
98 Output for trained perceptron model. Default value ''.
99
101 For further information, including relevant papers, citations, and the‐
102 ory, consult the documentation found at http://www.mlpack.org or
103 included with your distribution of mlpack.
104
105
106
107mlpack-3.0.4 21 February 2019 mlpack_perceptron(1)