calculate true positive , true negative, false positive and false negative as we have segmented and ground truth is that code is correct idx = (expected()==1)
p = length( expected(idx)) n = length( expected(~idx)) N = p+n tp = sum( expected(idx)== predicted(idx)) tn = sum( expected(~idx)== predicted(~idx)) fp = n-tn fn = p-tp
accuracy=(tp+tn)/(tp+tn+fp+fn)
Best Answer