How to calculate the precision and recall for prediction deep learning

Dear all,
How to calculate the precision and recall for my prediction result deep learning?
my groundTruth(g.mat) is logical, and my prediction(tempSeg1.mat) also logical. All as attached.
anyone can help me?

 採用された回答

Yatharth
Yatharth 2022 年 6 月 27 日
Hey, can you tell more about your output matrix ? if you want to do element wise comparision of the 3d matrix then you can simply run 3 for loops like this and apply the formula.
TP=0;FP=0;TN=0;FN=0;
for i=1:128
for j=1:128
for k = 1: 64
if(idxx(i,j,k)==1 && tempSeg1(i,j,k)==1)
TP=TP+1;
elseif(idxx(i,j,k)==0 && tempSeg1(i,j,k)==1)
FP=FP+1;
elseif(idxx(i,j,k)==0 && tempSeg1(i,j,k)==0)
TN=TN+1;
else
FN=FN+1;
end
end
end
end
Precision = TP/(TP + FP)
Recall = TP /(TP + FN)

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Get Started with Statistics and Machine Learning Toolbox についてさらに検索

質問済み:

2022 年 6 月 27 日

回答済み:

2022 年 6 月 27 日

Community Treasure Hunt

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

Start Hunting!

Translated by