Regression tree and regression equation

3 Ansichten (letzte 30 Tage)
Danish Nasir
Danish Nasir am 7 Nov. 2022
Beantwortet: Drew am 10 Nov. 2022
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.

Akzeptierte Antwort

Drew
Drew am 10 Nov. 2022
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:

Weitere Antworten (0)

Produkte


Version

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by