MATLAB Answers

0

How to extract the predicted response from the Regression Learner App ?

Asked by Pierre Guy on 9 Sep 2019
Latest activity Commented on by Pierre Guy on 13 Sep 2019
After training a model using the Regression Learner App, how to extract the predicted response (values)?
Thank you.

  0 Comments

Sign in to comment.

1 Answer

Answer by Bhargavi Maganuru on 12 Sep 2019
 Accepted Answer

To extract the predicted response for trained data,
Select Response plot and click Export plot to Figure. It creates a figure from the plot.
To save data to workspace from the figure select File>Save Workspace. This creates a .mat file.
Load .mat file and get predicted responses
a=load('responses.mat');
PredictedResponses=a.yfit;
Hope this helps!

  3 Comments

First of all, thank you very much for your time. Following your reply, I performed new attempts to extract the predicted responses, which remained unsuccessful.
1) you said I shoud: click Export plot to Figure, however there is no such option in the regression learner app (in my case: SVM regression on Matlab R2018a).
Instead, in the Export section, I selected Export Model that exports model to the workspace as a structure containing a regression model object. From there, the two lines code you provided don't work.
2) I don't quite understand your piece of code, in particular, what is 'responses.mat' in a=load('responses.mat')?
I'm seeking further guidance.... Again, thank you very much.
Best regards,
Solution which I have mentioned is for MATLAB R2019a version.New feature Export plot to Figure in R2019a, creates figure from plot.
While saving the data to the workspace, I stored the file as 'responses.mat', which containes true and predicted responses of training data.
As there is no feature Export plot to Figure in R2018a, you can export model using Export Model and predict the responses of the training data.
Suppose you export the model as trainedModel to the workspace you can do following
PredictedReponses=trainedModel.predictFcn(T) %where T is the Training data
Thank you for your precious help.
Regards,

Sign in to comment.