Skip to content

Instantly share code, notes, and snippets.

@douglaspsteen
Created Sep 5, 2020
Embed
What would you like to do?
from collections import Counter
# Create counter object to track the labels
counter = Counter(y[df_nn.index])
# Get most common label of all the nearest neighbors
counter.most_common()[0][0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment