1mlpack_perceptron(1) General Commands Manual mlpack_perceptron(1)
2
3
4
6 mlpack_perceptron - perceptron
7
9 mlpack_perceptron [-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 using the --max_iterations (-n) parameter, if the data supplied is lin‐
17 early separable. The perceptron is parameterized by a matrix of weight
18 vectors that denote the numerical weights of the neural network.
19
20 This program allows loading a perceptron from a model (-m) or training
21 a perceptron given training data (-t), or both those things at once. In
22 addition, this program allows classification on a test dataset (-T) and
23 will save the classification results to the given output file (-o). The
24 perceptron model itself may be saved with a file specified using the -M
25 option.
26
27 The training data given with the -t option should have class labels as
28 its last dimension (so, if the training data is in CSV format, labels
29 should be the last column). Alternately, the -l (--labels_file) option
30 may be used to specify a separate file of labels.
31
32 All these options make it easy to train a perceptron, and then re-use
33 that perceptron for later classification. The invocation below trains a
34 perceptron on 'training_data.csv' (and 'training_labels.csv)' and saves
35 the model to ’perceptron.xml'.
36
37 $ perceptron -t training_data.csv -l training_labels.csv -M percep‐
38 tron.xml
39
40 Then, this model can be re-used for classification on 'test_data.csv'.
41 The example below does precisely that, saving the predicted classes to
42 ’predictions.csv'.
43
44 $ perceptron -m perceptron.xml -T test_data.csv -o predictions.csv
45
46 Note that all of the options may be specified at once: predictions may
47 be calculated right after training a model, and model training can
48 occur even if an existing perceptron model is passed with -m
49 (--input_model_file). However, note that the number of classes and the
50 dimensionality of all data must match. So you cannot pass a perceptron
51 model trained on 2 classes and then re-train with a 4-class dataset.
52 Similarly, attempting classification on a 3-dimensional dataset with a
53 perceptron that has been trained on 8 dimensions will cause an error.
54
56 --help (-h)
57 Default help info.
58
59 --info [string]
60 Get help on a specific module or option. Default value ''.
61 --input_model_file (-m) [string] File containing input percep‐
62 tron model. Default value ''.
63
64 --labels_file (-l) [string]
65 A file containing labels for the training set. Default value
66 ''.
67
68 --max_iterations (-n) [int]
69 The maximum number of iterations the perceptron is to be run
70 Default value 1000.
71
72 --test_file (-T) [string]
73 A file containing the test set. Default value ’'. --train‐
74 ing_file (-t) [string] A file containing the training set.
75 Default value ''.
76
77 --verbose (-v)
78 Display informational messages and the full list of parameters
79 and timers at the end of execution.
80
81 --version (-V)
82 Display the version of mlpack.
83
85 --output_file (-o) [string]
86 The file in which the predicted labels for the test set will be
87 written. Default value ''. --output_model_file (-M) [string]
88 File to save trained perceptron model to. Default value ''.
89
92 For further information, including relevant papers, citations, and the‐
93 ory, For further information, including relevant papers, citations, and
94 theory, consult the documentation found at http://www.mlpack.org or
95 included with your consult the documentation found at
96 http://www.mlpack.org or included with your DISTRIBUTION OF MLPACK.
97 DISTRIBUTION OF MLPACK.
98
99
100
101 mlpack_perceptron(1)