Closed HeyWeCome closed 1 year ago
For example, when predictions
is [[0.6, 0.7, 0.1, 0.2]]
, the score of the ground_truth item is 0.6.
sort_idx
will return [[1, 0, 3, 2]]
that indicates the index of values in descending order.
Considering that the ground_truth item always corresponds to the index 0, sort_idx == 0
actually finds the rank of the ground_truth item, rather than random sampled items.
Thank you very much for the explanation. I didn't know enough about this function before, but now I understand it.
Hi Wang,
Recently, I was reading the source code of Rechorus. There is something coufused me in BaseRunner.py.
It's about
evaluate_method
in BaseRunner.py on line 48.As the comment says, the first column indicates the score of
ground_truth
. Thesort_idx
contains the index values of the array values in descending order. Thesort_idx == 0
represents the highest record.My confusion is that the code
hit = (gt_rank <= k)
. In my understanding,gt_rank
means the item with the highest score, not necessarily theground_truth
, but also the random sample item. Can you please explain this for me?