SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2311.17327 · NeurIPS · 2023

Improving Self-supervised Molecular Representation Learning using Persistent Homology

Veronika Thost, Lei Shi, Yuankai Luo

arXiv · PDF · Open in the Atlas

Code that ran

4 of 11 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; 2 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 2 failures of our instrument; 7 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/2311.17327.json · badge: /api/ran/2311.17327.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
LUOyk1999/Molecular-homology canonical (classifier label)
classifier basis: census
4 ran · 4 no recorded run
luoyk1999/molecular-homology canonical (classifier label)
classifier basis: classifier_2025
0 ran · 3 no recorded run
FunctionStatusWhere it lives
eval Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
LUOyk1999/Molecular-homology/finetune/PI_SSVM.py
code served (permissive licence) · get_code("4813598288997a46")
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 float, 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 numpy as np

# The function expects:
# - y_true: numpy array of shape (n_samples, n_targets) with values in {-1, 1}
# - y_scores: numpy array of shape (n_samples, n_targets) with prediction scores

# Create small test data
np.random.seed(0)

# 5 samples, 3 targets
n_samples = 5
n_targets = 3

# y_true: binary labels with values -1 or 1
y_true = np.random.choice([-1, 1], size=(n_samples, n_targets))

# y_scores: prediction scores (typically probabilities or raw scores)
# Make sure they're in a reasonable range for ROC-AUC
y_scores = np.random.rand(n_samples, n_targets)

ARGS = {
    "y_true": y_true,
    "y_scores": y_scores,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, 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
eval Ran
ran, honoured the contract we drafted
LUOyk1999/Molecular-homology/finetune/finetune_PI.py
code served (permissive licence) · get_code("2231da93609b1a63")
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
import torch.nn as nn

torch.manual_seed(0)

# Define a minimal model that satisfies the usage in eval()
class MinimalGNNModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 4)
    
    def forward(self, x, edge_index, edge_attr, batch):
        # Return predictions with shape (num_nodes, 4)
        # The function expects to compute cdist on these predictions
        return self.linear(x)

# Create a minimal batch object that satisfies the usage in eval()
class MinimalBatch:
    def __init__(self):
        # x: node features (6 nodes, 4 features)
        self.x = torch.randn(6, 4)
        # edge_index: (2, num_edges)
        self.edge_index = torch.tensor([[0, 1, 2], [1, 2, 3]], dtype=torch.long)
        # edge_attr: edge features
        self.edge_attr = torch.randn(3, 2)
        # PI: protein interaction matrix (num_nodes, some_dim)
        self.PI = torch.randn(6, 100)
        # id: identifier for reshaping
        self.id = torch.arange(6)
        # batch: batch assignment for nodes
        self.batch = torch.zeros(6, dtype=torch.long)
    
    def to(self, device):
        # Move all tensors to device and return self
        self.x = self.x.to(device)
        self.edge_index = self.edge_index.to(device)
        self.edge_attr = self.edge_attr.to(device)
        self.PI = self.PI.to(device)
        self.id = self.id.to(device)
        self.batch = self.batch.to(device)
        return self

# Create loader with minimal batches
loader = [MinimalBatch(), MinimalBatch()]

# Create model and device
model = MinimalGNNModel()
device = torch.device('cpu')

# Define args dict
ARGS = {
    'args': None,  # args parameter is not used in the function body
    'model': model,
    'device': device,
    'loader': loader
}
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
pearson_correlation Ran
ran; our contract draft was wrong, not the code
LUOyk1999/Molecular-homology/finetune/finetune_PI.py
code served (permissive licence) · get_code("f2033d144dea2f7d")
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 two small 1D tensors for computing Pearson correlation
x = torch.randn(4)
y = torch.randn(4)

ARGS = {
    "x": x,
    "y": y,
}
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
train Ran
ran, honoured the contract we drafted
LUOyk1999/Molecular-homology/finetune/finetune_PI.py
code served (permissive licence) · get_code("a5d7dc316a22678a")
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
import torch.nn as nn

torch.manual_seed(0)

# Define a simple GNN model that matches the function's usage
class SimpleGNNModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 50)
    
    def forward(self, x, edge_index, edge_attr, batch):
        # x: node features
        # edge_index: graph connectivity
        # edge_attr: edge features
        # batch: batch assignment
        # Output shape: (num_samples, 50)
        out = self.linear(x)
        # Simple pooling by batch
        batch_size = batch.max().item() + 1
        pooled = torch.zeros(batch_size, 50)
        for i in range(batch_size):
            mask = batch == i
            pooled[i] = out[mask].mean(dim=0)
        return pooled

# Create a simple batch class that mimics torch_geometric Data
class SimpleBatch:
    def __init__(self, x, edge_index, edge_attr, batch, PI, id_tensor):
        self.x = x
        self.edge_index = edge_index
        self.edge_attr = edge_attr
        self.batch = batch
        self.PI = PI
        self.id = id_tensor
    
    def to(self, device):
        self.x = self.x.to(device)
        self.edge_index = self.edge_index.to(device)
        self.edge_attr = self.edge_attr.to(device)
        self.batch = self.batch.to(device)
        self.PI = self.PI.to(device)
        self.id = self.id.to(device)
        return self

# Create sample batches for the loader
def create_sample_batch():
    # Node features: 6 nodes with 4 features each
    x = torch.randn(6, 4)
    # Edge indices: simple connectivity
    edge_index = torch.tensor([[0, 1, 2, 3], [1, 2, 3, 4]], dtype=torch.long)
    # Edge attributes: 4 edges with 3 features each
    edge_attr = torch.randn(4, 3)
    # Batch assignment: which graph each node belongs to (2 graphs)
    batch = torch.tensor([0, 0, 0, 1, 1, 1], dtype=torch.long)
    # PI: target values (2 samples, arbitrary width that will be reshaped)
    PI = torch.randn(2, 100)
    # id: sample identifiers
    id_tensor = torch.tensor([0, 1], dtype=torch.long)
    
    return SimpleBatch(x, edge_index, edge_attr, batch, PI, id_tensor)

# Create loader with 2 batches
loader = [create_sample_batch(), create_sample_batch()]

# Create model
model = SimpleGNNModel()

# Create optimizer
optimizer = torch.optim.Adam(model.parameters(), lr=0.01)

# Device
device = torch.device('cpu')

# Args dict
ARGS = {
    'args': None,
    'model': model,
    'device': device,
    'loader': loader,
    'optimizer': optimizer
}
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
eval Not yet run
unverified (harvested, no recorded run)
luoyk1999/molecular-homology/finetune/finetune.py
code served (permissive licence) · get_code("78fd2b56af04527d")
How it ran

no invocation recorded.

eval Not yet run
unverified (harvested, no recorded run)
LUOyk1999/Molecular-homology/finetune/finetune_concat.py
code served (permissive licence) · get_code("9e1ab9842a6eae20")
How it ran

no invocation recorded.

eval Not yet run
unverified (harvested, no recorded run)
LUOyk1999/Molecular-homology/finetune/finetune_individual.py
code served (permissive licence) · get_code("90e631aaf0ae4800")
How it ran

no invocation recorded.

eval Not yet run
unverified (harvested, no recorded run)
LUOyk1999/Molecular-homology/finetune/finetune_subset.py
code served (permissive licence) · get_code("1bdbcd220ba6eefe")
How it ran

no invocation recorded.

eval Not yet run
unverified (harvested, no recorded run)
LUOyk1999/Molecular-homology/finetune/knn.py
code served (permissive licence) · get_code("33289ea7fc2c396c")
How it ran

no invocation recorded.

loss_topo Not yet run
unverified (harvested, no recorded run)
luoyk1999/molecular-homology/pretrain_PI/pretrain_graphcl_TDL.py
code served (permissive licence) · get_code("d674bc77f0d11cae")
How it ran

no invocation recorded.

sigmoid Not yet run
unverified (harvested, no recorded run)
luoyk1999/molecular-homology/finetune/finetune.py
code served (permissive licence) · get_code("dd6b2ab1d9d8e062")
How it ran

no invocation recorded. this sample carries JSON test cases instead of a setup block; get_reference_implementation serves them with the level they back.

Also present in other papers' code

Of 11 samples lifted from this paper's linked repositories, 11 carry a function identity and 0 do not. Of the 11 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, 1 later) and 10 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
eval 2 other papers
1 dated earlier, 1 later
2208.04529 (2022-08)
Motif-based Graph Representation Learning with Application to Chemical Molecules
2404.15806 (2024-04)
Where to Mask: Structure-Guided Masking for Graph Masked Autoencoders

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

Self-supervised learning (SSL) has great potential for molecular representation learning given the complexity of molecular graphs, the large amounts of unlabelled data available, the considerable cost of obtaining labels experimentally, and the hence often only small training datasets. The importance of the topic is reflected in the variety of paradigms and architectures that have been investigated recently. Yet the differences in performance seem often minor and are barely understood to date. In this paper, we study SSL based on persistent homology (PH), a mathematical tool for modeling topological features of data that persist across multiple scales. It has several unique features which particularly suit SSL, naturally offering: different views of the data, stability in terms of distance preservation, and the opportunity to flexibly incorporate domain knowledge. We (1) investigate an autoencoder, which shows the general representational power of PH, and (2) propose a contrastive loss that complements existing approaches. We rigorously evaluate our approach for molecular property prediction and demonstrate its particular features in improving the embedding space: after SSL, the representations are better and offer considerably more predictive power than the baselines over different probing tasks; our loss increases baseline performance, sometimes largely; and we often obtain substantial improvements over very small datasets, a common scenario in practice.

For agents

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

get_harvested_code_for_paper("2311.17327")
get_code_for_paper("2311.17327")
have("2311.17327")

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

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

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

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

Connect an agent — have() is free.