What is the Confusion Matrix in Machine Learning? What are Type 1 and Type 2 Error?

What is a confusion matrix?

A confusion matrix is one of the evaluation techniques for machine learning models in which you compare the results of all the predicted and actual values.

  1. There are 4 instances when the actual value (y) is 0 and the predicted value (ŷ) is also 0. This is called a True Negative case where True means that values are the same (0 & 0) and Negative means that it is a negative scenario.
  2. There are 3 instances when the actual value (y) is 0 and the predicted value (ŷ) is 1. This is called a False Positive case where False means that the values are different (0 & 1) and Positive means that the predicted value is positive or 1.
  3. There are 2 instances when the actual value (y) is 1 and the predicted value (ŷ) is 0. This is called a False Negative case where False means that the values are different (1 & 0) and Negative means that the predicted value is negative or 0.

Type 1 Error and Type 2 Error

  • Type 1 Error arises when the predicted value is positive while it is actually negative (False Positive).
    eg. If your device predicts that it will rain today but in reality, it did not rain today.
  • Type 2 Error arises when the predicted value is negative while it is actually positive (False Negative).
    eg. If your device predicts that it will not rain today but in reality, it did rain today.

Complete summary of the confusion matrix

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store