1mlpack_softmax_regression(1) User Commands mlpack_softmax_regression(1)
2
3
4
6 mlpack_softmax_regression - softmax regression
7
9 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]
10
12 This program performs softmax regression, a generalization of logistic
13 regression to the multiclass case, and has support for L2 regulariza‐
14 tion. The program is able to train a model, load an existing model, and
15 give predictions (and optionally their accuracy) for test data.
16
17 Training a softmax regression model is done by giving a file of train‐
18 ing points with the '--training_file (-t)' parameter and their corre‐
19 sponding labels with the '--labels_file (-l)' parameter. The number of
20 classes can be manually specified with the '--number_of_classes (-c)'
21 parameter, and the maximum number of iterations of the L-BFGS optimizer
22 can be specified with the ’--max_iterations (-n)' parameter. The L2
23 regularization constant can be specified with the '--lambda (-r)'
24 parameter and if an intercept term is not desired in the model, the
25 '--no_intercept (-N)' parameter can be specified.
26
27 The trained model can be saved with the '--output_model_file (-M)' out‐
28 put parameter. If training is not desired, but only testing is, a model
29 can be loaded with the '--input_model_file (-m)' parameter. At the cur‐
30 rent time, a loaded model cannot be trained further, so specifying both
31 '--input_model_file (-m)' and '--training_file (-t)' is not allowed.
32
33 The program is also able to evaluate a model on test data. A test
34 dataset can be specified with the '--test_file (-T)' parameter. Class
35 predictions can be saved with the '--predictions_file (-p)' output
36 parameter. If labels are specified for the test data with the
37 '--test_labels_file (-L)' parameter, then the program will print the
38 accuracy of the predictions on the given test set and its corresponding
39 labels.
40
41 For example, to train a softmax regression model on the data
42 'dataset.csv' with labels 'labels.csv' with a maximum of 1000 itera‐
43 tions for training, saving the trained model to 'sr_model.bin', the
44 following command can be used:
45
46 $ softmax_regression --training_file dataset.csv --labels_file
47 labels.csv --output_model_file sr_model.bin
48
49 Then, to use 'sr_model.bin' to classify the test points in
50 'test_points.csv', saving the output predictions to 'predictions.csv',
51 the following command can be used:
52
53 $ softmax_regression --input_model_file sr_model.bin --test_file
54 test_points.csv --predictions_file predictions.csv
55
57 --help (-h) [bool]
58 Default help info.
59
60 --info [string]
61 Get help on a specific module or option. Default value ''.
62
63 --input_model_file (-m) [unknown]
64 File containing existing model (parameters). Default value ''.
65
66 --labels_file (-l) [string]
67 A matrix containing labels (0 or 1) for the points in the train‐
68 ing set (y). The labels must order as a row. Default value ''.
69
70 --lambda (-r) [double]
71 L2-regularization constant Default value 0.0001.
72
73 --max_iterations (-n) [int]
74 Maximum number of iterations before termination. Default value
75 400.
76
77 --no_intercept (-N) [bool]
78 Do not add the intercept term to the model.
79
80 --number_of_classes (-c) [int]
81 Number of classes for classification; if unspecified (or 0), the
82 number of classes found in the labels will be used. Default
83 value 0.
84
85 --test_file (-T) [string]
86 Matrix containing test dataset. Default value ''.
87
88 --test_labels_file (-L) [string]
89 Matrix containing test labels. Default value ''.
90
91 --training_file (-t) [string]
92 A matrix containing the training set (the matrix of predictors,
93 X). Default value ''.
94
95 --verbose (-v) [bool]
96 Display informational messages and the full list of parameters
97 and timers at the end of execution.
98
99 --version (-V) [bool]
100 Display the version of mlpack.
101
103 --output_model_file (-M) [unknown]
104 File to save trained softmax regression model to. Default value
105 ''.
106
107 --predictions_file (-p) [string]
108 Matrix to save predictions for test dataset into. Default value
109 ''.
110
112 For further information, including relevant papers, citations, and the‐
113 ory, consult the documentation found at http://www.mlpack.org or
114 included with your distribution of mlpack.
115
116
117
118mlpack-3.0.4 21 February 2019 mlpack_softmax_regression(1)