Hello, my name is. Krishna and welcome to my Youtube channel. So guys, many of you have actually asked me to please Explain Performance Metrics on Multi-clas’s classification problem. Because many of you have this particular confusion. And if you see many articles, also, they have actually explained you about binary classification. They have explained about confusion matrix. They explain you about terms like, true, positive, false, positive or false, negative, true negative, but when you have multi-clas’s classification problems, you basically get confused with this kind of parameters when we should consider true, positive or true. Negative, So in this 6 minutes video, what? I’ll try to do is that I’ll try to clarify all your doubts And by watching this particular video. I think everything will get clarified. So please make sure that you watch this video till the end now here. I’m just going to give you a very simple example. So here what I’m going to do. Is that first of all? I am importing from Ascalon Import Matrix because the matrix consider this library consists of, you know, classification reports, confusion, Matrix classification reports is for precision and recall f1 score all that particular values. Now what I’m going to do is that I’m going to consider three categories, cat dog and Fox, so I have initialized this as constants, so I have in my variable C B and F Now what I’m going to do, I’m going to consider These are my output values actual output values. Okay, y2 so I have values like CCCC fffff ddddd. Okay, and then I’m not again developing any model, so yes, consider that my model has predicted the values like Y pride. CCCC, DF. This all values. It has got predicted now now. I have my y2 and this is my. Y predicted value of I will try to find out the confusion matrix in order to find out the confusion matrix. I have something called as metric is not confusion on Disko matrix. Here I am going to give my value as Y underscore true. Wireless copy right now. When you give this usually for a binary classification problem. I get this particular scenario in my left hand side. I have actual class, which is just my positive and negative. My predicted class, positive and negative now in 3 cross 3 matrix. You can see that. I’ll get my actual value over here, but I love having 3 records. Which three records cat, okay. The first one is cat cat and the second record will be dogs and third records will be. Fox, OK, actual values. And if I go and see from the top, this will be my predicted values. Now here, you have all the values and again in the column. Y is also you’d. Be having three columns. Okay, now you hear you have this terms like true. Positive, false, negative, true, false, positive and true negatives understand guys in multi-clas’s classification. He cannot consider this kind of terms. Okay, so what we do is that. If you want to calculate how what will be the accuracy, you just have to see these diagonals elements all the diagonal elements. If we sum it up divided by total sum of all, the other elements will be actually your accuracy. Okay, but still, we need to find out how we can actually call with precision and how we can actually find out with respect to precision record now here. I’m going to take a some example of precision now for precision for CAD class is the number of correctly predicted class cat out of all the predicted cat. Now, first of all, we need to find out, which is the actual predicted. Cat okay again? I’m saying going to the paid. The precision for the cat. Class is the number of correctly predicted cat out of all. The predicted cat, okay. So what is the correctly predicted Cat or I can have four values? Okay, but what about the all predicted cats? Then I have to go and see my first column. Whatever value comes in this particular column that I don’t need to sum it up, so I have four, three six. So if I go and open my calculator, Okay if I go and open my calculator And if I write 4 divided by which is my actual and our total predicted will be 6 Plus 3 9 9 plus 4 will be 13 So if I divide this particular value, I am getting some way around points. 3 0 7 6 Which is nothing but 0.3 0 8 Now here you can see for cat. The precision is this particular value. It is pretty much simple and like this. Only you calculate the precision for all the other things right for dog. If you want to calculate again, my second column, will the second row will be dog dog basically present. Is this 6 value. So if I go and see what will be for dog, I can do 6 divided by 9 Okay, so here you can see that 0.666 7 I am getting, which is absolutely right, and for the last, you can see that it will be 2/3 then again. I will be getting 0.667 but this is how you actually calculate a precision now. What is more important over here, guys? What is more important that you can actually see over here? Is that how you are interpreting things everywhere You cannot just find through positive, false, negative and until it is a binary classification problem, we cannot go through this particular pattern, so it is very, very much important that how you represent this now for the cat. The precision is 0.3 0-8 for the dog point 667 for the Fox. It is 0.667 now. The next important thing is that sometimes. I say that, for a particular use case, you also have to need to determine if you’re going to implement f1 score whether the false positive is important. A false negative is important. Oh, yeah, again. The false, positive and false negative in this particular case will be considered again. You cannot represent it, but you should actually try to see that. Most of the time dog should not get predicted. Most of the time cat should not forget red agree. You should reduce that particular number and here you can also see the f1 score. The same formula is basically applied. Whatever was actually present over there again. This there is some difference with respect to binary classification. But if you have understood this properly, you just have to interpret this particular confusion matrix. You’ll be able to get all the values and again in binary classification, the precision and recall are actually calculated for zeros and one’s similarly. The f1 score is actually calculated for zeros and ones. Okay, and finally, you can see the magnate More accuracy, man, a macro average, a weight weighted average. Okay, so these all values are also same so this was a small video about performance metrics or about the class classification problem. Please do let me know it. Whether you have any queries, you can again comment down in this particular comment box of this particular video again. If you have any more queries. I will make a separate video to explain you more about Multi-clas’s classification problems. So this is all about this particular video. I hope you liked it. Please just subscribe the channel. If you are not already subscribe in the next video, have a great day. Thank you one and all bye.