train regression models in regression learner app -凯发k8网页登录

main content

train regression models in regression learner app

you can use regression learner to train regression models including linear regression models, regression trees, gaussian process regression models, support vector machines, kernel approximation, ensembles of regression trees, and neural network regression models. in addition to training models, you can explore your data, select features, specify validation schemes, and evaluate results. you can export a model to the workspace to use the model with new data or generate matlab® code to learn about programmatic regression.

training a model in regression learner consists of two parts:

  • validated model: train a model with a validation scheme. by default, the app protects against overfitting by applying cross-validation. alternatively, you can choose holdout validation. the validated model is visible in the app.

  • full model: train a model on full data, excluding test data. the app trains this model simultaneously with the validated model. however, the model trained on full data is not visible in the app. when you choose a regression model to export to the workspace, regression learner exports the full model.

note

the app does not use test data for model training. models exported from the app are trained on the full data, excluding any data reserved for testing.

the app displays the results of the validated model. diagnostic measures, such as model accuracy, and plots, such as a response plot or residuals plot, reflect the validated model results. you can automatically train one or more regression models, compare validation results, and choose the best model that works for your regression problem. when you choose a model to export to the workspace, regression learner exports the full model. because regression learner creates a model object of the full model during training, you experience no lag time when you export the model. you can use the exported model to make predictions on new data.

to get started by training a selection of model types, see automated regression model training. if you already know which regression model you want to train, see manual regression model training.

automated regression model training

you can use regression learner to automatically train a selection of different regression models on your data.

  • get started by automatically training multiple models simultaneously. you can quickly try a selection of models, and then explore promising models interactively.

  • if you already know what model type you want, then you can train individual models instead. see manual regression model training.

  1. on the apps tab, in the machine learning and deep learning group, click regression learner to open the regression learner app.

  2. on the regression learner tab, in the file section, click new session and select data from the workspace or from a file. specify a response variable and variables to use as predictors. alternatively, click open to open a previously saved app session. see .

  3. in the models section, click the arrow to expand the list of regression models. select all quick-to-train. this option trains all the model presets that are fast to fit.

    all quick-to-train option in the models gallery on the regression learner tab

  4. in the train section, click train all and select train all.

    note

    if you have parallel computing toolbox™, the app trains the models in parallel by default. see parallel regression model training.

    a selection of model types appears in the models pane. when the models finish training, the best rmse (validation) score is outlined in a box.

    models pane with the lowest validation score outlined in a box

  5. click models in the models pane and open the corresponding plots to explore the results.

    for the next steps, see manual regression model training or compare and improve regression models.

  6. to try all the nonoptimizable model presets available, click all in the models section of the regression learner tab.

    all option in the models gallery

  7. in the train section, click train all and select train selected.

manual regression model training

to explore individual model types, you can train models one at a time or as a group.

  1. choose a model type. on the regression learner tab, in the models section, click a model type. to see all available model options, click the arrow in the models section to expand the list of regression models. the nonoptimizable model options in the gallery are preset starting points with different settings, suitable for a range of different regression problems.

    to read descriptions of the models, switch to the details view.

    details view of the regression models in the models gallery

    for more information on each option, see .

  2. after selecting a model, you can train the model. in the train section, click train all and select train selected. repeat the process to explore different models.

    alternatively, you can create several draft models and then train the models as a group. in the train section, click train all and select train all.

    tip

    select regression trees first. if your trained models do not predict the response accurately enough, then try other models with higher flexibility. to avoid overfitting, look for a less flexible model that provides sufficient accuracy.

  3. if you want to try all nonoptimizable models of the same or different types, then select one of the all options in the models gallery.

    alternatively, if you want to automatically tune hyperparameters of a specific model type, select the corresponding optimizable model and perform hyperparameter optimization. for more information, see .

for next steps, see compare and improve regression models.

parallel regression model training

you can train models in parallel using regression learner if you have parallel computing toolbox. parallel training allows you to train multiple models simultaneously and continue working.

to control parallel training, toggle the use parallel button in the train section of the regression learner tab. to train draft models in parallel, ensure the button is toggled on before clicking train all. the use parallel button is available only if you have parallel computing toolbox.

use parallel button in the train section

the use parallel button is on by default. the first time you click train all and select train all or train selected, a dialog box is displayed while the app opens a parallel pool of workers. after the pool opens, you can train multiple models at once.

when models are training in parallel, progress indicators appear on each training and queued model in the models pane. if you want, you can cancel individual models. during training, you can examine results and plots from models, and initiate training of more models.

if you have parallel computing toolbox, then parallel training is available for nonoptimizable models in regression learner, and you do not need to set the useparallel option of the statset function.

note

even if you do not have parallel computing toolbox, you can keep the app responsive during model training. before training draft models, on the regression learner tab, in the train section, click train all and ensure the use background training check box is selected. then, select the train all option. a dialog box is displayed while the app opens a background pool. after the pool opens, you can continue to interact with the app while models train in the background.

compare and improve regression models

  1. examine the rmse (validation) score reported in the models pane for each model. click models in the models pane and open the corresponding plots to explore the results. compare model performance by inspecting results in the plots. you can rearrange the layout of the plots to compare results across multiple models: use the options in the layout button, drag and drop plots, or select the options provided by the document actions arrow located to the right of the model plot tabs.

    additionally, you can compare the models by using the sort by options in the models pane. delete any unwanted model by selecting the model and clicking the delete selected model button in the upper right of the pane, clicking delete in the models section of the regression learner tab, or right-clicking the model and selecting delete.

    see .

  2. select the best model in the models pane and then try including and excluding different features in the model.

    first, create a copy of the model. after selecting the model, either click duplicate in the models section of the regression learner tab or right-click the model and select duplicate.

    then, click feature selection in the options section of the regression learner tab. use the available feature ranking algorithms to select features.

    try the response plot to help you identify features to remove. see if you can improve the model by removing features with low predictive power. specify predictors to include in the model, and train new models using the new options. compare results among the models in the models pane.

    you also can try transforming features with pca to reduce dimensionality. click pca in the options section of the regression learner tab.

    see .

  3. to try to improve the model further, you can duplicate it, change the hyperparameter options in the model hyperparameters section of the model summary tab, and then train the model using the new options. to learn how to control model flexibility, see . for information on how to tune model hyperparameters automatically, see .

    if feature selection, pca, or new hyperparameter values improve your model, try training all model types with the new settings. see if another model type does better with the new settings.

tip

to avoid overfitting, look for a less flexible model that provides sufficient accuracy. for example, look for simple models, such as regression trees that are fast and easy to interpret. if your models are not accurate enough, then try other models with higher flexibility, such as ensembles. to learn about the model flexibility, see .

this figure shows the app with a models pane containing various regression model types.

regression learner app with trained models in the models pane

for a step-by-step example comparing different regression models, see train regression trees using regression learner app.

next, you can generate code to train the model with different data or export trained models to the workspace to make predictions using new data. see .

related topics

网站地图