Main Content

**Class: **RegressionLinear

Select fitted regularized linear regression models

One way to build several predictive linear regression models is:

Hold out a portion of the data for testing.

Train a linear regression model using

`fitrlinear`

. Specify a grid of regularization strengths using the`'`

`Lambda`

`'`

name-value pair argument and supply the training data.`fitrlinear`

returns one`RegressionLinear`

model object, but it contains a model for each regularization strength.To determine the quality of each regularized model, pass the returned model object and the held-out data to, for example,

`loss`

.Identify the indices (

`idx`

) of a satisfactory subset of regularized models, and then pass the returned model and the indices to`selectModels`

.`selectModels`

returns one`RegressionLinear`

model object, but it contains`numel(idx)`

regularized models.To predict class labels for new data, pass the data and the subset of regularized models to

`predict`

.