Filter löschen
Filter löschen

Inconsistant Accuracy , Precision , Recall and F1 Score

4 Ansichten (letzte 30 Tage)
Life is Wonderful
Life is Wonderful am 20 Jun. 2023
Hi there,
I'm attempting to calculate Precision, Recall, and F1 score, but I see NaN in my calculations. Could you please assist me in resolving a computation bug?
Thank you
act =[
0
0.0269
0.0354
0
51.9578
34.4936
10.0596
4.2331
3.4373
2.0611
2.9576
3.1177
1.9092
1.8423
5.5713
4.7685
3.8489
3.8223
52.2738
26.4217];
pred = -0 + (100+0)*rand(size(act,1),1); %between a = 0 to b = 100
[m,order] = confusionmat(act,pred);
cmtx = m';
diagonal = diag(cmtx); % Bug here
SumOfrows = sum(cmtx,2);
precision = diagonal ./ SumOfrows;
OverallPrecision = mean(precision);
SumOfCol = sum(cmtx,1);
recall = diagonal ./ SumOfCol';
OverallRecall = mean(recall);
f1Score = 2* ((OverallPrecision*OverallRecall)/ OverallPrecision+OverallRecall);
precision,
precision = 39×1
NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
OverallPrecision,
OverallPrecision = NaN
recall,
recall = 39×1
0 0 0 0 0 0 0 0 0 0
OverallRecall,
OverallRecall = NaN
f1Score
f1Score = NaN
  20 Kommentare
dpb
dpb am 23 Jun. 2023
Bearbeitet: dpb am 23 Jun. 2023
Well, that's certainly a different result; those two have almost perfect correlation.
However, as to what can be inferred from the above and what sort of an analysis to apply is far too complex a question to answer in this forum; would need in-depth consultation in order to have a sufficient understanding of the problem in order to be able to do so.
Good luck in finding someone in your environment that has such expertise...
Life is Wonderful
Life is Wonderful am 24 Jun. 2023
Thank you very much for your time and efforts in helping me.
best wishes

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Descriptive Statistics finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by