SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1808.04122 · 2018

A Capsule Network-based Embedding Model for Knowledge Graph Completion and Search Personalization

arXiv · PDF · Open in the Atlas

Code that ran

5 of 7 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, 1 violated it and 4 have no contract verdict; 0 failures of our instrument; 2 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/1808.04122.json · badge: /api/ran/1808.04122.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
daiquocnguyen/CapsE canonical (classifier label)
classifier basis: census
5 ran · 2 no recorded run
FunctionStatusWhere it lives
assignEmbeddings Ran
ran on a synthesized input
daiquocnguyen/CapsE/builddata_ecir.py
code served (permissive licence) · get_code("8254437f82bb7032")
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, 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 numpy as np

# Create lstent: a dictionary mapping words to embedding vectors
lstent = {
    "hello": np.array([0.1, 0.2, 0.3, 0.4], dtype=np.float32),
    "world": np.array([0.5, 0.6, 0.7, 0.8], dtype=np.float32),
    "test": np.array([0.9, 1.0, 1.1, 1.2], dtype=np.float32),
}

# Create word_indexes: a dictionary mapping words to their indices
word_indexes = {
    "hello": 0,
    "world": 1,
    "test": 2,
}

# Set embedding_dim
embedding_dim = 4

ARGS = {
    "lstent": lstent,
    "word_indexes": word_indexes,
    "embedding_dim": embedding_dim,
}
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 (3, 4) — shape (3, 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
init_dataset_ecir Ran
ran on a synthesized input
daiquocnguyen/CapsE/builddata_ecir.py
code served (permissive licence) · get_code("24a6fe3889b241f3")
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 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 tempfile
import os

# Create a temporary file with entity initialization data
temp_file = tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.txt')
temp_file.write("entity1 0.1 0.2 0.3\n")
temp_file.write("entity2 0.4 0.5 0.6\n")
temp_file.write("entity3 0.7 0.8 0.9\n")
temp_file.close()

ARGS = {
    'entinit': temp_file.name
}
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 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
parse_line Ran
ran on a synthesized input
daiquocnguyen/CapsE/builddata_softplus.py
code served (permissive licence) · get_code("e1642aeda2a336f1")
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 torch
import numpy as np

torch.manual_seed(0)

# parse_line takes a single parameter: line (a string)
# The function:
# 1. Strips and splits the line into tokens
# 2. Expects at least 3 tokens: subject, relation, object
# 3. Optionally checks if 4th token is '-1' to set val to [-1]
# 4. Returns a tuple of (subject, object, relation, val)

# Valid test cases for the line parameter:
line_basic = "entity1 relation1 entity2"
line_with_negative = "entity1 relation1 entity2 -1"

# Choose one for the test
ARGS = {
    "line": line_basic
}
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
read_from_id Ran
ran on a synthesized input
daiquocnguyen/CapsE/builddata_ecir.py
code served (permissive licence) · get_code("b66238861fb279c7")
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, 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 tempfile
import os

# Create a temporary file with entity2id format
temp_dir = tempfile.mkdtemp()
temp_file = os.path.join(temp_dir, 'entity2id.txt')

with open(temp_file, 'w') as f:
    f.write('entity_A 0\n')
    f.write('entity_B 1\n')
    f.write('entity_C 2\n')
    f.write('entity_D 3\n')

ARGS = {
    'filename': temp_file
}
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 1, 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
squash Ran
ran, violated the contract we drafted
daiquocnguyen/CapsE/capsuleLayer.py
code served (permissive licence) · get_code("521985ebd5591503")
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 4, dtype family float, shape (2, 3, 4, 1) 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

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

# Create a small test vector with shape [batch_size, num_caps, vec_len, 1]
# batch_size=2, num_caps=3, vec_len=4
vector_data = np.random.randn(2, 3, 4, 1).astype(np.float32)
vector = tf.constant(vector_data)

ARGS = {
    "vector": vector
}
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 4, dtype family float, shape (2, 3, 4, 1) — shape (2, 3, 4, 1) 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
init_norm_Vector Not yet run
unverified (harvested, no recorded run)
daiquocnguyen/CapsE/builddata_softplus.py
code served (permissive licence) · get_code("a4febf650e2dc53c")
How it ran

no invocation recorded.

routing Not yet run
unverified (harvested, no recorded run)
daiquocnguyen/CapsE/capsuleLayer.py
code served (permissive licence) · get_code("ec06ba2f35ee2f52")
How it ran

no invocation recorded.

Also present in other papers' code

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

FunctionAlso present inEarliest-datedOthers named
squash 2 other papers
2 later
1911.03903 (2019-11)
A Re-evaluation of Knowledge Graph Completion Methods
2008.08476 (2020-08)
NASCaps: A Framework for Neural Architecture Search to Optimize the Accuracy and Hardware Efficiency of Convolutional Capsule Networks
assignEmbeddings 1 other paper
1 later
1911.03903 (2019-11)
A Re-evaluation of Knowledge Graph Completion Methods
init_dataset_ecir 1 other paper
1 later
1911.03903 (2019-11)
A Re-evaluation of Knowledge Graph Completion Methods
init_norm_Vector 1 other paper
1 later
1911.03903 (2019-11)
A Re-evaluation of Knowledge Graph Completion Methods
parse_line 1 other paper
1 later
1911.03903 (2019-11)
A Re-evaluation of Knowledge Graph Completion Methods
read_from_id 1 other paper
1 later
1911.03903 (2019-11)
A Re-evaluation of Knowledge Graph Completion Methods
routing 1 other paper
1 later
1911.03903 (2019-11)
A Re-evaluation of Knowledge Graph Completion Methods

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

In this paper, we introduce an embedding model, named CapsE, exploring a capsule network to model relationship triples (subject, relation, object). Our CapsE represents each triple as a 3-column matrix where each column vector represents the embedding of an element in the triple. This 3-column matrix is then fed to a convolution layer where multiple filters are operated to generate different feature maps. These feature maps are reconstructed into corresponding capsules which are then routed to another capsule to produce a continuous vector. The length of this vector is used to measure the plausibility score of the triple. Our proposed CapsE obtains better performance than previous state-of-the-art embedding models for knowledge graph completion on two benchmark datasets WN18RR and FB15k-237, and outperforms strong search personalization baselines on SEARCH17.

For agents

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

get_harvested_code_for_paper("1808.04122")
get_code_for_paper("1808.04122")
have("1808.04122")

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

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

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

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

Connect an agent — have() is free.