Unit Test Fail for Nearest Neighbor

Hi @Shilpa_Bhandari

You skipped (deleted) the line:
# Reverse the order of the sorted_ids array

There’s a code hint in the assignment:

To reverse the order of the result of numpy.argsort to get the element with highest cosine similarity as the first element of the array you can use tmp[::-1]. This reverses the order of an array. Then, you can extract the first k elements.

This is not explicitly stated, but the “sorted form” is that the first row should be the “nearest” neighbor (and not the last as is your case).

Good luck!

P.S. please remove your solution code.

Thank you. That worked.