SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2105.07542 · IJCAI · 2021

Collaborative Graph Learning with Auxiliary Text for Temporal Event Prediction in Healthcare

Chandan Reddy, Chang Lu, Yue Ning, Prithwish Chakraborty, Samantha Kleinberg

arXiv · PDF · Open in the Atlas

Code that ran

14 of 16 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (8 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 2 violated it and 11 have no contract verdict; 0 failures of our instrument; 2 no recorded run), measured 2026-11-22; 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/2105.07542.json · badge: /api/ran/2105.07542.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
LuChang-CS/CGL marked official in Papers with Code
Papers with Code archive
14 ran · 2 no recorded run
FunctionStatusWhere it lives
Attention Ran
ran on a synthesized input
LuChang-CS/CGL/models/model.py
code served (permissive licence) · get_code("926c550cbbfdfac9")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) 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 tensorflow as tf
from tensorflow.keras.layers import Layer, Dense, Concatenate
from tensorflow.keras.initializers import GlorotUniform

def masked_softmax(inputs, mask):
    inputs = inputs - tf.reduce_max(inputs, keepdims=True, axis=-1)
    exp = tf.exp(inputs) * mask
    result = tf.math.divide_no_nan(exp, tf.reduce_sum(exp, keepdims=True, axis=-1))
    return result

class Attention(Layer):

    def __init__(self, attention_dim, name='attention'):
        super().__init__(name=name)
        self.attention_dim = attention_dim
        self.u_omega = self.add_weight(name=name + '_u', shape=(attention_dim,), initializer=GlorotUniform())
        self.w_omega = None

    def build(self, input_shape):
        hidden_size = input_shape[-1]
        self.w_omega = self.add_weight(name=self.name + '_w', shape=(hidden_size, self.attention_dim), initializer=GlorotUniform())

    def call(self, x, mask=None):
        """
            x: (batch_size, max_seq_len, rnn_dim[-1] / hidden_size)
        """
        t = tf.matmul(x, self.w_omega)
        vu = tf.tensordot(t, self.u_omega, axes=1)
        if mask is not None:
            vu *= mask
            alphas = masked_softmax(vu, mask)
        else:
            alphas = tf.nn.softmax(vu)
        output = tf.reduce_sum(x * tf.expand_dims(alphas, -1), axis=-2)
        return (output, alphas)


INIT_ARGS = {
    'attention_dim': 3,
    'name': 'attention'
}

ARGS = {
    'x': tf.random.normal((2, 5, 4)),
    'mask': None
}

if __name__ == '__main__':
    attention_layer = Attention(**INIT_ARGS)
    output, alphas = attention_layer(**ARGS)
    print("Output shape:", output.shape)
    print("Alphas shape:", alphas.shape)
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
tensorflow — 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
Classifier Ran
ran on a synthesized input · constructed an object; no result was computed
LuChang-CS/CGL/models/model.py
code served (permissive licence) · get_code("0a584d6741a3053f")
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 an instance of its own class, Classifier: the run constructed the object and did not call it, so no result was computed. 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 tensorflow as tf
from tensorflow.keras.layers import Layer, Dense, Concatenate
import numpy as np

class Classifier(Layer):

    def __init__(self, output_dim, activation=None, name='classifier'):
        super().__init__(name=name)
        self.dense = Dense(output_dim, activation=activation)
        self.dropout = tf.keras.layers.Dropout(0.2)

    def call(self, x):
        x = self.dropout(x)
        output = self.dense(x)
        return output

ARGS = {
    'output_dim': 8,
    'activation': None,
    'name': 'classifier'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Classifier — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a Classifier 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
GraphConvBlock Ran
ran on a synthesized input · constructed an object; no result was computed
LuChang-CS/CGL/models/model.py
code served (permissive licence) · get_code("bfa19a1c1dba8766")
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 an instance of its own class, GraphConvBlock: the run constructed the object and did not call it, so no result was computed. 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 tensorflow as tf
import numpy as np

# Set random seed for reproducibility
tf.random.set_seed(0)
np.random.seed(0)

# Create small tensors for the arguments
# embedding: shape (num_nodes, embedding_dim)
embedding = tf.constant([[1.0, 2.0, 3.0, 4.0],
                         [5.0, 6.0, 7.0, 8.0]], dtype=tf.float32)

# embedding_neighbor: shape (num_nodes, embedding_dim)
embedding_neighbor = tf.constant([[0.5, 1.5, 2.5, 3.5],
                                   [4.5, 5.5, 6.5, 7.5]], dtype=tf.float32)

# adj: adjacency matrix shape (num_nodes, num_nodes)
adj = tf.constant([[1.0, 0.5],
                   [0.3, 1.0]], dtype=tf.float32)

# weight_decay: shape (num_nodes, num_nodes) - used only for 'code' node type
weight_decay = tf.constant([[0.1, 0.2],
                            [0.3, 0.4]], dtype=tf.float32)

# node_type parameter
node_type = 'code'

# dim parameter
dim = 4

# name parameter
name = 'graph_conv_block'

ARGS = {
    'node_type': node_type,
    'dim': dim,
    'adj': adj,
    'name': name
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type GraphConvBlock — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a GraphConvBlock 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
GraphConvolution Ran
ran on a synthesized input · constructed an object; no result was computed
LuChang-CS/CGL/models/model.py
code served (permissive licence) · get_code("64da4cb6887f7202")
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 an instance of its own class, GraphConvolution: the run constructed the object and did not call it, so no result was computed. 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 tensorflow as tf
import numpy as np

# Set seed for reproducibility
np.random.seed(0)
tf.random.set_seed(0)

# Define small dimensions
patient_dim = 4
code_dim = 5
patient_hidden_dims = [6, 7]
code_hidden_dims = [8, 9]

# Create small adjacency matrices
# patient_code_adj: (num_patients, num_codes)
num_patients = 2
num_codes = 3
patient_code_adj = tf.constant(
    np.random.rand(num_patients, num_codes).astype(np.float32)
)

# code_code_adj: (num_codes, num_codes)
code_code_adj = tf.constant(
    np.random.rand(num_codes, num_codes).astype(np.float32)
)

# Create small embedding tensors for testing
patient_embeddings = tf.constant(
    np.random.rand(num_patients, patient_dim).astype(np.float32)
)

code_embeddings = tf.constant(
    np.random.rand(num_codes, code_dim).astype(np.float32)
)

ARGS = {
    'patient_dim': patient_dim,
    'code_dim': code_dim,
    'patient_code_adj': patient_code_adj,
    'code_code_adj': code_code_adj,
    'patient_hidden_dims': patient_hidden_dims,
    'code_hidden_dims': code_hidden_dims,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type GraphConvolution — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a GraphConvolution 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
HierarchicalEmbedding Ran
ran on a synthesized input · constructed an object; no result was computed
LuChang-CS/CGL/models/model.py
code served (permissive licence) · get_code("00aafc718c485a28")
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 an instance of its own class, HierarchicalEmbedding: the run constructed the object and did not call it, so no result was computed. 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 tensorflow as tf
import numpy as np

# Set seed for reproducibility
tf.random.set_seed(0)
np.random.seed(0)

# Define the arguments for HierarchicalEmbedding
# code_levels: tensor of shape (num_codes, level_num) containing indices into each level's embedding table
# code_num_in_levels: list of integers, number of codes at each level
# code_dims: list of integers, embedding dimension for each level
# name: string identifier for the layer

# Create small example data
num_codes = 3  # number of hierarchical codes
level_num = 2  # number of levels in hierarchy

# code_levels: shape (num_codes, level_num) with indices for lookups
# Each row represents a hierarchical code path
code_levels = tf.constant([
    [0, 1],  # code 0: level 0 index 0, level 1 index 1
    [1, 0],  # code 1: level 0 index 1, level 1 index 0
    [0, 2],  # code 2: level 0 index 0, level 1 index 2
], dtype=tf.int32)

# code_num_in_levels: number of unique codes at each level
code_num_in_levels = [2, 3]  # 2 codes at level 0, 3 codes at level 1

# code_dims: embedding dimension for each level
code_dims = [4, 5]  # 4-dim embeddings at level 0, 5-dim at level 1

# name: optional layer name
name = 'hierarchical_embedding'

ARGS = {
    'code_levels': code_levels,
    'code_num_in_levels': code_num_in_levels,
    'code_dims': code_dims,
    'name': name,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type HierarchicalEmbedding — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a HierarchicalEmbedding 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
NoteAttention Ran
ran on a synthesized input
LuChang-CS/CGL/models/model.py
code served (permissive licence) · get_code("04ecf31e022aec9b")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) 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 tensorflow as tf
from tensorflow.keras.layers import Layer, Dense, Concatenate
from tensorflow.keras.initializers import GlorotUniform

def masked_softmax(inputs, mask):
    inputs = inputs - tf.reduce_max(inputs, keepdims=True, axis=-1)
    exp = tf.exp(inputs) * mask
    result = tf.math.divide_no_nan(exp, tf.reduce_sum(exp, keepdims=True, axis=-1))
    return result

class NoteAttention(Layer):

    def __init__(self, attention_dim, name='attention'):
        super().__init__(name=name)
        self.attention_dim = attention_dim
        self.w_omega = None

    def build(self, input_shape):
        hidden_size = input_shape[-1]
        self.w_omega = self.add_weight(name=self.name + '_w', shape=(hidden_size, self.attention_dim), initializer=GlorotUniform())

    def call(self, x, ctx_vector, mask=None):
        """
            x: (batch_size, max_seq_len, rnn_dim[-1] / hidden_size)
        """
        t = tf.matmul(x, self.w_omega)
        vu = tf.reduce_sum(t * tf.expand_dims(ctx_vector, axis=1), axis=-1)
        if mask is not None:
            vu *= mask
            alphas = masked_softmax(vu, mask)
        else:
            alphas = tf.nn.softmax(vu)
        output = tf.reduce_sum(t * tf.expand_dims(alphas, -1), axis=-2)
        return (output, alphas)


INIT_ARGS = {
    'attention_dim': 3,
    'name': 'attention'
}

ARGS = {
    'x': tf.random.normal((2, 5, 4)),
    'ctx_vector': tf.random.normal((2, 3)),
    'mask': tf.ones((2, 5))
}

layer = NoteAttention(**INIT_ARGS)
output, alphas = layer(**ARGS)
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
tensorflow — 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
NoteEmbedding Ran
ran on a synthesized input
LuChang-CS/CGL/models/model.py
code served (permissive licence) · get_code("df595a3c41d43629")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) 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 tensorflow as tf
from tensorflow.keras.layers import Layer, Dense, Concatenate
from tensorflow.keras.initializers import GlorotUniform
import numpy as np

class NoteAttention(Layer):

    def __init__(self, attention_dim, name='attention'):
        super().__init__(name=name)
        self.attention_dim = attention_dim
        self.w_omega = None

    def build(self, input_shape):
        hidden_size = input_shape[-1]
        self.w_omega = self.add_weight(name=self.name + '_w', shape=(hidden_size, self.attention_dim), initializer=GlorotUniform())

    def call(self, x, ctx_vector, mask=None):
        """
            x: (batch_size, max_seq_len, rnn_dim[-1] / hidden_size)
        """
        t = tf.matmul(x, self.w_omega)
        vu = tf.reduce_sum(t * tf.expand_dims(ctx_vector, axis=1), axis=-1)
        if mask is not None:
            vu *= mask
            alphas = masked_softmax(vu, mask)
        else:
            alphas = tf.nn.softmax(vu)
        output = tf.reduce_sum(t * tf.expand_dims(alphas, -1), axis=-2)
        return (output, alphas)

def log_no_nan(x):
    mask = tf.cast(x == 0, dtype=x.dtype)
    x = x + mask
    return tf.math.log(x)

def masked_softmax(inputs, mask):
    inputs = inputs - tf.reduce_max(inputs, keepdims=True, axis=-1)
    exp = tf.exp(inputs) * mask
    result = tf.math.divide_no_nan(exp, tf.reduce_sum(exp, keepdims=True, axis=-1))
    return result

class NoteEmbedding(Layer):

    def __init__(self, attention_dim, max_seq_len, lambda_, name='note_embedding'):
        super().__init__(name=name)
        self.attention = NoteAttention(attention_dim, name=name + '_attention')
        self.max_seq_len = max_seq_len
        print(max_seq_len)
        self.lambda_ = lambda_

    def call(self, word_embeddings, word_lens, visit_output, tf_idf=None, training=True):
        word_mask = tf.sequence_mask(word_lens, self.max_seq_len, dtype=word_embeddings.dtype)
        word_embeddings = word_embeddings * tf.expand_dims(word_mask, axis=-1)
        outputs, alphas = self.attention(word_embeddings, visit_output, word_mask)
        if training:
            loss = alphas * log_no_nan(tf_idf) + (1 - alphas) * log_no_nan(1 - tf_idf)
            loss = -self.lambda_ * tf.reduce_mean(tf.reduce_sum(loss, axis=-1))
            self.add_loss(loss)
        return (outputs, alphas)


INIT_ARGS = {
    'attention_dim': 3,
    'max_seq_len': 5,
    'lambda_': 0.5,
    'name': 'note_embedding'
}

batch_size = 2
max_seq_len = 5
hidden_size = 4
attention_dim = 3

word_embeddings = tf.constant(np.random.randn(batch_size, max_seq_len, hidden_size), dtype=tf.float32)
word_lens = tf.constant([3, 4], dtype=tf.int32)
visit_output = tf.constant(np.random.randn(batch_size, attention_dim), dtype=tf.float32)
tf_idf = tf.constant(np.random.uniform(0.1, 0.9, (batch_size, max_seq_len)), dtype=tf.float32)

ARGS = {
    'word_embeddings': word_embeddings,
    'word_lens': word_lens,
    'visit_output': visit_output,
    'tf_idf': tf_idf,
    'training': True
}

METHOD = 'call'

layer = NoteEmbedding(**INIT_ARGS)
result = layer(**ARGS)
print("Output shape:", result[0].shape)
print("Alphas shape:", result[1].shape)
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
numpy, tensorflow — 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
PatientEmbedding Ran
ran on a synthesized input · constructed an object; no result was computed
LuChang-CS/CGL/models/model.py
code served (permissive licence) · get_code("5f870665d46a9475")
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 an instance of its own class, PatientEmbedding: the run constructed the object and did not call it, so no result was computed. 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 tensorflow as tf
from tensorflow.keras.layers import Layer, Dense, Concatenate
from tensorflow.keras.initializers import GlorotUniform

# Define the PatientEmbedding class
class PatientEmbedding(Layer):
    def __init__(self, patient_num, patient_dim, name='patient_embedding'):
        super().__init__(name=name)
        self.patient_embeddings = self.add_weight(
            name='p_emb',
            shape=(patient_num, patient_dim),
            initializer=GlorotUniform(),
            trainable=True
        )

    def call(self, inputs=None):
        return self.patient_embeddings


# Define arguments for PatientEmbedding.__init__
ARGS = {
    'patient_num': 10,
    'patient_dim': 4,
    'name': 'patient_embedding'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type PatientEmbedding — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a PatientEmbedding 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
TemporalEmbedding Ran
ran on a synthesized input · constructed an object; no result was computed
LuChang-CS/CGL/models/model.py
code served (permissive licence) · get_code("587eea04970d520a")
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 an instance of its own class, TemporalEmbedding: the run constructed the object and did not call it, so no result was computed. 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 tensorflow as tf
from tensorflow.keras.layers import GRUCell
import numpy as np

# Set seed for reproducibility
np.random.seed(0)
tf.random.set_seed(0)

# Define small test data
batch_size = 2
max_seq_len = 5
embedding_dim = 4
rnn_dim_1 = 3
rnn_dim_2 = 2
attention_dim = 3

# Create arguments dictionary
ARGS = {
    'rnn_dims': [rnn_dim_1, rnn_dim_2],
    'attention_dim': attention_dim,
    'max_seq_len': max_seq_len,
    'cell_type': GRUCell,
    'name': 'temporal_embedding'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type TemporalEmbedding — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a TemporalEmbedding 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
VisitEmbedding Ran
ran on a synthesized input · constructed an object; no result was computed
LuChang-CS/CGL/models/model.py
code served (permissive licence) · get_code("a16881965bbed81d")
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 an instance of its own class, VisitEmbedding: the run constructed the object and did not call it, so no result was computed. 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 tensorflow as tf
import numpy as np

# Define the VisitEmbedding layer
class VisitEmbedding(tf.keras.layers.Layer):

    def __init__(self, max_seq_len, name='visit_embedding'):
        super().__init__(name=name)
        self.max_seq_len = max_seq_len

    def call(self, code_embeddings, visit_codes, visit_lens):
        """
            visit_codes: (batch_size, max_seq_len, max_code_num_in_a_visit)
        """
        visit_codes_embedding = tf.nn.embedding_lookup(code_embeddings, visit_codes)
        visit_codes_mask = tf.expand_dims(visit_codes > 0, axis=-1)
        visit_codes_mask = tf.cast(visit_codes_mask, visit_codes_embedding.dtype)
        visit_codes_embedding *= visit_codes_mask
        visit_codes_num = tf.expand_dims(tf.reduce_sum(tf.cast(visit_codes > 0, visit_codes_embedding.dtype), axis=-1), axis=-1)
        visits_embeddings = tf.math.divide_no_nan(tf.reduce_sum(visit_codes_embedding, axis=-2), visit_codes_num)
        visit_mask = tf.expand_dims(tf.sequence_mask(visit_lens, self.max_seq_len, dtype=visits_embeddings.dtype), axis=-1)
        visits_embeddings *= visit_mask
        return visits_embeddings


# Create tiny test data
batch_size = 2
max_seq_len = 3
max_code_num_in_a_visit = 4
embedding_dim = 5
vocab_size = 10

# code_embeddings: shape (vocab_size, embedding_dim)
code_embeddings = tf.constant(
    np.random.randn(vocab_size, embedding_dim).astype(np.float32)
)

# visit_codes: shape (batch_size, max_seq_len, max_code_num_in_a_visit)
# Values should be in range [0, vocab_size) where 0 means padding
visit_codes = tf.constant([
    [[1, 2, 3, 0], [4, 5, 0, 0], [6, 0, 0, 0]],
    [[2, 3, 4, 5], [1, 0, 0, 0], [0, 0, 0, 0]]
], dtype=tf.int32)

# visit_lens: shape (batch_size,) - length of each visit sequence
visit_lens = tf.constant([3, 2], dtype=tf.int32)

ARGS = {
    'max_seq_len': max_seq_len,
    'name': 'visit_embedding'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type VisitEmbedding — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a VisitEmbedding 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
WordEmbedding Ran
ran on a synthesized input · constructed an object; no result was computed
LuChang-CS/CGL/models/model.py
code served (permissive licence) · get_code("55d2dac86c58e686")
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 an instance of its own class, WordEmbedding: the run constructed the object and did not call it, so no result was computed. 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 tensorflow as tf
from tensorflow.keras.layers import Embedding
import numpy as np

ARGS = {
    'word_num': 100,
    'word_dim': 16,
    'embeddings_initializer': 'glorot_uniform',
    'name': 'word_embedding'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type WordEmbedding — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a WordEmbedding 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
log_no_nan Ran
ran, honoured the contract we drafted
LuChang-CS/CGL/models/model.py
code served (permissive licence) · get_code("657c92ad8df1fe7d")
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 EagerTensor, ndim 2, dtype family float, shape (2, 4) 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 tensorflow as tf
import numpy as np

def log_no_nan(x):
    mask = tf.cast(x == 0, dtype=x.dtype)
    x = x + mask
    return tf.math.log(x)

# Create a small TensorFlow tensor with some zeros and non-zero values
# Using float32 to match typical usage
x_tensor = tf.constant([
    [0.0, 1.5, 2.3, 0.0],
    [0.5, 0.0, 1.1, 2.0]
], dtype=tf.float32)

ARGS = {
    'x': x_tensor
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) 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
masked_softmax Ran
ran, violated the contract we drafted
LuChang-CS/CGL/models/model.py
code served (permissive licence) · get_code("641734132235e418")
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 EagerTensor, ndim 3, dtype family float, shape (2, 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 tensorflow as tf
import numpy as np

# Create small test tensors
batch_size = 2
seq_length = 4
vocab_size = 3

# Create input tensor: shape (batch_size, seq_length, vocab_size)
inputs = tf.constant(np.random.randn(batch_size, seq_length, vocab_size).astype(np.float32))

# Create mask tensor: same shape as inputs, with some zeros to mask out positions
mask = tf.constant(np.array([
    [[1.0, 1.0, 0.0],
     [1.0, 1.0, 1.0],
     [0.0, 1.0, 1.0],
     [1.0, 1.0, 1.0]],
    [[1.0, 1.0, 1.0],
     [1.0, 0.0, 1.0],
     [1.0, 1.0, 0.0],
     [1.0, 1.0, 1.0]]
], dtype=np.float32))

ARGS = {
    "inputs": inputs,
    "mask": mask
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, ndim 3, dtype family float, shape (2, 4, 3) — shape (2, 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
norm_no_nan Ran
ran, violated the contract we drafted
LuChang-CS/CGL/models/model.py
code served (permissive licence) · get_code("b7fb27610f18e176")
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 EagerTensor, ndim 2, dtype family float, shape (2, 4) 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 tensorflow as tf
import numpy as np

def norm_no_nan(x):
    return tf.math.divide_no_nan(x, tf.reduce_sum(x, axis=-1, keepdims=True))

# Create a small test tensor with shape (2, 4)
# This will test the normalization along the last axis
x = tf.constant([
    [1.0, 2.0, 3.0, 4.0],
    [2.0, 2.0, 2.0, 2.0]
], dtype=tf.float32)

ARGS = {
    "x": x
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) 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
CGL Not yet run
unverified (harvested, no recorded run)
LuChang-CS/CGL/models/model.py
code served (permissive licence) · get_code("7b5a6bfc404c8400")
How it ran

no invocation recorded.

CGLFeatureExtractor Not yet run
unverified (harvested, no recorded run)
LuChang-CS/CGL/models/model.py
code served (permissive licence) · get_code("c29628903ce5e056")
How it ran

no invocation recorded.

Also present in other papers' code

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

Accurate and explainable health event predictions are becoming crucial for healthcare providers to develop care plans for patients. The availability of electronic health records (EHR) has enabled machine learning advances in providing these predictions. However, many deep learning based methods are not satisfactory in solving several key challenges: 1) effectively utilizing disease domain knowledge; 2) collaboratively learning representations of patients and diseases; and 3) incorporating unstructured text. To address these issues, we propose a collaborative graph learning model to explore patient-disease interactions and medical domain knowledge. Our solution is able to capture structural features of both patients and diseases. The proposed model also utilizes unstructured text data by employing an attention regulation strategy and then integrates attentive text features into a sequential learning process. We conduct extensive experiments on two important healthcare problems to show the competitive prediction performance of the proposed method compared with various stateof-the-art models. We also confirm the effectiveness of learned representations and model interpretability by a set of ablation and case studies.

For agents

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

get_harvested_code_for_paper("2105.07542")
get_code_for_paper("2105.07542")
have("2105.07542")

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

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

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

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

Connect an agent — have() is free.