Refactor e2e_eval function and add unit tests #11193
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR was copied from kevinlu1248#17, written by Sweep, and AI-powered junior developer.
Description
This PR refactors the
e2e_eval
function intools/end2end/eval_end2end.py
to make it more modular and adds unit tests ineval_end2end_tests.py
. Thee2e_eval
function is quite large and complex, so it has been broken down into smaller, more manageable functions. Additionally, unit tests have been added to ensure the correctness of the code and make it easier to identify and fix bugs in the future.Summary of Changes
calculate_iou
intools/end2end/utils.py
.calculate_edit_distance
intools/end2end/utils.py
.calculate_metrics
intools/end2end/utils.py
.match_gt_and_dt
intools/end2end/utils.py
.eval_end2end_tests.py
.Please review and merge this PR. Thank you!
Fixes #1.
🎉 Latest improvements to Sweep:
rope
library to refactor Python! Check out Large Language Models are Bad at Refactoring Code. To have Sweep refactor your code, trysweep: Refactor <your_file>.py to be more modular
!💡 To get Sweep to edit this pull request, you can: