How to plot a regression model after exporting from regression learner app to workspace as function

2 views (last 30 days)
I have exported model from Regression learner app as function
function [trainedModel, validationRMSE] = trainRegressionModel(trainingData)
I trained new data and stored trained model and validationRMSE in variables 'a' and 'b' respectively.
Now I want to plot the actual values , predicted values and confidence interval of that model.
the varible 'a' is struct, could you please guide how can I plot the respose after exporting regression model as a funciton in workspace.
Thanks in advance.

Answers (1)

Drew
Drew on 7 Feb 2023
The answer at https://www.mathworks.com/matlabcentral/answers/1881227-question-on-regression-learner-app shows how to create predicted vs actual plots using a model exported from the Regression Learner app. You can do similarly with the model you have trained using the generate function from the Regression Learner app.
As for confidence intervals, that depends on the type of Regression Model that you have built. For Linear Models (class = LinearModel), there are many object functions for visualization, including some that show confidence intervals. See documentation https://www.mathworks.com/help/stats/linearmodel.html#bsz4dm2-5
If this answer is helpful to you, please accept this answer. If you have another more specific question about confidence intervals for a particular type of model, you might want to make that a different question.

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!