문제

I have a small problem in coding confusion 3x3 matrix by using matlab...

I tried the code below,

average = sum(diag(Mconf)./sum(Mconf,2))/3;

However, it get NaN for the confusion matrix is [0 0 0;1 2 3;4 5 6] or [1 2 3;0 0 0;4 5 6] or [1 2 3;4 5 6;0 0 0]

도움이 되었습니까?

해결책

Try

average = sum(diag(Mconf)./sum(Mconf+eps,2))/3;

To eliminate the division by zero.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top