summaryrefslogtreecommitdiff
path: root/experiments/run_cs_full.py
diff options
context:
space:
mode:
Diffstat (limited to 'experiments/run_cs_full.py')
-rw-r--r--experiments/run_cs_full.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/experiments/run_cs_full.py b/experiments/run_cs_full.py
index d66fc59..d170e13 100644
--- a/experiments/run_cs_full.py
+++ b/experiments/run_cs_full.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
"""H19 CitationFull-CiteSeer (4.2K, deg 2.5, 6-class) — same regime as Planetoid CiteSeer.
-Quick BP + GRAFT depth sweep to confirm/extend the 'GRAFT wins on real sparse citation' story."""
+Quick BP + KAFT depth sweep to confirm/extend the 'KAFT wins on real sparse citation' story."""
import torch, sys, numpy as np, time
import torch.nn as nn, torch.nn.functional as F
@@ -9,7 +9,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
DATA_ROOT = '/home/yurenh2/graph-grape/data/CFull'
device = torch.device('cuda:0')
@@ -90,7 +90,7 @@ def bp_one(L, seed, d, train_mask, val_mask, test_mask, epochs=200, lr=5e-3, hid
return bt
-def graft_one(L, seed, d, A_hat, A_row, A_row_T, train_mask, val_mask, test_mask,
+def kaft_one(L, seed, d, A_hat, A_row, A_row_T, train_mask, val_mask, test_mask,
epochs=200, lr=5e-3, hidden=128):
torch.manual_seed(seed); np.random.seed(seed); torch.cuda.manual_seed_all(seed)
data = {
@@ -99,7 +99,7 @@ def graft_one(L, seed, d, A_hat, A_row, A_row_T, train_mask, val_mask, test_mask
'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=0.0,
lr_feedback=0.5, num_probes=64, topo_mode='fixed_A', max_topo_power=3,
diffusion_alpha=0.5, diffusion_iters=10,
@@ -133,14 +133,14 @@ 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_accs.append(bp); gf_accs.append(gf)
- print(f' L={L} s={s}: BP={bp:.4f}({t1-t0:.0f}s) GRAFT={gf:.4f}({t2-t1:.0f}s)', flush=True)
+ print(f' L={L} s={s}: BP={bp:.4f}({t1-t0:.0f}s) KAFT={gf:.4f}({t2-t1:.0f}s)', flush=True)
bp_m, bp_sd = np.mean(bp_accs), np.std(bp_accs)
gf_m, gf_sd = np.mean(gf_accs), np.std(gf_accs)
bp_res[L] = (bp_m, bp_sd); gf_res[L] = (gf_m, gf_sd)
- print(f'>>> L={L}: BP {bp_m:.4f}±{bp_sd:.4f} GRAFT {gf_m:.4f}±{gf_sd:.4f} Δ={gf_m-bp_m:+.3f}', flush=True)
+ print(f'>>> L={L}: BP {bp_m:.4f}±{bp_sd:.4f} KAFT {gf_m:.4f}±{gf_sd:.4f} Δ={gf_m-bp_m:+.3f}', flush=True)
if __name__ == '__main__':