Confusion Matrix is a table which is used to describe the performance of a classification model on a set of data whose true values are known.
Consider the following Table
Predicted |
Actual
|
||
Option 1 | Option 2 | ||
Option 1 | TRUE POSITIVE | FALSE POSITIVE | |
Option 2 | FALSE NEGATIVE | TRUE NEGATIVE |
-
The Rows in a confusion matrix corresponds to what the machine learning algorithm predicted
-
The columns correspond to the known results or the Actual Value
To illustrate consider the following Dataset.
Chest Pain | Blood Circulation | Blocked Arteries | Heart Problems |
NO | NO | NO | NO |
NO | YES | YES | YES |
YES | YES | NO | NO |
--- | ---- | ---- | ----- |
So suppose based
upon the dataset above Our ML Algorithm returns the results that we
placed in the confusion matrix.
Predicted |
Actual
|
||
Heart Problems | No Heart Problems | ||
Heart problems | 250 | 20 | |
No Heart Problems | 40 | 500 |
The above table or confusion matrix shows us the following
-
The Algorithm correctly predicted that 250 people had heart diseases
-
The Algorithm correctly predicted that 500 people didn’t have a heart disease
-
The Algorithm incorrectly predicted that 20 people had heart disease
-
The Algorithm incorrectly predicted that 40 People had no heart disease
Confusion Matrix can be a very important tool to compare the results of different algorithms.