Exercise

Euclidean distance

Euclidean distance is the basis of many measures of similarity and is the most important distance metric. You can compute the Euclidean distance in R using the dist() function. In this exercise, you will compute the Euclidean distance between the first 10 records of the MNIST sample data.

The mnist_sample object is loaded for you.

Instructions

100 XP
  • Show the labels of the first 10 records of mnist_sample.
  • Compute the Euclidean distance between the first 10 digits. Be careful to remove the true label which is the first column of the data frame. Store the results in a variable named distances.
  • Show the values stored in distances variable in the console.
  • Plot the numeric matrix of the distances in a heatmap().