Quickstart¶
This page takes you from a working install to a five-seed benchmark with a LaTeX-ready summary table and a critical-difference diagram.
Train one model¶
The single-task trainers accept any nn.Module and return a per-epoch
history dict ready for plotting:
from graphnetz import GCN, train_node_classification, plot_history
from graphnetz.datasets.social import cora
ds = cora("data/cora")
model = GCN(ds.num_features, 64, ds.num_classes)
history = train_node_classification(model, ds[0], epochs=200)
fig, ax = plot_history(history, title="GCN on Cora")
Use this when you only need one model on one dataset and don't care about
cross-seed variance. For everything else — multi-seed, multi-task,
multi-model — reach for run_benchmark.
Run a multi-seed benchmark¶
from graphnetz import GAT, GCN, GraphSAGE, GraphTransformer, run_benchmark
report = run_benchmark(
"social",
{"GCN": GCN, "GAT": GAT, "GraphSAGE": GraphSAGE, "GraphTransformer": GraphTransformer},
seeds=(0, 1, 2, 3, 4, 5, 6, 7, 8, 9),
task_type="node_cls",
)
print(report.summary()) # per-(task, model) mean ± t-CI
print(report.pairwise()) # Holm-corrected paired t-tests
fig, _ = report.plot_critical_difference(alpha=0.05)
report.to_latex("results.tex") # publication-ready table
The same call works for any category and task family: pass
task_type="graph_cls" to benchmark on graph classification,
task_type="link_pred" for link prediction, and so on. Pass
only=[task_name, ...] to restrict to specific loaders.
Five-minute tour¶
- Pick a category.
combinatorial,biology,social,knowledge,infrastructure,finance,computing,vision,physics,security. Installing the optionalogbextra adds OGB datasets to the existing domain categories (e.g.ogbn-arxivjoinssocial/node_cls,ogbg-molhivjoinsbiology/graph_cls). - Pick a task.
node_cls,graph_cls,graph_reg, orlink_pred. The runner skips models that don't declare support for the chosen task. - Pick architectures. Any subset of the five built-ins, or your own — see Models & adapters.
- Run.
run_benchmark(category, models, task_type=..., seeds=...). Useseeds=(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)for the default reproducible 10-seed sweep. - Report. Call
summary,pairwise,plot_critical_difference,plot_pairwise,plot_forest,plot_learning_curves,to_latex,pairwise_to_latex. Every method works on the sameBenchmarkReport.
Next steps¶
- Bring your own encoder or dataset: Custom models & datasets.
- Browse the dataset taxonomy to find loaders that match your domain.
- Read Reading the report to learn which plot or table answers which question.
- Skim Contributing before adding a new loader, model, or task so your additions thread through the same pipeline.