| build_hierarchy |
Ran ran; our contract draft was wrong, not the code |
BobXWu/TopMost/topmost/eva/build_hierarchy.py code served (permissive licence) · get_code("fa2268afeec470f7") 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 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
# Construct valid arguments for build_hierarchy
# Create a small hierarchical topic structure
# We need phi_list: list of matrices where phi[i] has shape (num_topics, next_num_topics)
# phi_list[0]: 2 topics -> 4 sub-topics (ratio 2:1)
# phi_list[1]: 4 topics -> 8 sub-topics (ratio 2:1)
phi_0 = np.random.rand(2, 4) # 2 topics, 4 child topics
phi_1 = np.random.rand(4, 8) # 4 topics, 8 child topics
phi_list = [phi_0, phi_1]
# Create hierarchical_topic_dict mapping layer_id to topic names
# layer_id 0: 2 topics named "topic_0_0", "topic_0_1"
# layer_id 1: 4 topics named "topic_1_0", "topic_1_1", "topic_1_2", "topic_1_3"
# layer_id 2: 8 topics named "topic_2_0", ..., "topic_2_7"
hierarchical_topic_dict = {
0: ["topic_0_0", "topic_0_1"],
1: ["topic_1_0", "topic_1_1", "topic_1_2", "topic_1_3"],
2: ["topic_2_0", "topic_2_1", "topic_2_2", "topic_2_3", "topic_2_4", "topic_2_5", "topic_2_6", "topic_2_7"]
}
ARGS = {
"hierarchical_topic_dict": hierarchical_topic_dict,
"phi_list": phi_list,
"topic_idx_list": None,
"layer_id": 0
}
- 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
|
| clustering_metrics |
Ran ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT) |
BobXWu/TopMost/topmost/eva/clustering.py code served (permissive licence) · get_code("ffd744fa6180ff2f") 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 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
from sklearn import metrics
def purity_score(y_true, y_pred):
contingency_matrix = metrics.cluster.contingency_matrix(y_true, y_pred)
return np.sum(np.amax(contingency_matrix, axis=0)) / np.sum(contingency_matrix)
def clustering_metrics(labels, preds):
metrics_func = [{'name': 'Purity', 'method': purity_score}, {'name': 'NMI', 'method': metrics.cluster.normalized_mutual_info_score}]
results = dict()
for func in metrics_func:
results[func['name']] = func['method'](labels, preds)
return results
# Setup code
np.random.seed(0)
# Create small sample data for clustering evaluation
# labels: ground truth cluster assignments
labels = np.array([0, 0, 1, 1, 2, 2])
# preds: predicted cluster assignments
preds = np.array([0, 0, 1, 1, 2, 2])
ARGS = {
'labels': labels,
'preds': preds
}
- 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 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_TD |
Ran ran, honoured the contract we drafted |
BobXWu/TopMost/topmost/eva/hierarchy_quality.py code served (permissive licence) · get_code("51dbd32c66f5d5fa") 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 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 torch
import numpy as np
from sklearn.feature_extraction.text import CountVectorizer
# The function expects:
# - texts: a list of strings (text documents)
# The function uses:
# - len(texts) to get K (number of documents)
# - texts[0].split() to get T (number of tokens in first document)
# - CountVectorizer.fit_transform(texts).toarray() to get word counts
# - Operations on the resulting counter matrix
texts = [
"hello world example text",
"hello world another sample"
]
ARGS = {
"texts": texts
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy, sklearn, torch — 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
|
| convert_topicStr_to_dict |
Ran ran; our contract draft was wrong, not the code |
BobXWu/TopMost/topmost/eva/hierarchy_quality.py code served (permissive licence) · get_code("b85535190ab1aa1b") 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.
from collections import defaultdict
# Construct valid arguments for convert_topicStr_to_dict
topic_str_list = [
"L-0_K-0 word1 word2 word3",
"L-0_K-1 word4 word5 word6",
"L-1_K-0 word7 word8 word9",
"L-1_K-1 word10 word11 word12"
]
ARGS = {
"topic_str_list": topic_str_list
}
- 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 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
|
| crosslingual_cls |
Ran ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT) |
BobXWu/TopMost/topmost/eva/classification.py code served (permissive licence) · get_code("68951864ab4ec0e0") 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 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
# Set seed for reproducibility
np.random.seed(0)
# Create small dummy feature matrices (theta) with distinct dimensions
# train_theta: (6, 4) - 6 samples, 4 features
# test_theta: (2, 4) - 2 samples, 4 features
train_theta_en = np.random.randn(6, 4).astype(np.float32)
train_theta_cn = np.random.randn(6, 4).astype(np.float32)
test_theta_en = np.random.randn(2, 4).astype(np.float32)
test_theta_cn = np.random.randn(2, 4).astype(np.float32)
# Create corresponding labels (binary classification)
train_labels_en = np.array([0, 1, 0, 1, 0, 1], dtype=np.int32)
train_labels_cn = np.array([1, 0, 1, 0, 1, 0], dtype=np.int32)
test_labels_en = np.array([0, 1], dtype=np.int32)
test_labels_cn = np.array([1, 0], dtype=np.int32)
ARGS = {
'train_theta_en': train_theta_en,
'train_theta_cn': train_theta_cn,
'test_theta_en': test_theta_en,
'test_theta_cn': test_theta_cn,
'train_labels_en': train_labels_en,
'train_labels_cn': train_labels_cn,
'test_labels_en': test_labels_en,
'test_labels_cn': test_labels_cn,
'classifier': 'SVM',
'gamma': 'scale'
}
- 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 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
|
| dynamic_diversity |
Ran ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT) |
BobXWu/TopMost/topmost/eva/topic_diversity.py code served (permissive licence) · get_code("0ad03ffc6b5947bb") 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 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
from typing import List
np.random.seed(0)
# Create small test data
num_docs = 4
vocab_size = 6
num_time_steps = 2
# Create vocabulary
vocab = ['word0', 'word1', 'word2', 'word3', 'word4', 'word5']
# Create train_bow as a sparse-like array (documents x vocabulary)
# Using dense numpy array, shape (4, 6)
train_bow = np.array([
[1, 0, 1, 0, 0, 1],
[0, 1, 1, 0, 1, 0],
[1, 1, 0, 1, 0, 0],
[0, 0, 1, 1, 1, 0]
], dtype=int)
# Create train_times mapping each document to a time slice
# 4 documents across 2 time steps
train_times = np.array([0, 0, 1, 1], dtype=int)
# Create top_words structure - dict mapping time to list of topic strings
# Each topic is a space-separated string of words
top_words = {
0: ['word0 word1', 'word2 word3'], # 2 topics at time 0
1: ['word1 word4', 'word3 word5'] # 2 topics at time 1
}
ARGS = {
'top_words': top_words,
'train_bow': train_bow,
'train_times': train_times,
'vocab': vocab,
'verbose': False
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy, tqdm — 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_child_topic_idx |
Ran ran, violated the contract we drafted |
BobXWu/TopMost/topmost/eva/build_hierarchy.py code served (permissive licence) · get_code("80e6b9d640d300cc") 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 list, ndim 1, 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 numpy as np
# Create a simple phi matrix (num_topic x next_num_topic)
# phi[topic_idx] will be indexed, and we'll use np.argsort on it
# The function computes num_child_topic = round(next_num_topic / num_topic)
# and then returns the top num_child_topic indices sorted by value
# Let's use distinct dimensions: 4 topics, 12 next topics
# This gives num_child_topic = round(12/4) = 3
num_topic = 4
next_num_topic = 12
# Create phi with random values (probability distributions over next topics)
phi = np.random.rand(num_topic, next_num_topic)
# topic_idx should be a valid index into phi (0 to num_topic-1)
topic_idx = 1
ARGS = {
"phi": phi,
"topic_idx": topic_idx,
}
- 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 list, ndim 1, dtype family int — 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
|
| hierarchical_cls |
Ran ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT) |
BobXWu/TopMost/topmost/eva/classification.py code served (permissive licence) · get_code("abbbe644d2594dd1") 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 numpy as np
from sklearn.svm import SVC
from sklearn.metrics import f1_score, accuracy_score
from collections import defaultdict
# Create small sample data for hierarchical classification
np.random.seed(0)
# Number of layers
num_layers = 3
# Create train_theta as a list of arrays, one per layer
# Shape: (num_samples=6, num_features=4) per layer
train_theta = [
np.random.randn(6, 4),
np.random.randn(6, 4),
np.random.randn(6, 4)
]
# Create test_theta as a list of arrays, one per layer
# Shape: (num_samples=2, num_features=4) per layer
test_theta = [
np.random.randn(2, 4),
np.random.randn(2, 4),
np.random.randn(2, 4)
]
# Create labels for training (6 samples, 3 classes)
train_labels = np.array([0, 1, 2, 0, 1, 2])
# Create labels for testing (2 samples, 3 classes)
test_labels = np.array([1, 2])
ARGS = {
'train_theta': train_theta,
'test_theta': test_theta,
'train_labels': train_labels,
'test_labels': test_labels,
'classifier': 'SVM',
'gamma': 'scale'
}
- 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 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
|
| hierarchical_clustering |
Ran ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT) |
BobXWu/TopMost/topmost/eva/clustering.py code served (permissive licence) · get_code("c3c2c22528dd70af") 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 numpy as np
from collections import defaultdict
from sklearn import metrics
def purity_score(y_true, y_pred):
contingency_matrix = metrics.cluster.contingency_matrix(y_true, y_pred)
return np.sum(np.amax(contingency_matrix, axis=0)) / np.sum(contingency_matrix)
def clustering_metrics(labels, preds):
metrics_func = [{'name': 'Purity', 'method': purity_score}, {'name': 'NMI', 'method': metrics.cluster.normalized_mutual_info_score}]
results = dict()
for func in metrics_func:
results[func['name']] = func['method'](labels, preds)
return results
def _clustering(theta, labels):
preds = np.argmax(theta, axis=1)
return clustering_metrics(labels, preds)
def hierarchical_clustering(test_theta, test_labels):
num_layer = len(test_theta)
results = defaultdict(list)
for layer in range(num_layer):
layer_results = _clustering(test_theta[layer], test_labels)
for key in layer_results:
results[key].append(layer_results[key])
for key in results:
results[key] = np.mean(results[key])
return results
# Create test data
# test_theta should be a list of 2D arrays (one per layer)
# Each array has shape (num_samples, num_classes)
num_samples = 4
num_classes = 3
num_layers = 2
# Create test_theta as a list of softmax-like probability matrices
test_theta = [
np.random.rand(num_samples, num_classes) for _ in range(num_layers)
]
# Normalize to make them look like probability distributions
for i in range(num_layers):
test_theta[i] = test_theta[i] / test_theta[i].sum(axis=1, keepdims=True)
# Create test_labels as cluster assignments (0, 1, or 2)
test_labels = np.array([0, 1, 0, 2])
ARGS = {
'test_theta': test_theta,
'test_labels': test_labels
}
- 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 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
|
| parse_item_info |
Ran ran, honoured the contract we drafted |
BobXWu/TopMost/topmost/eva/hierarchy_quality.py code served (permissive licence) · get_code("d2e1ec834d93b3de") 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 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)
# The function parse_item_info takes a topic_str parameter
# It expects a string formatted like "layer-{layer_id}_topic-{topic_idx} ..."
# The function splits on whitespace, takes the first element, then splits on '_'
# to get two items, each formatted as "key-value" where it extracts the numeric value
topic_str = "layer-3_topic-7 extra_stuff"
ARGS = {
"topic_str": topic_str
}
- 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 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
|
| purity_score |
Ran ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT) |
BobXWu/TopMost/topmost/eva/clustering.py code served (permissive licence) · get_code("1645ca2fb55ce1f8") 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 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
from sklearn import metrics
# purity_score computes clustering purity by:
# 1. Creating a contingency matrix from y_true and y_pred
# 2. Finding the max value in each column (axis=0)
# 3. Summing those maxes and dividing by total sum
#
# Parameters:
# - y_true: ground truth labels (array-like)
# - y_pred: predicted cluster labels (array-like)
# Create small example data
np.random.seed(0)
# Ground truth labels: 10 samples, 3 true classes
y_true = np.array([0, 0, 0, 0, 1, 1, 1, 2, 2, 2])
# Predicted clusters: 10 samples, 4 predicted clusters
y_pred = np.array([0, 0, 1, 1, 1, 2, 2, 2, 3, 3])
ARGS = {
"y_true": y_true,
"y_pred": y_pred,
}
- 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 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
|
| multiaspect_diversity |
Not yet run unverified (harvested, no recorded run) |
BobXWu/TopMost/topmost/eva/topic_diversity.py code served (permissive licence) · get_code("1079878712970146") How it ran |