K-Nearest Neighbors

In this chapter, we will be learning how to calculate K-nearest neighbors based on cosine similarity.

Chapter Goals:

  • Learn about K-nearest neighbors in terms of word similarity
  • Create a function that computes the K-nearest neighbors for a given word

A. Similar words

When comparing cosine similarities for word embeddings, a common procedure is to find the K-nearest neighbors for a given word. This means that for a given a word w and an integer K ...