22.02.2024 Views

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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Figure 3.13 - Using a low threshold

You can see in the figure above that lowering the threshold (moving it to the left

on the probability line) turned one false negative into a true positive (blue point

close to 0.4), but it also turned one true negative into a false positive (red point

close to 0.4).

Let’s double-check it with Scikit-Learn’s confusion matrix:

confusion_matrix(y_val, (probabilities_val >= 0.3))

Output

array([[ 6, 3],

[ 0, 11]])

OK, now let’s plot the corresponding metrics one more time:

Figure 3.14 - Trade-offs for two different thresholds

Still not a curve, I know, but we can already learn something from these two points.

Classification Threshold | 251

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

Saved successfully!

Ooh no, something went wrong!