Metthew Correlation Coeffecient
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (3)
the cyclist
el 9 de Feb. de 2012
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
el 13 de En. de 2013
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 comentario
Eric T
el 25 de Mzo. de 2013
Editada: Eric T
el 25 de Mzo. de 2013
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
el 24 de Oct. de 2020
Editada: TaeKeun Yoo
el 24 de Oct. de 2020
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 comentarios
Ver también
Categorías
Más información sobre Startup and Shutdown en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!