How to extract data from the "plotperform" function?

조회 수: 5 (최근 30일)
I am using the "plotperform" function to see performance curves when training my neural network. How can I get the numeric values (i.e. the "x" and "y" coordinates that are plotted) of these curves as vectors (as opposed to just visuals)?

채택된 답변

MathWorks Support Team
MathWorks Support Team 2025년 1월 25일
편집: MathWorks Support Team 2025년 2월 14일
Here are two approaches to getting the "x" and "y" coordinates from the "plotperform" function:
1) Before calling "plotperform", you would typically call a function like "train" that returns a "struct" (known as the "training record"), which should contain the numeric values you are looking for, as these are used by "plotperform" for plotting. To understand the structure of the "training record," you can access the specific documentation by executing the following command in the MATLAB R2020a command window:
>> web(fullfile(docroot, 'deeplearning/ref/network.train.html'))
2) Alternatively, if you would like to access the data after running "plotperform", you could use the "XData" and "YData" attributes of the "line" object. You would first have to get handles to the "line" objects. The following code snippet is a small example of how to do this:
%initialize a network for which you can plot graphs
[x,t] = bodyfat_dataset; % Dataset shipped with MATLAB
net = feedforwardnet(10);
[net,tr] = train(net,x,t);
plotperform(tr)
% get numeric values
ax = gca; % gets handle to axes
h = findobj(ax,'Type','line'); % gets handles to all lines plotted in axes (with "plotperform" there would be 6)
x = h(6).XData; %6th line in "h" is the train curve
y = h(6).YData
Please follow the link below to search for the required information regarding the current release:

추가 답변 (0개)

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by