I keep getting error using plot not enough input arguments.

I keep getting error when I try to plot the following code and I don't really know what to do.
figure
plot(recall,precision)
xlabel("Recall")
ylabel("Precision")
grid on
title(sprintf("Average Precision = %.2f",ap))
Error using plot
Not enough input arguments.

3 Comments

And how are the arrays for recall and prescision defined in your code ?
At the moment, both plot components are empty - thus nothing to plot.
[ap,recall,precision] = evaluateDetectionPrecision(detectionResults,testData);
like this
i improved the code to something like this :
recallv = cell2mat(recall);
precisionv = cell2mat(precision);
figure
plot(recallv,precisionv)
xlabel("Recall")
ylabel("Precision")
grid on
title(sprintf("Average Precision = %.2f",ap))
the graph is shown but it looks bad, something else is wrong also.

Sign in to comment.

Answers (1)

You need to sort your x data.
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))

6 Comments

thanks, it looks like this helped, but i have 6 classes in my detector... it looks like there is average precision for all the classes in one graph ... how to improve it ?
Could you please attach your data?
The arrays - recall and precision.
Also, could you elaborate on this statement?
"it looks like there is average precision for all the classes in one graph ... how to improve it ? "
recall :
0
[0;0.166666666666667;0.333333333333333;0.500000000000000;0.666666666666667;0.833333333333333]
20x1 double
[0;0.125000000000000;0.250000000000000;0.375000000000000;0.500000000000000;0.625000000000000;0.750000000000000;0.875000000000000;1]
12x1 double
[0;0.111111111111111;0.222222222222222;0.333333333333333;0.444444444444444;0.555555555555556;0.666666666666667;0.777777777777778;0.888888888888889;1]
precision :
1
[1;1;1;1;1;1]
20x1 double
[1;1;1;1;1;1;1;1;1]
12x1 double
[1;1;1;1;1;1;1;1;1;1]
i want to say that i have 6 classes in my project, so in that graph (on the top of the graph, ap = 0,83, ap = 0,29...) i posted, there are average precisions for 6 classes in my opinion ... i don´t know if its possible to combine them to only one average precision or what to do with them... on matlab page there is one example where the graph looks like this (but they had only one class to detect) :
I hope you understand me, and i am so thankful for your answers.
maybe it will be easier to make one graph for each class, but i don´t know how to do it ...

Sign in to comment.

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Products

Release

R2023a

Asked:

on 4 May 2023

Commented:

on 4 May 2023

Community Treasure Hunt

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

Start Hunting!