akera commited on
Commit
ceca234
·
verified ·
1 Parent(s): fe8454f

Update src/leaderboard.py

Browse files
Files changed (1) hide show
  1. src/leaderboard.py +11 -2
src/leaderboard.py CHANGED
@@ -352,6 +352,11 @@ def get_track_leaderboard(
352
  track_quality_col = f"{track}_{metric}"
353
  track_adequate_col = f"{track}_adequate"
354
 
 
 
 
 
 
355
  # Filter by adequacy
356
  if min_adequacy > 0:
357
  adequacy_mask = df["scientific_adequacy_score"] >= min_adequacy
@@ -361,8 +366,12 @@ def get_track_leaderboard(
361
  if category_filter != "all":
362
  df = df[df["model_category"] == category_filter]
363
 
364
- # Filter to models that have this track
365
- valid_mask = (df[track_quality_col] > 0) & df[track_adequate_col]
 
 
 
 
366
  df = df[valid_mask]
367
 
368
  if df.empty:
 
352
  track_quality_col = f"{track}_{metric}"
353
  track_adequate_col = f"{track}_adequate"
354
 
355
+ # Ensure columns exist
356
+ if track_quality_col not in df.columns or track_adequate_col not in df.columns:
357
+ print(f"Warning: Missing columns for track {track}")
358
+ return pd.DataFrame()
359
+
360
  # Filter by adequacy
361
  if min_adequacy > 0:
362
  adequacy_mask = df["scientific_adequacy_score"] >= min_adequacy
 
366
  if category_filter != "all":
367
  df = df[df["model_category"] == category_filter]
368
 
369
+ # Filter to models that have this track - fix boolean operation
370
+ # Convert to proper boolean and handle NaN values
371
+ quality_mask = pd.to_numeric(df[track_quality_col], errors='coerce') > 0
372
+ adequate_mask = df[track_adequate_col].fillna(False).astype(bool)
373
+
374
+ valid_mask = quality_mask & adequate_mask
375
  df = df[valid_mask]
376
 
377
  if df.empty: