Skip to content
MathWorks - Mobile View
  • Sign In to Your MathWorks AccountSign In to Your MathWorks Account
  • Access your MathWorks Account
    • My Account
    • My Community Profile
    • Link License
    • Sign Out
  • Products
  • Solutions
  • Academia
  • Support
  • Community
  • Events
  • Get MATLAB
MathWorks
  • Products
  • Solutions
  • Academia
  • Support
  • Community
  • Events
  • Get MATLAB
  • Sign In to Your MathWorks AccountSign In to Your MathWorks Account
  • Access your MathWorks Account
    • My Account
    • My Community Profile
    • Link License
    • Sign Out

Videos and Webinars

  • MathWorks
  • Videos
  • Videos Home
  • Search
  • Videos Home
  • Search
  • Contact sales
  • Trial software
3:42 Video length is 3:42.
  • Description
  • Full Transcript
  • Code and Resources

Forecast Electrical Load Using the Regression Learner App

From the series: Machine Learning in Finance

The Regression Learner app lets you explore your data, select features, specify validation schemes, optimize hyperparameters, and assess model performance to predict your data without needing to write any code.

You can export regression models to the MATLAB® workspace or generate MATLAB code to integrate models into applications.

The app takes menial workflows and tasks like setting up the validation, picking the relevant predictors, and picking the optimal model and tuning it and makes them interactive, saving you time. It also gives you full transparency into what's happening under the hood and automates the workflow by automatically generating code.

Regression Learner App in the Statistics and Machine Learning toolbox lets you train multiple models and choose the best model to predict your data, without needing to write any code.

You can also use the app to explore your data, select features, specify validation schemes, optimize hyperparameters, and assess model performance.

This example will use the app to model the amount of electricity required to support an electric grid – also referred to as the “load” – and use that model to make predictions about a future load.

You can find the Regression Learner app in the app gallery under machine learning and deep learning.

You can also open it directly from the MATLAB command line.

Start a new session, and then select the dataset you want to use. Based on the data types of the variables therein, the app will automatically assign them as predictors or as responses. However, you can always change their roles if necessary. You can also deselect variables irrelevant to predicting a response, which will save on training time.

The default automatic cross-validation option protects against overfitting. In this example, where we have lots of data, hold-out validation works well.

Next, you’ll be able to explore which machine learning model makes the most sense with your data.

There are many models from which you can choose: linear regression models, regression trees, Gaussian process regression models, support vector machines, and ensembles of regression trees.

If you already have an idea of what kinds of models are best suited for your data, you can train them one-by-one, or select a group of models to train. If you’re unsure, just select them all, start training, and look at the one that gives you the best initial performance.

You can see the models in the history list along with the Root-Mean Square Error (or RMSE). RMSE represents the model’s performance, or fitness, against your data. The lower the error, the better the fitness. The app will automatically highlight the model with the lowest error.

In this example, the model with the lowest RMSE is the Matern 5/2 GPR.

When you select a model, you’ll be able to use various plots to see more details about its performance.

As an example, the predicted vs actual plot helps you understand how well this particular model makes predictions for different response values. A perfect regression model has a predicted response equal to the true response, so all the points lie on a diagonal line. The vertical distance from the line to any point is the error of the prediction for that point.

To further optimize the model, you can tune its hyperparameters. The app will try different combinations of hyperparameter values by using an optimization scheme that seeks to minimize the model error.

To do this, select the Optimizable model corresponding to your model type, in this case, the Optimizable GPR.

The app will iterate through all these combinations of hyperparameters for GPR models. The visualization shows how the error decreases as different combinations of hyperparameters are evaluated. When it’s done, the app will highlight the best one with the lowest RMSE.

After you are satisfied with the training and tuning process, you can export your model back to the MATLAB workspace or generate MATLAB code.

Exporting to the workspace enables you to use the trained model to make predictions on new data.

Generating the MATLAB code for this model enables you to integrate it into machine learning applications, and enables your colleagues to quickly replicate your results.

To learn more about regression learning and download example datasets, click on the Help icon in the top right corner of the app.

Download Code and Files

Download code

Related Products

  • Statistics and Machine Learning Toolbox

Classify Data Using the Classification Learner App (4:34)
Machine Learning Questions Asked and Answered: All About the Regression Learner App
What Is Linear Regression?
Machine Learning with MATLAB

Bridging Wireless Communications Design and Testing with MATLAB

Read white paper
VIEW SLIDESHOW

VIEW SLIDESHOW

Five Interactive Apps for Machine Learning

Feedback

Featured Product

Statistics and Machine Learning Toolbox

  • Request Trial
  • Get Pricing

Related Videos:

4:34
Classify Data Using the Classification Learner App
35:09
Regression Analysis with MATLAB: New Statistics Toolbox...
46:23
Solving Data Management and Analysis Challenges Using...
39:42
Computational Statistics in BioPharm Using MATLAB Products
34:44
Multilevel Mixed-Effects Modeling Using MATLAB

View more related videos

MathWorks - Domain Selector

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

  • Switzerland (English)
  • Switzerland (Deutsch)
  • Switzerland (Français)
  • 中国 (简体中文)
  • 中国 (English)

You can also select a web site from the following list:

How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

Americas

  • América Latina (Español)
  • Canada (English)
  • United States (English)

Europe

  • Belgium (English)
  • Denmark (English)
  • Deutschland (Deutsch)
  • España (Español)
  • Finland (English)
  • France (Français)
  • Ireland (English)
  • Italia (Italiano)
  • Luxembourg (English)
  • Netherlands (English)
  • Norway (English)
  • Österreich (Deutsch)
  • Portugal (English)
  • Sweden (English)
  • Switzerland
    • Deutsch
    • English
    • Français
  • United Kingdom (English)

Asia Pacific

  • Australia (English)
  • India (English)
  • New Zealand (English)
  • 中国
    • 简体中文Chinese
    • English
  • 日本Japanese (日本語)
  • 한국Korean (한국어)

Contact your local office

  • Contact sales
  • Trial software

MathWorks

Accelerating the pace of engineering and science

MathWorks is the leading developer of mathematical computing software for engineers and scientists.

Discover…

Explore Products

  • MATLAB
  • Simulink
  • Student Software
  • Hardware Support
  • File Exchange

Try or Buy

  • Downloads
  • Trial Software
  • Contact Sales
  • Pricing and Licensing
  • How to Buy

Learn to Use

  • Documentation
  • Tutorials
  • Examples
  • Videos and Webinars
  • Training

Get Support

  • Installation Help
  • MATLAB Answers
  • Consulting
  • License Center
  • Contact Support

About MathWorks

  • Careers
  • Newsroom
  • Social Mission
  • Customer Stories
  • About MathWorks
  • Select a Web Site United States
  • Trust Center
  • Trademarks
  • Privacy Policy
  • Preventing Piracy
  • Application Status

© 1994-2022 The MathWorks, Inc.

  • Facebook
  • Twitter
  • Instagram
  • YouTube
  • LinkedIn
  • RSS

Join the conversation