How to make separate graph for each class?

Hello, i have 6 classes in my project and i need to make one graph for each class... now my graph looks like this and i need graphs with average precision for each class...
...
i want each graph to look like this :

댓글 수: 6

Hard to know how to answer this without having your data and code.
should i put my entire code here ?
Cris LaPierre
Cris LaPierre 2023년 5월 4일
편집: Cris LaPierre 2023년 5월 4일
At least the data and code you used to create your two figures. We need something to work with.
Only the first figure is mine, second one is just screenshoted from matlab page.
i have this code :
Run the detector on all the test images.
detectionResults = detect(detector,testData);
Evaluate the object detector using average precision metric.
[ap,recall,precision] = evaluateDetectionPrecision(detectionResults,testData);
Plot the PR curve.
recallv = cell2mat(recall);
precisionv = cell2mat(precision);
[r,index] = sort(recallv);
p = precisionv(index);
figure
plot(r,p)
xlabel("Recall")
ylabel("Precision")
grid on
title(sprintf("Average Precision = %.2f",ap))
----------------------------------------------------------
Here are the data
recall :
[0;0.166666666666667;0.333333333333333;0.500000000000000;0.666666666666667]
17x1 double
[0;0;0;0;0;0]
15x1 double
[0;0.111111111111111;0.222222222222222;0.333333333333333;0.444444444444444;0.555555555555556;0.666666666666667;0.777777777777778]
precision:
[1;1;1;1;1]
17x1 double
[1;0;0;0;0;0]
15x1 double
[1;1;1;1;1;1;1;1]
----------------------------------
i hope this will help you with helping me :)
After adding numbers for example 1 to "ap" the figure looks like this (but i don´t know if it´s figure only for first class or no) :
recallv = cell2mat(recall);
precisionv = cell2mat(precision);
[r,index] = sort(recallv);
p = precisionv(index);
figure
plot(r,p)
xlabel("Recall")
ylabel("Precision")
grid on
title(sprintf("Average Precision = %.2f",ap(1)))
Your data does not appear to have copied correctly. Try saving your variables to a mat file and then attach that to your post using the paperclip icon.

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

답변 (1개)

Shree Harsha Kodi
Shree Harsha Kodi 2023년 6월 22일

0 개 추천

To make separate graphs for each class in MATLAB, you can follow these general steps:
1) Identify the classes in your dataset. Depending on your data format, you may need to extract the class labels from your data.
2)Iterate over the classes and create separate graphs for each class. Within each iteration, filter the data points based on the current class and plot them.
Go through the below documentation for a better understanding:
MATLAB Scatter Plot: https://www.mathworks.com/help/matlab/ref/scatter.html
MATLAB Figure Properties: https://in.mathworks.com/help/matlab/creating_plots/setting-graph-properties.html
MATLAB Control Flow (for loop): https://in.mathworks.com/help/matlab/ref/for.html

카테고리

도움말 센터File Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

제품

릴리스

R2023a

질문:

2023년 5월 4일

답변:

2023년 6월 22일

Community Treasure Hunt

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

Start Hunting!

Translated by