Session Ready
Exercise

Classifying a collection of road signs

Now that the autonomous vehicle has successfully stopped on its own, your team feels confident allowing the car to continue the test course.

The test course includes 59 additional road signs divided into three types:

Stop Sign Speed Limit Sign Pedestrian Sign

At the conclusion of the trial, you are asked to measure the car's overall performance at recognizing these signs.

The class package and the dataset signs are already loaded in your workspace. So is the dataframe test_signs, which holds a set of observations you'll test your model on.

Instructions
100 XP
  • Classify the test_signs data using knn().
    • Set train equal to the observations in signs without labels.
    • Use test_signs for the test argument, again without labels.
    • For the cl argument, use the vector of labels provided for you.
  • Use table() to explore the classifier's performance at identifying the three sign types (the confusion matrix).
    • Create the vector signs_actual by extracting the labels from test_signs.
    • Pass the vector of predictions and the vector of actual signs to table() to cross tabulate them.
  • Compute the overall accuracy of the kNN learner using the mean() function.