Metthew Correlation Coeffecient

13 vues (au cours des 30 derniers jours)
Malde Gorania
Malde Gorania le 9 Fév 2012
Modifié(e) : TaeKeun Yoo le 24 Oct 2020
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.

Réponses (3)

the cyclist
the cyclist le 9 Fév 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!
  1 commentaire
Malde Gorania
Malde Gorania le 9 Fév 2012
Thank you Sir

Connectez-vous pour commenter.


John
John le 13 Jan 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 commentaire
Eric T
Eric T le 25 Mar 2013
Modifié(e) : Eric T le 25 Mar 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).

Connectez-vous pour commenter.


TaeKeun Yoo
TaeKeun Yoo le 24 Oct 2020
Modifié(e) : TaeKeun Yoo le 24 Oct 2020
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));

Catégories

En savoir plus sur Startup and Shutdown dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by