-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
bug: run parameter "ranking_mode" does not override init param in meta field ranker #7375
Conversation
Pull Request Test Coverage Report for Build 8330793362Details
💛 - Coveralls |
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 |
There was a problem hiding this comment.
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
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.
There was a problem hiding this 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!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Related Issues
Proposed Changes:
The
_merge_rankings
method uses theself.ranking_mode
value initialized in the constructor.If this value is overridden in the
run
method, the newranking_mode
is not considered for ranking calculations. Added an extra param to_merge_rankings
to accept the updatedranking_mode
value that is passed in therun
method.How did you test it?
Added a unit test
Notes for the reviewer
Checklist
fix:
,feat:
,build:
,chore:
,ci:
,docs:
,style:
,refactor:
,perf:
,test:
.