sophryu99 / TIL

TIL Repository
0 stars 1 forks source link

Confusion Matrix: TP, TN, FP, FN #37

Open sophryu99 opened 2 years ago

sophryu99 commented 2 years ago

Confusion Matrix

A confusion matrix describes the performance of the classification model. In other words, confusion matrix is a way to summarize classifier performance. The following figure shows a basic representation of a confusion matrix:

Screen Shot 2022-01-27 at 1 54 21 PM

It’s based on the fact that we need to compare the class predicted by the classifier with the actual class for each observation.

If the predicted val and the actual value are the same, it is True, else False If the predicted val is 1, it is Positive, else Negative

>>> tn, fp, fn, tp = confusion_matrix([0, 1, 0, 1], [1, 1, 1, 0]).ravel()
>>> (tn, fp, fn, tp)
(0, 2, 1, 1)
sophryu99 commented 2 years ago

False Discovery Rate(FDR):