Roni Goldshmidt commited on
Commit
436a7cd
·
1 Parent(s): 7ada547

Initial leaderboard setup

Browse files
.ipynb_checkpoints/comparison-checkpoint.py CHANGED
@@ -42,15 +42,21 @@ class ModelEvaluator:
42
  print(f"Skipping {category} - missing columns")
43
  continue
44
 
45
- y_true = merged_df[true_col].astype(str)
46
- y_pred = merged_df[pred_col].astype(str)
 
 
 
 
 
 
47
 
48
  valid_labels = sorted(set(y_true) | set(y_pred))
49
 
50
- valid_labels = [label for label in valid_labels if (y_true == label).sum() > 0]
51
 
52
  if not valid_labels:
53
- print(f"Skipping {category} - No valid labels found.")
54
  continue
55
 
56
  class_precisions = precision_score(y_true, y_pred, labels=valid_labels, average=None, zero_division=0)
 
42
  print(f"Skipping {category} - missing columns")
43
  continue
44
 
45
+ filtered_df = merged_df[merged_df[true_col] != "unknown"]
46
+
47
+ if filtered_df.empty:
48
+ print(f"Skipping {category} - only 'unknown' values present.")
49
+ continue
50
+
51
+ y_true = filtered_df[true_col].astype(str)
52
+ y_pred = filtered_df[pred_col].astype(str)
53
 
54
  valid_labels = sorted(set(y_true) | set(y_pred))
55
 
56
+ valid_labels = [label for label in valid_labels if (y_true == label).sum() > 0 and label != "unknown"]
57
 
58
  if not valid_labels:
59
+ print(f"Skipping {category} - No valid labels found after filtering.")
60
  continue
61
 
62
  class_precisions = precision_score(y_true, y_pred, labels=valid_labels, average=None, zero_division=0)
__pycache__/comparison.cpython-310.pyc CHANGED
Binary files a/__pycache__/comparison.cpython-310.pyc and b/__pycache__/comparison.cpython-310.pyc differ
 
comparison.py CHANGED
@@ -42,15 +42,21 @@ class ModelEvaluator:
42
  print(f"Skipping {category} - missing columns")
43
  continue
44
 
45
- y_true = merged_df[true_col].astype(str)
46
- y_pred = merged_df[pred_col].astype(str)
 
 
 
 
 
 
47
 
48
  valid_labels = sorted(set(y_true) | set(y_pred))
49
 
50
- valid_labels = [label for label in valid_labels if (y_true == label).sum() > 0]
51
 
52
  if not valid_labels:
53
- print(f"Skipping {category} - No valid labels found.")
54
  continue
55
 
56
  class_precisions = precision_score(y_true, y_pred, labels=valid_labels, average=None, zero_division=0)
 
42
  print(f"Skipping {category} - missing columns")
43
  continue
44
 
45
+ filtered_df = merged_df[merged_df[true_col] != "unknown"]
46
+
47
+ if filtered_df.empty:
48
+ print(f"Skipping {category} - only 'unknown' values present.")
49
+ continue
50
+
51
+ y_true = filtered_df[true_col].astype(str)
52
+ y_pred = filtered_df[pred_col].astype(str)
53
 
54
  valid_labels = sorted(set(y_true) | set(y_pred))
55
 
56
+ valid_labels = [label for label in valid_labels if (y_true == label).sum() > 0 and label != "unknown"]
57
 
58
  if not valid_labels:
59
+ print(f"Skipping {category} - No valid labels found after filtering.")
60
  continue
61
 
62
  class_precisions = precision_score(y_true, y_pred, labels=valid_labels, average=None, zero_division=0)