- You can save the model built by regression learner in a .mat file, and load that model in a new script.
- You can use the code generated by the regression learner app to re-train the model in a new script, or to train with new data, if you prefer. The specific section is https://www.mathworks.com/help/stats/export-regression-model-to-predict-new-data.html#bvi2d8a-49
Regression tree and regression equation
3 次查看(过去 30 天)
显示 更早的评论
Suppose i have 3 input variables x1,x2 and x3. Each variable is 400x1 size. x1 is a categorical variable while x2 and x3 are continuous variable. Also y is output which is also continuous.x1 range is [a b c d e f] and keep repeating it for 400 cells. x2 range is [0.2 to 2], x3 range is [3 to 23]. The output y range is [2 to 7]. The values of x1,x2,x3 and y can be generated using rand generator. I want to generate regression tree to predict y*. Now i want this prediction equation or code to be saved in a file so that i can use it in another file. The Matlab regression learner app have these features but i am not able to export the code or model in my other script. I want that the prediction equation will predict the output y* based on the other input x1,x2 and x3.
Pls suggest the steps with an example to generate regression tree,export code,save code and use in other script to predict y* for other randomly generated input data x1,x2,x3.
0 个评论
采纳的回答
Drew
2022-11-10
You can train a regression model using the regression learner app, then export the model to the workspace to predict new data as described at https://www.mathworks.com/help/stats/export-regression-model-to-predict-new-data.html. The specific section is: https://www.mathworks.com/help/stats/export-regression-model-to-predict-new-data.html#bvi2d8a-47
As for using the model in a different script, you have several options:
0 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!