-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ndcg@k metric is inaccurate #6707
Comments
Hey, I have faced the same issue. After some investigation I think the issue is that the computation of the ideal ranking is wrong. For instance, let a query q, and a set of relevant documents for this query RelevantDocs = {d1, d2, d3}. Lets assume that the relevance grades of each document is the following: {d1=2, d2=1, d3=1}. In order to compute the ideal ranking, we have to sort the Relevant Documents in the best way possible (based only on the set of relevant documents). So, in this case, the ideal ranking is Now, imagine we have a retrieval model (say BM25) which returns a ranking R = {d3, d2, d1}.
Then we can compute
The issue that is happening during the computation of the ndcg@k is probably due to wrong calculations of the ideal ranking. Basically, imagine now we want to compute ndcg@2. The results should be computed as follows:
However, I think that the computation of the ideal ranking is being computed as a sort of the relevant documents in ranking R. So basically, R_Ideal would look like this if we cut-off at k=2. R_Ideal = {d3, d2}
In addition, it looks like it is using the initial ranking (baseline) to extract this top-k of relevant documents. So basically, if you after resorting using LTR got a rank like: R_LTR = {d3, d2}. Since the ideal ranking isbeing computed as DCG@2(R_Ideal) = (1/1) + (1/2) = 1.5, when you compute DCG (R_LTR), you would have something like this:
which would result in the wrong result of NDCG@2. This is what I think that is happening. Did someone else faced this same issue and have a fix? |
Hi, thank you for sharing a detailed analysis. For the original issue posted here, the issue is just overflow. The exponential gain |
Hey,
I am using xgboost version 1.3.3 and I am getting invalid ndcg@k metric values. The values are >1 while the ndcg@k has to be in [0,1] by definition.
Example:
The text was updated successfully, but these errors were encountered: