File size: 1,214 Bytes
0f332f8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import json
import os
import sys

# Mock paths
PROJECT_ROOT = os.path.abspath(os.getcwd())
sys.path.append(PROJECT_ROOT)

from leaderboard import rank_results

def test_dataset(name):
    path = os.path.join(PROJECT_ROOT, "results", f"{name}.json")
    if not os.path.exists(path):
        print(f"[ERROR] {name} not found")
        return

    with open(path, 'r', encoding='utf-8') as f:
        data = json.load(f)
    
    print(f"--- Testing {name} ---")
    try:
        ranked = rank_results(data)
        if len(ranked) > 0:
            first = ranked[0]
            print("Keys in first item:", first.keys())
            # Check for critical keys
            for key in ['mean_f1', 'mean_auc', 'time']:
                if key not in first:
                    print(f"[FAIL] Missing key: {key}")
                elif first[key] is None:
                    print(f"[FAIL] Key is None: {key}")
                else:
                    print(f"[OK] {key}: {first[key]} (type: {type(first[key])})")
        else:
            print("[WARN] Ranked list is empty")
    except Exception as e:
        print(f"[ERROR] Ranking failed: {e}")

test_dataset("Authorship")
test_dataset("Factors")
test_dataset("dna")