C3_W2_Collaborative_RecSys_Assignment data Order issue

Hello,

I have a question about this line in the code: ix = tf.argsort(my_predictions, direction=‘DESCENDING’)

Not sure how the function sorted the indices in the m_predictions array. It seemed that for 5 star ratings, it gave random order to the indices. I would have expected the order to be like this: [2700,1150,929,793,622,366,246]

I tried the function on a smaller array but it seems that for similar values in the array, it sorts them in an ascending order towards the end of the result array. I am a little confused on how tf.argsort(my_predictions, direction=‘DESCENDING’) work.

Thanks

Hello @Mo_Okasha,

There is a difference between tf.sort and tf.argsort. The former returns the sorted values, whereas the latter returns the indices of the sorted values. Please experiment both on the same array.

Raymond

Sorry, you can ignore this. I was confusing the data in my_ratings with my_predictions. Thanks.