qbiocode.apps.quvine.reproducibility.method_runner module#

Method Runner for Reproducible Benchmarking

Provides a unified interface for running all 42 methods with pre-generated data.

Summary#

Classes:

MethodRunner

Unified runner for all QuVINE methods using pre-generated data.

Functions:

create_method_adapter

Create an adapter function that wraps an existing method to work with the reproducible pipeline.

Reference#

class MethodRunner(registry, seed_manager)[source]#

Bases: object

Unified runner for all QuVINE methods using pre-generated data.

Ensures all methods: 1. Load the same pre-generated graph 2. Use the same pre-generated split 3. Use the same canonical seed 4. Return results with full provenance

__init__(registry, seed_manager)[source]#

Initialize method runner.

Parameters:
load_graph(dataset_name, repetition_id)[source]#

Load pre-generated graph from registry.

Parameters:
  • dataset_name (str) – Dataset name

  • repetition_id (int) – Repetition ID

Returns:

Pre-generated graph

Return type:

nx.Graph

load_split(dataset_name, repetition_id, task)[source]#

Load pre-generated split from registry.

Parameters:
  • dataset_name (str) – Dataset name

  • repetition_id (int) – Repetition ID

  • task (str) – Task name

Returns:

Pre-generated split data

Return type:

dict

load_train_graph(dataset_name, repetition_id, task)[source]#

Load training graph for link prediction tasks.

For link prediction, we need a graph with test/val edges removed to prevent data leakage. This is especially critical for methods like GAT/GraphGPS that train on edges.

Parameters:
  • dataset_name (str) – Dataset name

  • repetition_id (int) – Repetition ID

  • task (str) – Task name

Returns:

Training graph if available (link prediction), None otherwise

Return type:

nx.Graph or None

compute_graph_complexity(G, labels=None, features=None)[source]#

Compute graph complexity metrics.

Parameters:
  • G (nx.Graph) – Graph to analyze

  • labels (np.ndarray, optional) – Node labels for homophily computation

  • features (np.ndarray, optional) – Node features for Dirichlet energy computation

Returns:

Dictionary of complexity metrics (all float values)

Return type:

dict

run_method(method_name, dataset_name, repetition_id, task, config=None, output_dir=None)[source]#

Run a method with pre-generated data.

Parameters:
  • method_name (str) – Name of the method to run

  • dataset_name (str) – Dataset name

  • repetition_id (int) – Repetition ID

  • task (str) – Task name

  • config (dict, optional) – Method configuration/hyperparameters

  • output_dir (Path, optional) – Directory to save results

Returns:

Results with metrics and provenance

Return type:

dict

create_method_adapter(method_name)[source]#

Create an adapter function that wraps an existing method to work with the reproducible pipeline.

This is a helper for migrating existing methods.

Parameters:

method_name (str) – Name of the method

Returns:

Adapter function

Return type:

callable