hynky HF staff commited on
Commit
1c27705
·
1 Parent(s): 2990133

mean + std

Browse files
Files changed (1) hide show
  1. app.py +13 -6
app.py CHANGED
@@ -162,7 +162,10 @@ def prepare_for_group_plotting(metric, top_k, direction: PARTITION_OPTIONS, rege
162
  else:
163
  keys = heapq.nsmallest(top_k, means, key=means.get)
164
 
165
- return [(key, means[key]) for key in keys]
 
 
 
166
 
167
 
168
  def set_alpha(color, alpha):
@@ -237,11 +240,15 @@ def plot_bars(
237
  y = []
238
 
239
  for i, (name, histogram) in enumerate(progress.tqdm(data.items(), total=len(data), desc="Plotting...")):
240
- histogram_prepared = prepare_for_group_plotting(histogram, top_k, direction, regex, rounding)
241
- x, y = zip(*histogram_prepared)
242
 
243
- fig.add_trace(go.Bar(x=x, y=y, name=name, marker=dict(color=set_alpha(px.colors.qualitative.Plotly[i % len(px.colors.qualitative.Plotly)], 0.5))))
244
-
 
 
 
 
 
245
 
246
  fig.update_layout(
247
  title=f"Bar Plots for {metric_name}",
@@ -533,7 +540,7 @@ The data might not be 100% representative, due to the sampling and optimistic me
533
  if not new_dsts:
534
  return gr.update(value=list(selected_runs))
535
  dst_union = new_dsts.union(selected_runs or [])
536
- return gr.update(value=list(dst_union))
537
 
538
  regex_button.click(
539
  fn=update_datasets_with_regex,
 
162
  else:
163
  keys = heapq.nsmallest(top_k, means, key=means.get)
164
 
165
+
166
+ means = [means[key] for key in keys]
167
+ stds = [metric[key].standard_deviation for key in keys]
168
+ return keys, means, stds
169
 
170
 
171
  def set_alpha(color, alpha):
 
240
  y = []
241
 
242
  for i, (name, histogram) in enumerate(progress.tqdm(data.items(), total=len(data), desc="Plotting...")):
243
+ x, y, stds = prepare_for_group_plotting(histogram, top_k, direction, regex, rounding)
 
244
 
245
+ fig.add_trace(go.Bar(
246
+ x=x,
247
+ y=y,
248
+ name=f"{name} Mean",
249
+ marker=dict(color=set_alpha(px.colors.qualitative.Plotly[i % len(px.colors.qualitative.Plotly)], 0.5)),
250
+ error_y=dict(type='data', array=stds, visible=True)
251
+ ))
252
 
253
  fig.update_layout(
254
  title=f"Bar Plots for {metric_name}",
 
540
  if not new_dsts:
541
  return gr.update(value=list(selected_runs))
542
  dst_union = new_dsts.union(selected_runs or [])
543
+ return gr.update(value=sorted(list(dst_union)))
544
 
545
  regex_button.click(
546
  fn=update_datasets_with_regex,