cs3319-project2 / docs /diagrams /src /architecture.d2
NLP-beginner's picture
CS3319 Project 2 final deliverable (public F1 = 0.96626)
f28d994
Raw
History Blame Contribute Delete
4.05 kB
# CS3319 Project 2 — System architecture (D2)
# Layered view of the two-stage stacking system + the shared infrastructure
# (deterministic split, feature cache, two load_module shared libraries).
# Render: d2 architecture.d2 ../svg/architecture.svg
direction: down
classes: {
layer_data: { style.fill: "#eef4fb"; style.stroke: "#3b6ea8"; style.stroke-width: 1 }
layer_split: { style.fill: "#fff4e6"; style.stroke: "#d98c00"; style.stroke-width: 1 }
layer_stage1: { style.fill: "#eafaf0"; style.stroke: "#1e8449"; style.stroke-width: 1 }
layer_contrib: { style.fill: "#fdecea"; style.stroke: "#c0392b"; style.stroke-width: 2 }
layer_stage2: { style.fill: "#f3eafd"; style.stroke: "#6c3baa"; style.stroke-width: 1 }
layer_decide: { style.fill: "#e8f8f8"; style.stroke: "#117a8b"; style.stroke-width: 1 }
layer_out: { style.fill: "#e9ecef"; style.stroke: "#495057"; style.stroke-width: 1 }
shared: { style.stroke-dash: 4; style.fill: "#f7f7f7"; style.stroke: "#888888" }
}
Data Layer: {
style.fill: "#fbfcfe"
shape: rectangle
bipartite train: "bipartite_train\n682,421 author→paper" {class: layer_data; shape: page}
co-author: "author_file\n9,663 edges" {class: layer_data; shape: page}
citation: "paper_file\n327,113 edges" {class: layer_data; shape: page}
use: "feature.pkl\n79,937×512 USE" {class: layer_data; shape: page}
test: "bipartite_test\n2,047,262 pairs" {class: layer_data; shape: page}
}
Deterministic Split: "make_notebook_style_split\nseed=202 · 90/10\n→ 136,484 pairs (1:1)" {
class: layer_split
shape: hexagon
}
Stage-1 Suite: {
style.fill: "#f6fdf8"
shape: rectangle
LightGCN: "LightGCN ensemble\nBPR + hard neg" {class: layer_stage1}
BPR-MF: "BPR-MF (dim 256)" {class: layer_stage1}
Content: "Content mean-cos\n+ rich (18-d)" {class: layer_stage1}
Random Walk: "7× DeepWalk/Node2Vec\n+ aggregate" {class: layer_stage1}
Explicit Graph: "Explicit graph / meta-path\n18-d + rank 4-d" {class: layer_stage1}
High-order: "High-order citation propagation\nH_k=R·C^k ; G_k=S·R·C^k\nundir 24-d + dir 45-d" {class: layer_contrib}
}
Stage-2 Meta-learner: {
style.fill: "#faf7fe"
shape: rectangle
Feature vector: "259-dim feature vector\n(feature_cache)" {class: layer_stage2; shape: cylinder}
LightGBM: "LightGBM\n5-fold OOF · best_f1" {class: layer_stage2}
}
Decision: "Rank cutoff top 50%\n+ force train/test-known = 1" {
class: layer_decide
shape: diamond
}
Output: "Submission CSV (Index, Predicted)\npublic F1 = 0.96626 | val F1 = 0.966874" {
class: layer_out
shape: document
}
Shared Infrastructure: {
class: shared
shape: package
style.fill: "#f2f2f2"
lib1: "train_val_lgcn_ensemble.py\n(data · split · best_f1)\nloaded by ~12 scripts"
lib2: "stack_rank_calibration.py\n(explicit features · rank)\nloaded by ~12 scripts"
cache: "cache-or-compute\nval_*.npy · *_oof.npy · *.npz"
note: "No utils.py — scripts reuse via\nimportlib load_module()" {shape: text}
}
Data Layer -> Deterministic Split
Deterministic Split -> Stage-1 Suite.LightGCN
Deterministic Split -> Stage-1 Suite.BPR-MF
Deterministic Split -> Stage-1 Suite.Content
Deterministic Split -> Stage-1 Suite.Random Walk
Deterministic Split -> Stage-1 Suite.Explicit Graph
Deterministic Split -> Stage-1 Suite.High-order
Stage-1 Suite.LightGCN -> Stage-2 Meta-learner.Feature vector: score+rank
Stage-1 Suite.BPR-MF -> Stage-2 Meta-learner.Feature vector: bpr
Stage-1 Suite.Content -> Stage-2 Meta-learner.Feature vector: content
Stage-1 Suite.Random Walk -> Stage-2 Meta-learner.Feature vector: 7×11+agg
Stage-1 Suite.Explicit Graph -> Stage-2 Meta-learner.Feature vector: explicit+rank
Stage-1 Suite.High-order -> Stage-2 Meta-learner.Feature vector: undir24+dir45
Stage-2 Meta-learner.Feature vector -> Stage-2 Meta-learner.LightGBM
Stage-2 Meta-learner.LightGBM -> Decision
Data Layer.test -> Decision: test pairs
Decision -> Output
Shared Infrastructure.lib1 <-> Stage-1 Suite: load_module
Shared Infrastructure.lib2 <-> Stage-1 Suite: load_module