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

Add metrics calculations to the inference pipeline #23

Merged
merged 16 commits into from
Jan 19, 2024

Conversation

RashmikaReddy
Copy link
Collaborator

Change Description

Adding changes to add metrics to the inference pipeline in main.py. Added unit test case in test_main.py
closes #2

Solution Description

Added BLEU, METEOR evaluation metrics to the inference pipeline.
image
BLEU score calculation
https://www.baeldung.com/cs/nlp-bleu-score#:~:text=BLEU%20(Bilingual%20Evaluation%20Understudy)%20is,%2Danswering%20systems%2C%20and%20chatbots.
METEOR score calculation
https://huggingface.co/spaces/evaluate-metric/meteor

Code Quality

  • [Yes] I have read the Contribution Guide
  • [Yes] My code follows the code style of this project
  • [Yes] My code builds (or compiles) cleanly without any errors or warnings
  • [Yes] My code contains relevant comments and necessary documentation

Project-Specific Pull Request Checklists

Copy link

codecov bot commented Dec 15, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (45bd148) 95.83% compared to head (368e73c) 96.32%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #23      +/-   ##
==========================================
+ Coverage   95.83%   96.32%   +0.49%     
==========================================
  Files           3        3              
  Lines         120      136      +16     
==========================================
+ Hits          115      131      +16     
  Misses          5        5              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@RashmikaReddy RashmikaReddy marked this pull request as ready for review December 15, 2023 22:13
Copy link
Collaborator

@carlosgjs carlosgjs left a comment

Choose a reason for hiding this comment

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

Looking good! Some comments/questions inline. Thx!

docs/requirements.txt Outdated Show resolved Hide resolved
src/autora/doc/pipelines/main.py Outdated Show resolved Hide resolved
src/autora/doc/pipelines/main.py Show resolved Hide resolved
src/autora/doc/pipelines/main.py Show resolved Hide resolved
src/autora/doc/pipelines/main.py Outdated Show resolved Hide resolved
labels = [item["output"] for item in items]

bleu, meteor = evaluate_documentation(labels, labels)
assert bleu >= 0 and bleu <= 1, "BLEU score should be between 0 and 1"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are bleu, meteor==1 when label==prediction?

It would actually be a bit clearer if you hard code some examples and assert specific values. Eg. all tokens match, extra token in the prediction, missing token in the prediction, etc.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added more tests cases, and code works as expected.

@codecov-commenter
Copy link

codecov-commenter commented Jan 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (fdcce7e) 96.15% compared to head (9fcd8ec) 96.57%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #23      +/-   ##
==========================================
+ Coverage   96.15%   96.57%   +0.42%     
==========================================
  Files           3        3              
  Lines         130      146      +16     
==========================================
+ Hits          125      141      +16     
  Misses          5        5              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@carlosgjs carlosgjs left a comment

Choose a reason for hiding this comment

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

Almost done! See just a couple of suggestions in line.

src/autora/doc/pipelines/main.py Outdated Show resolved Hide resolved
src/autora/doc/pipelines/main.py Outdated Show resolved Hide resolved
@RashmikaReddy
Copy link
Collaborator Author

Closing the Pull Request for evaluation metrics

@RashmikaReddy RashmikaReddy reopened this Jan 19, 2024
@RashmikaReddy RashmikaReddy merged commit 61d2480 into main Jan 19, 2024
18 checks passed
@RashmikaReddy RashmikaReddy deleted the rashmika-dec13 branch January 19, 2024 18:25
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.

Add metrics calculations to the inference pipeline
3 participants