计划执行与检查节点
executing-plans
按既定实施计划完成工作,保持过程检查和反馈。
node-classification-gnns【效率与协作】Guides StellarGraph supervised and semi-supervised node classification or regression with GCN, GAT, GraphSAGE, DirectedGraphSAGE, HinSAGE, Cluster-GCN, RGCN, PPNP, APPNP, and Keras heads.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this sub-skill for StellarGraph workflows that predict node labels or node attributes with TensorFlow/Keras graph neural networks.
references/model-reference.md for verified
model constructors, generator pairings, and major decision points.references/workflows.md for end-to-end GCN,
GraphSAGE, HinSAGE, directed, cluster, relational, PPNP/APPNP, and SGC-style
node workflows.references/troubleshooting.md when shape,
generator/model pairing, sparse/dense adjacency, labels, directedness, or
heterogeneity fails.scripts/gcn_node_smoke.py for a safe tiny GCN
graph/model wiring check without downloads or training.GCN, GAT, GraphSAGE,
DirectedGraphSAGE, HinSAGE, RGCN, PPNP, APPNP, Cluster-GCN, or SGC;../graph-data-loading/SKILL.md.flow shape inspection:
../sampling-generators/SKILL.md.../link-prediction-kg/SKILL.md.../embedding-workflows/SKILL.md.../model-ops-interpretability/SKILL.md.StellarGraph/StellarDiGraph with numeric node
features and node IDs that match the target labels.GCN, GAT, PPNP, APPNP: FullBatchNodeGenerator on homogeneous
graphs;ClusterNodeGenerator plus GCN for larger homogeneous
graphs;GraphSAGE: GraphSAGENodeGenerator for sampled inductive homogeneous
graphs;DirectedGraphSAGE: directed GraphSAGE generator with in/out samples;HinSAGE: HinSAGENodeGenerator for heterogeneous graphs;RGCN: RelationalFullBatchNodeGenerator for relational edge types.in_out_tensors() or default_model()
as appropriate.import tensorflow as tf
from stellargraph.mapper import FullBatchNodeGenerator
from stellargraph.layer import GCN
generator = FullBatchNodeGenerator(graph, method="gcn")
gcn = GCN(layer_sizes=[16, 16], generator=generator, activations=["relu", "relu"])
x_inp, x_out = gcn.in_out_tensors()
predictions = tf.keras.layers.Dense(units=num_classes, activation="softmax")(x_out)
model = tf.keras.Model(inputs=x_inp, outputs=predictions)
model.compile(optimizer="adam", loss="categorical_crossentropy", metrics=["accuracy"])
model.fit(generator.flow(train_node_ids, train_targets), epochs=epochs)
python sub-skills/node-classification-gnns/scripts/gcn_node_smoke.py --help
python sub-skills/node-classification-gnns/scripts/gcn_node_smoke.py
The script verifies graph construction, FullBatchNodeGenerator, GCN, and a
Keras Dense head on a tiny synthetic graph. It does not download Cora or train a
full notebook model.