FUNCTION REFERENCE

lasso

Lasso and elastic-net regression along a regularization path.

Lasso and elastic-net regression along a regularization path.

Syntax

[B,FitInfo] = lasso(X,y,'Lambda',lambda,'Alpha',alpha)

Minimizes weighted mean squared residual divided by two plus lambda times Alpha*sum(abs(b))+(1-Alpha)*sum(b.^2)/2. Alpha is in (0,1], default 1. Standardize and Intercept default true; standardized predictors have weighted population standard deviation one. Lambda defaults to 100 logarithmically spaced values from lambda_max to 1e-4*lambda_max; lambda_max is max(abs(X'*weighted_centered_y))/Alpha in standardized units. NumLambda, LambdaRatio, RelTol (1e-4), MaxIter (100000), and nonnegative Weights are accepted. Coordinate descent uses decreasing-lambda warm starts; returned columns and FitInfo.Lambda are increasing. FitInfo also has Intercept, Alpha, DF, MSE, PredictorNames (empty cell), and UseCovariance (false). NaN rows are excluded.

Example

[b,f] = lasso(eye(2),[2;-1],'Lambda',[0 .1],'Standardize',false,'Intercept',false);   % [2 1.8;-1 -0.8]

Differences from MATLAB: CV and plotting options are not supported yet. Uses cyclic coordinate descent without a covariance cache. Relative coefficient stopping tolerance is scaled by max(1,max(abs(b))).

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.