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!