summaryrefslogtreecommitdiff
path: root/experiments/run_realworld_hero_L20.py
diff options
context:
space:
mode:
Diffstat (limited to 'experiments/run_realworld_hero_L20.py')
-rw-r--r--experiments/run_realworld_hero_L20.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/experiments/run_realworld_hero_L20.py b/experiments/run_realworld_hero_L20.py
index 93a6c91..3b352f1 100644
--- a/experiments/run_realworld_hero_L20.py
+++ b/experiments/run_realworld_hero_L20.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
-"""H33: 20-seed extension of L=20 hero on 4 real-world datasets × {BP, DFA, DFA-GNN, GRAFT}.
+"""H33: 20-seed extension of L=20 hero on 4 real-world datasets × {BP, DFA, DFA-GNN, KAFT}.
Paper setup (5%/class, hidden=64, lr=0.01, no scheduler, 200 epochs, GCN backbone, no dropout/BN/res).
Tightens DBLP std (0.121 at 10-seed bimodal) for paper-grade stats.
@@ -17,7 +17,7 @@ from torch_geometric.nn import GCNConv
from torch_geometric.utils import add_self_loops, degree
sys.path.insert(0, '/home/yurenh2/graph-grape')
-from src.trainers import GraphGrAPETrainer
+from src.trainers import KAFTTrainer
device = torch.device('cuda:2')
@@ -92,7 +92,7 @@ def bp_one(L, seed, d, tm, vm, tem, epochs=200, lr=0.01, hidden=64):
return bt
-def graft_one(L, seed, d, A_hat, A_row, A_row_T, tm, vm, tem,
+def kaft_one(L, seed, d, A_hat, A_row, A_row_T, tm, vm, tem,
epochs=200, lr=0.01, hidden=64):
torch.manual_seed(seed); np.random.seed(seed); torch.cuda.manual_seed_all(seed)
data = {
@@ -101,7 +101,7 @@ def graft_one(L, seed, d, A_hat, A_row, A_row_T, tm, vm, tem,
'num_features': d.x.shape[1], 'num_classes': int(d.y.max())+1,
'num_nodes': d.num_nodes, 'traces': {},
}
- trainer = GraphGrAPETrainer(
+ trainer = KAFTTrainer(
data=data, hidden_dim=hidden, lr=lr, weight_decay=5e-4,
lr_feedback=0.5, num_probes=64, topo_mode='fixed_A', max_topo_power=3,
diffusion_alpha=0.5, diffusion_iters=10,
@@ -149,21 +149,21 @@ def main():
t0 = time.time()
bp = bp_one(L, s, d, tm, vm, tem)
t1 = time.time()
- gf = graft_one(L, s, d, A_hat, A_row, A_row_T, tm, vm, tem)
+ gf = kaft_one(L, s, d, A_hat, A_row, A_row_T, tm, vm, tem)
t2 = time.time()
bp_a.append(bp); gf_a.append(gf)
- print(f' s={s} L={L}: BP={bp:.4f}({t1-t0:.0f}s) GRAFT={gf:.4f}({t2-t1:.0f}s)', flush=True)
+ print(f' s={s} L={L}: BP={bp:.4f}({t1-t0:.0f}s) KAFT={gf:.4f}({t2-t1:.0f}s)', flush=True)
bp_m, bp_sd = float(np.mean(bp_a)), float(np.std(bp_a))
gf_m, gf_sd = float(np.mean(gf_a)), float(np.std(gf_a))
- out[name] = dict(seeds=seeds, BP=bp_a, GRAFT=gf_a, BP_mean=bp_m, BP_std=bp_sd,
+ out[name] = dict(seeds=seeds, BP=bp_a, KAFT=gf_a, BP_mean=bp_m, BP_std=bp_sd,
GRAFT_mean=gf_m, GRAFT_std=gf_sd)
- print(f' >>> {name} L=20 (seeds {s_lo}-{s_hi-1}): BP {bp_m:.4f}±{bp_sd:.4f} GRAFT {gf_m:.4f}±{gf_sd:.4f} Δ={gf_m-bp_m:+.3f}', flush=True)
+ print(f' >>> {name} L=20 (seeds {s_lo}-{s_hi-1}): BP {bp_m:.4f}±{bp_sd:.4f} KAFT {gf_m:.4f}±{gf_sd:.4f} Δ={gf_m-bp_m:+.3f}', flush=True)
del d, A_hat, A_row, A_row_T
torch.cuda.empty_cache()
print('\n=== SUMMARY (this run) ===', flush=True)
for k, v in out.items():
- print(f' {k}: BP {v["BP_mean"]:.4f}±{v["BP_std"]:.4f} GRAFT {v["GRAFT_mean"]:.4f}±{v["GRAFT_std"]:.4f}', flush=True)
+ print(f' {k}: BP {v["BP_mean"]:.4f}±{v["BP_std"]:.4f} KAFT {v["GRAFT_mean"]:.4f}±{v["GRAFT_std"]:.4f}', flush=True)
if __name__ == '__main__':