Skip to main content
2 of 2
added 708 characters in body

this link helped me.. https://www.youtube.com/watch?v=HBi-P5j0Kec i am hoping it will help you as well

say the distribution as as below

    A   B   C   D
A   100 80  10  10
B   0    9   0   1
C   0    1   8   1
D   0    1   0   9

the precision for A would be

P(A) = 100/ 100 + 0 + 0 +0 = 100

P(B) = 9/ 9 + 80 + 1 + 1 = 9/91 psst... essentially take the true positive of the class and divide up by the column data across rows

recall for a would be

R(A) = 100/ 100+ 80+10+10 = 0.5

R(B) = 9 / 9+ 0+0+1 = 0.9

psst... essentially take the true positive of the class and divide up by the row data across columns

once you get all the values, take the macro average

avg(P) = P(A) + P(B) + P(C) + P(D) / 4

avg(R) = R(A) + R(B) + R(C) + R(D) / 4

F1 = 2 *avg(P) * avg(R) / avg(P) + avg(R)