Recall

Recall is similar to precision in the sense that it measures the fraction of relevant instances that are retrieved (as opposed to the fraction of retrieved instances that are relevant). Thus, it will tell us the probability that we will not notice it for a given positive class (given sign). 

In a classification task, the number of false negatives is the number of items that are not labeled as belonging to the positive class but should have been labeled.

Recall is the number of true positives divided by the sum of true positives and false negatives. In other words, out of all the pictures of cats in the world, recall is the fraction of pictures that have been correctly identified as pictures of cats.

Here is how to calculate recall of a given positive label using true and predicted labels:

  1. Again, we have the same signature as for the precision, and we retrieve true positives the same way, as follows:
def recall(y_predicted, y_true, positive_label):
cm = confusion_matrix(y_predicted, y_true)
true_positives = cm[positive_label, positive_label]

Now, notice that the sum of true positives and false negatives is the total number of points in the given data class.

  1. Thus, we just have to count the number of elements in that class, which means we sum the positive_label column of the confusion matrix, as follows:
    class_members = sum(cm[:, positive_label])
  1. Then, we return the ratio as for the precision function, like this:
    return true_positives / class_members

Now, let's look at the distribution of recall values for all 43 classes of traffic signs, shown in the following screenshot:

The recall values are a lot more spread out, with class 21 having a value of 0.66. Let's check out which class has a value of 21:

Now, this is not as harmful as driving on a road covered with snowflakes/ice, but it's very important not to miss dangerous curves ahead on the road. Missing this sign could have bad consequences.

The next section will demonstrate the main() function routine needed to run our app. 

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.33.207