Code demo
K-nearest neighbours
In the following code, we apply the k-nearest neighbours (KNN) algorithm to the PCA-transformed GTZAN data.
KNN is a simple distance-based classification method that bases its predictions on the proximity of a data point to other labelled data.