diff options
| author | YurenHao0426 <blackhao0426@gmail.com> | 2026-05-04 23:05:16 -0500 |
|---|---|---|
| committer | YurenHao0426 <blackhao0426@gmail.com> | 2026-05-04 23:05:16 -0500 |
| commit | bd9333eda60a9029a198acaeacb1eca4312bd1e8 (patch) | |
| tree | 7544c347b7ac4e8629fa1cc0fcf341d48cb69e2e /figures/gen_realworld_depth_fig.py | |
Initial release: GRAFT (KAFT) — NeurIPS 2026 submission code
Topology-factorized Jacobian-aligned feedback for deep GNNs. Includes:
- src/: GraphGrAPETrainer (KAFT) + BP / DFA / DFA-GNN / VanillaGrAPE baselines
+ multi-probe alignment estimator + dataset / sparse-mm utilities.
- experiments/: 19 runners reproducing every figure / table in the paper.
- figures/: 4 generators + the 4 PDFs cited in the report.
- paper/: NeurIPS .tex and consolidated experiments_master notes.
Smoke test: 50-epoch Cora GCN L=4 gives BP 77.3% / KAFT 79.0%.
Diffstat (limited to 'figures/gen_realworld_depth_fig.py')
| -rw-r--r-- | figures/gen_realworld_depth_fig.py | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/figures/gen_realworld_depth_fig.py b/figures/gen_realworld_depth_fig.py new file mode 100644 index 0000000..1ff7e2d --- /dev/null +++ b/figures/gen_realworld_depth_fig.py @@ -0,0 +1,93 @@ +#!/usr/bin/env python3 +"""Real-world dataset depth-sweep figure (Fig 4(a)' style). +4 panels: CFull-CiteSeer, CFull-DBLP, CFull-PubMed (biomed), Coauthor-Physics. +Data hardcoded from cfull_paper_setup.log + dblpfull_full_depth.log + +pubmedfull_full_depth.log + physics_full_depth.log + dblp_paper_setup.log + cs_paper_setup.log.""" + +import numpy as np +import matplotlib.pyplot as plt +from matplotlib.colors import to_rgba + +# Aggregated paper-setup data: (mean, std) for BP and GRAFT at each depth +DATA = { + 'CFull-CiteSeer': { + 'depths': [3, 5, 8, 10, 12, 14, 16, 18, 20], + 'BP': [(0.870, 0.0072), (0.860, 0.0056), (0.825, 0.0208), (0.549, 0.1164), (0.365, 0.0209), (0.297, 0.0421), (0.230, 0.0209), (0.238, 0.0131), (0.209, 0.0319)], + 'DFA': [(0.855, 0.0044), (0.834, 0.0106), (0.566, 0.0289), (0.425, 0.0993), (0.329, 0.1060), (0.368, 0.0604), (0.297, 0.0722), (0.243, 0.0661), (0.244, 0.0667)], + 'DFA-GNN': [(0.858, 0.0038), (0.826, 0.0187), (0.581, 0.1085), (0.465, 0.0698), (0.289, 0.0677), (0.296, 0.1372), (0.244, 0.0673), (0.211, 0.0204), (0.193, 0.0051)], + 'GRAFT': [(0.857, 0.0006), (0.846, 0.0019), (0.829, 0.0021), (0.780, 0.0197), (0.667, 0.0630), (0.487, 0.0621), (0.430, 0.1145), (0.369, 0.0089), (0.380, 0.0258)], + }, + 'CFull-DBLP': { + 'depths': [3, 5, 8, 10, 12, 14, 16, 18, 20], + 'BP': [(0.826, 0.0027), (0.814, 0.0006), (0.793, 0.0070), (0.710, 0.1180), (0.652, 0.0728), (0.559, 0.1132), (0.454, 0.0065), (0.469, 0.0077), (0.461, 0.0144)], + 'DFA': [(0.829, 0.0031), (0.819, 0.0076), (0.736, 0.0409), (0.703, 0.0025), (0.682, 0.0257), (0.548, 0.1104), (0.532, 0.1206), (0.533, 0.1209), (0.447, 0.0000)], + 'DFA-GNN': [(0.832, 0.0024), (0.823, 0.0033), (0.766, 0.0362), (0.617, 0.1203), (0.617, 0.1203), (0.523, 0.1018), (0.447, 0.0000), (0.447, 0.0000), (0.531, 0.1187)], + 'GRAFT': [(0.827, 0.0024), (0.825, 0.0090), (0.813, 0.0121), (0.786, 0.0032), (0.730, 0.0315), (0.701, 0.0020), (0.700, 0.0001), (0.610, 0.1150), (0.613, 0.1175)], + }, + 'CFull-PubMed (biomed)': { + 'depths': [3, 5, 8, 10, 12, 14, 16, 18, 20], + 'BP': [(0.845, 0.0018), (0.833, 0.0023), (0.825, 0.0026), (0.824, 0.0025), (0.699, 0.0096), (0.499, 0.1413), (0.399, 0.0000), (0.500, 0.1421), (0.399, 0.0000)], + 'DFA': [(0.822, 0.0041), (0.793, 0.0188), (0.585, 0.1353), (0.531, 0.0768), (0.484, 0.0833), (0.431, 0.0446), (0.427, 0.0383), (0.399, 0.0000), (0.399, 0.0000)], + 'DFA-GNN': [(0.822, 0.0040), (0.750, 0.0551), (0.604, 0.1572), (0.522, 0.1154), (0.462, 0.0888), (0.399, 0.0000), (0.438, 0.0550), (0.399, 0.0000), (0.466, 0.0945)], + 'GRAFT': [(0.830, 0.0068), (0.814, 0.0049), (0.789, 0.0099), (0.732, 0.0713), (0.690, 0.0585), (0.646, 0.0134), (0.603, 0.0086), (0.545, 0.1031), (0.525, 0.0887)], + }, + 'Coauthor-Physics': { + 'depths': [3, 5, 8, 10, 12, 14, 16, 18, 20], + 'BP': [(0.949, 0.0005), (0.943, 0.0014), (0.937, 0.0011), (0.829, 0.0344), (0.818, 0.0387), (0.770, 0.0151), (0.743, 0.0038), (0.682, 0.1000), (0.521, 0.0215)], + 'DFA': [(0.948, 0.0007), (0.920, 0.0067), (0.711, 0.0227), (0.686, 0.1275), (0.560, 0.0751), (0.506, 0.0005), (0.557, 0.0737), (0.559, 0.0762), (0.505, 0.0000)], + 'DFA-GNN': [(0.947, 0.0012), (0.836, 0.0451), (0.712, 0.0369), (0.567, 0.0720), (0.505, 0.0003), (0.505, 0.0000), (0.505, 0.0000), (0.559, 0.0756), (0.505, 0.0000)], + 'GRAFT': [(0.947, 0.0008), (0.943, 0.0004), (0.922, 0.0092), (0.867, 0.0368), (0.749, 0.0423), (0.686, 0.0122), (0.614, 0.0771), (0.666, 0.0010), (0.667, 0.0003)], + }, +} + +COLORS = {'BP': '#888888', 'DFA': '#7A5BAA', 'DFA-GNN': '#3B7AC2', 'GRAFT': '#C23B3B'} +GRID = '#ECEFF3' +TEXT = '#2F3437' + +plt.rcParams.update({ + 'font.size': 9, 'axes.labelsize': 9, + 'xtick.labelsize': 8, 'ytick.labelsize': 8, 'legend.fontsize': 9, + 'pdf.fonttype': 42, 'ps.fonttype': 42, +}) + +fig, axes = plt.subplots(1, 4, figsize=(13.0, 3.0)) + +datasets = list(DATA.keys()) +legend_handles = {} +for ax, ds in zip(axes, datasets): + d = DATA[ds] + xs = d['depths'] + for method in ['BP', 'DFA', 'DFA-GNN', 'GRAFT']: + means = np.array([v[0] for v in d[method]]) + stds = np.array([v[1] for v in d[method]]) + c = COLORS[method] + line, = ax.plot(xs, means, marker='o', markersize=5, color=c, linewidth=1.6, + markerfacecolor=to_rgba(c, alpha=0.35), markeredgecolor=c, + markeredgewidth=0.8, zorder=3) + ax.fill_between(xs, means - stds, means + stds, color=c, alpha=0.12, edgecolor='none', zorder=2) + if method not in legend_handles: + legend_handles[method] = line + + ax.set_title(ds, fontsize=10, color=TEXT, pad=4) + ax.set_xlabel('Number of layers $L$', fontsize=9, color=TEXT) + ax.grid(axis='both', color=GRID, linewidth=0.6) + ax.set_axisbelow(True) + ax.spines['top'].set_visible(False) + ax.spines['right'].set_visible(False) + ax.spines['left'].set_color('#C9CDD3') + ax.spines['bottom'].set_color('#C9CDD3') + ax.tick_params(colors=TEXT) + ax.set_xticks([3, 5, 10, 14, 18, 20]) + +axes[0].set_ylabel('Test accuracy', fontsize=9, color=TEXT) + +handles = [legend_handles[m] for m in ['BP', 'DFA', 'DFA-GNN', 'GRAFT']] +fig.tight_layout(rect=(0.0, 0.06, 1.0, 1.0), w_pad=1.5) +# Display label: GRAFT data key stays for the lookup, render as KAFT +fig.legend(handles, ['BP', 'DFA', 'DFA-GNN', 'KAFT'], frameon=False, loc='lower center', + ncol=4, bbox_to_anchor=(0.5, -0.005), handletextpad=0.6, columnspacing=1.8) + +fig.savefig('/home/yurenh2/graph-grape/kaft_realworld_depth.png', dpi=300, bbox_inches='tight') +fig.savefig('/home/yurenh2/graph-grape/kaft_realworld_depth.pdf', bbox_inches='tight') +plt.close(fig) +print('Saved /home/yurenh2/graph-grape/kaft_realworld_depth.{png,pdf}') |
