Inconsistant Accuracy , Precision , Recall and F1 Score

조회 수: 9 (최근 30일)
Life is Wonderful
Life is Wonderful 2023년 6월 20일
댓글: Life is Wonderful 2023년 6월 24일
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
dpb
dpb 2023년 6월 23일
편집: dpb 2023년 6월 23일
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 2023년 6월 24일
Thank you very much for your time and efforts in helping me.
best wishes

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

태그

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by