Session Ready
Exercise

Minkowski distance

There are other well-known distance metrics besides the Euclidean distance, like the Minkowski distance. This metric can be considered a generalisation of both the Euclidean and Manhattan distance. In R, you can calculate the Minkowski distance of order p by using dist(..., method = "minkowski", p).

The MNIST sample data is loaded for you as mnist_sample.

Instructions
100 XP
  • Compute the Minkowski distance of order 3 for the first 10 records of mnist_sample and store them in an object named distances_3.
  • Display the values by printing the variable to the console.
  • Plot the values on a heatmap().
  • Do the same as before, but with a Minkowski distance of order 2.