-
Notifications
You must be signed in to change notification settings - Fork 2
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
Fix sort by confidence or prediction without postprocessing #327
Fix sort by confidence or prediction without postprocessing #327
Conversation
if ( | ||
sort_by in {UtterancesSortableColumn.confidence, UtterancesSortableColumn.prediction} | ||
and pipeline_index is None | ||
): | ||
sort_by = UtterancesSortableColumn.index | ||
|
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 combined the check for pipeline_index
being None
with the other conditions on sort_by
, so there is only one place to look at to understand how sort_by
works.
UtterancesSortableColumn.index: DatasetColumn.row_idx, | ||
UtterancesSortableColumn.utterance: config.columns.text_input, | ||
UtterancesSortableColumn.label: config.columns.label, | ||
UtterancesSortableColumn.prediction: DatasetColumn.postprocessed_prediction, |
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 removed this sort_mapping
since it's no longer a 1:1 mapping, as it now depends on without_postprocessing
.
- Split into unit tests - Assert that responses are sorted
e829dab
to
644d754
Compare
Fix sort confidence or prediction without postprocessing while also simplifying the mapping from `UtterancesSortableColumn` to the actual dataset column, since it's no longer 1:1 (it now depends on `without_postprocessing`).
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 was a charm to review; so easy to follow!! Thank you!
# The `sort=confidence` is ignored because no pipeline is specified | ||
resp = client.get("/dataset_splits/eval/utterances?sort=confidence").json() | ||
first_idx_ignored = resp["utterances"][0]["index"] | ||
assert first_idx_ignored == first_idx | ||
assert len(resp["utterances"]) == 42 |
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.
May be use a global variable for 42 instead of repeats?
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.
👍 Added one in 7458251
* Clean up test utterances - Split into unit tests - Assert that responses are sorted * Test sort without postprocessing * Fix sort without postprocessing - Fix sort confidence or prediction without postprocessing while also simplifying the mapping from `UtterancesSortableColumn` to the actual dataset column, since it's no longer 1:1 (it now depends on `without_postprocessing`). * Polish comment
Resolve #319
Description:
UtterancesSortableColumn
to the actual dataset column, since it's no longer 1:1 (it now depends onwithout_postprocessing
).Checklist:
You should check all boxes before the PR is ready. If a box does not apply, check it to acknowledge it.
ran
pre-commit run --all-files
at the end.our users.
README
files and our wiki for any big design decisions, if relevant.