RINGS integration for existing GNN pipelines#12
Merged
Conversation
Replaces the framework-coupled GraphBenchEvaluator approach with a thin, framework-agnostic collector that slots into a user's existing training loop rather than owning it. Includes a PyG/MUTAG recipe and unit tests. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- SeparabilityCallback bridges Lightning's trainer.callback_metrics into SeparabilityStudy.record on on_test_end. Guards pytorch_lightning and lightning.pytorch imports so rings.integrations stays importable without Lightning installed, and exposes the callback via lazy __getattr__. - pyproject.toml: new [project.optional-dependencies] lightning extra. - examples/lightning_separability.py: end-to-end MUTAG recipe with a LightningModule GCN, LightningDataset, and one Trainer per run. - tests/test_lightning_callback.py: stub-trainer tests covering normal recording, unknown-perturbation, missing-metric, accumulation, and plain-float metric values. Skipped cleanly when Lightning is absent. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
CompleteFeatures requires max_nodes; compute it from the dataset before constructing the perturbation map. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Lightning emits "GPU available", "Seed set to N", "Trainer.fit stopped", checkpoint paths and a litlogger tip through several logger namespaces (and some via print). Setting individual logger levels does not catch all of them, so the example uses logging.disable(WARNING) at import time and also disables checkpointing on the Trainer. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This update ensures that dataset files and checkpoints are excluded from version control, preventing unnecessary clutter in the repository.
This commit removes the optional dependencies section for Lightning from pyproject.toml and deletes the uv.lock file, streamlining the project configuration.
This commit introduces a new example script, `graphbench.py`, demonstrating the use of GraphBench metrics in a GCN training pipeline on the MUTAG dataset. The script includes dataset loading, model training, and evaluation, showcasing the application of various perturbations through the `SeparabilityStudy` class. This enhances the integration of GraphBench with PyG for graph classification tasks.
This commit introduces a `__version__` attribute to the `rings` module, setting the initial version to "0.1.0". This addition helps in tracking the module's version for future releases.
This commit introduces a GitHub Actions CI workflow that triggers on pushes and pull requests to the main branch. It sets up a matrix build for Python versions 3.11, 3.12, and 3.13, installs dependencies, checks for version consistency between `pyproject.toml` and `rings/__init__.py`, runs tests with pytest, and performs linting and formatting checks using Ruff for Python 3.13.
torch_geometric's BaseTransform now requires subclasses to implement forward() rather than __call__(). Renaming the method across Shuffle and all perturbation transforms restores instantiability and unblocks the test suite under the new CI checks. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Updated the introduction to succinctly describe RINGS as a perturbation framework for attributed graphs. - Consolidated installation instructions into a quickstart section for easier access. - Improved example usage with clearer code snippets and integration instructions for PyTorch Lightning. - Removed outdated sections to focus on current features and usage.
- Introduced new documentation files for the `rings.complementarity` and `rings.separability` modules, detailing their functionalities and usage. - Removed outdated files related to complementarity comparators, functors, metrics, and utilities to streamline the documentation. - Updated the main index and configuration files to reflect the new structure and added sidebar navigation for improved user experience.
Pseudomanifold
approved these changes
May 20, 2026
Pseudomanifold
approved these changes
May 20, 2026
Pseudomanifold
approved these changes
May 20, 2026
Pseudomanifold
left a comment
Contributor
There was a problem hiding this comment.
Looks very good to me :-)
- Added installation instructions for the package from PyPI, including a requirement for Python 3.11+. - Included guidance for installing from source to facilitate contributions and example execution.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
rings.integrations.SeparabilityStudy, a thin, framework-agnostic collector that slots into a user's existing PyG training loop instead of taking it over.graph-bench-wrapper(aGraphBenchEvaluatororchestrator with atrain_func(dataset, evaluator)callback and a hardgraphbench-libdependency) — that shape was too invasive for users who already have full training pipelines.examples/pyg_separability.pyand unit tests intests/test_study.py.Why
RINGS' actual integration surface is small: perturbations are already PyG
BaseTransforms, andSeparabilityFunctoralready accepts a plainDict[str, np.array]. So instead of wrapping the training loop, this PR provides ~5 lines of glue the user adds around their existing code:apply()usesisinstanceagainsttorch_geometric.data.Data/Dataset(replacing the brittlehasattr(..., "__len__")branching from the prior wrapper) andtorch_geometricis imported lazily soimport ringsstays cheap.