table of contents
mlpack_linear_regression(1) | User Commands | mlpack_linear_regression(1) |
NAME¶
mlpack_linear_regression - simple linear regression and prediction
SYNOPSIS¶
mlpack_linear_regression [-m unknown] [-l double] [-T string] [-t string] [-r string] [-V bool] [-M unknown] [-o string] [-h -v]
DESCRIPTION¶
An implementation of simple linear regression and simple ridge regression using ordinary least squares. This solves the problem
where X (specified by '--training_file (-t)') and y (specified either as the last column of the input matrix '--training_file (-t)' or via the ’--training_responses_file (-r)' parameter) are known and b is the desired variable. If the covariance matrix (X'X) is not invertible, or if the solution is overdetermined, then specify a Tikhonov regularization constant (with '--lambda (-l)') greater than 0, which will regularize the covariance matrix to make it invertible. The calculated b may be saved with the ’--output_predictions_file (-o)' output parameter.
y = X * b + e
Optionally, the calculated value of b is used to predict the responses for another matrix X' (specified by the '--test_file (-T)' parameter):
and the predicted responses y' may be saved with the ’--output_predictions_file (-o)' output parameter. This type of regression is related to least-angle regression, which mlpack implements as the 'lars' program.
y' = X' * b
For example, to run a linear regression on the dataset 'X.csv' with responses ’y.csv', saving the trained model to 'lr_model.bin', the following command could be used:
$ mlpack_linear_regression --training_file X.csv --training_responses_file y.csv --output_model_file lr_model.bin
Then, to use 'lr_model.bin' to predict responses for a test set 'X_test.csv', saving the predictions to 'X_test_responses.csv', the following command could be used:
$ mlpack_linear_regression --input_model_file lr_model.bin --test_file X_test.csv --output_predictions_file X_test_responses.csv
OPTIONAL INPUT OPTIONS¶
- --help (-h) [bool]
- Default help info.
- --info [string]
- Print help on a specific option. Default value ''.
- --input_model_file (-m) [unknown]
- Existing LinearRegression model to use.
- --lambda (-l) [double]
- Tikhonov regularization for ridge regression. If 0, the method reduces to linear regression. Default value 0.
- --test_file (-T) [string]
- Matrix containing X' (test regressors).
- --training_file (-t) [string]
- Matrix containing training set X (regressors).
- --training_responses_file (-r) [string]
- Optional vector containing y (responses). If not given, the responses are assumed to be the last row of the input file.
- --verbose (-v) [bool]
- Display informational messages and the full list of parameters and timers at the end of execution.
- --version (-V) [bool]
- Display the version of mlpack.
OPTIONAL OUTPUT OPTIONS¶
- --output_model_file (-M) [unknown]
- Output LinearRegression model.
- --output_predictions_file (-o) [string]
- If --test_file is specified, this matrix is where the predicted responses will be saved.
ADDITIONAL INFORMATION¶
For further information, including relevant papers, citations, and theory, consult the documentation found at http://www.mlpack.org or included with your distribution of mlpack.
12 December 2020 | mlpack-3.4.2 |