Problem in KNN: Assignment of week 4

I have problem in solving assignment of week 4. I am having problem in question UNC8 (KNN); I have also attached the notebook.

[code removed - moderator]

Computations for reversing sorted_ids and getting the k most similar candidates are incorrect.

I have already noted that; can @balaji.ambresh identify my mistake.

2 things:

  1. I can’t know what you’ve changed once you give a notebook. So, you should take the responsibility of informating me.
  2. Without the latest version of your notebook (via a direct message), I can’t identify the mistake in your code.

Hi, I also have the same issue, my code isnt giving me the desired output, please se below, thanks.


Please use the following hints to fix the function candidates:

  1. similarity_l contains the cosine similarity of each candidate and v, in the order in which the candidates are given.
  2. Once you apply argsort, the indices now point to indices of similarity_l, in increasing order of cosine similarities.
  3. Reversing this sequence provides indices in descending order of similarities.
  4. Finally, we take the k elements from the start to get the closest candidates

Could anyone guide that how this problem is solved

Which problem are you referring to? Someone replied about a solution.

Adding @arvyzukai, @Elemento

Hey @Praveen_Behara,
Welcome to the community. Can you please state your query, describing what exactly are you facing an issue with?