---
name: "mlpack_lars"
section: "1"
platform: "linux"
package: "mlpack-bin"
version: "4.6.0-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/mlpack_lars"
---

# mlpack\_lars(1)

lars

## NAME

**mlpack\_lars** - lars

## SYNOPSIS

```
 mlpack_lars [-i unknown] [-m unknown] [-l double] [-L double] [-n bool] [-N bool] [-r unknown] [-t unknown] [-c bool] [-V bool] [-M unknown] [-o unknown] [-h -v]
```

## DESCRIPTION

An implementation of LARS: Least Angle Regression (Stagewise/laSso). This is a stage-wise homotopy-based algorithm for L1-regularized linear regression (LASSO) and L1+L2-regularized linear regression (Elastic Net).

This program is able to train a LARS/LASSO/Elastic Net model or load a model from file, output regression predictions for a test set, and save the trained model to a file. The LARS algorithm is described in more detail below:

Let X be a matrix where each row is a point and each column is a dimension, and let y be a vector of targets.

The Elastic Net problem is to solve

```
  min_beta 0.5 || X * beta - y ||_2^2 + lambda_1 ||beta||_1 +
    0.5 lambda_2 ||beta||_2^2
```

If lambda1 \> 0 and lambda2 = 0, the problem is the LASSO. If lambda1 \> 0 and lambda2 \> 0, the problem is the Elastic Net. If lambda1 = 0 and lambda2 \> 0, the problem is ridge regression. If lambda1 = 0 and lambda2 = 0, the problem is unregularized linear regression.

For efficiency reasons, it is not recommended to use this algorithm with ’**--lambda1** (**-l**)' = 0. In that case, use the 'linear\_regression' program, which implements both unregularized linear regression and ridge regression.

To train a LARS/LASSO/Elastic Net model, the '**--input\_file** (**-i**)' and ’**--responses\_file** (**-r**)' parameters must be given. The '**--lambda1** (**-l**)', ’**--lambda2** (**-L**)', and '**--use\_cholesky** (**-c**)' parameters control the training options. A trained model can be saved with the '**--output\_model\_file** (**-M**)'.  If no training is desired at all, a model can be passed via the ’**--input\_model\_file** (**-m**)' parameter.

The program can also provide predictions for test data using either the trained model or the given input model. Test points can be specified with the ’**--test\_file** (**-t**)' parameter. Predicted responses to the test points can be saved with the '**--output\_predictions\_file** (**-o**)' output parameter.

For example, the following command trains a model on the data 'data.csv' and responses 'responses.csv' with lambda1 set to 0.4 and lambda2 set to 0 (so, LASSO is being solved), and then the model is saved to 'lasso\_model.bin':

$ **mlpack\_lars** **--input\_file** data.csv **--responses\_file** responses.csv **--lambda1** 0.4 **--lambda2** 0 **--output\_model\_file** lasso\_model.bin

The following command uses the 'lasso\_model.bin' to provide predicted responses for the data 'test.csv' and save those responses to ’test\_predictions.csv':

$ **mlpack\_lars** **--input\_model\_file** lasso\_model.bin **--test\_file** test.csv **--output\_predictions\_file** test\_predictions.csv

## OPTIONAL INPUT OPTIONS

- **--help (-h) \[*bool*\]**

  Default help info.

- **--info \[string\]**

  Print help on a specific option. Default value ''.

- **--input\_file (-i) \[*unknown*\]**

  Matrix of covariates (X).

- **--input\_model\_file (-m) \[*unknown*\]**

  Trained LARS model to use.

- **--lambda1 (-l) \[*double*\]**

  Regularization parameter for l1-norm penalty.  Default value 0.

- **--lambda2 (-L) \[*double*\]**

  Regularization parameter for l2-norm penalty.  Default value 0.

- **--no\_intercept (-n) \[*bool*\]**

  Do not fit an intercept in the model.

- **--no\_normalize (-N) \[*bool*\]**

  Do not normalize data to unit variance before modeling.

- **--responses\_file (-r) \[*unknown*\]**

  Matrix of responses/observations (y).

- **--test\_file (-t) \[*unknown*\]**

  Matrix containing points to regress on (test points).

- **--use\_cholesky (-c) \[*bool*\]**

  Use Cholesky decomposition during computation rather than explicitly computing the full Gram matrix.

- **--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 LARS model.

- **--output\_predictions\_file (-o) \[*unknown*\]**

  If **--test\_file** is specified, this file 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.
