Evaluating Multi-Class Image Classification

2 次查看(过去 30 天)
Here I written a code for evaluating multi class image classification. Kindly correct if I'm wrong
C=confusionmat(Yactual,YPred)
[row,col]= size(C);
n_class=row;
for i=1:n_class
TP(i)=C(i,i);
FN(i)=sum(C(i,:))-C(i,i);
FP(i)=sum(C(:,i))-C(i,i);
TN(i)=sum(C(:))-TP(i)-FP(i)-FN(i);
end
TP1=sum(TP)
FP1=sum(FP)
FN1=sum(FN)
TN1=sum(TN)
Accuracy=(TP1+TN1)/(TP1+TN1+FP1+FN1)
Error=1-Acc
Recall=TP1/(TP1+FN1)
Precision=TP1/(TP1+FP1)
Specificity = TN1/(TN1+FP1)
Sensitivity = TP1/(TP1+FN1)
FPR=1-Specificity
beta=1;
F1_score=( (1+(beta^2))*(Recall.*Precision)) ./ ( (beta^2)*(Precision+Recall))
I want to know above code is correct or not?
and also when I'm using accuracy = mean(YPred == Yactual) it gives precision value. why?
kindly help me in this regard. Thank you.

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Get Started with Statistics and Machine Learning Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by