.\" Text automatically generated by txt2man .TH mlpack_linear_regression 1 "12 December 2020" "mlpack-3.4.2" "User Commands" .SH NAME \fBmlpack_linear_regression \fP- simple linear regression and prediction .SH SYNOPSIS .nf .fam C \fBmlpack_linear_regression\fP [\fB-m\fP \fIunknown\fP] [\fB-l\fP \fIdouble\fP] [\fB-T\fP \fIstring\fP] [\fB-t\fP \fIstring\fP] [\fB-r\fP \fIstring\fP] [\fB-V\fP \fIbool\fP] [\fB-M\fP \fIunknown\fP] [\fB-o\fP \fIstring\fP] [\fB-h\fP \fB-v\fP] .fam T .fi .fam T .fi .SH DESCRIPTION An implementation of simple linear regression and simple ridge regression using ordinary least squares. This solves the problem .PP .nf .fam C y = X * b + e .fam T .fi where X (specified by '\fB--training_file\fP (\fB-t\fP)') and y (specified either as the last column of the input matrix '\fB--training_file\fP (\fB-t\fP)' or via the \(cq\fB--training_responses_file\fP (\fB-r\fP)' 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 '\fB--lambda\fP (\fB-l\fP)') greater than 0, which will regularize the covariance matrix to make it invertible. The calculated b may be saved with the \(cq\fB--output_predictions_file\fP (\fB-o\fP)' output parameter. .PP Optionally, the calculated value of b is used to predict the responses for another matrix X' (specified by the '\fB--test_file\fP (\fB-T\fP)' parameter): .PP .nf .fam C y' = X' * b .fam T .fi and the predicted responses y' may be saved with the \(cq\fB--output_predictions_file\fP (\fB-o\fP)' output parameter. This type of regression is related to least-angle regression, which mlpack implements as the 'lars' program. .PP For example, to run a linear regression on the dataset 'X.csv' with responses \(cqy.csv', saving the trained model to 'lr_model.bin', the following command could be used: .PP $ \fBmlpack_linear_regression\fP \fB--training_file\fP X.csv \fB--training_responses_file\fP y.csv \fB--output_model_file\fP lr_model.bin .PP 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: .PP $ \fBmlpack_linear_regression\fP \fB--input_model_file\fP lr_model.bin \fB--test_file\fP X_test.csv \fB--output_predictions_file\fP X_test_responses.csv .RE .PP .SH OPTIONAL INPUT OPTIONS .TP .B \fB--help\fP (\fB-h\fP) [\fIbool\fP] Default help info. .TP .B \fB--info\fP [\fIstring\fP] Print help on a specific option. Default value ''. .TP .B \fB--input_model_file\fP (\fB-m\fP) [\fIunknown\fP] Existing LinearRegression model to use. .TP .B \fB--lambda\fP (\fB-l\fP) [\fIdouble\fP] Tikhonov regularization for ridge regression. If 0, the method reduces to linear regression. Default value 0. .TP .B \fB--test_file\fP (\fB-T\fP) [\fIstring\fP] Matrix containing X' (test regressors). .TP .B \fB--training_file\fP (\fB-t\fP) [\fIstring\fP] Matrix containing training set X (regressors). .TP .B \fB--training_responses_file\fP (\fB-r\fP) [\fIstring\fP] Optional vector containing y (responses). If not given, the responses are assumed to be the last row of the input file. .TP .B \fB--verbose\fP (\fB-v\fP) [\fIbool\fP] Display informational messages and the full list of parameters and timers at the end of execution. .TP .B \fB--version\fP (\fB-V\fP) [\fIbool\fP] Display the version of mlpack. .SH OPTIONAL OUTPUT OPTIONS .TP .B \fB--output_model_file\fP (\fB-M\fP) [\fIunknown\fP] Output LinearRegression model. .TP .B \fB--output_predictions_file\fP (\fB-o\fP) [\fIstring\fP] If \fB--test_file\fP is specified, this matrix is where the predicted responses will be saved. .SH 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.