-
Notifications
You must be signed in to change notification settings - Fork 1
add postprocessing script to select only 50% of best examples and 50% of random examples #89
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
base: ht+sm/conflict-maybe-lrec
Are you sure you want to change the base?
Conversation
honghanhh
left a comment
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.
The logic LGTM 🚀 Just a few comments to remove redundancies & optimize it.
|
|
||
| def create_output_filename() -> str: | ||
| """Create output filename with git SHA and date.""" | ||
| git_sha = get_git_sha() |
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.
Both create_output_filename and create_metadata called get_git_sha() at the beginning, it's better to call once in main() directly before calling these 2 function to avoid redundant calls.
| # Split 1: Best propositions | ||
| for item in data: | ||
| if len(best_split) >= best_limit: | ||
| break | ||
| pair_id = get_pair_id(item) | ||
| is_best = item.get("data", {}).get("best_conflict", False) | ||
|
|
||
| if is_best and pair_id not in used_pair_ids: | ||
| best_split.append(item) | ||
| used_pair_ids.add(pair_id) | ||
|
|
||
| # Split 2: Low-scored propositions | ||
| for item in data: | ||
| if len(low_score_split) >= low_score_limit: | ||
| break | ||
| pair_id = get_pair_id(item) | ||
| avg_score = calculate_average_score(item) | ||
|
|
||
| if avg_score < 4.0 and pair_id not in used_pair_ids: | ||
| low_score_split.append(item) | ||
| used_pair_ids.add(pair_id) | ||
|
|
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.
The function iterates through the entire dataset twice. I think it is possible to be done in a single pass.
| pair_id = get_pair_id(item) | ||
| avg_score = calculate_average_score(item) | ||
|
|
||
| if avg_score < 4.0 and pair_id not in used_pair_ids: |
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.
This value will be used both in moderator agents & post-processing steps, maybe it is worth to save in a constants.py/utils.py for later consistency.
No description provided.