# Confusion Matrix | Machine Learning

## Judge the performance of the classification algorithm

How do we judge- how good or how bad the performance of a predictor is? We use error metrics here and this is known as a confusion matrix. This confusion matrix is meant only for classification algorithms. In regression, we use something called Mean squared error (MSE), but we are talking about classification here.

Suppose here, we have “n” which is equal to 165 observations, we have got some results from the classification algorithm or from some classifier. The actual is given on one side and the predicted is given on the other side, so there are some Yes’ or some Nos out of these 165 observations. Actually, the total Nos should be 55, but our results are here and 50 have gone into No, and rest 5 have gone into Yes, so we can call this as a missed classification. This is an error and this will be perfect if it would be 55 here. Similarly, for Yes there should be 110, 100 comes under our machine learning classifier or machine learning algorithm. Our model has 100 observations or 100 predictions correctly and 10 is miss-classified, these 10 have gone here. It would be perfect only if this was 55 Nos and Yes’ should be 110, that means we think diagonally always. When this diagonal is full, there are zeros this side. At that point of time we can say that the model is giving us 100 % correct results and there is zero error in it. We can now sum it up and divide with the total number of observations 165 and that can give us the error of the model. So here we have 50+100 which is equal to 150, divided by total 165 which can give us the accuracy of the model. So in other words, classification or the confusion matrix updates us the number of correct classification and the miss-classification. As we discussed if the diagonal is perfect, there are zeros in other places, then our model gives us 100% correct results and there are zero errors in the model. As the classes increase, the rows and columns also increase in the confusion matrix.

At this point of time, it is important to mention that linear models are not inferior models. The existing statistical models have given rise to machine learning models. These models can be well-studied, well-programmed and handled. Once we are thorough with the statistical models, we cannot jump directly into machine learning models. So here we have some inspiring literature about machine learning models. Hope this session proves to be fruitful to one and all.

### Related Topics

## Join Our Data Science Bootcamp

With Job Assistance