-
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
Add AnswerExactMatchEvaluator
#7381
Conversation
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.
I believe we can leave out from_dict
and to_dict
implementations as they have the same effect as the default implementation. Otherwise looks good to me.
``` | ||
""" | ||
|
||
def to_dict(self) -> Dict[str, Any]: |
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.
We can leave out the to_dict
and from_dict
implementation here as it is just using the default right?
For example, when component_to_dict
is used it will automatically fall back to default_to_dict
:
haystack/haystack/core/serialization.py
Line 10 in f69c3e5
def component_to_dict(obj: Any) -> Dict[str, Any]: |
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.
Right, I always forget that. Will remove them right away.
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.
LGTM! 👍
We should add more test cases later. Will also make sense for consistency with test cases for other metrics. For example, we could test more than one prediction per query. Something like:
evaluator.run(
questions=["What is the capital of Germany?", "What is the capital of France?"],
ground_truth_answers=[["Berlin"], ["London"]],
predicted_answers=[["Berlin", "wrong_second_answer_candidate"], ["wrong_first_answer_candidate", "London"]],
)
should result in result["result"] == 1.0
Pull Request Test Coverage Report for Build 8345123752Details
💛 - Coveralls |
Related Issues
Proposed Changes:
Add
AnswerExactMatchEvaluator
. This Component calculates the Exact Match metrics given a list of questions, a list of expected answers for each question and the list of predicted answers for each question.How did you test it?
I added unit tests.
Notes for the reviewer
N/A
Checklist
fix:
,feat:
,build:
,chore:
,ci:
,docs:
,style:
,refactor:
,perf:
,test:
.