| TrainConfig |
Ran ran on a synthesized input · constructed an object; no result was computed |
marcuslassila/mia-audit-gnn/src/lood.py code served (permissive licence) · get_code("8682d43ff7f3052a") How it ranRan 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 an instance of its own class, TrainConfig: the run constructed the object and did not call it, so no result was computed. 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.optim as optim
import numpy as np
torch.manual_seed(0)
# Define a simple loss function
def criterion_fn(y_pred, y_true):
if isinstance(y_pred, torch.Tensor):
return torch.nn.functional.mse_loss(y_pred, y_true).item()
else:
return float(np.mean((y_pred - y_true) ** 2))
# Define another loss function (loss_fn)
def loss_fn(y_pred, y_true):
if isinstance(y_pred, torch.Tensor):
return torch.nn.functional.mse_loss(y_pred, y_true).item()
else:
return float(np.mean((y_pred - y_true) ** 2))
# Create a simple model for the optimizer
class SimpleModel(nn.Module):
def __init__(self):
super().__init__()
self.linear = nn.Linear(4, 2)
def forward(self, x):
return self.linear(x)
model = SimpleModel()
# Create optimizer with the model parameters
optimizer = optim.SGD(model.parameters(), lr=0.01, weight_decay=0.0001)
ARGS = {
"criterion": criterion_fn,
"device": "cpu",
"epochs": 10,
"early_stopping": 3,
"loss_fn": loss_fn,
"lr": 0.01,
"weight_decay": 0.0001,
"optimizer": optimizer,
}
- 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 TrainConfig — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a TrainConfig 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
|
| cross_entropy |
Ran ran, violated the contract we drafted |
privacytrustlab/lood_in_ml/exact_nngp/compute_LOOD.py code served (permissive licence) · get_code("ddc730f825d30aeb") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned ArrayImpl, 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 jax.numpy as jnp
# Create small logprobs tensor (batch_size=2, num_classes=4)
# logprobs should be log probabilities, so values between -inf and 0
logprobs = jnp.array([
[-0.5, -1.2, -2.1, -0.8],
[-0.3, -0.9, -1.5, -2.0]
], dtype=jnp.float32)
# Create targets tensor (batch_size=2, num_classes=4)
# targets should be one-hot encoded or class probabilities
targets = jnp.array([
[1.0, 0.0, 0.0, 0.0],
[0.0, 1.0, 0.0, 0.0]
], dtype=jnp.float32)
ARGS = {
"logprobs": logprobs,
"targets": targets
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1
- Imports
- jax — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type ArrayImpl, 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
|
| gaussian_kl_divergence |
Ran ran, honoured the contract we drafted |
marcuslassila/mia-audit-gnn/src/lood.py code served (permissive licence) · get_code("af3b24c0d1df242e") How it ranRan 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 (2, 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)
# Create small tensors for the Gaussian KL divergence function
# The function performs element-wise operations, so all inputs should have the same shape
batch_size = 2
dim = 4
mean_0 = torch.randn(batch_size, dim)
std_0 = torch.abs(torch.randn(batch_size, dim)) + 0.1 # ensure positive
mean_1 = torch.randn(batch_size, dim)
std_1 = torch.abs(torch.randn(batch_size, dim)) + 0.1 # ensure positive
ARGS = {
"mean_0": mean_0,
"std_0": std_0,
"mean_1": mean_1,
"std_1": std_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 Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 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
|
| k_hop_query |
Ran ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT) |
marcuslassila/mia-audit-gnn/src/lood.py code served (permissive licence) · get_code("860cf41704a441fd") How it ranRan 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 (2, 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 as nn
from torch_geometric.data import Data
torch.manual_seed(0)
# Define a minimal GNN model that satisfies the function's usage
class MinimalGNN(nn.Module):
def __init__(self, in_channels, out_channels, num_layers):
super().__init__()
self.num_layers = num_layers
self.lin = nn.Linear(in_channels, out_channels)
def forward(self, x, edge_index):
# Simple model: just apply linear layer to node features
# edge_index is used but not strictly needed for this minimal version
return self.lin(x)
def eval(self):
super().eval()
return self
# Create a minimal dataset-like object
class MinimalDataset:
def __init__(self):
self.num_nodes = 8
self.num_classes = 3
# Node features: 8 nodes, 4 features each
self.x = torch.randn(8, 4)
# Edge index: 2 x num_edges
self.edge_index = torch.tensor([
[0, 1, 1, 2, 2, 3, 3, 4, 4, 5],
[1, 0, 2, 1, 3, 2, 4, 3, 5, 4]
], dtype=torch.long)
# Inductive mask for filtering edges
self.inductive_mask = torch.ones(self.edge_index.shape[1], dtype=torch.bool)
# Create instances
model = MinimalGNN(in_channels=4, out_channels=3, num_layers=2)
dataset = MinimalDataset()
query_nodes = torch.tensor([0, 3], dtype=torch.int64)
ARGS = {
"model": model,
"dataset": dataset,
"query_nodes": query_nodes,
"num_hops": 1,
"inductive_split": False,
"edge_dropout": 0.0
}
- 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 (2, 3) — shape (2, 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
|
| masked_subgraph |
Ran ran; our contract draft was wrong, not the code |
marcuslassila/mia-audit-gnn/src/lood.py code served (permissive licence) · get_code("9a6e2d5cad2883cd") How it ranRan 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. 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.data import Data
torch.manual_seed(0)
# Create a small graph dataset
num_nodes = 6
num_edges = 8
num_features = 4
num_classes = 3
# Create node features
x = torch.randn(num_nodes, num_features)
# Create edge index
edge_index = torch.tensor([
[0, 1, 1, 2, 2, 3, 4, 5],
[1, 0, 2, 1, 3, 2, 5, 4]
], dtype=torch.long)
# Create node labels
y = torch.randint(0, num_classes, (num_nodes,))
# Create masks for train/val/test splits
train_mask = torch.tensor([True, True, False, False, False, False])
val_mask = torch.tensor([False, False, True, True, False, False])
test_mask = torch.tensor([False, False, False, False, True, True])
# Create the graph
graph = Data(
x=x,
edge_index=edge_index,
y=y,
train_mask=train_mask,
val_mask=val_mask,
test_mask=test_mask,
num_classes=num_classes
)
# Create a mask for subgraph selection
mask = torch.tensor([True, True, True, False, False, False])
ARGS = {
"graph": graph,
"mask": mask,
"include_train_masks": False
}
- 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 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
|
| mse_loss_acc_fn |
Ran ran; our contract draft was wrong, not the code |
privacytrustlab/lood_in_ml/exact_nngp/compute_LOOD.py code served (permissive licence) · get_code("be09318c6244ea19") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned tuple, ndim 1, dtype family float; 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 jax
from jax import numpy as jnp
import numpy as np
# Set seed for reproducibility
np.random.seed(0)
# Define a simple kernel function that takes two inputs and returns a kernel matrix
def rbf_kernel_fn(x1, x2):
"""Simple RBF kernel function"""
# x1: (n, d), x2: (m, d) -> output: (n, m)
sq_dists = jnp.sum((x1[:, None, :] - x2[None, :, :]) ** 2, axis=2)
return jnp.exp(-sq_dists)
# Create small test data
batch_size_query = 2
batch_size_target = 3
batch_size_alt = 3
feature_dim = 4
num_classes = 2
# x_query: (2, 4)
x_query = jnp.array(np.random.randn(batch_size_query, feature_dim), dtype=jnp.float32)
# x_target: (3, 4)
x_target = jnp.array(np.random.randn(batch_size_target, feature_dim), dtype=jnp.float32)
# y_target: (3, 2) - one-hot encoded targets
y_target = jnp.array(np.eye(num_classes)[np.random.randint(0, num_classes, batch_size_target)], dtype=jnp.float32)
# x_alt: (3, 4)
x_alt = jnp.array(np.random.randn(batch_size_alt, feature_dim), dtype=jnp.float32)
# y_alt: (3, 2) - one-hot encoded targets
y_alt = jnp.array(np.eye(num_classes)[np.random.randint(0, num_classes, batch_size_alt)], dtype=jnp.float32)
# Pre-compute kernel matrices
k_tt = rbf_kernel_fn(x_target, x_target) # (3, 3)
k_aa = rbf_kernel_fn(x_alt, x_alt) # (3, 3)
# Regularization parameter
reg = 0.01
# Kernel function
kernel_fn = rbf_kernel_fn
ARGS = {
"x_query": x_query,
"x_target": x_target,
"y_target": y_target,
"x_alt": x_alt,
"y_alt": y_alt,
"k_tt": k_tt,
"k_aa": k_aa,
"reg": reg,
"kernel_fn": kernel_fn,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1
- Imports
- jax, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type tuple, ndim 1, dtype family float — 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
|
| multi_gaussian_kl_divergence |
Ran ran, violated the contract we drafted |
marcuslassila/mia-audit-gnn/src/lood.py code served (permissive licence) · get_code("6bbaf642c5710a82") How it ranRan 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 Gaussian parameters
# mean_0: shape (4,)
mean_0 = torch.randn(4)
# cov_0: shape (4, 4), must be positive definite
A_0 = torch.randn(4, 4)
cov_0 = A_0 @ A_0.t() + torch.eye(4)
# mean_1: shape (4,)
mean_1 = torch.randn(4)
# cov_1: shape (4, 4), must be positive definite
A_1 = torch.randn(4, 4)
cov_1 = A_1 @ A_1.t() + torch.eye(4)
ARGS = {
"mean_0": mean_0,
"cov_0": cov_0,
"mean_1": mean_1,
"cov_1": cov_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 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
|
| to_cuda |
Ran ran, honoured the contract we drafted |
privacytrustlab/lood_in_ml/FC_MIA/compute_auc_and_diff.py code served (permissive licence) · get_code("6986149c1865e125") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned Tensor, ndim 2, dtype family float, shape (2, 4) as a later run recorded it. 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, 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)
# The function to_cuda takes a single parameter 'x' which should be a torch tensor
# It checks if CUDA is available and moves the tensor to CUDA if so
# Otherwise returns the tensor as-is
# Create a small tensor to pass to to_cuda
x = torch.randn(2, 4)
ARGS = {
"x": x
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1
- Imports
- absl, matplotlib, numpy, pandas, scipy, sklearn, torch, tqdm — 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 (2, 4) — shape (2, 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
|
| train_gnn |
Ran ran; our contract draft was wrong, not the code |
marcuslassila/mia-audit-gnn/src/lood.py code served (permissive licence) · get_code("312d10ceb8442d70") How it ranRan 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 defaultdict. 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.optim import Adam, SGD
import numpy as np
from collections import defaultdict
torch.manual_seed(0)
np.random.seed(0)
# Define a minimal GNN model
class SimpleGNN(nn.Module):
def __init__(self, input_dim, hidden_dim, output_dim):
super().__init__()
self.linear1 = nn.Linear(input_dim, hidden_dim)
self.linear2 = nn.Linear(hidden_dim, output_dim)
def forward(self, x, edge_index):
x = F.relu(self.linear1(x))
x = self.linear2(x)
return x
# Define a minimal dataset class
class SimpleDataset:
def __init__(self):
self.x = torch.randn(6, 4)
self.edge_index = torch.tensor([[0, 1, 2, 3, 4, 5],
[1, 2, 3, 4, 5, 0]], dtype=torch.long)
self.y = torch.tensor([0, 1, 0, 1, 0, 1], dtype=torch.long)
self.train_mask = torch.tensor([True, True, True, False, False, False])
self.val_mask = torch.tensor([False, False, False, True, True, False])
self.inductive_mask = torch.tensor([True, True, True, True, False, False])
def to(self, device):
self.x = self.x.to(device)
self.edge_index = self.edge_index.to(device)
self.y = self.y.to(device)
self.train_mask = self.train_mask.to(device)
self.val_mask = self.val_mask.to(device)
self.inductive_mask = self.inductive_mask.to(device)
return self
# Define loss function
def loss_fn(pred, target):
return F.cross_entropy(pred, target)
# Define criterion (accuracy)
def criterion(pred, target):
return (pred == target).float().mean()
# Create model instance
model = SimpleGNN(input_dim=4, hidden_dim=8, output_dim=3)
# Create dataset instance
dataset = SimpleDataset()
# Define TrainConfig
from dataclasses import dataclass
from typing import Callable, Union
@dataclass
class TrainConfig:
criterion: Callable[[Union[np.ndarray, torch.tensor], Union[np.ndarray, torch.tensor]], float]
device: Union[str, torch.device]
epochs: int
early_stopping: int
loss_fn: Callable[[Union[np.ndarray, torch.tensor], Union[np.ndarray, torch.tensor]], float]
lr: float
weight_decay: float
optimizer: torch.optim.Optimizer
# Create config
config = TrainConfig(
criterion=criterion,
device='cpu',
epochs=3,
early_stopping=2,
loss_fn=loss_fn,
lr=0.01,
weight_decay=0.0,
optimizer=Adam
)
ARGS = {
'model': model,
'dataset': dataset,
'config': config,
'disable_tqdm': True,
'inductive_split': True
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy, torch, tqdm — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type defaultdict — a defaultdict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a defaultdict 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
|
| train_split_interconnection_mask |
Ran ran, violated the contract we drafted |
marcuslassila/mia-audit-gnn/src/lood.py code served (permissive licence) · get_code("6e86451052b11f1a") How it ranRan 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 torch
import torch.nn as nn
torch.manual_seed(0)
class MockDataset:
def __init__(self):
# edge_index: shape (2, num_edges) - stores source and target node indices
self.edge_index = torch.tensor([[0, 1, 0, 1], [1, 0, 2, 2]], dtype=torch.long)
# Masks for train/val/test splits: shape (num_nodes,) boolean tensors
# We have 3 nodes (0, 1, 2) based on edge_index
self.train_mask = torch.tensor([True, True, False], dtype=torch.bool)
self.val_mask = torch.tensor([False, False, True], dtype=torch.bool)
self.test_mask = torch.tensor([False, False, False], dtype=torch.bool)
dataset = MockDataset()
ARGS = {
"dataset": dataset
}
- 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 (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
|
| valid_step_gnn |
Ran ran, honoured the contract we drafted |
marcuslassila/mia-audit-gnn/src/lood.py code served (permissive licence) · get_code("e7b5e1f562be899b") How it ranRan 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 1, dtype family float; 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
import torch.nn as nn
torch.manual_seed(0)
# Build a minimal GNN model that accepts (x, edge_index) and returns logits
class MinimalGNN(nn.Module):
def __init__(self, input_dim, hidden_dim, output_dim):
super().__init__()
self.lin1 = nn.Linear(input_dim, hidden_dim)
self.lin2 = nn.Linear(hidden_dim, output_dim)
def forward(self, x, edge_index):
# Simple MLP-based model (ignores edge_index structure for simplicity)
x = self.lin1(x)
x = torch.relu(x)
x = self.lin2(x)
return x
# Build minimal dataset object with required attributes
class MinimalDataset:
def __init__(self):
# 5 nodes, 4 features
self.x = torch.randn(5, 4)
# 6 edges (2 x num_edges)
self.edge_index = torch.tensor([
[0, 1, 2, 3, 4, 0],
[1, 2, 3, 4, 0, 2]
], dtype=torch.long)
# 5 labels (3 classes)
self.y = torch.tensor([0, 1, 2, 0, 1], dtype=torch.long)
# Validation mask: nodes 3, 4 are validation
self.val_mask = torch.tensor([False, False, False, True, True])
# Create model
model = MinimalGNN(input_dim=4, hidden_dim=8, output_dim=3)
# Create dataset
dataset = MinimalDataset()
# Loss function: CrossEntropyLoss expects logits and targets
loss_fn = nn.CrossEntropyLoss(reduction='sum')
# Criterion: accuracy metric
criterion = nn.Identity() # We'll use a simple accuracy counter
def accuracy_fn(preds, targets):
correct = (preds == targets).sum().float()
return correct / len(targets)
criterion = accuracy_fn
# Number of validation nodes
num_val_nodes = dataset.val_mask.sum().item()
# Edge mask (optional): select a subset of edges
edge_mask = torch.tensor([True, True, False, True, False, True])
ARGS = {
"model": model,
"dataset": dataset,
"loss_fn": loss_fn,
"criterion": criterion,
"num_val_nodes": num_val_nodes,
"edge_mask": edge_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 tuple, ndim 1, dtype family float — 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
|
| LOOD |
Not yet run unverified (harvested, no recorded run) |
marcuslassila/mia-audit-gnn/src/lood.py code served (permissive licence) · get_code("ced15d198fbc913f") How it ran |
| fresh_model |
Not yet run unverified (harvested, no recorded run) |
marcuslassila/mia-audit-gnn/src/lood.py code served (permissive licence) · get_code("01fc4c2299894c2d") How it ran |
| plot_histogram_and_fitted_gaussian |
Not yet run unverified (harvested, no recorded run) |
marcuslassila/mia-audit-gnn/src/lood.py code served (permissive licence) · get_code("46491b355211dca6") How it ran |
| savefig_or_show |
Not yet run unverified (harvested, no recorded run) |
marcuslassila/mia-audit-gnn/src/lood.py code served (permissive licence) · get_code("d87f450c3b155b93") How it ran |
| train_step_gnn |
Not yet run unverified (harvested, no recorded run) |
marcuslassila/mia-audit-gnn/src/lood.py code served (permissive licence) · get_code("27ead46c9420e337") How it ran |