Regression learner response plot?

조회 수: 3 (최근 30일)
Phil Whitfield
Phil Whitfield 2018년 8월 7일
편집: Milly 2024년 6월 20일
So I am using the regression learner app, and it provides the plot that I want, however I would like to use that plot in the main matlab section, so I can change the titles, axis and colours of the graph.
I had a look for the data that it plots when exported, however could not find it.
Any advice?
  댓글 수: 7
Milly
Milly 2024년 6월 20일
Any update on this yet? It has been 6 years!
I have been able to recreate the resonse plot with "True" and "Predicted" options by adding the following code to the default "Generate Function" code.
I am still searching for how to include the "Errors" option to the chart, any suggestions welcome.
figure
plot(responseData,"*");
hold on
plot(validationPredictions,"*");
% need something here to add the "Errors" option!
hold off
Milly
Milly 2024년 6월 20일
To add the error bars use the following:
% calculate mid point between each pair
midpoint = (responseData + validationPredictions)/2;
% calculate the distance from the mid point to either result
errorBars = abs(responseData - validationPredictions)/2;
% use both in errorbar plot with the connecting lines and markers turned off
errorbar(midpoint,errorBars,"LineStyle","none", 'DisplayName',"Error")

댓글을 달려면 로그인하십시오.

답변 (1개)

Milly
Milly 2024년 6월 20일
편집: Milly 2024년 6월 20일
To manually replicate the Response Plot from the Regression Learner and plot when you run it, add the following code to the end of the function.
The variables [responseData, validationPredictions] are created as default in the "Generate Function" code.
You can then adjust titles, axis and colours of the graph as usual, within this code.
% Dummy data, variable names as in "Generate Function" code
responseData = randi([1,10],10,1); % True
validationPredictions = randi([1,10],10,1); % Predicted
% plot results
figure
hold on
plot(responseData,"*", "DisplayName","True"); % Plot "True"
plot(validationPredictions,"*", "DisplayName","Predicted"); % Plot "Predicted"
% add errors
midpoint = (responseData + validationPredictions)/2; % mid point between each pair
errorBars = abs(responseData - validationPredictions)/2; % distance from mid point
errorbar(midpoint,errorBars,"LineStyle","none", 'DisplayName',"Error") % Plot "Errors"
legend('Location','northeastoutside')
title("Response Plot")
xlabel("Record number"); ylabel("Response")
hold off

카테고리

Help CenterFile Exchange에서 Support Vector Machine Regression에 대해 자세히 알아보기

제품


릴리스

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by