Is it possible to make Machine Learning model to predict multiple outputs with Statistics and Machine Learning Toolbox?
17 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
翼
am 23 Sep. 2024
Kommentiert: Philip Brown
am 23 Okt. 2024
I'd like to create a model to predict two output signals based on the following seven input signals, by using Statistics and Machine Learning Toolbox.
This csv is a the data (about 4,200 rows) used as training data.
This data is a time series every 0.025 seconds.
I think the model type is Regressin model if you create a model from this data.
(Data type of each Signal is double type.)
Input Signals:
- V_TGT_Vehicle
- P_DCDC_PNT_W
- P_HVAC_PNT_W
- SOC_BT_Hi_PNT_per
- open_accel_Driver_per
- open_break_Driver_per
- w_MG_PNT_radps
Output Signals:
- trq_MG2_tgtCalc1
- trq_MG2_tgtCalc2
I've been going through Statistics and Machine Learning Toolbox documentation, I'm not sure if it's possible to create a machine learning model like above.
I'd like to export the model as Simulink block.
Do you have any ideas?
How do I make this with Statistics and Machine Learning Toolbox?
0 Kommentare
Akzeptierte Antwort
Yifeng Tang
am 30 Sep. 2024
Using Regression Learner App, you can build a regression model for EACH of the outputs. That is to say you need to build TWO models. The app support saving the resulting regression model for use in Simulink for newer versions. Looks like you are using R2024b, so it should be OK.
Here is an example of brining one regression model to Simulink: https://www.mathworks.com/help/stats/predict-responses-using-regression-gp-predict-block.html. You just need to use two of this.
Here are examples of similar workflow for other types of models: https://www.mathworks.com/help/stats/examples.html?category=code-generation&s_tid=CRUX_topnav
You can also do this using MATLAB Function in Simulink. Here is an example: https://www.mathworks.com/help/stats/predict-class-labels-using-matlab-function-block.html. The class label model can be replaced with any regression model. You can modify the MATLAB function to accept multiple regression models and produce multiple outputs. However, each regression model is multi-input-single-output.
8 Kommentare
Yifeng Tang
am 7 Okt. 2024
Also, you may check out the Step 6 and 7 from this example: Battery State of Charge Estimation Using Deep Learning. Once you export your trained network to a format for Simulink using "exportNetworkToSimulink(recurrentNet)", it can be used in Simulink using a "Predict" block.
Weitere Antworten (1)
Jacob Mathew
am 25 Sep. 2024
Hey 翼,
The Statistics and Machine Learning Toolbox deals with classical machine learning models like linear regression and decision tree ensemble approaches which deal with a single output. If there are any data preprocessing or transformation which allows single parameter output for the dataset then the following examples are worth exploring:
- Analyze Time Series Data : https://www.mathworks.com/help/releases/R2024b/stats/time-series-regression-of-airline-passenger-data.html
- Manually Perform Time Series Forecasting Using Ensembles of Boosted Regression Trees : https://www.mathworks.com/help/releases/R2024b/stats/time-series-forecasting-using-ensemble-of-boosted-regression-trees.html
- Model and Simulate Electricity Spot Prices Using the Skew-Normal Distribution : https://www.mathworks.com/help/releases/R2024b/econ/model-and-simulate-electricity-spot-prices-using-skew-normal-distribution.html
However, if you have require the output to have two signals, then you will require the Deep Learning Toolbox to create regression neural networks. The link to the Toolbox is :
Refer to the following example to get started with Time Series Forecasting:
Once the model has been trained, it can be exported using the exportNetworkToSimulink function. The link to the function’s documentation is below:
4 Kommentare
Philip Brown
am 23 Okt. 2024
exportNetworkToSimulink works on networks of type dlnetwork, but trainNetwork trains a DAGNetwork network.
To train dlnetwork objects, you could take a look at the trainnet function.However, a simple workaround for you may be to call dlnet = dag2dlnetwork(net), which will convert the network type.
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!