Skip to content
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

Incorporate Retrieval Scores into RM3 #453

Merged
merged 11 commits into from
Aug 13, 2024
Merged

Conversation

mam10eks
Copy link
Contributor

This pull request (currently in draft) is aimed to address issue 407.

@mam10eks mam10eks marked this pull request as ready for review August 13, 2024 07:53
occurrences = [0] * len(docids)

elif "docno" in topics_and_res.columns:
docnos = topics_and_res[topics_and_res["qid"] == qid]["docno"].values
docids = []
scores = []
docnos_to_scores = {i:0.0 for i in docnos}
if self.requires_scores:
docnos_to_scores = {i['docno']: i['score'] for _, i in topics_and_res[topics_and_res["qid"] == qid].iterrows()}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to make a dictionary here? why not extract a list like was done above?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit of an aside, but the topics_and_res[topics_and_res["qid"] == qid] selector is also performed a few lines above, and it's pretty inefficient. Can we cache the result to avoid doing it twice?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, we could indeed cache the results.

And I also see now that we do not need a dict, I confused the skipped part, I was thinking that the if condition for skipped documents would have a continue statement, but now I see that this is not the case. I will modify the code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I modified the code accordingly.

@cmacdonald
Copy link
Contributor

Great, thanks @mam10eks for the high quality explanations. I have removed some unit test checks (Bo1 etc dont need the additional PRF jar), and added a single comment (do we need a dict?)

@cmacdonald cmacdonald changed the title Incorporate Retrieval Scores into RM3 (Pull request in Draft) Incorporate Retrieval Scores into RM3 Aug 13, 2024
@cmacdonald
Copy link
Contributor

cmacdonald commented Aug 13, 2024

I made some edits to ensure it didnt crash if some docno could not be resolved. @seanmacavaney are you happy?

I'll merge this forward to the java branch after its committed to master.

@seanmacavaney
Copy link
Collaborator

lgtm! I think we can remove the test jankiness once in the java branch.

@cmacdonald cmacdonald merged commit 4dd0752 into terrier-org:master Aug 13, 2024
14 checks passed
@mam10eks
Copy link
Contributor Author

Cool :)

seanmacavaney added a commit that referenced this pull request Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants