SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2308.14181 · ICML · 2024

Class-Imbalanced Graph Learning without Class Rebalancing

Zhe Xu, Zhining Liu, Jingrui He, Hanghang Tong, Yada Zhu, Ruizhong Qiu, Zhichen Zeng, Hyunsik Yoo, David Zhou, Kommy Weldemariam

arXiv · PDF · Open in the Atlas

Code that ran

17 of 19 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 1 has no contract verdict; 16 failures of our instrument; 2 no recorded run), measured 2026-11-23; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2308.14181.json · badge: /api/ran/2308.14181.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
zhiningliu1998/bat canonical (classifier label)
classifier basis: census
17 ran · 2 no recorded run
FunctionStatusWhere it lives
adj_mse_loss Ran
ran; our contract draft was wrong, not the code
zhiningliu1998/bat/baselines/graphsmote.py
code served (permissive licence) · get_code("21a723cc578ed155")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Create small adjacency matrices
# adj_tgt: target adjacency matrix (should be sparse with some zeros and ones)
adj_tgt = torch.tensor([
    [0.0, 1.0, 0.0, 1.0],
    [1.0, 0.0, 1.0, 0.0],
    [0.0, 1.0, 0.0, 1.0],
    [1.0, 0.0, 1.0, 0.0]
], dtype=torch.float32)

# adj_rec: reconstructed adjacency matrix (predicted values, typically in [0,1])
adj_rec = torch.tensor([
    [0.1, 0.9, 0.2, 0.8],
    [0.85, 0.15, 0.88, 0.1],
    [0.05, 0.95, 0.12, 0.92],
    [0.92, 0.08, 0.87, 0.11]
], dtype=torch.float32)

# adj_mask: optional masking (not used in the function body, but included as parameter)
adj_mask = None

ARGS = {
    "adj_rec": adj_rec,
    "adj_tgt": adj_tgt,
    "adj_mask": adj_mask
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
create_gat Ran
ran; our contract draft was wrong, not the code
zhiningliu1998/bat/nets/gat.py
code served (permissive licence) · get_code("95760bbbf8a5f313")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned StandGAT2. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
import torch.nn.functional as F
from torch_geometric.nn import GATConv

torch.manual_seed(0)

# Define parameters for create_gat
nfeat = 4      # input feature dimension
nhid = 8       # hidden dimension (must be divisible by 4 for heads)
nclass = 3     # number of output classes
dropout = 0.5  # dropout probability
nlayer = 2     # number of layers

ARGS = {
    "nfeat": nfeat,
    "nhid": nhid,
    "nclass": nclass,
    "dropout": dropout,
    "nlayer": nlayer,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, torch_geometric — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type StandGAT2 — a StandGAT2 output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a StandGAT2 output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
create_gcn Ran
ran; our contract draft was wrong, not the code
zhiningliu1998/bat/nets/gcn.py
code served (permissive licence) · get_code("4cea1d9ec9cc2c00")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned StandGCN2. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from torch_geometric.nn import GCNConv

torch.manual_seed(0)

# Small example parameters
nfeat = 4  # input feature dimension
nhid = 8   # hidden dimension
nclass = 3  # number of classes
dropout = 0.5
nlayer = 2

ARGS = {
    "nfeat": nfeat,
    "nhid": nhid,
    "nclass": nclass,
    "dropout": dropout,
    "nlayer": nlayer,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, torch_geometric — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type StandGCN2 — a StandGCN2 output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a StandGCN2 output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
create_sage Ran
ran; our contract draft was wrong, not the code
zhiningliu1998/bat/nets/sage.py
code served (permissive licence) · get_code("79e06c40d53557a6")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned GraphSAGE2. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

ARGS = {
    "nfeat": 4,
    "nhid": 8,
    "nclass": 3,
    "dropout": 0.5,
    "nlayer": 2,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, torch_geometric — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type GraphSAGE2 — a GraphSAGE2 output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a GraphSAGE2 output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
focal_loss Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
zhiningliu1998/bat/baselines/renode.py
code served (permissive licence) · get_code("6ccd040c4ef8720b")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 1, dtype family float, shape (2,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn.functional as F

torch.manual_seed(0)

# Create small tensors for the function
batch_size = 2
num_features = 4

# labels: binary labels, shape (batch_size, num_features)
labels = torch.randint(0, 2, (batch_size, num_features)).float()

# logits: raw model outputs, shape (batch_size, num_features)
logits = torch.randn(batch_size, num_features)

# alpha: weighting factor for the loss
alpha = 0.25

# gamma: focusing parameter
gamma = 2.0

ARGS = {
    "labels": labels,
    "logits": logits,
    "alpha": alpha,
    "gamma": gamma,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 1, dtype family float, shape (2,) — shape (2,) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_device Ran
ran; our contract draft was wrong, not the code
zhiningliu1998/bat/utils.py
code served (permissive licence) · get_code("0a88485c71725fa4")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# The function get_device takes a single parameter: gpu_id
# It doesn't actually use the gpu_id value for computation in a way that requires
# a real GPU -- it just checks if it's -1 and handles CUDA availability checks.
# We'll pass gpu_id=-1 to use CPU, which is safe and won't raise errors.

ARGS = {
    'gpu_id': -1
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_ins_neighbor_dist Ran
ran; our contract draft was wrong, not the code
zhiningliu1998/bat/baselines/graphens.py
code served (permissive licence) · get_code("b12b543e5de0f826")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 2, dtype family float, shape (3, 3) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn.functional as F

torch.manual_seed(0)

# Construct edge_index: a 2xE tensor representing edges in a graph
# Let's create a simple graph with 3 nodes and 4 edges
edge_index = torch.tensor([
    [0, 1, 1, 2],
    [1, 0, 2, 1]
], dtype=torch.long)

# num_nodes: the number of nodes in the graph
num_nodes = 3

# train_mask: a boolean mask indicating which nodes are in the training set
train_mask = torch.tensor([True, True, False], dtype=torch.bool)

# device: the device to run on (CPU only)
device = torch.device('cpu')

ARGS = {
    'num_nodes': num_nodes,
    'edge_index': edge_index,
    'train_mask': train_mask,
    'device': device,
    'disable_tqdm': True
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, torch_geometric — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (3, 3) — shape (3, 3) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_model Ran
ran on a synthesized input
zhiningliu1998/bat/utils.py
code served (permissive licence) · get_code("98058776b6c23bc4")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned MockGNN. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Create mock network creation functions since we can't import from nets
class MockGNN(nn.Module):
    def __init__(self, nlayer, nfeat, nhid, nclass, dropout):
        super().__init__()
        self.nlayer = nlayer
        self.nfeat = nfeat
        self.nhid = nhid
        self.nclass = nclass
        self.dropout = dropout
        self.linear = nn.Linear(nfeat, nclass)
    
    def forward(self, x):
        return self.linear(x)

def create_gcn(nlayer, nfeat, nhid, nclass, dropout):
    return MockGNN(nlayer, nfeat, nhid, nclass, dropout)

def create_gat(nlayer, nfeat, nhid, nclass, dropout):
    return MockGNN(nlayer, nfeat, nhid, nclass, dropout)

def create_sage(nlayer, nfeat, nhid, nclass, dropout):
    return MockGNN(nlayer, nfeat, nhid, nclass, dropout)

# Patch the imports by creating a mock nets module
import sys
from types import ModuleType

nets_module = ModuleType('nets')
nets_module.create_gcn = create_gcn
nets_module.create_gat = create_gat
nets_module.create_sage = create_sage
sys.modules['nets'] = nets_module

gens_networks_module = ModuleType('gens_networks')
gens_networks_module.create_gcn = create_gcn
gens_networks_module.create_gat = create_gat
gens_networks_module.create_sage = create_sage
sys.modules['nets.gens_networks'] = gens_networks_module

ARGS = {
    'gnn_arch': 'GCN',
    'feat_dim': 4,
    'hid_dim': 8,
    'out_dim': 3,
    'n_layer': 2,
    'use_ens_net': False,
    'dropout': 0.5,
    'device': 'cpu'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
nets, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type MockGNN — a MockGNN output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a MockGNN output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_step_imbalanced_split_data Ran
ran; our contract draft was wrong, not the code
zhiningliu1998/bat/data_utils.py
code served (permissive licence) · get_code("a79704f24c380553")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Data. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch_geometric as pyg
from torch_geometric.data import Data

torch.manual_seed(0)

# Create a simple graph data object
num_nodes = 10
num_features = 4
num_classes = 3

# Create node features
x = torch.randn(num_nodes, num_features)

# Create labels with some class distribution
y = torch.tensor([0, 0, 1, 1, 1, 2, 2, 2, 0, 1])

# Create a simple edge list
edge_index = torch.tensor([
    [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
    [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
])

# Create the data object
data = Data(x=x, y=y, edge_index=edge_index)

ARGS = {
    'data': data,
    'use_public_split': 'auto',
    'imbratio': 2,
    'n_tail_class': None,
    'head_class_size': 4,
    'test_ratio': 0.5,
    'random_seed': 42,
    'verbose': False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch, torch_geometric — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Data — a Data output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_weight Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
zhiningliu1998/bat/baselines/reweight.py
code served (permissive licence) · get_code("5821da1111d3abeb")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 1, dtype family float, shape (4,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np
import torch

torch.manual_seed(0)

# Analyze the function:
# - is_reweight: boolean flag
# - class_num_list: list of numbers (class counts)
# The function uses np.min() on class_num_list and iterates through it
# Returns a torch.float32 tensor

ARGS = {
    "is_reweight": True,
    "class_num_list": [100, 50, 200, 75]
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 1, dtype family float, shape (4,) — shape (4,) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
index2adj Ran
ran; our contract draft was wrong, not the code
zhiningliu1998/bat/baselines/renode.py
code served (permissive licence) · get_code("afbe8cadd27cfb04")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ndarray, ndim 2, dtype family int, shape (2708, 2708) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# Create a small tensor with edge indices
# The function expects inf to have a .numpy() method and be indexable as indx[0] and indx[1]
# This simulates a PyTorch tensor containing edge indices (source nodes, target nodes)
inf = torch.tensor([[0, 1, 0, 1], [1, 0, 2, 2]], dtype=torch.long)

ARGS = {
    'inf': inf,
    'nnode': 2708
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family int, shape (2708, 2708) — shape (2708, 2708) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
index2dense Ran
ran; our contract draft was wrong, not the code
zhiningliu1998/bat/baselines/renode.py
code served (permissive licence) · get_code("a4f5f19dedc1e493")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 2, dtype family float, shape (2708, 2708) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# Construct a small edge_index tensor
# edge_index should be a 2D tensor where first row is source nodes, second row is target nodes
# For a graph with nnode=2708, indices should be in range [0, 2708)
edge_index = torch.tensor([
    [0, 1, 2, 1],
    [1, 2, 0, 0]
], dtype=torch.long)

nnode = 2708

ARGS = {
    "edge_index": edge_index,
    "nnode": nnode
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2708, 2708) — shape (2708, 2708) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
parse_args Ran
ran; our contract draft was wrong, not the code
zhiningliu1998/bat/args.py
code served (permissive licence) · get_code("1b1b4c3047314015")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Namespace. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import tempfile
import yaml
import os

# Create a temporary config file
temp_dir = tempfile.mkdtemp()
config_path = os.path.join(temp_dir, 'config.yaml')

config = {
    'general': {
        'gpu_id': 0,
        'seed': 42,
        'n_runs': 5,
        'debug': False
    },
    'dataset': {
        'dataset': 'Cora',
        'imb_type': 'step',
        'imb_ratio': 100
    },
    'architecture': {
        'gnn_arch': 'GCN',
        'n_layer': 3,
        'hid_dim': 64
    },
    'training': {
        'lr': 0.01,
        'weight_decay': 0.0005,
        'epochs': 200,
        'early_stop': 50,
        'tqdm': True
    },
    'bat_parameters': {
        'bat_mode': 'dummy'
    }
}

with open(config_path, 'w') as f:
    yaml.dump(config, f)

ARGS = {
    'config_path': config_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
yaml — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Namespace — a Namespace output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Namespace output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
recon_upsample Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
zhiningliu1998/bat/baselines/graphsmote.py
code served (permissive licence) · get_code("940042d001009524")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np
import random

torch.manual_seed(0)
random.seed(0)

# Create small test tensors
num_nodes = 10
embedding_dim = 4
num_classes = 3

# Embeddings: shape (num_nodes, embedding_dim)
embed = torch.randn(num_nodes, embedding_dim, dtype=torch.float32)

# Labels: shape (num_nodes,) with values 0 to num_classes-1
labels = torch.tensor([0, 0, 1, 1, 1, 2, 2, 2, 0, 1], dtype=torch.long)

# Training indices: subset of node indices
idx_train = torch.tensor([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], dtype=torch.long)

# Adjacency matrix: shape (num_nodes, num_nodes)
adj = torch.randint(0, 2, (num_nodes, num_nodes), dtype=torch.float32)
adj = (adj + adj.t()) / 2  # Make symmetric

# Portion: fraction of samples to use
portion = 0.5

# Tail classes: classes to oversample
tail_classes = [1, 2]

ARGS = {
    "embed": embed,
    "labels": labels,
    "idx_train": idx_train,
    "adj": adj,
    "portion": portion,
    "tail_classes": tail_classes,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
saliency_mixup Ran
ran; our contract draft was wrong, not the code
zhiningliu1998/bat/baselines/graphens.py
code served (permissive licence) · get_code("5439e47e4ad4ea35")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 2, dtype family float, shape (7, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Define tensor dimensions
num_nodes = 5
num_augmented_nodes = 2
feature_dim = 4

# Create node features: [# of nodes, feature dimension]
x = torch.randn(num_nodes, feature_dim)

# Create source and destination indices for augmented nodes
sampling_src_idx = torch.tensor([0, 2], dtype=torch.long)
sampling_dst_idx = torch.tensor([1, 3], dtype=torch.long)

# Create mixing ratio lambda: [# of augmented nodes, 1]
lam = torch.rand(num_augmented_nodes, 1)

# Create saliency map: [# of nodes, feature dimension]
saliency = torch.abs(torch.randn(num_nodes, feature_dim))

# Create KL divergence values: [# of augmented nodes, 1]
dist_kl = torch.randn(num_augmented_nodes, 1)

# Keep probability scalar
keep_prob = 0.3

ARGS = {
    "x": x,
    "sampling_src_idx": sampling_src_idx,
    "sampling_dst_idx": sampling_dst_idx,
    "lam": lam,
    "saliency": saliency,
    "dist_kl": dist_kl,
    "keep_prob": keep_prob
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (7, 4) — shape (7, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
sampling_idx_individual_dst Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
zhiningliu1998/bat/baselines/graphens.py
code served (permissive licence) · get_code("301fa81caf73f05d")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 2, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# class_num_list: list of class counts
class_num_list = [5, 3, 4]

# idx_info: list of tensors, where each tensor contains indices for that class
# Each tensor should have length equal to the corresponding class_num_list value
idx_info = [
    torch.tensor([0, 1, 2, 3, 4]),           # 5 indices for class 0
    torch.tensor([5, 6, 7]),                 # 3 indices for class 1
    torch.tensor([8, 9, 10, 11])             # 4 indices for class 2
]

# device: CPU device
device = torch.device('cpu')

ARGS = {
    'class_num_list': class_num_list,
    'idx_info': idx_info,
    'device': device
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 2, dtype family int — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
src_upsample Ran
ran; our contract draft was wrong, not the code
zhiningliu1998/bat/baselines/graphsmote.py
code served (permissive licence) · get_code("2c2ac99298171352")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np
from torch_geometric.data import Data

torch.manual_seed(0)

# Create a small graph with sparse adjacency matrix
num_nodes = 5
num_features = 4
num_classes = 3

# Create a simple sparse edge list (COO format)
edge_index = torch.tensor([
    [0, 1, 1, 2, 2, 3, 3, 4],
    [1, 0, 2, 1, 3, 2, 4, 3]
], dtype=torch.long)

# Create node features
features = torch.randn(num_nodes, num_features)

# Create labels (class assignments for nodes)
labels = torch.tensor([0, 1, 2, 0, 1], dtype=torch.long)

# Create training node indices
idx_train = torch.tensor([0, 1, 2, 3], dtype=torch.long)

# Define tail classes (minority classes to oversample)
tail_classes = [2]

# Portion parameter for oversampling
portion = 1.0

ARGS = {
    "adj": edge_index,
    "features": features,
    "labels": labels,
    "idx_train": idx_train,
    "portion": portion,
    "tail_classes": tail_classes
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch, torch_geometric — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_natural_imbalanced_split_data Not yet run
unverified (harvested, no recorded run)
zhiningliu1998/bat/data_utils.py
code served (permissive licence) · get_code("3d8498fea1e452e2")
How it ran

no invocation recorded.

load_data Not yet run
unverified (harvested, no recorded run)
zhiningliu1998/bat/data_utils.py
code served (permissive licence) · get_code("4fb3b99bd0ed491e")
How it ran

no invocation recorded.

Also present in other papers' code

Of 19 samples lifted from this paper's linked repositories, 19 carry a function identity and 0 do not. Of the 19 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 0 later) and 18 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
focal_loss 1 other paper
1 dated earlier
2110.04099 (2021-10)
Topology-Imbalance Learning for Semi-Supervised Node Classification

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Class imbalance is prevalent in real-world node classification tasks and poses great challenges for graph learning models. Most existing studies are rooted in a class-rebalancing (CR) perspective and address class imbalance with classwise reweighting or resampling. In this work, we approach the root cause of class-imbalance bias from an topological paradigm. Specifically, we theoretically reveal two fundamental phenomena in the graph topology that greatly exacerbate the predictive bias stemming from class imbalance. On this basis, we devise a lightweight topological augmentation framework BAT to mitigate the class-imbalance bias without class rebalancing. Being orthogonal to CR, BAT can function as an efficient plug-and-play module that can be seamlessly combined with and significantly boost existing CR techniques. Systematic experiments on real-world imbalanced graph learning tasks show that BAT can deliver up to 46.27% performance gain and up to 72.74% bias reduction over existing techniques. Code, examples, and documentations are available at https://github. com/ZhiningLiu1998/BAT.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2308.14181")
get_code_for_paper("2308.14181")
have("2308.14181")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2308.14181.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2308.14181.svg)](https://syntology.ai/paper/2308.14181)

Connect an agent — have() is free.