...
/Classification Threshold and Confusion Matrix
Classification Threshold and Confusion Matrix
Get to know the effects of using different thresholds for classification, and take a look at the confusion matrix.
We'll cover the following...
Using different thresholds for classification
So far, we have been using the trivial threshold of 50% to classify our data points, given the probabilities predicted by our model. Let us dive a bit deeper into this and see the effects of choosing different thresholds.
We will be working on the data points in the validation set. There are only 20 data points in it, so we can easily keep track of all of them.
First, let us compute the logits and corresponding probabilities:
logits_val = sbs.predict(X_val)probabilities_val = sigmoid(logits_val).squeeze()print(probabilities_val)
Then, let us visualize the probabilities on a line. It means we are going from the fancy contour plot to a simpler plot:
The left plot comes from the figure of the validation dataset in the previous lesson. It shows the contour plot of the probabilities and the decision boundary as a straight gray line. We then place the data points on a line according to ...