File size: 1,254 Bytes
cf739bf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9aefc6b
cf739bf
 
 
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 sys
import traceback

try:
    print("1. Loading config...")
    from src.config_loader import get_config
    get_config()
    
    print("2. Importing pipeline...")
    from src.data_loader import get_processed_data
    from src.graph_builder import build_graph, compute_pagerank, compute_betweenness, compute_louvain
    from src.detectors.alert_engine import get_all_alerts
    from src.ml.features import engineer_features
    
    print("3. Getting data...")
    df, node_features = get_processed_data()
    print(f"Loaded {len(df)} rows.")
    
    print("4. Building graph...")
    graph = build_graph(df)
    print(f"Graph: {len(graph.nodes)} nodes, {len(graph.edges)} edges.")
    
    print("5. Metrics...")
    pr = compute_pagerank(1, graph)
    bw = compute_betweenness(1, graph)
    lv = compute_louvain(1, graph)
    
    print("6. Detectors...")
    alerts = get_all_alerts(df, graph, lv, node_features, demo_mode=True)
    print(f"Generated {len(alerts)} alerts.")
    
    print("7. Features...")
    ff = engineer_features(df, graph, pr, bw, lv, alerts)
    print(f"Feature cols: {len(ff.columns)}")
    
    print("SUCCESS!")
    
except Exception:
    print("\n--- ERROR CAUGHT ---")
    traceback.print_exc()
    sys.exit(1)