-
Notifications
You must be signed in to change notification settings - Fork 91
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
Truncate golden CosineScores to 6 decimals to reduce noisy diffs. #4718
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.
thanks for updating!
for i, score in enumerate(part.get('CosineScore', [])): | ||
part['CosineScore'][i] = float("{:.6f}".format(score)) | ||
for i, score in enumerate(dbg['props_matching'].get('CosineScore', [])): | ||
dbg['props_matching']['CosineScore'][i] = float("{:.6f}".format(score)) |
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.
nit: instead of re-writing this formatting code, could we have a function to format_scores which takes a list of scores and returns a list of formatted scores, so that if we ever want to change how we format the scores, we do it in one place and won't run the risk of missing a spot?
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.
Agreed! I reformatted to use helper functions, is that better?
resp_var_to_score[sv] = float("{:.6f}".format(score)) | ||
truncated_score = _format_score(dbg['sv_matching']['CosineScore'][i]) | ||
resp_var_to_score[sv] = truncated_score | ||
dbg['sv_matching']['CosineScore'][i] = truncated_score |
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.
maybe we can move this part outside of the for loop & just have dbg['sv_matching']['CosineScore'] = _format_scores(dbg['sv_matching'].get('CosineScore', [])
& that way we just need one of the two helper functions & can read score from this formatted list
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.
thank you for fixing this!
Reduces CosineScores to 6 decimals to reduce the diffs that are generated when updating the integration_test goldens.
This is to reduce noise in reviews and should not fundamentally affect the actual tests.