SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1806.10701 · 2018

Empirical Risk Minimization and Stochastic Gradient Descent for Relational Data

arXiv · PDF · Open in the Atlas

Code that ran

9 of 23 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 9 have no contract verdict; 0 failures of our instrument; 14 no recorded run), measured 2026-11-24; 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/1806.10701.json · badge: /api/ran/1806.10701.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
wooden-spoon/relational-ERM canonical (classifier label)
classifier basis: census
9 ran · 14 no recorded run
FunctionStatusWhere it lives
adapt_random_walk_window Ran
ran on a synthesized input
wooden-spoon/relational-ERM/src/relational_erm/sampling/adapters.py
code served (permissive licence) · get_code("7c4eae3809a6a5f0")
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 function. 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 tensorflow as tf
import numpy as np

# Set random seed for reproducibility
tf.random.set_seed(0)

# Create a small random walk tensor
# A random walk is a sequence of node indices
walk = tf.constant([0, 1, 2, 1, 0, 2, 1], dtype=tf.int32)

# Create sample data dictionary with a walk
data = {
    'walk': walk,
    'metadata': 'sample_data'
}

# Define ARGS with window_size parameter
ARGS = {
    'window_size': 2
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
add_negative_sample Ran
ran on a synthesized input
wooden-spoon/relational-ERM/src/relational_erm/sampling/negative_sampling.py
code served (permissive licence) · get_code("c92775f5dfcb2ea9")
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 function. 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 tensorflow as tf
import numpy as np

# Set seeds for reproducibility
tf.random.set_seed(0)
np.random.seed(0)

# Define a small vertex distribution function (callable)
def vertex_distribution_fn(edge_list):
    """Returns logits for vertex distribution"""
    num_vertices = 10
    return tf.ones([num_vertices])

# Create small test tensors
num_vertices = 10
num_samples_per_vertex = 2
num_random_total = 5
vertex_distribution_logit = tf.ones([num_vertices])
bias_by_vertex_occurrence = False
seed = 42

ARGS = {
    'num_vertices': num_vertices,
    'num_samples_per_vertex': num_samples_per_vertex,
    'num_random_total': num_random_total,
    'vertex_distribution_logit': vertex_distribution_logit,
    'bias_by_vertex_occurrence': bias_by_vertex_occurrence,
    'seed': seed,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
apply_adapter Ran
ran on a synthesized input
wooden-spoon/relational-ERM/src/relational_erm/sampling/adapters.py
code served (permissive licence) · get_code("d6d0baaf4674b45b")
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 function. 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)

# Define a simple sampler function that returns some data
def sampler():
    """A sampling function that returns dummy data"""
    return torch.randn(2, 4)

# Define a simple adapter function that processes the sampled data
class SimpleAdapter:
    """An adapter that processes sampled data"""
    def __call__(self, data):
        """Apply adaptation to the data"""
        return data * 2.0

adapter = SimpleAdapter()

ARGS = {
    "sampler": sampler,
    "adapter": adapter,
}
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 function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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_packed_adjacency_from_redundant_edge_list Ran
ran on a synthesized input
wooden-spoon/relational-ERM/src/relational_erm/graph_ops/representations.py
code served (permissive licence) · get_code("2653ebdb4adef8ce")
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 PackedAdjacencyList. 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 numpy as np

# Create a simple edge list for testing
# Format: [source_vertex, destination_vertex]
# We'll create edges from vertices 0, 1, 2 to various destinations
redundant_edge_list = np.array([
    [0, 2],
    [0, 3],
    [1, 0],
    [1, 2],
    [2, 1],
    [2, 3],
], dtype=np.int32)

ARGS = {
    "redundant_edge_list": redundant_edge_list
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type PackedAdjacencyList — a PackedAdjacencyList output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a PackedAdjacencyList 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_packed_adjacency_list Ran
ran on a synthesized input
wooden-spoon/relational-ERM/src/relational_erm/graph_ops/representations.py
code served (permissive licence) · get_code("2fd19352149c130b")
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 PackedAdjacencyList. 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 numpy as np

# Create a simple adjacency list representation
# Keys are vertices (0 to num_vertices-1)
# Values are tuples of (neighbours_array, weights_array)

adjacency_list = {
    0: (np.array([1, 2], dtype=np.int32), np.array([0.5, 0.7], dtype=np.float32)),
    1: (np.array([0, 3], dtype=np.int32), np.array([0.5, 0.3], dtype=np.float32)),
    2: (np.array([0], dtype=np.int32), np.array([0.7], dtype=np.float32)),
    3: (np.array([1], dtype=np.int32), np.array([0.3], dtype=np.float32)),
}

ARGS = {
    "adjacency_list": adjacency_list,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type PackedAdjacencyList — a PackedAdjacencyList output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a PackedAdjacencyList 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
make_simple_skipgram_loss Ran
ran on a synthesized input
wooden-spoon/relational-ERM/src/relational_erm/models/skipgram.py
code served (permissive licence) · get_code("2f819eacfbd7c7bf")
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 function. 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 tensorflow as tf
import numpy as np

# Set seed for reproducibility
tf.random.set_seed(0)

# Create small test tensors
batch_size = 2
num_edges = 3
num_vertices = 4

# edge_logits: shape [batch_size, num_edges] - raw predictions from model
edge_logits = tf.constant([
    [0.5, -0.3, 1.2],
    [0.1, 0.8, -0.5]
], dtype=tf.float32)

# num_vertex: total number of vertices in the graph
num_vertex = num_vertices

# edge_list: shape [batch_size, num_edges, 2] - pairs of vertex indices
edge_list = tf.constant([
    [[0, 1], [1, 2], [2, 3]],
    [[0, 2], [1, 3], [0, 3]]
], dtype=tf.int32)

# edge_weights: shape [batch_size, num_edges]
# 1 = edge present, 0 = edge absent, -1 = censored (excluded from loss)
edge_weights = tf.constant([
    [1, 0, 1],
    [1, 0, -1]
], dtype=tf.float32)

# params: a simple dict or config object
params = {
    'learning_rate': 0.01,
    'embedding_dim': 16
}

# Test different values for clip parameter
clip_value = 2.0

ARGS = {
    'clip': clip_value
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
make_weighted_loss Ran
ran on a synthesized input
wooden-spoon/relational-ERM/src/relational_erm/models/skipgram.py
code served (permissive licence) · get_code("c703de90c21e5f2a")
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 function. 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 tensorflow as tf

# Create a simple loss function that takes predictions and targets
def simple_loss_fn(y_true, y_pred):
    """A simple MSE-like loss function"""
    return tf.reduce_mean(tf.square(y_true - y_pred))

# Create sample tensors for testing
y_true = tf.constant([[1.0, 2.0, 3.0, 4.0],
                       [5.0, 6.0, 7.0, 8.0]], dtype=tf.float32)
y_pred = tf.constant([[1.1, 2.1, 3.1, 4.1],
                       [5.1, 6.1, 7.1, 8.1]], dtype=tf.float32)

ARGS = {
    "loss_fn": simple_loss_fn,
    "weight": 2.5
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
preprocess_data Ran
ran on a synthesized input
wooden-spoon/relational-ERM/src/relational_erm/data_processing/wikipedia_hyperlink.py
code served (permissive licence) · get_code("c26027e156fcba64")
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 dict. 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 os
import tempfile
import gzip
import numpy as np

# Create temporary directory structure with mock data files
temp_dir = tempfile.mkdtemp()

# Create mock wiki-topcats.txt.gz (edge list)
link_file = os.path.join(temp_dir, 'wiki-topcats.txt.gz')
with gzip.open(link_file, 'wt') as f:
    f.write("0 1\n")
    f.write("1 2\n")
    f.write("2 3\n")
    f.write("0 3\n")

# Create mock wiki-topcats-page-names.txt.gz (article names)
name_file = os.path.join(temp_dir, 'wiki-topcats-page-names.txt.gz')
with gzip.open(name_file, 'wt') as f:
    f.write("0 Article One\n")
    f.write("1 Article Two\n")
    f.write("2 Article Three\n")
    f.write("3 Article Four\n")

# Create mock wiki-topcats-categories.txt.gz (categories and article mappings)
category_file = os.path.join(temp_dir, 'wiki-topcats-categories.txt.gz')
with gzip.open(category_file, 'wt') as f:
    f.write("category:Science; 0 1 2\n")
    f.write("category:History; 1 3\n")

ARGS = {
    'data_directory': temp_dir
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
redundant_edge_list_to_adj_list Ran
ran on a synthesized input
wooden-spoon/relational-ERM/src/relational_erm/graph_ops/representations.py
code served (permissive licence) · get_code("0f8181e306b9d954")
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 dict. 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 numpy as np

# Create a simple edge list with 4 edges
# Each row is [source, destination]
edge_list = np.array([
    [0, 1],
    [0, 2],
    [1, 2],
    [1, 0]
], dtype=np.int64)

# Create corresponding weights
weights = np.array([1.0, 2.0, 3.0, 4.0], dtype=np.float64)

ARGS = {
    "edge_list": edge_list,
    "weights": weights
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
compute_edge_logits Not yet run
unverified (harvested, no recorded run)
wooden-spoon/relational-ERM/src/relational_erm/models/label_clustering.py
code served (permissive licence) · get_code("b89681b6bcc47b09")
How it ran

no invocation recorded.

edge_list_to_adj_mat Not yet run
unverified (harvested, no recorded run)
wooden-spoon/relational-ERM/src/relational_erm/graph_ops/tensorflow.py
code served (permissive licence) · get_code("800dd4877fb341b6")
How it ran

no invocation recorded.

get_unigram_distribution Not yet run
unverified (harvested, no recorded run)
wooden-spoon/relational-ERM/src/relational_erm/sampling/factories.py
code served (permissive licence) · get_code("0439ddb77b64a048")
How it ran

no invocation recorded.

is_connected Not yet run
unverified (harvested, no recorded run)
wooden-spoon/relational-ERM/src/relational_erm/graph_ops/structure.py
code served (permissive licence) · get_code("aaa7c3eb2800a70a")
How it ran

no invocation recorded.

macro_f1 Not yet run
unverified (harvested, no recorded run)
wooden-spoon/relational-ERM/src/relational_erm/models/metrics.py
code served (permissive licence) · get_code("29195ba13112cc60")
How it ran

no invocation recorded.

macro_f1_oracle Not yet run
unverified (harvested, no recorded run)
wooden-spoon/relational-ERM/src/relational_erm/models/metrics.py
code served (permissive licence) · get_code("421a04d324bbda92")
How it ran

no invocation recorded.

make_learned_unigram_logits Not yet run
unverified (harvested, no recorded run)
wooden-spoon/relational-ERM/src/relational_erm/sampling/negative_sampling.py
code served (permissive licence) · get_code("3931742278578086")
How it ran

no invocation recorded.

make_node_classifier Not yet run
unverified (harvested, no recorded run)
wooden-spoon/relational-ERM/src/relational_erm/models/multilabel_node_classification_template.py
code served (permissive licence) · get_code("01e38183fab627fc")
How it ran

no invocation recorded.

oracle_predictions Not yet run
unverified (harvested, no recorded run)
wooden-spoon/relational-ERM/src/relational_erm/models/metrics.py
code served (permissive licence) · get_code("34f77f68c9add49f")
How it ran

no invocation recorded.

parallel_dataset Not yet run
unverified (harvested, no recorded run)
wooden-spoon/relational-ERM/src/relational_erm/sampling/factories.py
code served (permissive licence) · get_code("d49c54e9119eca26")
How it ran

no invocation recorded.

preprocess_data Not yet run
unverified (harvested, no recorded run)
wooden-spoon/relational-ERM/src/relational_erm/data_processing/pokec.py
code served (permissive licence) · get_code("f4e29a9d525179a1")
How it ran

no invocation recorded.

preprocess_packed_adjacency_list Not yet run
unverified (harvested, no recorded run)
wooden-spoon/relational-ERM/src/relational_erm/data_processing/pokec.py
code served (permissive licence) · get_code("23019e1839641c35")
How it ran

no invocation recorded.

preprocess_packed_adjacency_list Not yet run
unverified (harvested, no recorded run)
wooden-spoon/relational-ERM/src/relational_erm/data_processing/wikipedia_hyperlink.py
code served (permissive licence) · get_code("e790895dcebdb558")
How it ran

no invocation recorded.

skipgram_loss Not yet run
unverified (harvested, no recorded run)
wooden-spoon/relational-ERM/src/relational_erm/models/label_clustering.py
code served (permissive licence) · get_code("984d81b9ef31f1fa")
How it ran

no invocation recorded.

Also present in other papers' code

Of 23 samples lifted from this paper's linked repositories, 23 carry a function identity and 0 do not. Of the 23 distinct functions with an identity, 1 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 1 later) and 22 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
make_weighted_loss 1 other paper
1 later
2107.02363 (2021-07)
Asymptotics of Network Embeddings Learned via Subsampling

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-24.

Repositories linked to this paper

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

Abstract

Empirical risk minimization is the main tool for prediction problems, but its extension to relational data remains unsolved. We solve this problem using recent ideas from graph sampling theory to (i) define an empirical risk for relational data and (ii) obtain stochastic gradients for this empirical risk that are automatically unbiased. This is achieved by considering the method by which data is sampled from a graph as an explicit component of model design. By integrating fast implementations of graph sampling schemes with standard automatic differentiation tools, we provide an efficient turnkey solver for the risk minimization problem. We establish basic theoretical properties of the procedure. Finally, we demonstrate relational ERM with application to two non-standard problems: one-stage training for semi-supervised node classification, and learning embedding vectors for vertex attributes. Experiments confirm that the turnkey inference procedure is effective in practice, and that the sampling scheme used for model specification has a strong effect on model performance. Code is available at https://github.com/wooden-spoon/relational-ERM.

For agents

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

get_harvested_code_for_paper("1806.10701")
get_code_for_paper("1806.10701")
have("1806.10701")

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

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

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

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

Connect an agent — have() is free.