openhands openhands commited on
Commit
894bacb
·
1 Parent(s): eb54922

Fix Pareto frontier in Evolution Over Time chart

Browse files

- Make frontier strictly monotonically increasing (only shows improvements)
- Use step pattern: horizontal line until new best, then vertical jump
- Frontier line now exactly passes through the frontier points

Co-authored-by: openhands <openhands@all-hands.dev>

Files changed (1) hide show
  1. visualizations.py +31 -10
visualizations.py CHANGED
@@ -185,17 +185,38 @@ def create_evolution_over_time_chart(df: pd.DataFrame) -> go.Figure:
185
 
186
  fig = go.Figure()
187
 
188
- # Add trend line first (so it's behind the markers)
189
  if len(plot_df) > 1:
190
- fig.add_trace(go.Scatter(
191
- x=plot_df['release_date'],
192
- y=plot_df[score_col],
193
- mode='lines',
194
- line=dict(color='#FFE165', width=2, dash='dash'), # primary yellow
195
- name='Trend',
196
- hoverinfo='skip',
197
- showlegend=False
198
- ))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
199
 
200
  # Calculate axis ranges for domain coordinate conversion
201
  min_date = plot_df['release_date'].min()
 
185
 
186
  fig = go.Figure()
187
 
188
+ # Add Pareto frontier line (monotonically increasing best score over time)
189
  if len(plot_df) > 1:
190
+ # Compute Pareto frontier: for each date, track the max score seen so far
191
+ frontier_dates = []
192
+ frontier_scores = []
193
+ max_score_so_far = float('-inf')
194
+
195
+ for _, row in plot_df.iterrows():
196
+ current_score = row[score_col]
197
+ current_date = row['release_date']
198
+
199
+ if current_score > max_score_so_far:
200
+ # This point is on the Pareto frontier
201
+ if frontier_dates:
202
+ # Add a horizontal line segment from previous frontier point to this date
203
+ frontier_dates.append(current_date)
204
+ frontier_scores.append(max_score_so_far)
205
+ # Add the new frontier point
206
+ frontier_dates.append(current_date)
207
+ frontier_scores.append(current_score)
208
+ max_score_so_far = current_score
209
+
210
+ if frontier_dates:
211
+ fig.add_trace(go.Scatter(
212
+ x=frontier_dates,
213
+ y=frontier_scores,
214
+ mode='lines',
215
+ line=dict(color='#FFE165', width=2), # primary yellow, solid line
216
+ name='Pareto Frontier',
217
+ hoverinfo='skip',
218
+ showlegend=False
219
+ ))
220
 
221
  # Calculate axis ranges for domain coordinate conversion
222
  min_date = plot_df['release_date'].min()