sampling-generators
Guides StellarGraph random walks, samplers, Keras generators, flow inputs, batch shapes, and generator-to-model compatibility decisions.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- sampling-generators
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Guides StellarGraph random walks, samplers, Keras generators, flow inputs, batch shapes, and generator-to-model compatibility decisions.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/generator-reference.md5.5 KB
- 参考文档references/random-walks.md4.4 KB
- 参考文档references/troubleshooting.md3.4 KB
- 脚本scripts/generator_shape_smoke.py2.6 KB
03 SKILL.md 正文
Sampling and Generators
Use this sub-skill when a task involves StellarGraph random walks, sampled
neighborhoods, UnsupervisedSampler, or Keras-compatible generators that feed
node, link, graph, knowledge graph, or time-series models.
Read first
references/generator-reference.mdfor generator signatures,flowinputs, output shape patterns, and model pairing.references/random-walks.mdfor uniform, Node2Vec-style biased, metapath, breadth-first, and temporal walks.references/troubleshooting.mdwhen failures mention graph type, node/link IDs,num_samples,n_size, sparse adjacency, KerasSequence, or batch dimensions.scripts/generator_shape_smoke.pyfor a safe tiny fixture that constructs representative generators and prints batch shapes without training or downloads.
Route here when the user asks to
- choose between
FullBatchNodeGenerator,FullBatchLinkGenerator,GraphSAGENodeGenerator,GraphSAGELinkGenerator,HinSAGE*Generator,Attri2Vec*Generator,Node2Vec*Generator,ClusterNodeGenerator,RelationalFullBatchNodeGenerator,KGTripleGenerator,PaddedGraphGenerator, orSlidingFeaturesNodeGenerator; - debug
flow(...)arguments, target shapes, shuffling, seeds,use_ilocs, sparse vs dense adjacency, or neighbor-sampling lists; - sample random walks with
UniformRandomWalk,BiasedRandomWalk,UniformRandomMetaPathWalk,SampledBreadthFirstWalk,SampledHeterogeneousBreadthFirstWalk, orTemporalRandomWalk; - prepare generator outputs before wiring a TensorFlow/Keras model.
Route elsewhere
- Raw graph construction and dataset loading belong to
../graph-data-loading/SKILL.md. - Node model selection and Keras heads belong to
../node-classification-gnns/SKILL.md. - Link prediction and KG scoring logic belong to
../link-prediction-kg/SKILL.md. - Embedding training/extraction belongs to
../embedding-workflows/SKILL.md. - Graph classification and time-series model workflows belong to
../graph-time-series-workflows/SKILL.md.
Operating workflow
- Confirm the graph object is valid and has the node/edge types and features expected by the target model.
- Choose the generator family from the model and task:
- full-batch homogeneous GCN/GAT/PPNP/APPNP:
FullBatchNodeGeneratororFullBatchLinkGenerator; - inductive/sampled homogeneous GraphSAGE:
GraphSAGENodeGeneratororGraphSAGELinkGenerator; - directed GraphSAGE: directed GraphSAGE generators with separate in/out samples;
- heterogeneous HinSAGE:
HinSAGENodeGeneratororHinSAGELinkGenerator; - graph classification:
PaddedGraphGenerator; - RGCN:
RelationalFullBatchNodeGenerator; - knowledge graph completion:
KGTripleGenerator; - graph time series:
SlidingFeaturesNodeGenerator.
- full-batch homogeneous GCN/GAT/PPNP/APPNP:
- Match generator parameters to the model constructor:
num_samples,in_samples,out_samples,method,sparse,clusters,window_size, or graph list. - Use the generator's
flow(...)method with IDs and targets shaped for the task; inspect the first batch before compiling/training a Keras model. - Move to the owning model sub-skill only after the generator batch structure is understood.
Common decisions
sparse=Truefull-batch generators produce sparse adjacency placeholders and are usually memory-friendlier;sparse=Falseis simpler for tiny debugging.method="gcn",method="sgc"-style preprocessing,method="self_loops", and APPNP/PPNP methods change adjacency normalization; select the method that matches the model reference.num_sampleslength should match the number of GraphSAGE/HinSAGE layers.- Node/link IDs passed to
floware external IDs by default. Useuse_ilocsonly when you deliberately work with internal locations.
Safe checks
python sub-skills/sampling-generators/scripts/generator_shape_smoke.py --help
python sub-skills/sampling-generators/scripts/generator_shape_smoke.py
The script builds tiny synthetic graphs and prints representative batch shapes; it is designed to fail early if the installed package, TensorFlow/Keras, or basic generator contracts are broken.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).