| common_label_issues |
Ran ran on a synthesized input |
cleanlab/token-label-error-benchmarks/cleanlab/cleanlab/token_classification/summary.py code served (permissive licence) · get_code("9391fbc1f6e50239") 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 DataFrame. 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
import pandas as pd
# Set seed for reproducibility
np.random.seed(0)
# Create sample data
issues = [(0, 1), (1, 0), (2, 2), (0, 1), (1, 0)]
tokens = [
["A", "weird", "sentence"],
["Another", "valid", "example"],
["An", "sentence", "with", "typo"],
]
labels = [
[0, 1, 0],
[1, 0, 0],
[0, 1, 0, 1],
]
# Create pred_probs - list of arrays where each array has shape (num_tokens, num_classes)
# 3 classes, so each token gets a probability distribution over 3 classes
pred_probs = [
np.array([[0.7, 0.2, 0.1], [0.1, 0.6, 0.3], [0.8, 0.1, 0.1]]),
np.array([[0.2, 0.7, 0.1], [0.6, 0.2, 0.2], [0.5, 0.3, 0.2]]),
np.array([[0.7, 0.2, 0.1], [0.2, 0.5, 0.3], [0.1, 0.1, 0.8], [0.3, 0.6, 0.1]]),
]
class_names = ["class_0", "class_1", "class_2"]
exclude = []
ARGS = {
"issues": issues,
"tokens": tokens,
"labels": labels,
"pred_probs": pred_probs,
"class_names": class_names,
"top": 10,
"exclude": exclude,
"verbose": True,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy, pandas — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type DataFrame — a DataFrame output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DataFrame output the recorded ndim 2 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
|
| convert_long_to_wide_dataset |
Ran ran on a synthesized input |
cleanlab/token-label-error-benchmarks/cleanlab/cleanlab/multiannotator.py code served (permissive licence) · get_code("8142b45ae6cd6a3d") 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 DataFrame. 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 pandas as pd
# Create a small long-format DataFrame with the required columns: task, annotator, label
labels_multiannotator_long = pd.DataFrame({
'task': [0, 0, 0, 1, 1, 1, 2, 2, 2],
'annotator': ['annotator_1', 'annotator_2', 'annotator_3', 'annotator_1', 'annotator_2', 'annotator_3', 'annotator_1', 'annotator_2', 'annotator_3'],
'label': [1, 1, 0, 0, 0, 1, 1, 1, 1]
})
ARGS = {
'labels_multiannotator_long': labels_multiannotator_long
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- pandas — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type DataFrame — a DataFrame output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DataFrame output the recorded ndim 2 and dtype family int 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
|
| filter_by_token |
Ran ran on a synthesized input |
cleanlab/token-label-error-benchmarks/cleanlab/cleanlab/token_classification/summary.py code served (permissive licence) · get_code("d897ff0caca8b97d") 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 2, 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
import numpy as np
# Based on the function signature and docstring, we need to construct:
# 1. token: str - a specific token to filter by
# 2. issues: List[Tuple[int, int]] - list of (sentence_idx, token_idx) tuples
# 3. tokens: List[List[str]] - nested list of tokens per sentence
ARGS = {
"token": "?weird",
"issues": [(0, 1), (2, 0), (1, 2)],
"tokens": [
["A", "?weird", "sentence"],
["A", "valid", "?weird"],
["An", "?weird", "with", "a", "typo"],
],
}
- 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 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
|
| filter_sentence |
Ran ran on a synthesized input |
cleanlab/token-label-error-benchmarks/cleanlab/cleanlab/internal/token_classification_utils.py code served (permissive licence) · get_code("a137b9e19b47c3c5") 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. 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 numpy as np
from typing import List, Optional, Callable, Tuple
torch.manual_seed(0)
# Define test sentences
sentences = [
"Short sentence.",
"This is a longer sentence.",
"# Headline",
"&",
"Another test sentence here."
]
# Define a condition function that filters based on word count
condition = lambda x: len(x.split()) > 2
# Construct the ARGS dictionary
ARGS = {
"sentences": sentences,
"condition": condition
}
- 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 tuple — a tuple 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
|
| find_notebooks |
Ran ran on a synthesized input |
cleanlab/token-label-error-benchmarks/cleanlab/.ci/nblint.py code served (permissive licence) · get_code("1b2e1aa3ef515881") 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 set. 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 shutil
# Create temporary directories with some test notebook files
temp_base = tempfile.mkdtemp()
test_dir1 = os.path.join(temp_base, "notebooks1")
test_dir2 = os.path.join(temp_base, "notebooks2")
os.makedirs(test_dir1)
os.makedirs(test_dir2)
# Create subdirectories
subdir1 = os.path.join(test_dir1, "subdir")
os.makedirs(subdir1)
# Create some test notebook files
open(os.path.join(test_dir1, "notebook1.ipynb"), "w").close()
open(os.path.join(test_dir1, "notebook2.ipynb"), "w").close()
open(os.path.join(subdir1, "notebook3.ipynb"), "w").close()
open(os.path.join(test_dir2, "notebook4.ipynb"), "w").close()
# Create some non-notebook files that should be ignored
open(os.path.join(test_dir1, "readme.txt"), "w").close()
open(os.path.join(test_dir1, "script.py"), "w").close()
ARGS = {
"dirs": [test_dir1, test_dir2]
}
- 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 set — a set output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a set 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
|
| get_normalized_entropy |
Ran ran on a synthesized input |
cleanlab/token-label-error-benchmarks/cleanlab/cleanlab/internal/label_quality_utils.py code served (permissive licence) · get_code("da55361b346af336") 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 ndarray, ndim 1, dtype family float, shape (2,) 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
# Create valid arguments for get_normalized_entropy
# The function expects pred_probs as an ndarray of predicted probabilities
# Shape should be (num_examples, num_classes)
# Create a small example with 2 examples and 4 classes
pred_probs = np.array([
[0.7, 0.2, 0.05, 0.05], # high confidence in class 0
[0.25, 0.25, 0.25, 0.25] # uniform distribution (high entropy)
], dtype=np.float32)
min_allowed_prob = 1e-06
ARGS = {
"pred_probs": pred_probs,
"min_allowed_prob": min_allowed_prob,
}
- 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 ndarray, ndim 1, dtype family float, shape (2,) — shape (2,) 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
|
| get_pred_probs |
Ran ran on a synthesized input |
cleanlab/token-label-error-benchmarks/utils.py code served (permissive licence) · get_code("431baab68c830367") 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 ndarray, ndim 2, dtype family float, shape (4, 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 numpy as np
# Set random seed for reproducibility
np.random.seed(0)
# Create sample data for the function
# scores: np.array with shape (N', K) where N' is number of tokenizer tokens, K is number of classes
# Let's say we have 5 tokenizer tokens and 3 classes
scores = np.random.rand(5, 3).astype(np.float32)
# tokens: list of tokenizer-generated tokens (subword tokens)
# These represent how a tokenizer might break up a sentence
tokens = ['Hello', 'world', '##ing', 'is', 'great']
# given_token: list of original word-level tokens
# These are longer tokens that need to be reconstructed from subword tokens
# For example, "Hello" (1 char), "world" (5 chars), "ing" (3 chars) to reconstruct "worlding"
given_token = ['Hello', 'worlding', 'is', 'great']
# weighted: boolean flag
weighted = False
ARGS = {
'scores': scores,
'tokens': tokens,
'given_token': given_token,
'weighted': weighted
}
- 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 ndarray, ndim 2, dtype family float, shape (4, 3) — shape (4, 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
|
| get_sentence |
Ran ran on a synthesized input |
cleanlab/token-label-error-benchmarks/cleanlab/cleanlab/internal/token_classification_utils.py code served (permissive licence) · get_code("cf32c69cd3e18509") 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 str. 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 string
from typing import List
torch_imported = False
try:
import torch
torch_imported = True
torch.manual_seed(0)
except ImportError:
pass
# Construct valid arguments for get_sentence
words = ["This", "is", "a", "sentence", "."]
ARGS = {
"words": words
}
- 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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
|
| issues_from_scores |
Ran ran on a synthesized input |
cleanlab/token-label-error-benchmarks/cleanlab/cleanlab/token_classification/rank.py code served (permissive licence) · get_code("619c6dda82b1fef1") 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 ndarray, ndim 1, dtype family int, shape (2,) 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
# Test case 1: Basic sentence scores without token scores
sentence_scores_1 = np.array([0.1, 0.3, 0.6, 0.2, 0.05, 0.9, 0.8, 0.0125, 0.5, 0.6])
# Test case 2: Sentence scores with token scores
sentence_scores_2 = np.array([0.5, 0.1, 0.7, 0.15, 0.2, 0.25, 0.35, 0.55, 0.12, 0.65])
token_scores_2 = [
[0.9, 0.6],
[0.0, 0.8, 0.8],
[0.8, 0.8],
[0.1, 0.02, 0.3, 0.4],
[0.1, 0.2, 0.03, 0.4],
[0.1, 0.2, 0.3, 0.04],
[0.1, 0.2, 0.4],
[0.3, 0.4],
[0.08, 0.2, 0.5, 0.4],
[0.1, 0.2, 0.3, 0.4],
]
# Construct ARGS for the function
ARGS = {
"sentence_scores": sentence_scores_1,
"token_scores": None,
"threshold": 0.1,
}
- 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 ndarray, ndim 1, dtype family int, shape (2,) — shape (2,) 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
|
| process_token |
Ran ran on a synthesized input |
cleanlab/token-label-error-benchmarks/cleanlab/cleanlab/internal/token_classification_utils.py code served (permissive licence) · get_code("0c72d7c3e3f80747") 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 str. 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 re
from typing import List, Tuple
# Test case 1: Default behavior - remove '#' from tokens
token_1 = "#Comment"
replace_1 = [('#', '')]
# Test case 2: Custom replacement rules
token_2 = "Cleanlab"
replace_2 = [("C", "a"), ("a", "C")]
# Test case 3: Multiple replacements
token_3 = "hello#world@test"
replace_3 = [('#', ''), ('@', '_')]
# Test case 4: Empty replacements list
token_4 = "unchanged"
replace_4 = []
# Test case 5: Complex replacement patterns
token_5 = "test123"
replace_5 = [('1', 'x'), ('2', 'y'), ('3', 'z')]
# Using the first test case as the main ARGS
ARGS = {
"token": "#Comment",
"replace": [('#', '')]
}
- 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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
|
| readfile |
Ran ran on a synthesized input |
cleanlab/token-label-error-benchmarks/utils.py code served (permissive licence) · get_code("4a2ea73644772367") 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 3, 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 tempfile
import os
# Create a temporary CoNLL format file for testing
temp_file = tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.txt')
temp_file.write("John B-PER\n")
temp_file.write("Smith I-PER\n")
temp_file.write("works O\n")
temp_file.write("at O\n")
temp_file.write("Google B-ORG\n")
temp_file.write("\n")
temp_file.write("He O\n")
temp_file.write("lives O\n")
temp_file.write("in O\n")
temp_file.write("New B-LOC\n")
temp_file.write("York I-LOC\n")
temp_file.flush()
temp_filepath = temp_file.name
temp_file.close()
ARGS = {
'filepath': temp_filepath,
'sep': ' '
}
- 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 tuple, ndim 3, 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
|
| get_probs |
Not yet run unverified (harvested, no recorded run) |
cleanlab/token-label-error-benchmarks/utils.py code served (permissive licence) · get_code("3c41a5bdbdfce314") How it ran |