22.02.2024 Views

Daniel Voigt Godoy - Deep Learning with PyTorch Step-by-Step A Beginner’s Guide-leanpub

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

It looks like this:

Figure 3.10 - Split probability line

"Why is it more visually interesting?" you ask.

Well, now all correctly classified and all misclassified points are in different

quadrants. There is something else that looks exactly like this…

Confusion Matrix

Those quadrants have names: true negative (TN) and false positive (FP), above the

line, false negative (FN) and true positive (TP), below the line.

Figure 3.11 - Probability line as a confusion matrix

Points above the line are actual negatives, points below the line are actual

positives.

Points to the right of the threshold are classified as positive, points to the left of

the threshold are classified as negative.

Cool, right? Let’s double-check it with Scikit-Learn’s confusion_matrix() method:

cm_thresh50 = confusion_matrix(y_val, (probabilities_val >= 0.5))

cm_thresh50

Classification Threshold | 243

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!