I've tested the ConfusionMatrix and got results similar to the one in https://en.wikipedia.org/wiki/Matthews_correlation_coefficient. However, the code in line 23 is incorrect according to the confusion matrix.
tk, defined as the number of times class k truly occurred, should be the summation along axis=1; pk, on the other hand, is the summation of confusion matrix along axis=0.
Although this mistake does not affect the final result of Matthews correlation coefficient, it may lead to some misunderstanding of the confusion matrix. Hope it can be fixed.
I've tested the ConfusionMatrix and got results similar to the one in https://en.wikipedia.org/wiki/Matthews_correlation_coefficient. However, the code in line 23 is incorrect according to the confusion matrix. tk, defined as the number of times class k truly occurred, should be the summation along axis=1; pk, on the other hand, is the summation of confusion matrix along axis=0. Although this mistake does not affect the final result of Matthews correlation coefficient, it may lead to some misunderstanding of the confusion matrix. Hope it can be fixed.