1mlpack_lars(1) User Commands mlpack_lars(1)
2
3
4
6 mlpack_lars - lars
7
9 mlpack_lars [-i string] [-m unknown] [-l double] [-L double] [-r string] [-t string] [-c bool] [-V bool] [-M unknown] [-o string] [-h -v]
10
12 An implementation of LARS: Least Angle Regression (Stagewise/laSso).
13 This is a stage-wise homotopy-based algorithm for L1-regularized linear
14 regression (LASSO) and L1+L2-regularized linear regression (Elastic
15 Net).
16
17 This program is able to train a LARS/LASSO/Elastic Net model or load a
18 model from file, output regression predictions for a test set, and save
19 the trained model to a file. The LARS algorithm is described in more
20 detail below:
21
22 Let X be a matrix where each row is a point and each column is a dimen‐
23 sion, and let y be a vector of targets.
24
25 The Elastic Net problem is to solve
26
27 min_beta 0.5 || X * beta - y ||_2^2 + lambda_1 ||beta||_1 +
28 0.5 lambda_2 ||beta||_2^2
29
30 If lambda1 > 0 and lambda2 = 0, the problem is the LASSO. If lambda1 >
31 0 and lambda2 > 0, the problem is the Elastic Net. If lambda1 = 0 and
32 lambda2 > 0, the problem is ridge regression. If lambda1 = 0 and
33 lambda2 = 0, the problem is unregularized linear regression.
34
35 For efficiency reasons, it is not recommended to use this algorithm
36 with ’--lambda1 (-l)' = 0. In that case, use the 'linear_regression'
37 program, which implements both unregularized linear regression and
38 ridge regression.
39
40 To train a LARS/LASSO/Elastic Net model, the '--input_file (-i)' and
41 ’--responses_file (-r)' parameters must be given. The '--lambda1 (-l)',
42 ’--lambda2 (-L)', and '--use_cholesky (-c)' parameters control the
43 training options. A trained model can be saved with the '--out‐
44 put_model_file (-M)'. If no training is desired at all, a model can be
45 passed via the ’--input_model_file (-m)' parameter.
46
47 The program can also provide predictions for test data using either the
48 trained model or the given input model. Test points can be specified
49 with the ’--test_file (-t)' parameter. Predicted responses to the test
50 points can be saved with the '--output_predictions_file (-o)' output
51 parameter.
52
53 For example, the following command trains a model on the data
54 'data.csv' and responses 'responses.csv' with lambda1 set to 0.4 and
55 lambda2 set to 0 (so, LASSO is being solved), and then the model is
56 saved to 'lasso_model.bin':
57
58 $ lars --input_file data.csv --responses_file responses.csv --lambda1
59 0.4 --lambda2 0 --output_model_file lasso_model.bin
60
61 The following command uses the 'lasso_model.bin' to provide predicted
62 responses for the data 'test.csv' and save those responses to
63 ’test_predictions.csv':
64
65 $ lars --input_model_file lasso_model.bin --test_file test.csv --out‐
66 put_predictions_file test_predictions.csv
67
69 --help (-h) [bool]
70 Default help info.
71
72 --info [string]
73 Get help on a specific module or option. Default value ''.
74
75 --input_file (-i) [string]
76 Matrix of covariates (X). Default value ''.
77
78 --input_model_file (-m) [unknown]
79 Trained LARS model to use. Default value ''.
80
81 --lambda1 (-l) [double]
82 Regularization parameter for l1-norm penalty. Default value 0.
83
84 --lambda2 (-L) [double]
85 Regularization parameter for l2-norm penalty. Default value 0.
86
87 --responses_file (-r) [string]
88 Matrix of responses/observations (y). Default value ''.
89
90 --test_file (-t) [string]
91 Matrix containing points to regress on (test points). Default
92 value ''.
93
94 --use_cholesky (-c) [bool]
95 Use Cholesky decomposition during computation rather than
96 explicitly computing the full Gram matrix.
97
98 --verbose (-v) [bool]
99 Display informational messages and the full list of parameters
100 and timers at the end of execution.
101
102 --version (-V) [bool]
103 Display the version of mlpack.
104
106 --output_model_file (-M) [unknown]
107 Output LARS model. Default value ''.
108
109 --output_predictions_file (-o) [string]
110 If --test_file is specified, this file is where the predicted
111 responses will be saved. Default value ''.
112
114 For further information, including relevant papers, citations, and the‐
115 ory, consult the documentation found at http://www.mlpack.org or
116 included with your distribution of mlpack.
117
118
119
120mlpack-3.0.4 21 February 2019 mlpack_lars(1)