fix: coerce None filter_rate in Label/Int Filter charts - #851
Open
daviddallakyan2005 wants to merge 1 commit into
Open
fix: coerce None filter_rate in Label/Int Filter charts#851daviddallakyan2005 wants to merge 1 commit into
daviddallakyan2005 wants to merge 1 commit into
Conversation
PerformanceCustomDataset never set filter_rate, so Streamlit getRange/sort TypeError'd when the key was present with a None value. Mirror LabelFilterPerformanceCase and treat None as 0 on the chart axis.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: daviddallakyan2005 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Label Filter and Int Filter Streamlit charts crash with
TypeErrorwhen a result row hasfilter_rate=None.dict.get(metric, 0)still returnsNonewhen the key is present, somin/sortcompareNonewith a float.PerformanceCustomDatasetnever passedfilter_rateinto the case (unlikeLabelFilterPerformanceCase, which sets it to1.0 - label_percentage). Custom-dataset filter runs therefore land in result files withfilter_rate=None.This PR:
Nonemetric values to0in bothgetRangeand the x-axis sort (label_filter/charts.pyandint_filter/charts.py) so leftover result files still render.filter_rate = 1.0 - label_percentageonPerformanceCustomDatasetwhenuse_filterandlabel_percentageare set, matchingLabelFilter.How to test
pip install -e '.[test]' PYTHONPATH=. python3 -m pytest tests/test_filter_charts.py tests/test_custom_dataset_filter.py -q make lintExpected: 8 passed;
black --checkandruff check vectordb_benchclean.To reproduce the crash without the chart-side coerce: open Label Filter (or Int Filter) on a custom-dataset filter result whose
case.filter_rateisNone.