Machine Learning Introduction

Supervised Machine Learning

Unsupervised Machine Learning

Miscellaneous Topics in ML

Data Pre-Processing

The confusion matrix is a matrix used to determine the performance of the classification models for a given set of test data. It can only be determined if the true values for test data are known. The matrix itself can be easily understood, but the related terminologies may be confusing. Since it shows the errors in the model performance in the form of a matrix, hence also known as an error matrix. Some features of Confusion matrix are given below:

The above table has the following cases:

Example: We can understand the confusion matrix using an example.

Suppose we are trying to create a model that can predict the result for the disease that is either a person has that disease or not. So, the confusion matrix for this is given as:

From the above example, we can conclude that:

We can perform various calculations for the model, such as the model's accuracy, using this matrix. These calculations are given below:

- •
**Classification Accuracy**: It is one of the important parameters to determine the accuracy of the classification problems. It defines how often the model predicts the correct output. It can be calculated as the ratio of the number of correct predictions made by the classifier to all number of predictions made by the classifiers. The formula is given below:

Accuracy = TP+TN / TP+FP+FN+TN - •
**Misclassification rate**: It is also termed as Error rate, and it defines how often the model gives the wrong predictions. The value of error rate can be calculated as the number of incorrect predictions to all number of the predictions made by the classifier. The formula is given below:

Error rate = FP+FN / TP+FP+FN+TN - •
**Precision**: It can be defined as the number of correct outputs provided by the model or out of all positive classes that have predicted correctly by the model, how many of them were actually true. It can be calculated using the below formula:

Precision = TP / TP+FP - •
**Recall**: It is defined as the out of total positive classes, how our model predicted correctly. The recall must be as high as possible.

Recall = TP / TP+FN - •
**F-measure**: If two models have low precision and high recall or vice versa, it is difficult to compare these models. So, for this purpose, we can use F-score. This score helps us to evaluate the recall and precision at the same time. The F-score is maximum if the recall is equal to the precision. It can be calculated using the below formula:

F-measure = 2*Recall*Precision / Recall+Precision

Silan Software is one of the India's leading provider of offline & online training for Java, Python, AI (Machine Learning, Deep Learning), Data Science, Software Development & many more emerging Technologies.

We provide Academic Training || Industrial Training || Corporate Training || Internship || Java || Python || AI using Python || Data Science etc