Metthew Correlation Coeffecient
조회 수: 7 (최근 30일)
이전 댓글 표시
Hi All
I would like to calculate Metthew correlation coeffecient for four class of data for example
N1=25,36,98,78,98,53....n,
N2=45,12,25,36,17,45....n,
N3=12,13,24,25,51,62....n and
N4=13,15,61,17,81,28....n
any one could you kind enough to provide information or code to calculate Metthew correlation coeffecient by using MATLAB code. thank you very much in advance for your help and assistance.
댓글 수: 0
답변 (3개)
the cyclist
2012년 2월 9일
I didn't find any explicit calculations of Matthews correlation coefficient (MCC) in either MATLAB or the File Exchange. However, here are a couple things that might help you. First, MATLAB will calculate the confusion matrix, with the confusionmat() command. Using that, and the formula for MCC that can be found here:
you might be able to calculate it yourself.
Also, searching for "confusion matrix" at the FEX turned up the following contribution:
There is mention in there of the calculation of "true positives", etc., that might be helpful to you.
Good luck!
John
2013년 1월 13일
Hello, I'm just wondering if you have soloed this problem yet. I'm looking for answers about similar question, but one of my problem is, as described by Wiki, MCC is used in binary classification. So in the case of multiple classes, I wonder how MCC should be calculated.
Thanks.
Sincerely,
댓글 수: 1
Eric T
2013년 3월 25일
편집: Eric T
2013년 3월 25일
MCC is technically only defined for binary problems. Multiclass evaluation is an active area of research (e.g., http://arxiv.org/abs/1008.2908 is a good source of references, if not the best paper).
TaeKeun Yoo
2020년 10월 24일
편집: TaeKeun Yoo
2020년 10월 24일
The equation from https://en.wikipedia.org/wiki/Matthews_correlation_coefficient
function [mcc] = matthews_confusion(confusion)
%confusion : confusion matrix input
n = length(confusion);
upper=0;
for k=1:n
for l=1:n
for m=1:n
upper = upper + confusion(k,k)*confusion(l,m) - confusion(k,l)*confusion(m,k);
end
end
end
down1=0;
down2=0;
for k=1:n
down1_1=0;
down1_2=0;
for l=1:n
down1_1 = down1_1 + confusion(k,l);
end
for k_dot=1:n
if k_dot ~= k
for l_dot=1:n
down1_2 = down1_2 + confusion(k_dot,l_dot);
end
end
end
down1 = down1 + down1_1*down1_2;
end
for k=1:n
down2_1=0;
down2_2=0;
for l=1:n
down2_1 = down2_1 + confusion(l,k);
end
for k_dot=1:n
if k_dot ~= k
for l_dot=1:n
down2_2 = down2_2 + confusion(l_dot,k_dot);
end
end
end
down2 = down2 + down2_1*down2_2;
end
mcc = upper/(sqrt(down1)*sqrt(down2));
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!