Hi Van (Trang) Pham,
Thank you for reaching out to us on Microsoft Q&A forum.
As per the documentation, the provided values are accurate. Here is a clear explanation of the situation.
Let us calculate the TP, TN, FP, and FN values for the class 0 using the Above tricks:
TP: The actual value and predicted value should be the same. So, concerning 0 class, the value of cell 1 is the TP value.
TP= 2 (cell1)
FN: The sum of values of corresponding rows except for the TP value
FN = (cell 2 + cell3)
= (0 + 0)
= 0
FP: The sum of values of the corresponding column except for the TP value.
FP = (cell 4 + cell 7)
= (0 + 0)
= 0
TN: The sum of values of all columns and rows except the values of that class that we are calculating the values for.
TN = (cell 5 + cell 6 + cell 8 + cell 9)
= 2 + 0 +1 + 2
= 5
Similarly for class 2, the values are:
TP: 2 (cell 9)
FN: 0 + 1 = 1 (cell 7 +cell 8)
FP: 0 + 0 = 0 (cell 3 + cell 6)
TN: 2 +0 + 0 + 2 =4 (cell 1 + cell 2 + cell 4 + cell 5)
I trust that your query has been resolved satisfactorily.
If you encounter any future issues, please feel free to contact us, and we will be pleased to assist you further.
If you have found the answer provided to be helpful, please click on the "Accept Answer/Upvote" button so that it is useful for other members in the Microsoft Q&A community.
Thank you.