Simple-kNN-Gzip
Simple-kNN-Gzip copied to clipboard
Metric should be 'precomputed'
Enjoyed your YouTube video on the topic, as well as the comments section discussion on information theory.
My Kernel crashes on Input 14 in kNN-gzip-ncd-video-test it-deep-learning.ipynb for some reason. This is fixed for me by changing Input 13
neigh = KNeighborsClassifier(n_neighbors=7)
neigh.fit(train_ncd, train_y)
to
neigh = KNeighborsClassifier(n_neighbors=7, metric='precomputed')
neigh.fit(train_ncd, train_y)
Unless I'm mistaken in my understanding here, you should be specifying the metric as 'precomputed', right? According to the scikit-learn docs, sklearn.neighbors.KNeighborsClassifier defaults to using the Euclidean metric, which is not what you want.