openhands commited on
Commit
fd4b87b
·
1 Parent(s): 7962903

Show model names only for frontier points in Evolution chart

Browse files

- Track frontier_rows when computing Pareto frontier
- Only add model name labels for points on the frontier
- Matches behavior of Cost/Performance and Accuracy by Size charts

Files changed (1) hide show
  1. visualizations.py +19 -13
visualizations.py CHANGED
@@ -214,6 +214,8 @@ def create_evolution_over_time_chart(df: pd.DataFrame) -> go.Figure:
214
  fig = go.Figure()
215
 
216
  # Add Pareto frontier line (monotonically increasing best score over time)
 
 
217
  if len(plot_df) > 1:
218
  # Compute Pareto frontier: only include points that set a new best score
219
  frontier_dates = []
@@ -228,6 +230,7 @@ def create_evolution_over_time_chart(df: pd.DataFrame) -> go.Figure:
228
  # This point is on the Pareto frontier
229
  frontier_dates.append(current_date)
230
  frontier_scores.append(current_score)
 
231
  max_score_so_far = current_score
232
 
233
  if frontier_dates:
@@ -281,7 +284,6 @@ def create_evolution_over_time_chart(df: pd.DataFrame) -> go.Figure:
281
 
282
  # Add company logo images for each data point using data coordinates
283
  layout_images = []
284
- labels_data = []
285
 
286
  for _, row in plot_df.iterrows():
287
  model_name = row.get(model_col, '')
@@ -311,24 +313,28 @@ def create_evolution_over_time_chart(df: pd.DataFrame) -> go.Figure:
311
  yanchor="middle",
312
  layer="above"
313
  ))
314
-
315
- # Store label data for annotation
316
- labels_data.append({
317
- 'x': x_val,
318
- 'y': y_val,
319
- 'label': model_name
320
- })
321
  except Exception:
322
  pass
323
 
324
- # Add model name labels above each point
325
- for item in labels_data:
 
 
 
 
 
 
 
 
 
 
 
326
  fig.add_annotation(
327
- x=item['x'],
328
- y=item['y'],
329
  xref="x",
330
  yref="y",
331
- text=item['label'],
332
  showarrow=False,
333
  yshift=20,
334
  font=STANDARD_FONT,
 
214
  fig = go.Figure()
215
 
216
  # Add Pareto frontier line (monotonically increasing best score over time)
217
+ # Also track which rows are on the frontier for labeling
218
+ frontier_rows = []
219
  if len(plot_df) > 1:
220
  # Compute Pareto frontier: only include points that set a new best score
221
  frontier_dates = []
 
230
  # This point is on the Pareto frontier
231
  frontier_dates.append(current_date)
232
  frontier_scores.append(current_score)
233
+ frontier_rows.append(row)
234
  max_score_so_far = current_score
235
 
236
  if frontier_dates:
 
284
 
285
  # Add company logo images for each data point using data coordinates
286
  layout_images = []
 
287
 
288
  for _, row in plot_df.iterrows():
289
  model_name = row.get(model_col, '')
 
313
  yanchor="middle",
314
  layer="above"
315
  ))
 
 
 
 
 
 
 
316
  except Exception:
317
  pass
318
 
319
+ # Add model name labels only for frontier points
320
+ for row in frontier_rows:
321
+ model_name = row.get(model_col, '')
322
+ x_val = row['release_date']
323
+ y_val = row[score_col]
324
+
325
+ # Clean model name for label
326
+ if isinstance(model_name, list):
327
+ model_name = model_name[0] if model_name else ''
328
+ model_name = str(model_name).split('/')[-1]
329
+ if len(model_name) > 25:
330
+ model_name = model_name[:22] + '...'
331
+
332
  fig.add_annotation(
333
+ x=x_val,
334
+ y=y_val,
335
  xref="x",
336
  yref="y",
337
+ text=model_name,
338
  showarrow=False,
339
  yshift=20,
340
  font=STANDARD_FONT,