Skip to content

Commit

Permalink
fix(model-quality): catch errors when generating plots (#123)
Browse files Browse the repository at this point in the history
fix(model-quality): catch errors when generating plots.
  • Loading branch information
frederik-encord authored Jan 26, 2023
1 parent cd09f2a commit 10434b2
Showing 1 changed file with 17 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,18 +128,20 @@ def build(
show_decomposition=decompose_classes,
)

tpr = performance_rate_by_metric(
model_predictions, metric_name, scope=PredictionMatchScope.TRUE_POSITIVES, **chart_args
)
if tpr is None:
st.stop()
st.altair_chart(tpr.interactive(), use_container_width=True)

fnr = performance_rate_by_metric(
labels, label_metric_name, scope=PredictionMatchScope.FALSE_NEGATIVES, **chart_args
)

if fnr is None: # Label metric couldn't be matched to
st.stop()

st.altair_chart(fnr.interactive(), use_container_width=True)
try:
tpr = performance_rate_by_metric(
model_predictions, metric_name, scope=PredictionMatchScope.TRUE_POSITIVES, **chart_args
)
if tpr is not None:
st.altair_chart(tpr.interactive(), use_container_width=True)
except:
pass

try:
fnr = performance_rate_by_metric(
labels, label_metric_name, scope=PredictionMatchScope.FALSE_NEGATIVES, **chart_args
)
if fnr is not None:
st.altair_chart(fnr.interactive(), use_container_width=True)
except:
pass

0 comments on commit 10434b2

Please sign in to comment.