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

Fix sort by confidence or prediction without postprocessing #327

Merged

Conversation

JosephMarinier
Copy link
Contributor

@JosephMarinier JosephMarinier commented Dec 6, 2022

Resolve #319

Description:

Checklist:

You should check all boxes before the PR is ready. If a box does not apply, check it to acknowledge it.

  • ISSUE NUMBER. You linked the issue number (Ex: Resolve #XXX).
  • PRE-COMMIT. You ran pre-commit on all commits, or else, you
    ran pre-commit run --all-files at the end.
  • USER CHANGES. The changes are added to CHANGELOG.md and the documentation, if they impact
    our users.
  • DEV CHANGES.
    • Update the documentation if this PR changes how to develop/launch on the app.
    • Update the README files and our wiki for any big design decisions, if relevant.
    • Add unit tests, docstrings, typing and comments for complex sections.

@JosephMarinier JosephMarinier self-assigned this Dec 6, 2022
Comment on lines -113 to -118
if (
sort_by in {UtterancesSortableColumn.confidence, UtterancesSortableColumn.prediction}
and pipeline_index is None
):
sort_by = UtterancesSortableColumn.index

Copy link
Contributor Author

@JosephMarinier JosephMarinier Dec 7, 2022

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,
Copy link
Contributor Author

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
@JosephMarinier JosephMarinier changed the title Fix sort confidence without postprocessing Fix sort confidence or prediction without postprocessing Dec 9, 2022
@JosephMarinier JosephMarinier force-pushed the joseph/fix-sort-confidence-without-postprocessing branch from e829dab to 644d754 Compare December 9, 2022 18:57
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`).
@JosephMarinier JosephMarinier changed the title Fix sort confidence or prediction without postprocessing Fix sort by confidence or prediction without postprocessing Dec 9, 2022
@JosephMarinier JosephMarinier marked this pull request as ready for review December 12, 2022 20:48
Copy link
Contributor

@gabegma gabegma left a 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!

tests/test_routers/test_utterances.py Outdated Show resolved Hide resolved
# 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
Copy link

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 Added one in 7458251

@JosephMarinier JosephMarinier merged commit 23a9a70 into main Dec 15, 2022
@JosephMarinier JosephMarinier deleted the joseph/fix-sort-confidence-without-postprocessing branch December 15, 2022 22:27
JosephMarinier added a commit that referenced this pull request Dec 20, 2022
* 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
@JosephMarinier JosephMarinier added the bug Something isn't working label Jan 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sorting is using the post-processed confidence even when the toggle for removing post-processing is activated.
3 participants