Reverse the order of the sorted_ids array

I just do not know how to use (tmp[::-1]) which was suggested at the hint to reverse the order, so could anyone help me please, thank you!

Lets suppose you have:

a = [1,2,3]
a = a[::-1]
now a is the first a but reverse.

Thank you, but if I did so it shows this message “IndexError: only integers, slices (:), ellipsis (...), numpy.newaxis (None) and integer or boolean arrays are valid indices”

so what am I supposed to do, or how to fix it?

I dont know what you are doing but here is a cell with numpy arrays.

And it works fine.

Thank you for helping me, the problem was not in the way I use this thing “[::-1]” after your response, I tried to figure out where is the problem and I did, thank you.

1 Like

Just a note of caution!: I have initially sorted in reverse order using np.argsort(-np.array(similarity_l)) which should be the same, right? apparently this caused some sort stability issues as I was not getting test cases pass at the very end in approximate_knn (I was getting good results by my judgement when visually expecting tweets but grader wasn’t happy).

Apparently, grader only would be happy if you do argsort and then reverse the array.

1 Like

hey bro how did you solve this issue?