Skip to content

[Feature Request] Support for non-integer relevance labels #71

Description

@davefernig

I would like to be able to use real-valued labels, and compute DCG and NDCG metrics that respect the differences in labels that at less than 1. So for example:

  • A document with relevance label = 1 would have Burges gain of 2**1 - 1 = 1.0
  • But a document with relevance label = 1.9 would have Burges gain of 2**1.9 - 1 = 2.73

However, it seems like Ranx's Qrels object will cast my relevance labels to integers:

from ranx import Qrels

qrels_dict = {"q_1": {"d_11": 1.9}}
qrels = Qrels(qrels_dict)
print(qrels)

>>> {q_1: {d_11: 1}}

I believe this happens in the Qrels constructor here. A consequence of this is that I can't properly use real-valued labels. The relevance values will be truncated, and a lot of information will be lost.

Questions for the maintainers:

  1. Am I missing something? Is there a way to achieve what I want with Ranx?
  2. If not, what is required to make Ranx support this? Is this a big lift or a small one?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions