Open apdullahyayik opened 3 years ago
Yep, k
of recall in evaluation/metric.py
is redundant, but for the sake of consistency with other metrics,
I still add it into the recall function. In my opinion, the k
of recall_at_k is already included in y_reco
,
since it has length of k
. But I'm not sure about this, any suggestions?
No I don't have since it is cool. Two more questions here. (1) Computation of recall looks like hit rate: "computation of intersections by discarding the order". Is it true? I may be wrong, maybe hit rate needs considering the order. (2) Where is the difference between precision and recall on the code?
def precision_at_k(y_true_list, y_reco_list, users, k):
precision_all = list()
for u in users:
y_true = y_true_list[u]
y_reco = y_reco_list[u]
common_items = set(y_reco).intersection(y_true)
precision = len(common_items) / k
precision_all.append(precision)
return np.mean(precision_all)
Answer is appreciated.
Computation of recall at evaluation/metric.py does not consider "k" value which is passed as an arg. Whereas at the same module computation of precision uses "k" value. I think, there may be smthg wrong here.