Metrics
Explore how to use TensorFlow to convert model logits into probabilities with the sigmoid function, generate binary predictions by rounding probabilities, and calculate model accuracy by comparing predictions to labels. This lesson helps you understand metrics critical for evaluating and improving deep learning models.
We'll cover the following...
Chapter Goals:
- Convert logits to probabilities
- Obtain model predictions from probabilities
- Calculate prediction accuracy
A. Sigmoid
As discussed in the previous chapter, our model outputs logits based on the input data. These logits represent real number mappings from probabilities. Therefore, if we had the inverse mapping we could obtain the original probabilities. Luckily, we have exactly that, in the form of the sigmoid function.
The above plot shows a sigmoid function graph. The x-axis represents logits, while the y-axis represents probabilities.
Note the horizontal asymptotes at y = 0 and y = 1.
Using the sigmoid function (tf.math.sigmoid in TensorFlow), we can extract probabilities from ...