计划执行与检查节点
executing-plans
按既定实施计划完成工作,保持过程检查和反馈。
gnn-models【效率与协作】Guides Spektral graph neural network layers, pooling, ready-made models, message passing, and explanation workflows.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this sub-skill when the task is about building, selecting, debugging, or explaining graph neural network layers and models with Spektral.
references/layer-catalog.md for convolution, pooling, base layer, and mode-support summaries.references/api-reference.md for verified model, layer, utility, and explainer signatures.references/workflows.md for GCN, GeneralGNN, custom MessagePassing, batch-mask, and explainer recipes.references/troubleshooting.md for sparse/dense adjacency, mask propagation, Keras compatibility, layer-input, pooling, and explainer failures.scripts/smoke_models.py for a tiny no-download CPU model/layer sanity check.../graph-data/SKILL.md before selecting layers.SingleLoader and DisjointLoader usually work with sparse-aware layers.BatchLoader emits dense padded tensors; use only layers that support batch mode.MixedLoader shares one adjacency matrix and needs layers/models that support mixed mode.preprocess(a) and can be paired with LayerPreprocess.GraphMasking when BatchLoader(mask=True) appends a mask feature for dense padded batches.| Task | Start with | Notes |
|---|---|---|
| Simple citation-style node prediction | GCN or GCNConv | GCN outputs node predictions and accepts (x, a) or (x, a, i) |
| General graph classification/regression | GeneralGNN plus DisjointLoader | Defaults use GeneralConv blocks and global sum pooling |
| Custom architecture | Keras functional/subclassed model plus Spektral layers | Use layer catalog to match data mode and edge-feature needs |
| Custom sparse message passing | MessagePassing subclass | Single/disjoint sparse adjacency only |
| Dense pooling | BatchLoader(mask=True), GraphMasking, then dense pooling layer | MinCut/DiffPool-style layers expect batch-compatible shapes |
| Explanation | GNNExplainer | Node or graph explanations after a model is trained or otherwise produces predictions |
Run from the generated skill tree after installing Spektral:
python sub-skills/gnn-models/scripts/smoke_models.py
Expected signal: successful tiny forward passes for GeneralGNN, GCN, GCNConv with batch masking, and a custom MessagePassing subclass, followed by smoke_ok.
This Spektral source revision was verified with TensorFlow 2.15.1 and Keras 2.15.0. In a latest TensorFlow/Keras 3 environment, GCN/GCNConv mask handling may fail with an error about converting None to a tensor. If that happens, use the troubleshooting page to pin a TensorFlow/Keras 2.x-compatible stack or rewrite the model call path to avoid the incompatible mask behavior.
Graph or Dataset objects, choosing loaders, or configuring dataset downloads: use ../graph-data/SKILL.md.