Metthew Correlation Coeffecient

10 次查看(过去 30 天)
Malde Gorania
Malde Gorania 2012-2-9
编辑: TaeKeun Yoo 2020-10-24
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.

回答(3 个)

the cyclist
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
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
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
TaeKeun Yoo 2020-10-24
编辑:TaeKeun Yoo 2020-10-24
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));

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by