Skip to content

Macro Accuracy vs Micro Accuracy #863

Closed Answered by weiaicunzai
camilomarino asked this question in Classification
Discussion options

You must be logged in to vote

I believe micro means overall accuracy, and macro means class-wise accuracy.

target     = torch.tensor([1, 1, 0, 0, 0, 0, 0])
prediction = torch.tensor([1, 0, 1, 0, 0, 0, 0])

you have 7 samples. 5 of them are predicted crrectly, micro = 5 / 7 = 0.714

you have 5 samples with class 0, 80% of class 0 samples are right, you have 2 samples with class 1, 50% of them is right , class-wise average is (50 + 80) / 2 = 130 / 2 = 65%

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Borda
Comment options

Answer selected by Borda
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants