SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1205.2618 · 2012

BPR: Bayesian Personalized Ranking from Implicit Feedback

arXiv · PDF · Open in the Atlas

Code that ran

20 of 24 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 19 have no contract verdict; 1 failure of our instrument; 4 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/1205.2618.json · badge: /api/ran/1205.2618.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
jchanxtarov/BPRMF community (classifier label)
classifier basis not recorded on the link
6 ran · 0 no recorded run
EternalImmortal/bpr community (classifier label)
classifier basis not recorded on the link
6 ran · 0 no recorded run
benfred/implicit community (classifier label)
classifier basis not recorded on the link
5 ran · 4 no recorded run
SeongJinAhn/BPR community (classifier label)
classifier basis not recorded on the link
3 ran · 0 no recorded run
FunctionStatusWhere it lives
augment_inner_product_matrix Ran
ran on a synthesized input
benfred/implicit/implicit/utils.py
code served (permissive licence) · get_code("3f1895c1b7979ccc")
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

# Create a small factor matrix with shape (2, 4)
# 2 rows (items), 4 dimensions (features)
factors = np.array([
    [1.0, 2.0, 3.0, 0.5],
    [2.0, 1.0, 0.5, 1.5]
], dtype=np.float32)

ARGS = {
    "factors": factors
}
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 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
bm25_weight Ran
ran on a synthesized input
benfred/implicit/implicit/nearest_neighbours.py
code served (permissive licence) · get_code("4d0dbf9cb7e9445e")
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 coo_matrix. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np
from scipy.sparse import coo_matrix, csr_matrix

# Create a small sparse matrix for testing
# Using a 4x3 matrix with some non-zero entries
row_indices = np.array([0, 0, 1, 2, 2, 3])
col_indices = np.array([0, 1, 1, 0, 2, 1])
data = np.array([5, 3, 2, 1, 4, 6], dtype=float)
X = coo_matrix((data, (row_indices, col_indices)), shape=(4, 3))

ARGS = {
    "X": X,
    "K1": 100,
    "B": 0.8
}
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 coo_matrix — a coo_matrix output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a coo_matrix 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
check_csr Ran
ran on a synthesized input
benfred/implicit/implicit/utils.py
code served (permissive licence) · get_code("5a6933738d307e97")
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 csr_matrix. 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 scipy.sparse
import numpy as np

# Create a small sparse matrix in COO format (not CSR)
# This will test the conversion path in check_csr
row = np.array([0, 1, 2])
col = np.array([0, 1, 2])
data = np.array([1, 2, 3])
coo_matrix = scipy.sparse.coo_matrix((data, (row, col)), shape=(3, 3))

ARGS = {
    'user_items': coo_matrix
}
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 csr_matrix — a csr_matrix output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a csr_matrix output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
compute_hit Ran
ran on a synthesized input
jchanxtarov/BPRMF/src/utils/metrics.py
code served (permissive licence) · get_code("d7f1a1d88c632dba")
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 a small hits matrix
# Shape: (num_samples, num_items)
# Each row represents whether an item was hit (1) or not (0)
hits = np.array([
    [1, 0, 1, 0],
    [0, 1, 1, 1],
], dtype=np.float32)

# List of k values to compute hits@k for
list_k = [1, 2, 3]

ARGS = {
    "hits": hits,
    "list_k": list_k,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family 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 Ran
ran on a synthesized input
jchanxtarov/BPRMF/src/utils/metrics.py
code served (permissive licence) · get_code("73699d47e9c0ff00")
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. 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 numpy as np
import torch as th

th.manual_seed(0)

# Small dimensions: users=2, items=4
num_users = 2
num_items = 4

# Create matrix_scores as a torch tensor (2 users x 4 items)
matrix_scores = th.randn(num_users, num_items)

# Create dict_train_cf: user -> list of item indices they interacted with in training
dict_train_cf = {
    0: [0],      # user 0 has item 0 in training set
    1: [1, 2]    # user 1 has items 1, 2 in training set
}

# Create dict_test_cf: user -> list of item indices they interacted with in test set
dict_test_cf = {
    0: [2, 3],   # user 0 has items 2, 3 in test set
    1: [0, 3]    # user 1 has items 0, 3 in test set
}

# Users list
users = [0, 1]

# Items list
items = [0, 1, 2, 3]

# list_k: different cutoff values for metrics
list_k = [1, 2]

# is_predict flag
is_predict = False

ARGS = {
    'matrix_scores': matrix_scores,
    'dict_train_cf': dict_train_cf,
    'dict_test_cf': dict_test_cf,
    'users': users,
    'items': items,
    'list_k': list_k,
    'is_predict': is_predict
}
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
compute_precision Ran
ran on a synthesized input
jchanxtarov/BPRMF/src/utils/metrics.py
code served (permissive licence) · get_code("ddc18fe321d7784d")
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 a small hits array
# Shape: (batch_size=2, num_items=4)
# Each row represents hits (binary indicators) for a user
# Values should be 0 or 1 to represent hit/miss
hits = np.array([
    [1, 0, 1, 0],
    [1, 1, 0, 1]
], dtype=np.float32)

# Create a list of k values to compute precision at
list_k = [1, 2, 3]

ARGS = {
    "hits": hits,
    "list_k": list_k
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family 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
convert_unique_idx Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
EternalImmortal/bpr/preprocess.py
pointer only (licence: MIT); the stored copy get_code serves, from haolun-wu/jmefairness, is pointer only (licence: NONE) · get_code("8620a395f0a3a8ad")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from haolun-wu/jmefairness, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

convert_unique_idx Ran
ran on a synthesized input
SeongJinAhn/BPR/preprocess.py
code served (permissive licence) · get_code("3929b413a89c4ecb")
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 pandas as pd

# Create a simple DataFrame with a column containing categorical values
df = pd.DataFrame({
    'category': ['apple', 'banana', 'apple', 'cherry', 'banana', 'date']
})

ARGS = {
    'df': df,
    'column_name': 'category'
}
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
create_user_list Ran
ran on a synthesized input
EternalImmortal/bpr/preprocess.py
code served (permissive licence) · get_code("6fe5b45c50694d2f")
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. 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 dataframe with user, time, and item columns
df = pd.DataFrame({
    'user': [0, 1, 0, 1, 0],
    'time': [100, 200, 150, 250, 175],
    'item': ['item_a', 'item_b', 'item_c', 'item_d', 'item_e']
})

user_size = 2

ARGS = {
    'df': df,
    'user_size': user_size
}
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 list — a list 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
create_user_list Ran
ran on a synthesized input
SeongJinAhn/BPR/preprocess.py
code served (permissive licence) · get_code("c55ef60f63b830d2")
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 pandas as pd

# Create a small DataFrame with the required columns: 'user', 'item', 'time'
df = pd.DataFrame({
    'user': [0, 0, 1, 1, 2],
    'item': ['item_a', 'item_b', 'item_c', 'item_d', 'item_a'],
    'time': [100, 200, 150, 250, 175]
})

user_size = 3

ARGS = {
    'df': df,
    'user_size': user_size
}
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 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
generate_path_log_file Ran
ran on a synthesized input
jchanxtarov/BPRMF/src/utils/helpers.py
code served (permissive licence) · get_code("f25788e7d11a876a")
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 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 torch

ARGS = {
    'name_data': 'cifar10',
    'name_model': 'resnet18',
    'uniqid': 'exp_001'
}
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
generate_path_model_file Ran
ran on a synthesized input
jchanxtarov/BPRMF/src/utils/helpers.py
code served (permissive licence) · get_code("2f2eaa7252d7b165")
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 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 torch
import torch.nn as nn

torch.manual_seed(0)

ARGS = {
    "name_data": "cifar10",
    "name_model": "resnet18",
    "epoch": 42,
    "uniqid": "abc123def456"
}
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
generate_path_pretrain_file Ran
ran on a synthesized input
jchanxtarov/BPRMF/src/utils/helpers.py
code served (permissive licence) · get_code("7a69b58821a6c1ff")
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 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 torch
import torch.nn as nn

torch.manual_seed(0)

ARGS = {
    'name_data': 'experiment_001',
    'filename': 'model_checkpoint.pt'
}
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
get_index Ran
ran on a synthesized input
EternalImmortal/bpr/inference_with_output.py
code served (permissive licence) · get_code("f61c65ae5d8aaa26")
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 pandas as pd
import tempfile
import os

# Create a temporary CSV file with the expected format
temp_dir = tempfile.gettempdir()
temp_path = os.path.join(temp_dir, "test_data.csv")

# Write test data in the format expected by the function
# The file has delimiter ':' and columns 'user' and 'sequence'
with open(temp_path, 'w') as f:
    f.write("user1:seq_data_1\n")
    f.write("user2:seq_data_2\n")
    f.write("user3:seq_data_3\n")

ARGS = {
    'path': temp_path
}
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 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
load_data Ran
ran on a synthesized input
SeongJinAhn/BPR/preprocess.py
code served (permissive licence) · get_code("67dfb497c8208dde")
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 pandas as pd
import tempfile
import os

# Create a temporary CSV file with test data
temp_dir = tempfile.mkdtemp()
temp_file = os.path.join(temp_dir, 'test_data.csv')

# Write test data to the CSV file
test_data = """1::100::4.5::1000000000
2::200::3.5::1000000001
3::101::4.0::1000000002
3::102::5.0::1000000003
4::103::2.5::1000000004
5::104::3.0::1000000005
6::105::4.5::1000000006
7::106::2.0::1000000007
"""

with open(temp_file, 'w') as f:
    f.write(test_data)

# Define ARGS with valid parameters for load_data function
ARGS = {
    'fpath': temp_file,
    'sep': '::',
    'engine': 'python'
}
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 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
load_model Ran
ran on a synthesized input
EternalImmortal/bpr/util_origin.py
code served (permissive licence) · get_code("59ad70782b2fa0d4")
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. 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 tempfile
import os
import tarfile

torch.manual_seed(0)

# Create a temporary directory for the model files
temp_dir = tempfile.mkdtemp()

# Create a simple model
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

# Instantiate the model
model = SimpleModel()

# Save the model state dict to the expected location
model_path = os.path.join(temp_dir, 'model.pth')
torch.save(model.state_dict(), model_path)

# Create a tar.gz archive containing the model
tarpath = os.path.join(temp_dir, 'model.tar.gz')
with tarfile.open(tarpath, 'w:gz') as tar:
    tar.add(model_path, arcname='model.pth')

# Remove the extracted model.pth so it can be extracted from the tar
os.remove(model_path)

ARGS = {
    'model': model,
    'model_dir': temp_dir
}
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 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
normalize Ran
ran on a synthesized input
benfred/implicit/implicit/nearest_neighbours.py
code served (permissive licence) · get_code("896aecd2d4994f18")
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 coo_matrix. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np
from scipy.sparse import csr_matrix, coo_matrix

# Create a small sparse matrix for testing
# The function expects a sparse matrix (or something convertible to coo_matrix)
# It will:
# 1. Convert to coo_matrix
# 2. Access X.data, X.row attributes
# 3. Call bincount on row indices with squared data as weights
# 4. Normalize X.data by the computed counts

# Create a simple sparse matrix with shape (4, 3)
# This gives us a small test case
row = np.array([0, 1, 2, 3, 1, 2])
col = np.array([0, 1, 2, 0, 2, 1])
data = np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0])
X_sparse = csr_matrix((data, (row, col)), shape=(4, 3))

ARGS = {
    "X": X_sparse
}
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 coo_matrix — a coo_matrix output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a coo_matrix 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
set_env Ran
ran on a synthesized input
EternalImmortal/bpr/util_origin.py
code served (permissive licence) · get_code("5ab0124e5d65a7e8")
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 Namespace. 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 sys
import tempfile

# Create temporary directories for the environment variables
temp_dir = tempfile.mkdtemp()
data_dir = os.path.join(temp_dir, 'data-zl')
model_dir = os.path.join(temp_dir, 'model')
output_dir = os.path.join(temp_dir, 'output')
test_dir = os.path.join(temp_dir, 'data-ml')

os.makedirs(data_dir, exist_ok=True)
os.makedirs(model_dir, exist_ok=True)
os.makedirs(output_dir, exist_ok=True)
os.makedirs(test_dir, exist_ok=True)

ARGS = {
    'root_path': temp_dir,
    'kind': 'zl'
}
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 Namespace — a Namespace output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Namespace 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
split_train_test Ran
ran on a synthesized input
EternalImmortal/bpr/preprocess.py
code served (permissive licence) · get_code("2f78e267baa58c42")
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 math
import numpy as np
import pandas as pd

# Create a small DataFrame with user, time, and item columns
np.random.seed(0)
data = {
    'user': [0, 0, 1, 1, 2, 2, 0, 1, 2, 0],
    'time': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
    'item': [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
}
df = pd.DataFrame(data)

user_size = 3
test_size = 0.2
time_order = False

ARGS = {
    'df': df,
    'user_size': user_size,
    'test_size': test_size,
    'time_order': time_order
}
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 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
tfidf_weight Ran
ran on a synthesized input
benfred/implicit/implicit/nearest_neighbours.py
code served (permissive licence) · get_code("aeee987913fbda78")
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 coo_matrix. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np
from scipy.sparse import csr_matrix

# Create a small sparse matrix for testing
# Using a 4x3 sparse matrix (4 samples, 3 features)
# This will have some non-zero values for TF-IDF weighting
data = np.array([1.0, 2.0, 3.0, 1.5, 2.5])
row = np.array([0, 0, 1, 2, 3])
col = np.array([0, 1, 2, 1, 0])

# Create sparse matrix in COO format, then convert to CSR
X_sparse = csr_matrix((data, (row, col)), shape=(4, 3))

ARGS = {
    'X': X_sparse
}
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 coo_matrix — a coo_matrix output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a coo_matrix 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
check_random_state Not yet run
unverified (harvested, no recorded run)
benfred/implicit/implicit/utils.py
code served (permissive licence) · get_code("6d3ffaf4a60c58eb")
How it ran

no invocation recorded.

item_factor Not yet run
unverified (harvested, no recorded run)
benfred/implicit/implicit/cpu/als.py
code served (permissive licence) · get_code("a6fb94cd02242f2d")
How it ran

no invocation recorded.

user_factor Not yet run
unverified (harvested, no recorded run)
benfred/implicit/implicit/cpu/als.py
code served (permissive licence) · get_code("3aa483cf1abd78de")
How it ran

no invocation recorded.

user_linear_equation Not yet run
unverified (harvested, no recorded run)
benfred/implicit/implicit/cpu/als.py
code served (permissive licence) · get_code("65a90c4c57f40e8a")
How it ran

no invocation recorded.

Also present in other papers' code

Of 24 samples lifted from this paper's linked repositories, 24 carry a function identity and 0 do not. Of the 24 distinct functions with an identity, 6 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 6 later) and 18 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
convert_unique_idx 2 other papers
2 later
2205.00048 (2022-05)
Joint Multisided Exposure Fairness for Recommendation
aaai_25540 (2023 (year only))
Uniform Sequence Better: Time Interval Aware Data Augmentation for Sequential Recommendation
compute_hit 1 other paper
1 later
1510.01784 (2015-10)
VBPR: Visual Bayesian Personalized Ranking from Implicit Feedback
compute_precision 1 other paper
1 later
1510.01784 (2015-10)
VBPR: Visual Bayesian Personalized Ranking from Implicit Feedback
generate_path_log_file 1 other paper
1 later
1510.01784 (2015-10)
VBPR: Visual Bayesian Personalized Ranking from Implicit Feedback
generate_path_model_file 1 other paper
1 later
1510.01784 (2015-10)
VBPR: Visual Bayesian Personalized Ranking from Implicit Feedback
generate_path_pretrain_file 1 other paper
1 later
1510.01784 (2015-10)
VBPR: Visual Bayesian Personalized Ranking from Implicit Feedback

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

Item recommendation is the task of predicting a personalized ranking on a set of items (e.g. websites, movies, products). In this paper, we investigate the most common scenario with implicit feedback (e.g. clicks, purchases). There are many methods for item recommendation from implicit feedback like matrix factorization (MF) or adaptive knearest-neighbor (kNN). Even though these methods are designed for the item prediction task of personalized ranking, none of them is directly optimized for ranking. In this paper we present a generic optimization criterion BPR-Opt for personalized ranking that is the maximum posterior estimator derived from a Bayesian analysis of the problem. We also provide a generic learning algorithm for optimizing models with respect to BPR-Opt. The learning method is based on stochastic gradient descent with bootstrap sampling. We show how to apply our method to two state-of-the-art recommender models: matrix factorization and adaptive kNN. Our experiments indicate that for the task of personalized ranking our optimization method outperforms the standard learning techniques for MF and kNN. The results show the importance of optimizing models for the right criterion.

For agents

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

get_harvested_code_for_paper("1205.2618")
get_code_for_paper("1205.2618")
have("1205.2618")

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

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

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

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

Connect an agent — have() is free.