selectModels
R2026bSelect fitted regularized linear regression models
Description
Examples
Input Arguments
Output Arguments
Tips
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 theLambdaname-value argument and supply the training data.fitrlinearreturns oneRegressionLinearmodel 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 toselectModels.selectModelsreturns oneRegressionLinearmodel object, but it containsnumel(idx)regularized models.To predict class labels for new data, pass the data and the subset of regularized models to
predict.
