[🐛BUG] Over-estimated TopK metrics
See original GitHub issueIn my evaluations, I found that sometimes, precision or recall is larger than 1.
I went through the coding, and I beleive this is a bug in the library. Correct me, if I am wrong
Let’s take a look at recbole/evaluator/base_metric.py
def used_info(self, dataobject):
"""Get the bool matrix indicating whether the corresponding item is positive
and number of positive items for each user.
"""
rec_mat = dataobject.get('rec.topk')
topk_idx, pos_len_list = torch.split(rec_mat, [max(self.topk), 1], dim=1)
return rec_mat.to(torch.bool).numpy(), pos_len_list.squeeze(-1).numpy()
In the coding above, I blieve that we should:
return topk_idx.to(torch.bool).numpy(), pos_len_list.squeeze(-1).numpy()
Not
return rec_mat.to(torch.bool).numpy(), pos_len_list.squeeze(-1).numpy()
If I am going to recommender topK items, the first parameter returned is always with size num_users x K+1
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
Top Evaluation Metrics for Regression Problems in Machine ...
In this tutorial, you will learn the top evaluation metrics for regression ... Another commonly used metric is the root mean squared error, ......
Read more >Regression metrics when underestimation is worse than ...
I am trying to predict time that it will take to complete some task given some data. However the important thing to me...
Read more >Performance Metrics in Machine Learning [Complete Guide]
Performance metrics are a part of every machine learning pipeline. They tell you if you're making progress, and put a number on it....
Read more >Facebook Overestimated Key Video Metric for Two Years - WSJ
Big ad buyers and marketers are upset with Facebook Inc. after learning the tech giant vastly overestimated average viewing time for video ...
Read more >Performance Metrics (Error Measures) in Machine Learning ...
Performance metrics (error measures) are vital components of the evaluation frameworks in ... Top three metrics identified in the surveys, percentage.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
np.cumsum
function indeed count the last column. The shape ofrec_mat
is (user_num, max(self.topk) + 1). And the return value ofmetric_info
is also shaped like (user_num, max(self.topk)+1). However, in the above mentioned code: https://github.com/RUCAIBox/RecBole/blob/1bd8a587867959e8c37b881b2321eb6be7579912/recbole/evaluator/base_metric.py#L65-L80 The shape ofavg_result
is max((self.topk)+1). But we only save the first max(self.topk) values into dict in the loop. And the extra value is in the max(self.topk)+1-th column.But the last column will not be used in
topk_result
. In this function, we will only use columns inself.topk
. The last column ismax(self.topk) + 1
and will not be used.