-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathquick_start.py
More file actions
executable file
·63 lines (52 loc) · 2.34 KB
/
quick_start.py
File metadata and controls
executable file
·63 lines (52 loc) · 2.34 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/env python3
"""
Quick start script for XNode framework.
Runs a simple example with OrganCMNIST dataset.
"""
import os
import sys
import subprocess
def main():
print("XNode Quick Start")
print("=" * 50)
# Check if we have the required graph file
graph_file = "datasets/G_Organcmnist_inductive.gpickle"
if not os.path.exists(graph_file):
print(f"Graph file {graph_file} not found!")
print("Please ensure you have the required graph files in the datasets/ directory.")
print("You can copy them from the S-XAI/Models/ directory or build them using:")
print("python data_processing/build_graphs.py --dataset organcmnist")
return
print(f"Found graph file: {graph_file}")
# Run a simple baseline training
print("\nTraining GCN baseline model (fast mode)...")
cmd = f"python models/train_baseline.py --model gcn --dataset organcmnist --graph_file {graph_file} --output_dir results --epochs 10 --n_folds 2 --fast"
try:
# Stream logs directly so user sees progress
result = subprocess.run(cmd, shell=True, check=True)
print("\n✓ GCN baseline training completed!")
except subprocess.CalledProcessError as e:
print(f"✗ Error training GCN baseline: {e}")
if e.stderr:
print("Error:", e.stderr)
return
# Run reasoner training
print("\nTraining GCN reasoner model (fast mode)...")
cmd = f"python reasoners/train_reasoner.py --model gcn --dataset organcmnist --graph_file {graph_file} --output_dir results --epochs 10 --n_folds 2 --fast"
try:
result = subprocess.run(cmd, shell=True, check=True)
print("\n✓ GCN reasoner training completed!")
except subprocess.CalledProcessError as e:
print(f"✗ Error training GCN reasoner: {e}")
if e.stderr:
print("Error:", e.stderr)
return
print("\n" + "=" * 50)
print("Quick start completed!")
print("Check the results/ directory for outputs.")
print("\nTo run the full pipeline, use:")
print("python run_pipeline.py --dataset organcmnist --train_baselines --train_reasoners")
print("\nTo generate explanations (requires API key):")
print("python run_pipeline.py --dataset organcmnist --generate_explanations --api_key YOUR_API_KEY")
if __name__ == '__main__':
main()