Skip to content

Metric should be 'precomputed' #4

Description

@dilwong

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions