Skip to content

Commit

Permalink
Maintenance of Live Modules Update for 2024b+.
Browse files Browse the repository at this point in the history
- Updated CI
- Updated Smoke Tests
- Plotting hard-coded color updates
- Project structure updates
  • Loading branch information
callieEDU committed Oct 23, 2024
1 parent 781f8bb commit dd58fdc
Show file tree
Hide file tree
Showing 29 changed files with 569 additions and 371 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*.slmx binary merge=mlAutoMerge
*.sltx binary
*.slxc binary
*.slx binary merge=mlAutoMerge
*.slx binary merge=mlAutoMerge linguist-language=Simulink
*.slxp binary

## Other common binary file types
Expand Down
76 changes: 52 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
name: Module Test
name: MATLAB Build

# Controls when the action will run.
on:
push:
branches: [ release ]
pull_request:
branches: [ release ]
workflow_dispatch:

# Add permission to write GitHub pages
permissions:
contents: write
pages: write
id-token: write

jobs:
RunTests:
test:
strategy:
fail-fast: false
matrix:
MATLABVersion: [R2021a,R2021b,R2022a,R2022b,R2023a,R2023b]
MATLABVersion: [R2024a,R2024b]
runs-on: ubuntu-latest
steps:
# Checks-out your repository
- uses: actions/checkout@v3

- uses: actions/checkout@v4

# Sets up a display server
- name: Start display server
if: ${{ always() }}
run: |
Expand All @@ -30,7 +38,15 @@ jobs:
uses: matlab-actions/setup-matlab@v2
with:
release: ${{ matrix.MATLABVersion }}
products: Statistics_and_Machine_Learning_Toolbox Econometrics_Toolbox Deep_Learning_Toolbox Simulink Simulink_Coder
products: MATLAB Statistics_and_Machine_Learning_Toolbox Econometrics_Toolbox Deep_Learning_Toolbox Parallel_Computing_Toolbox
# List required products above in the format shown (and uncomment them)
# List of product strings:
# Simulink
# Statistics_and_Machine_Learning_Toolbox
# Simulink_Coder
# Econometrics_Toolbox
# Deep_Learning_Toolbox


# Run all the tests
- name: Run SmokeTests
Expand All @@ -40,42 +56,54 @@ jobs:

# Upload the test results as artifact
- name: Upload TestResults
if: always()
uses: actions/upload-artifact@v3.1.3
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: TestResults
path: ./SoftwareTests/TestResults_${{ matrix.MATLABVersion }}.txt

name: TestResults_${{ matrix.MATLABVersion }}
path: ./public/*
overwrite: true

CreateBadge:
badge:
if: ${{ always() }}
needs: [RunTests]
needs: [test]
strategy:
fail-fast: false
runs-on: ubuntu-latest
steps:

# Checks-out your repository
- uses: actions/checkout@v3
- uses: actions/checkout@v4

# Sets up R2023b
- name: Setup MATLAB
uses: matlab-actions/setup-matlab@v1
uses: matlab-actions/setup-matlab@v2
with:
release: R2023b
release: R2024b

# Download the test results from artifact
- name: Download TestResults
uses: actions/download-artifact@v2.1.1
- name: Download All TestResults
uses: actions/download-artifact@v4
with:
name: TestResults
path: ./SoftwareTests/

path: public
pattern: TestResults_*
merge-multiple: true

# Create the test results badge
- name: Run CreateBadge
uses: matlab-actions/run-command@v1
- name: Run PostSmokeTest
uses: matlab-actions/run-command@v2
with:
command: openProject(pwd); PostSmokeTest;

# Deploy reports to GitHub pages
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload pages artifact
uses: actions/upload-pages-artifact@v3
with:
command: openProject(pwd); CreateBadge;
path: public
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

# Commit the JSON for the MATLAB releases badge
- name: Commit changed files
Expand Down
7 changes: 2 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,5 @@ codegen/
# Project settings
Utilities/ProjectSettings.mat

# Test results
SoftwareTests/TestResults_*

# GitLab page fodler
public/
# GitLab page folder
public/
2 changes: 1 addition & 1 deletion Images/TestedWith.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"schemaVersion":1,"label":"Tested with","color":"success","message":"R2021a | R2021b | R2022a | R2022b | R2023a | R2023b"}
{"schemaVersion":1,"label":"Tested with","color":"success","message":"R2024a | R2024b"}
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2023, The MathWorks, Inc.
Copyright (c) 2024, The MathWorks, Inc.
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
198 changes: 102 additions & 96 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,96 +1,102 @@

<a name="T_DEF03274"></a>
# <span style="color:rgb(213,80,0)">Machine Learning for Regression</span>
<a name="H_053613DF"></a>

[![View on File Exchange](https://www.mathworks.com/matlabcentral/images/matlab-file-exchange.svg)](https://www.mathworks.com/matlabcentral/fileexchange/95903-machine-learning-for-regression) or [![Open in MATLAB Online](https://www.mathworks.com/images/responsive/global/open-in-matlab-online.svg)](https://matlab.mathworks.com/open/github/v1?repo=MathWorks-Teaching-Resources/Machine-Learning-for-Regression&project=MLforRegression.prj&file=README.mlx)

![MATLAB Versions Tested](https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2FMathWorks-Teaching-Resources%2FMachine-Learning-for-Regression%2Frelease%2FImages%2FTestedWith.json)

**Curriculum Module**

_Created with R2021a. Compatible with R2021a and later releases._

# Information

This curriculum module contains interactive [MATLAB® live scripts](https://www.mathworks.com/products/matlab/live-editor.html) that teach the basics of machine learning for regression.

<a name="H_F00D98E4"></a>
## Background

You can use these live scripts as demonstrations in lectures, class activities, or interactive assignments outside class. This module covers the difference between regression, classification, and clustering, as well as feature engineering and feature extraction, overfitting and underfitting, and a variety of machine learning models commonly used for regression. It also includes a detailed example of applying regression models for electricity load forecasting using real-world data.


The instructions inside the live scripts will guide you through the exercises and activities. Get started with each live script by running it one section at a time. To stop running the script or a section midway (for example, when an animation is in progress), use the <img src="Images/image_0.png" width="19" alt="image_0.png"> Stop button in the **RUN** section of the **Live Editor** tab in the MATLAB Toolstrip.

## Contact Us

Solutions are available upon instructor request. Contact the [MathWorks teaching resources team](mailto:[email protected]) if you would like to request solutions, provide feedback, or if you have a question.

<a name="H_30BC7141"></a>
## Prerequisites

This module does not assume any prior exposure to the subject of machine learning.

<a name="H_330E72C3"></a>
## Getting Started
### Accessing the Module
### **On MATLAB Online:**

Use the [<img src="Images/image_1.png" width="136" alt="image_1.png">](https://matlab.mathworks.com/open/github/v1?repo=MathWorks-Teaching-Resources/Machine-Learning-for-Regression&project=MLforRegression.prj) link to download the module. You will be prompted to log in or create a MathWorks account. The project will be loaded, and you will see an app with several navigation options to get you started.

### **On Desktop:**

Download or clone this repository. Open MATLAB, navigate to the folder containing these scripts and double-click on [MLforRegression.prj](MLforRegression.prj). It will add the appropriate files to your MATLAB path and open an app that asks you where you would like to start.


Ensure you have all the required products ([listed below](#H_E850B4FF)) installed. If you need to include a product, add it using the Add-On Explorer. To install an add-on, go to the **Home** tab and select <img src="Images/image_2.png" width="16" alt="image_2.png"> **Add-Ons** > **Get Add-Ons**.

<a name="H_E850B4FF"></a>
## Products

MATLAB® is used throughout. Tools from Statistics and Machine Learning Toolbox™ are used frequently as well.

<a name="H_E8C62B23"></a>
# Scripts

*If you are viewing this in a version of MATLAB prior to R2023b, you can view the learning outcomes for each script* [*here*](https://www.mathworks.com/matlabcentral/fileexchange/95903-machine-learning-for-regression)

## [**MachineLearningIntro.mlx**](Scripts/MachineLearningIntro.mlx)
| <img src="Images/image_3.png" width="171" alt="image_3.png"> | **In this script, students will...** <br>- Learn the difference between regression, classification, and clustering <br>- Define feature engineering/extraction <br>- Identify and use different machine learning models commonly used for regression <br>- Be able to explain overfitting and underfitting |
| :-- | :-- |

## [**LoadForecastRegression.mlx**](Scripts/LoadForecastRegression.mlx)
| <img src="Images/image_4.png" width="171" alt="image_4.png"> | **In this script, students will...** <br>- Apply the machine learning workflow to solve a problem in time series forecasting <br>- Engineer appropriate features to solve the forecasting problem <br>- Validate and compare different types of regression models <br>- Test and evaluate the trained model to make predictions |
| :-- | :-- |

## [**FE1_ProgrammaticML.mlx**](Scripts/FE1_ProgrammaticML.mlx) **and** [**FE2_LoadForecastDL.mlx**](Scripts/FE2_LoadForecastDL.mlx)
| <img src="Images/image_5.png" width="371" alt="image_5.png"> | **In these scripts, students will...** <br>- Expand on the practical problem presented in [LoadForecastRegression.mlx](Scripts/LoadForecastRegression.mlx) <br>- Define feature engineering/extraction <br>- Identify and use different machine learning models commonly used for regression <br>- Be able to explain overfitting and underfitting |
| :-- | :-- |

# Related Courseware Modules
<a name="H_61EB2540"></a>
## [**Regression Basics**](https://www.mathworks.com/matlabcentral/fileexchange/93435-regression-basics)
| <img src="Images/image_6.png" width="171" alt="image_6.png"> | **Available on:**[<img src="Images/image_7.png" width="129" alt="image_7.png">](https://www.mathworks.com/matlabcentral/fileexchange/93435-regression-basics)[<img src="Images/image_8.png" width="130" alt="image_8.png">](https://matlab.mathworks.com/open/github/v1?repo=MathWorks-Teaching-Resources/Regression-Basics&project=RegressionBasics.prj)[GitHub](https://github.com/MathWorks-Teaching-Resources/Regression-Basics) |
| :-- | :-- |

<a name="H_5F86F1DE"></a>
## [**Machine Learning Methods: Clustering**](https://www.mathworks.com/matlabcentral/fileexchange/135381-machine-learning-methods-clustering)
| <img src="Images/image_9.png" width="171" alt="image_9.png"> | **Available on:**[<img src="Images/image_10.png" width="129" alt="image_10.png">](https://www.mathworks.com/matlabcentral/fileexchange/135381-machine-learning-methods-clustering)[<img src="Images/image_11.png" width="130" alt="image_11.png">](https://matlab.mathworks.com/open/github/v1?repo=MathWorks-Teaching-Resources/Machine-Learning-Methods-Clustering&project=MLMethodsClustering.prj)[GitHub](https://github.com/MathWorks-Teaching-Resources/Machine-Learning-Methods-Clustering) |
| :-- | :-- |


Or feel free to explore our other [modular courseware content](https://www.mathworks.com/matlabcentral/fileexchange/?q=tag%3A%22courseware+module%22&sort=downloads_desc_30d).

# Educator Resources
- [Educator Page](https://www.mathworks.com/academia/educators.html)
<a name="H_0FA5DA18"></a>
# Contribute

Looking for more? Find an issue? Have a suggestion? Please contact the [MathWorks teaching resources team](mailto:%[email protected]). If you want to contribute directly to this project, you can find information about how to do so in the [CONTRIBUTING.md](https://github.com/MathWorks-Teaching-Resources/Machine-Learning-for-Regression/blob/release/CONTRIBUTING.md) page on GitHub.


*©* Copyright 2023 The MathWorks™, Inc




# <span style="color:rgb(213,80,0)">Machine Learning for Regression</span>


[![View on File Exchange](https://www.mathworks.com/matlabcentral/images/matlab-file-exchange.svg)](https://www.mathworks.com/matlabcentral/fileexchange/95903-machine-learning-for-regression) or [![Open in MATLAB Online](https://www.mathworks.com/images/responsive/global/open-in-matlab-online.svg)](https://matlab.mathworks.com/open/github/v1?repo=MathWorks-Teaching-Resources/Machine-Learning-for-Regression&project=MLforRegression.prj&file=README.mlx)

[![MATLAB Versions Tested](https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2FMathWorks-Teaching-Resources%2FMachine-Learning-for-Regression%2Frelease%2FImages%2FTestedWith.json)](https://MathWorks-Teaching-Resources.github.io/Machine-Learning-for-Regression)

**Curriculum Module**

_Created with R2024b. Compatible with R2024b and later releases._

# Information

This curriculum module contains interactive [MATLAB® live scripts](https://www.mathworks.com/products/matlab/live-editor.html) that teach the basics of machine learning for regression.


## Background

You can use these live scripts as demonstrations in lectures, class activities, or interactive assignments outside class. This module covers the difference between regression, classification, and clustering, as well as feature engineering and feature extraction, overfitting and underfitting, and a variety of machine learning models commonly used for regression. It also includes a detailed example of applying regression models for electricity load forecasting using real\-world data.


The instructions inside the live scripts will guide you through the exercises and activities. Get started with each live script by running it one section at a time. To stop running the script or a section midway (for example, when an animation is in progress), use the <img src="Images/image_0.png" width="19" alt="image_0.png"> Stop button in the **RUN** section of the **Live Editor** tab in the MATLAB Toolstrip.

## Contact Us

Solutions are available upon instructor request. Contact the [MathWorks teaching resources team](mailto:[email protected]) if you would like to request solutions, provide feedback, or if you have a question.


## Prerequisites

This module does not assume any prior exposure to the subject of machine learning.


## Getting Started
### Accessing the Module
### **On MATLAB Online:**

Use the [<img src="Images/image_1.png" width="136" alt="image_1.png">](https://matlab.mathworks.com/open/github/v1?repo=MathWorks-Teaching-Resources/Machine-Learning-for-Regression&project=MLforRegression.prj) link to download the module. You will be prompted to log in or create a MathWorks account. The project will be loaded, and you will see an app with several navigation options to get you started.

### **On Desktop:**

Download or clone this repository. Open MATLAB, navigate to the folder containing these scripts and double\-click on [MLforRegression.prj](MLforRegression.prj). It will add the appropriate files to your MATLAB path and open an app that asks you where you would like to start.


Ensure you have all the required products (listed below) installed. If you need to include a product, add it using the Add\-On Explorer. To install an add\-on, go to the **Home** tab and select <img src="Images/image_2.png" width="16" alt="image_2.png"> **Add-Ons** > **Get Add-Ons**.


## Products

MATLAB® is used throughout. Tools from Statistics and Machine Learning Toolbox™, Deep Learning Toolbox™, and Econometrics Toolbox™ are used frequently as well. Parallel Computing Toolbox™ is utilized specifically for the [parfor](https://www.mathworks.com/help/parallel-computing/parfor.html) function.


# Scripts

*If you are viewing this in a version of MATLAB prior to R2023b, you can view the learning outcomes for each script* [*here*](https://www.mathworks.com/matlabcentral/fileexchange/95903-machine-learning-for-regression)

## [**MachineLearningIntro.mlx**](Scripts/MachineLearningIntro.mlx)
| | |
| :-- | :-- |
| <img src="Images/image_3.png" width="171" alt="image_3.png"> <br> | **In this script, students will...** <br> $\bullet$ Learn the difference between regression, classification, and clustering <br> $\bullet$ Define feature engineering/extraction <br> $\bullet$ Identify and use different machine learning models commonly used for regression <br> $\bullet$ Be able to explain overfitting and underfitting <br> |
| | |

## [**LoadForecastRegression.mlx**](Scripts/LoadForecastRegression.mlx)
| | |
| :-- | :-- |
| <img src="Images/image_4.png" width="171" alt="image_4.png"> <br> | **In this script, students will...** <br> $\bullet$ Apply the machine learning workflow to solve a problem in time series forecasting <br> $\bullet$ Engineer appropriate features to solve the forecasting problem <br> $\bullet$ Validate and compare different types of regression models <br> $\bullet$ Test and evaluate the trained model to make predictions <br> |
| | |

## [**FE1\_ProgrammaticML.mlx**](Scripts/FE1_ProgrammaticML.mlx) **and** [**FE2\_LoadForecastDL.mlx**](Scripts/FE2_LoadForecastDL.mlx)
| | |
| :-- | :-- |
| <img src="Images/image_5.png" width="371" alt="image_5.png"> <br> | **In these scripts, students will...** <br> $\bullet$ Expand on the practical problem presented in [LoadForecastRegression.mlx](Scripts/LoadForecastRegression.mlx) <br> $\bullet$ Define feature engineering/extraction <br> $\bullet$ Identify and use different machine learning models commonly used for regression <br> $\bullet$ Be able to explain overfitting and underfitting <br> |
| | |

# Related Courseware Modules
## [**Regression Basics**](https://www.mathworks.com/matlabcentral/fileexchange/93435-regression-basics)
| | |
| :-- | :-- |
| <img src="Images/image_6.png" width="171" alt="image_6.png"> <br> | **Available on:** <br> [<img src="Images/image_7.png" width="129" alt="image_7.png">](https://www.mathworks.com/matlabcentral/fileexchange/93435-regression-basics) <br> [<img src="Images/image_8.png" width="130" alt="image_8.png">](https://matlab.mathworks.com/open/github/v1?repo=MathWorks-Teaching-Resources/Regression-Basics&project=RegressionBasics.prj) <br> [GitHub](https://github.com/MathWorks-Teaching-Resources/Regression-Basics) <br> |
| | |

## [**Machine Learning Methods: Clustering**](https://www.mathworks.com/matlabcentral/fileexchange/135381-machine-learning-methods-clustering)
| | |
| :-- | :-- |
| <img src="Images/image_9.png" width="171" alt="image_9.png"> <br> | **Available on:** <br> [<img src="Images/image_10.png" width="129" alt="image_10.png">](https://www.mathworks.com/matlabcentral/fileexchange/135381-machine-learning-methods-clustering) <br> [<img src="Images/image_11.png" width="130" alt="image_11.png">](https://matlab.mathworks.com/open/github/v1?repo=MathWorks-Teaching-Resources/Machine-Learning-Methods-Clustering&project=MLMethodsClustering.prj) <br> [GitHub](https://github.com/MathWorks-Teaching-Resources/Machine-Learning-Methods-Clustering) <br> |
| | |


Or feel free to explore our other [modular courseware content](https://www.mathworks.com/matlabcentral/fileexchange/?q=tag%3A%22courseware+module%22&sort=downloads_desc_30d).

# Educator Resources
- [Educator Page](https://www.mathworks.com/academia/educators.html)

# Contribute

Looking for more? Find an issue? Have a suggestion? Please contact the [MathWorks teaching resources team](mailto:%[email protected]). If you want to contribute directly to this project, you can find information about how to do so in the [CONTRIBUTING.md](https://github.com/MathWorks-Teaching-Resources/Machine-Learning-for-Regression/blob/release/CONTRIBUTING.md) page on GitHub.


*©* Copyright 2023 The MathWorks™, Inc


Binary file modified README.mlx
Binary file not shown.
Binary file modified Scripts/ElectricityLoadDataML.mlx
Binary file not shown.
Binary file modified Scripts/FE1_ProgrammaticML.mlx
Binary file not shown.
Binary file modified Scripts/FE2_LoadForecastDL.mlx
Binary file not shown.
Binary file modified Scripts/LoadForecastRegression.mlx
Binary file not shown.
Binary file modified Scripts/MachineLearningIntro.mlx
Binary file not shown.
Loading

0 comments on commit dd58fdc

Please sign in to comment.