Lightning-AI / pytorch-lightning

Pretrain, finetune ANY AI model of ANY size on multiple GPUs, TPUs with zero code changes.
https://lightning.ai
Apache License 2.0
28.37k stars 3.38k forks source link

how to implement Matthews correlation coefficient(MCC) with pytorch-lightning #5035

Closed MarsSu0618 closed 3 years ago

MarsSu0618 commented 3 years ago

Problems

Hi, Everyone. I have encountered problem about classification metrics. I want to use mcc metric to monitor. But i use sklearn.metrics.matthews_corrcoef to solve it. But i not sure this metrics how to implement in pytorch-lightning. Hope someone can answer, I will thanks a lot.

abhik-99 commented 3 years ago

Hey @MarsSu0618 , this gist might be of help. I came across the same problem quite recently and ended up in this issue. This is how I Implemented it. If you have a different or better implementation, please drop it here. Would be of help to me!