1mlpack_linear_regression(1) User Commands mlpack_linear_regression(1)
2
3
4
6 mlpack_linear_regression - simple linear regression and prediction
7
9 mlpack_linear_regression [-m unknown] [-l double] [-T string] [-t string] [-r string] [-V bool] [-M unknown] [-o string] [-h -v]
10
12 An implementation of simple linear regression and simple ridge regres‐
13 sion using ordinary least squares. This solves the problem
14
15 y = X * b + e
16
17 where X (specified by '--training_file (-t)') and y (specified either
18 as the last column of the input matrix '--training_file (-t)' or via
19 the ’--training_responses_file (-r)' parameter) are known and b is the
20 desired variable. If the covariance matrix (X'X) is not invertible, or
21 if the solution is overdetermined, then specify a Tikhonov regulariza‐
22 tion constant (with '--lambda (-l)') greater than 0, which will regu‐
23 larize the covariance matrix to make it invertible. The calculated b
24 may be saved with the ’--output_predictions_file (-o)' output parame‐
25 ter.
26
27 Optionally, the calculated value of b is used to predict the responses
28 for another matrix X' (specified by the '--test_file (-T)' parameter):
29
30 y' = X' * b
31
32 and the predicted responses y' may be saved with the ’--output_predic‐
33 tions_file (-o)' output parameter. This type of regression is related
34 to least-angle regression, which mlpack implements as the 'lars' pro‐
35 gram.
36
37 For example, to run a linear regression on the dataset 'X.csv' with
38 responses ’y.csv', saving the trained model to 'lr_model.bin', the fol‐
39 lowing command could be used:
40
41 $ linear_regression --training_file X.csv --training_responses_file
42 y.csv --output_model_file lr_model.bin
43
44 Then, to use 'lr_model.bin' to predict responses for a test set
45 'X_test.csv', saving the predictions to 'X_test_responses.csv', the
46 following command could be used:
47
48 $ linear_regression --input_model_file lr_model.bin --test_file
49 X_test.csv --output_predictions_file X_test_responses.csv
50
52 --help (-h) [bool]
53 Default help info.
54
55 --info [string]
56 Get help on a specific module or option. Default value ''.
57
58 --input_model_file (-m) [unknown]
59 Existing LinearRegression model to use. Default value ''.
60
61 --lambda (-l) [double]
62 Tikhonov regularization for ridge regression. If 0, the method
63 reduces to linear regression. Default value 0.
64
65 --test_file (-T) [string]
66 Matrix containing X' (test regressors). Default value ''.
67
68 --training_file (-t) [string]
69 Matrix containing training set X (regressors). Default value
70 ''.
71
72 --training_responses_file (-r) [string]
73 Optional vector containing y (responses). If not given, the
74 responses are assumed to be the last row of the input file.
75 Default value ''.
76
77 --verbose (-v) [bool]
78 Display informational messages and the full list of parameters
79 and timers at the end of execution.
80
81 --version (-V) [bool]
82 Display the version of mlpack.
83
85 --output_model_file (-M) [unknown]
86 Output LinearRegression model. Default value ''.
87
88 --output_predictions_file (-o) [string]
89
90 If --test_file is specified, this matrix is where the predicted
91 responses will be saved.
92 Default value ''.
93
95 For further information, including relevant papers, citations, and the‐
96 ory, consult the documentation found at http://www.mlpack.org or
97 included with your distribution of mlpack.
98
99
100
101mlpack-3.0.4 21 February 2019 mlpack_linear_regression(1)