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

Updated Labeled and Inferred Stacked Bars #158

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions viz_scripts/scaffolding.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,14 @@ def _select_max_label(row):
if row['user_input']:
return row['user_input']
max_entry = max(row['inferred_labels'], key=lambda x: x['p'])
return max_entry['labels'] if max_entry['p'] > row['confidence_threshold'] else {
'mode_confirm': 'uncertain'
}
# Look up for the 'p' value > 90%
return max_entry['labels'] if (max_entry['p'] > .90) else {}

labeled_inferred_labels = labeled_inferred_ct.apply(_select_max_label, axis=1).apply(pd.Series)
disp.display(labeled_inferred_labels.head())
expanded_labeled_inferred_ct = pd.concat([labeled_inferred_ct, labeled_inferred_labels], axis=1)
# Filter out the dataframe in which mode_confirm is uncertain
expanded_labeled_inferred_ct = expanded_labeled_inferred_ct[(expanded_labeled_inferred_ct['mode_confirm'] != 'uncertain')]
# Filter out the dataframe
expanded_labeled_inferred_ct.dropna('index', how='all', inplace=True)
disp.display(expanded_labeled_inferred_ct.head())
return expanded_labeled_inferred_ct

Expand Down