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

bug: run parameter "ranking_mode" does not override init param in meta field ranker #7375

Merged
merged 4 commits into from
Mar 19, 2024

Conversation

mohitlal31
Copy link
Contributor

@mohitlal31 mohitlal31 commented Mar 17, 2024

Related Issues

Proposed Changes:

The _merge_rankings method uses the self.ranking_mode value initialized in the constructor.
If this value is overridden in the run method, the new ranking_mode is not considered for ranking calculations. Added an extra param to _merge_rankings to accept the updated ranking_mode value that is passed in the run method.

How did you test it?

Added a unit test

Notes for the reviewer

Checklist

@mohitlal31 mohitlal31 requested a review from a team as a code owner March 17, 2024 23:21
@mohitlal31 mohitlal31 requested review from anakin87 and removed request for a team March 17, 2024 23:21
@github-actions github-actions bot added topic:tests 2.x Related to Haystack v2.0 labels Mar 17, 2024
@mohitlal31 mohitlal31 requested a review from a team as a code owner March 17, 2024 23:29
@mohitlal31 mohitlal31 requested review from dfokina and removed request for a team March 17, 2024 23:29
@coveralls
Copy link
Collaborator

coveralls commented Mar 17, 2024

Pull Request Test Coverage Report for Build 8330793362

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 89.204%

Totals Coverage Status
Change from base Build 8326632443: 0.0%
Covered Lines: 5371
Relevant Lines: 6021

💛 - Coveralls

@sjrl
Copy link
Contributor

sjrl commented Mar 18, 2024

Thanks for making a quick fix on this!


output = ranker.run(documents=docs_before, ranking_mode="reciprocal_rank_fusion")
docs_after = output["documents"]
assert docs_after[0].score == 0.01626123744050767
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's update to use pytest.approx so something like

Suggested change
assert docs_after[0].score == 0.01626123744050767
assert docs_after[0].score == pytest.approx(0.016261, abs=1e-5)

since doing float comparisons to that many decimals can be fragile.

@sjrl sjrl requested review from sjrl and removed request for anakin87 March 18, 2024 07:58
Copy link
Contributor

@sjrl sjrl left a comment

Choose a reason for hiding this comment

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

Once the test is updated this looks good to go!

Copy link
Contributor Author

@mohitlal31 mohitlal31 left a comment

Choose a reason for hiding this comment

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

Done

@mohitlal31 mohitlal31 requested a review from sjrl March 19, 2024 03:23
Copy link
Contributor

@sjrl sjrl left a comment

Choose a reason for hiding this comment

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

Thanks!

@sjrl sjrl merged commit 2807193 into deepset-ai:main Mar 19, 2024
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.x Related to Haystack v2.0 topic:tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

run parameter "ranking_mode" does not override init param in metafield ranker
3 participants