- Notifications
You must be signed in to change notification settings - Fork0
vlainic/matthews-correlation-coefficient
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
MCC function for ML
Here I would like to share my implementation of Matthews Correlation Coefficient (MCC) for various situations.
Inspiration fromKaggle kernel by Michal on "Best loss function for F1-score metric".
I encountered MCC while search for the"best multi-class classification metric".
Wikipedia has very nice explanation of MCC, while atstats.stackexchange you can find a very interesting discussion on the topic. Multi-class MCC is often called "R_K statistics" so I foundthe whole page devoted to it.
The most useful expression for computation was Eq.(8) from the original article byGorodkin:
where N is the number of examples, \tilde{C}_k is the kth row of the confusion matrix C, \hat{C}_l the lth column of C, C^T is C transposed and Tr(C) is the trace of C.
Note: if you only need MCC value to be computed usesklearn.metrics.matthews_corrcoef !!!
Function that can be used as loss function for Keras training in the binary classification case.
Function that can be used as loss function for Keras training in the multi-class classification case.
Following the practice of plotting precision/recall vs tresholds, I wanted to see how MCC behaves.
About
MCC functions for ML
Topics
Resources
Uh oh!
There was an error while loading.Please reload this page.