SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2206.12088 · 2022

Classifying Unstructured Clinical Notes via Automatic Weak Supervision

arXiv · PDF · Open in the Atlas

Code that ran

8 of 9 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 8 have no contract verdict; 0 failures of our instrument; 1 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/2206.12088.json · badge: /api/ran/2206.12088.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
autonlab/KeyClass canonical (classifier label)
classifier basis not recorded on the link
8 ran · 1 no recorded run
FunctionStatusWhere it lives
assign_categories_to_keywords Ran
ran on a synthesized input
autonlab/KeyClass/keyclass/create_lfs.py
code served (permissive licence) · get_code("1b4e0d59af9067ec")
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 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 numpy as np

np.random.seed(0)

# Parameters:
# - vocabulary: array of vocabulary words (used with mask indexing)
# - vocabulary_embeddings: embeddings for each vocabulary word (shape: n_vocab x embedding_dim)
# - label_embeddings: embeddings for each label/category (shape: n_labels x embedding_dim)
# - word_indicator_matrix: matrix indicating word presence (shape: n_docs x n_vocab, indexed with column mask)
# - cutoff: optional distance threshold
# - topk: optional top-k parameter
# - min_topk: boolean flag

# Create small test data
n_vocab = 5
n_labels = 3
embedding_dim = 4
n_docs = 2

vocabulary = np.array(['apple', 'banana', 'cherry', 'date', 'elderberry'])
vocabulary_embeddings = np.random.randn(n_vocab, embedding_dim).astype(np.float32)
label_embeddings = np.random.randn(n_labels, embedding_dim).astype(np.float32)
word_indicator_matrix = np.random.randint(0, 2, size=(n_docs, n_vocab)).astype(np.float32)

ARGS = {
    'vocabulary': vocabulary,
    'vocabulary_embeddings': vocabulary_embeddings,
    'label_embeddings': label_embeddings,
    'word_indicator_matrix': word_indicator_matrix,
    'cutoff': None,
    'topk': 2,
    'min_topk': True,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — 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
compute_metrics Ran
ran on a synthesized input
autonlab/KeyClass/keyclass/utils.py
code served (permissive licence) · get_code("0f5512a4db9b8c25")
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 1, 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 small numpy arrays for predictions and ground truth
np.random.seed(0)

# Create predictions and ground truth labels for a multiclass classification problem
# Using 3 samples with labels in range [0, 2] (3 classes)
y_preds = np.array([0, 1, 2, 1, 0, 2])
y_true = np.array([0, 1, 1, 1, 0, 2])

ARGS = {
    'y_preds': y_preds,
    'y_true': y_true,
    'average': 'weighted'
}
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 list, ndim 1, 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
compute_metrics_bootstrap Ran
ran on a synthesized input
autonlab/KeyClass/keyclass/utils.py
code served (permissive licence) · get_code("fa93a4fbdfbc3f4a")
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 ndarray, ndim 2, dtype family float, shape (3, 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
import joblib
from sklearn.metrics import precision_score, recall_score

np.random.seed(0)

# Create small sample predictions and ground truth labels
# Using multiclass classification with 3 classes
n_samples = 20
y_preds = np.array([0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 
                     1, 2, 0, 1, 2, 0, 1, 2, 0, 1])
y_true = np.array([0, 1, 2, 0, 1, 1, 0, 2, 2, 0, 
                    1, 2, 0, 1, 2, 0, 1, 1, 0, 2])

ARGS = {
    'y_preds': y_preds,
    'y_true': y_true,
    'average': 'weighted',
    'n_bootstrap': 10,
    'n_jobs': 2
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
joblib, numpy, sklearn — 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 (3, 2) — shape (3, 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
create_label_matrix Ran
ran on a synthesized input
autonlab/KeyClass/keyclass/create_lfs.py
code served (permissive licence) · get_code("3a2f3d189a4784b7")
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 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

# Create sample arguments for create_label_matrix

# word_indicator_matrix: a 2D numpy array where 0 and non-zero values indicate presence/absence
# Shape: (num_documents, num_keywords) = (4, 3)
word_indicator_matrix = np.array([
    [1, 0, 1],
    [0, 1, 0],
    [1, 1, 1],
    [0, 0, 1]
], dtype=int)

# keywords: list of keyword column names
keywords = ["keyword_A", "keyword_B", "keyword_C"]

# assigned_category: array of category assignments for each keyword
# Length must match number of columns in word_indicator_matrix
assigned_category = np.array([10, 20, 30])

ARGS = {
    "word_indicator_matrix": word_indicator_matrix,
    "keywords": keywords,
    "assigned_category": assigned_category
}
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 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
get_balanced_data_mask Ran
ran on a synthesized input
autonlab/KeyClass/keyclass/utils.py
code served (permissive licence) · get_code("a219a30234693f6b")
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 ndarray, ndim 1, dtype family float, shape (10,) 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 sample probabilistic predictions
# Shape: (n_samples, n_classes)
# Let's use 10 samples and 3 classes
np.random.seed(0)
proba_preds = np.random.dirichlet(np.ones(3), size=10)

# max_num: maximum number of data points per class
max_num = 5

# class_balance: prevalence of each class (must sum to 1)
class_balance = np.array([0.5, 0.3, 0.2])

ARGS = {
    "proba_preds": proba_preds,
    "max_num": max_num,
    "class_balance": class_balance,
}
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 (10,) — shape (10,) 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_q_soft Ran
ran on a synthesized input
autonlab/KeyClass/keyclass/train_classifier.py
code served (permissive licence) · get_code("3699b8e80bbf3398")
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 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

# Create a small prediction matrix
# Shape: (n_samples, n_clusters) = (4, 3)
# Each row should sum to 1 (valid probability distribution)
p = np.array([
    [0.7, 0.2, 0.1],
    [0.1, 0.8, 0.1],
    [0.2, 0.1, 0.7],
    [0.6, 0.3, 0.1]
], dtype=np.float32)

# Ensure rows sum to 1
p = p / p.sum(axis=1, keepdims=True)

ARGS = {
    "p": p
}
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
self_train Ran
ran on a synthesized input
autonlab/KeyClass/keyclass/train_classifier.py
code served (permissive licence) · get_code("d477aabbf7a48b79")
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 MockModel. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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
import numpy as np

torch.manual_seed(0)
np.random.seed(0)

class MockModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, X, mode='normal', raw_text=False):
        # Convert list of strings to dummy tensor
        if isinstance(X, list) and len(X) > 0 and isinstance(X[0], str):
            batch_size = len(X)
        else:
            batch_size = len(X) if isinstance(X, (list, np.ndarray)) else X.shape[0]
        
        # Return log probabilities for KLDivLoss
        dummy_input = torch.randn(batch_size, 4)
        output = torch.nn.functional.log_softmax(self.linear(dummy_input), dim=1)
        return output
    
    def predict_proba(self, X, batch_size=32, raw_text=False):
        # Return probability distribution over classes
        if isinstance(X, list):
            num_samples = len(X)
        else:
            num_samples = len(X)
        
        # Return 3-class probabilities
        proba = np.random.dirichlet([1, 1, 1], size=num_samples)
        return proba
    
    def predict(self, X):
        # Return class predictions
        if isinstance(X, list):
            num_samples = len(X)
        else:
            num_samples = len(X)
        
        return np.random.randint(0, 3, size=num_samples)

model = MockModel()

# Create small dummy datasets
X_train = ["text sample 1", "text sample 2", "text sample 3", "text sample 4"]
X_val = ["val sample 1", "val sample 2"]
y_val = np.array([0, 1])

ARGS = {
    'model': model,
    'X_train': X_train,
    'X_val': X_val,
    'y_val': y_val,
    'device': torch.device('cpu'),
    'lr': 1e-5,
    'weight_decay': 0.0001,
    'batch_size': 2,
    'q_update_interval': 2,
    'patience': 3,
    'self_train_thresh': 0.998,
    'print_eval': True,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch, tqdm — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type MockModel — a MockModel output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a MockModel 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
train Ran
ran on a synthesized input
autonlab/KeyClass/keyclass/train_classifier.py
code served (permissive licence) · get_code("e5a3acc3722b593e")
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 SimpleModel. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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
import numpy as np

torch.manual_seed(0)

# Define a minimal model that satisfies the function's usage
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.fc1 = nn.Linear(4, 3)
        self.fc2 = nn.Linear(3, 2)
    
    def forward(self, x, mode='inference', raw_text=False):
        # The function calls model.forward(batch_x, mode='inference', raw_text=raw_text)
        if raw_text:
            # For raw text, x would be strings, just return dummy output
            return torch.randn(len(x) if isinstance(x, list) else x.shape[0], 2)
        else:
            # For tensor input
            x = self.fc1(x)
            x = torch.relu(x)
            x = self.fc2(x)
            return x

model = SimpleModel()

# Training data - small tensors
X_train = torch.randn(6, 4)  # 6 samples, 4 features
y_train = np.array([0, 1, 0, 1, 0, 1])  # 6 labels

# Sample weights - optional
sample_weights = np.array([1.0, 1.0, 1.0, 1.0, 1.0, 1.0])

# Device - CPU only
device = torch.device('cpu')

# Criterion
criterion = nn.CrossEntropyLoss(reduction='none')

ARGS = {
    'model': model,
    'X_train': X_train,
    'y_train': y_train,
    'device': device,
    'sample_weights': sample_weights,
    'epochs': 2,
    'batch_size': 2,
    'criterion': criterion,
    'raw_text': False,
    'lr': 0.001,
    'weight_decay': 0.0001,
    'patience': 2
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch, tqdm — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type SimpleModel — a SimpleModel output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a SimpleModel 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_vocabulary Not yet run
unverified (harvested, no recorded run)
autonlab/KeyClass/keyclass/create_lfs.py
code served (permissive licence) · get_code("5e3d4b993b102216")
How it ran

no invocation recorded.

Also present in other papers' code

Of 9 samples lifted from this paper's linked repositories, 9 carry a function identity and 0 do not. Of the 9 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 9 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-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

Healthcare providers usually record detailed notes of the clinical care delivered to each patient for clinical, research, and billing purposes. Due to the unstructured nature of these narratives, providers employ dedicated staff to assign diagnostic codes to patients' diagnoses using the International Classification of Diseases (ICD) coding system. This manual process is not only time-consuming but also costly and error-prone. Prior work demonstrated potential utility of Machine Learning (ML) methodology in automating this process, but it has relied on large quantities of manually labeled data to train the models. Additionally, diagnostic coding systems evolve with time, which makes traditional supervised learning strategies unable to generalize beyond local applications. In this work, we introduce a general weakly-supervised text classification framework that learns from class-label descriptions only, without the need to use any human-labeled documents. It leverages the linguistic domain knowledge stored within pre-trained language models and the data programming framework to assign code labels to individual texts. We demonstrate the efficacy and flexibility of our method by comparing it to state-of-the-art weak text classifiers across four real-world text classification datasets, in addition to assigning ICD codes to medical notes in the publicly available MIMIC-III database.

For agents

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

get_harvested_code_for_paper("2206.12088")
get_code_for_paper("2206.12088")
have("2206.12088")

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

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

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

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

Connect an agent — have() is free.