SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2002.11661 · 2020

Data Structures & Algorithms for Exact Inference in Hierarchical Clustering

arXiv · PDF · Open in the Atlas

Code that ran

6 of 6 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 6 have no contract verdict; 0 failures of our instrument; 0 no recorded run), measured 2026-11-22; 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/2002.11661.json · badge: /api/ran/2002.11661.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
SebastianMacaluso/ClusterTrellis community (classifier label)
classifier basis not recorded on the link
6 ran · 0 no recorded run
FunctionStatusWhere it lives
getConstituents Ran
ran on a synthesized input
SebastianMacaluso/ClusterTrellis/src/ClusterTrellis/utils.py
code served (permissive licence) · get_code("fc32f46ff089b0d9")
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 list, ndim 2, 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 numpy as np

torch.manual_seed(0)

# Build a jet structure as expected by the function
# The function accesses jet['tree'] and jet['content']
# jet['tree'] is indexed with [node_id, 0] and [node_id, 1]
# jet['content'] is indexed with [node_id]

# Create a binary tree structure where:
# - tree[node_id, 0] and tree[node_id, 1] are child node indices (-1 means leaf)
# - content[node_id] stores the constituent data for that node

# Simple tree with 4 nodes (indices 0-3):
# Node 0: internal (has children 1, 2)
# Node 1: internal (has children 3, 4) - but we'll keep it simple
# Node 2: leaf
# Node 3: leaf
# Node 4: leaf

tree = torch.tensor([
    [1, 2],      # node 0: children are nodes 1 and 2
    [3, 4],      # node 1: children are nodes 3 and 4
    [-1, -1],    # node 2: leaf (no children)
    [-1, -1],    # node 3: leaf
    [-1, -1],    # node 4: leaf
], dtype=torch.long)

# Content: feature vectors for each node
content = torch.randn(5, 4)  # 5 nodes, 4 features each

jet = {
    'tree': tree,
    'content': content
}

node_id = 0
outers_list = []

ARGS = {
    'jet': jet,
    'node_id': node_id,
    'outers_list': outers_list
}
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 list, ndim 2, dtype family float — a list 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
get_delta_LR Ran
ran on a synthesized input
SebastianMacaluso/ClusterTrellis/src/ClusterTrellis/Ginkgo_likelihood.py
code served (permissive licence) · get_code("553e5a832c97c087")
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 float64, ndim 0, 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 numpy as np

# Create momentum vectors for left and right particles
# These represent 4-momenta: [energy, px, py, pz]
pL = np.array([5.0, 1.0, 2.0, 1.5])
pR = np.array([3.0, 0.5, -1.0, 0.8])

ARGS = {
    "pL": pL,
    "pR": pR,
}
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 float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
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_leaves Ran
ran on a synthesized input
SebastianMacaluso/ClusterTrellis/src/ClusterTrellis/utils.py
code served (permissive licence) · get_code("c638b5451a407e76")
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 list, ndim 2, 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 numpy as np

torch.manual_seed(0)

# The function expects a 'jet' dict with keys: 'tree', 'content', 'root_id'
# 'tree' is indexed as jet['tree'][node_id, 0] and jet['tree'][node_id, 1]
# so it should be a 2D array/tensor where each row has at least 2 elements
# 'content' is indexed as jet['content'][node_id]
# 'root_id' is a scalar node id

# Build a small tree structure for testing
# Tree with 3 nodes (indices 0, 1, 2):
# Node 0 (root): has children at indices 0 and 1 in tree[0]
# Node 1: leaf (tree[1, 0] == -1)
# Node 2: leaf (tree[2, 0] == -1)

tree = np.array([
    [1, 2],      # node 0: children are nodes 1 and 2
    [-1, -1],    # node 1: leaf (no children)
    [-1, -1]     # node 2: leaf (no children)
], dtype=np.int64)

# Content for each node (leaf values)
content = np.array([
    [1.0, 2.0, 3.0, 4.0],
    [5.0, 6.0, 7.0, 8.0],
    [9.0, 10.0, 11.0, 12.0]
], dtype=np.float32)

jet = {
    'tree': tree,
    'content': content,
    'root_id': 0
}

ARGS = {
    'jet': jet
}
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 list, ndim 2, dtype family float — a list 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
get_logger Ran
ran on a synthesized input
SebastianMacaluso/ClusterTrellis/src/ClusterTrellis/utils.py
code served (permissive licence) · get_code("4a24f023d0dcd220")
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 Logger. 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 logging

# Define __file__ for use in the default parameter
__file__ = "test_logger.py"

# Construct arguments for get_logger
ARGS = {
    "name": "my_test_logger",
    "level": logging.DEBUG
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Logger — a Logger output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Logger 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
split_logLH_with_stop_nonstop_prob Ran
ran on a synthesized input
SebastianMacaluso/ClusterTrellis/src/ClusterTrellis/Ginkgo_likelihood.py
code served (permissive licence) · get_code("ce662a5e23440900")
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 float64, ndim 0, 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 numpy as np

# Analyze the function to understand what it needs:
# - pL: 4D momentum vector (used in pR + pL and norm calculation)
# - tL: scalar mass squared value
# - pR: 4D momentum vector (used in pR + pL and norm calculation)
# - tR: scalar mass squared value
# - t_cut: scalar threshold for mass squared
# - lam: scalar lambda parameter for exponential distribution

# Create small valid test arguments
pL = np.array([10.0, 3.0, 2.0, 1.0])  # 4D momentum vector
pR = np.array([8.0, 2.0, 1.5, 0.5])   # 4D momentum vector
tL = 2.5  # scalar mass squared
tR = 1.8  # scalar mass squared
t_cut = 5.0  # scalar threshold (should be > tp1 for valid case)
lam = 0.5  # scalar lambda parameter

ARGS = {
    'pL': pL,
    'tL': tL,
    'pR': pR,
    'tR': tR,
    't_cut': t_cut,
    'lam': lam
}
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 float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
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
split_logLH_without_non_stop_prob Ran
ran on a synthesized input
SebastianMacaluso/ClusterTrellis/src/ClusterTrellis/Ginkgo_likelihood.py
code served (permissive licence) · get_code("a3604e6497a6b57e")
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 float64, ndim 0, 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 numpy as np

# Analyze the function to understand what each parameter needs:
# pL: 4-momentum (used in pP = pR + pL, then np.linalg.norm on pP[1:])
# tL: scalar (used in max/min comparisons)
# pR: 4-momentum (used in pP = pR + pL)
# tR: scalar (used in max/min comparisons)
# t_cut: scalar threshold
# lam: scalar parameter for lambda in exponential

# Create 4-momenta as numpy arrays (energy, px, py, pz)
pL = np.array([5.0, 1.0, 2.0, 0.5])
pR = np.array([3.0, 0.5, 1.0, 0.3])

# Create scalar invariant masses (t-values must be positive or zero for leaves)
tL = 0.1
tR = 0.2

# Create threshold and lambda parameter
t_cut = 0.01
lam = 1.5

ARGS = {
    'pL': pL,
    'tL': tL,
    'pR': pR,
    'tR': tR,
    't_cut': t_cut,
    'lam': lam
}
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 float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
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

Also present in other papers' code

Of 6 samples lifted from this paper's linked repositories, 6 carry a function identity and 0 do not. Of the 6 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 6 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.

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

Repositories linked to this paper

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

Abstract

Hierarchical clustering is a fundamental task often used to discover meaningful structures in data, such as phylogenetic trees, taxonomies of concepts, subtypes of cancer, and cascades of particle decays in particle physics. Typically approximate algorithms are used for inference due to the combinatorial number of possible hierarchical clusterings. In contrast to existing methods, we present novel dynamic-programming algorithms for \emph{exact} inference in hierarchical clustering based on a novel trellis data structure, and we prove that we can exactly compute the partition function, maximum likelihood hierarchy, and marginal probabilities of sub-hierarchies and clusters. Our algorithms scale in time and space proportional to the powerset of $N$ elements which is super-exponentially more efficient than explicitly considering each of the (2N-3)!! possible hierarchies. Also, for larger datasets where our exact algorithms become infeasible, we introduce an approximate algorithm based on a sparse trellis that compares well to other benchmarks. Exact methods are relevant to data analyses in particle physics and for finding correlations among gene expression in cancer genomics, and we give examples in both areas, where our algorithms outperform greedy and beam search baselines. In addition, we consider Dasgupta's cost with synthetic data.

For agents

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

get_harvested_code_for_paper("2002.11661")
get_code_for_paper("2002.11661")
have("2002.11661")

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

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

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

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

Connect an agent — have() is free.