SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2007.06133 · IJCAI · 2020

Explainable Recommendation via Interpretable Feature Mapping and Evaluation of Explainability

Xin Li, Xiangrui Li, Deng Pan, Dongxiao Zhu

arXiv · PDF · Open in the Atlas

Code that ran

2 of 2 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 2 have no contract verdict; 0 failures of our instrument; 0 no recorded run), measured 2026-11-21; 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/2007.06133.json · badge: /api/ran/2007.06133.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
pd90506/AMCF community
Papers with Code archive
2 ran · 0 no recorded run
FunctionStatusWhere it lives
AMCF Ran
ran on a synthesized input
pd90506/AMCF/amcf.py
code served (permissive licence) · get_code("03f44bdb7f52b655")
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 list. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
import torch.nn.functional as F

class Aspect_emb(nn.Module):
    """
    module to embed each aspect to the latent space.
    """

    def __init__(self, num_asp, e_dim):
        super(Aspect_emb, self).__init__()
        self.num_asp = num_asp
        self.W = nn.Parameter(torch.randn(num_asp, e_dim))

    def forward(self, x):
        shape = x.shape
        x = x.reshape([x.shape[0], x.shape[1], 1])
        x = x.expand(-1, -1, self.W.shape[1])
        asp_latent = torch.mul(x, self.W)
        return asp_latent

class AMCF(nn.Module):
    """
    The AMCF class
    """

    def __init__(self, num_user, num_item, num_asp=18, e_dim=16):
        super(AMCF, self).__init__()
        self.num_asp = num_asp
        self.user_emb = nn.Embedding(num_user, e_dim)
        self.item_emb = nn.Embedding(num_item, e_dim)
        self.u_bias = nn.Parameter(torch.randn(num_user))
        self.i_bias = nn.Parameter(torch.randn(num_item))
        self.asp_emb = Aspect_emb(num_asp, e_dim)
        self.mlp = nn.Sequential(nn.Linear(e_dim, 50), nn.Linear(50, 25), nn.Linear(25, num_asp))
        self.e_dim = e_dim
        self.pdist = nn.PairwiseDistance(p=2)

    def forward(self, x, y, asp):
        user_latent = self.user_emb(x)
        item_latent = self.item_emb(y)
        detached_item_latent = item_latent.detach()
        u_bias = self.u_bias[x]
        i_bias = self.i_bias[y]
        out = (user_latent * item_latent).sum(-1) + u_bias + i_bias + 3.53
        asp_latent = self.asp_emb(asp)
        asp_weight = F.softmax(self.mlp(detached_item_latent), dim=-1).unsqueeze(-1)
        item_asp = torch.bmm(asp_latent.permute(0, 2, 1), asp_weight).squeeze(-1)
        sim = self.pdist(item_asp, detached_item_latent)
        user_latent = user_latent.unsqueeze(-1)
        pref = torch.bmm(asp_latent, user_latent).squeeze(-1)
        return [out, sim, pref]

    def predict_pref(self, x):
        user_latent = self.user_emb(x)
        user_latent = user_latent.unsqueeze(1).expand(-1, self.num_asp, -1)
        batch_size = x.shape[0]
        if torch.cuda.is_available():
            dummy_asp = torch.ones([batch_size, self.num_asp]).cuda()
        else:
            dummy_asp = torch.ones([batch_size, self.num_asp])
        item_latent = self.asp_emb(dummy_asp)
        user_latent = user_latent.reshape(-1, self.e_dim)
        item_latent = item_latent.reshape(-1, self.e_dim)
        out = (user_latent * item_latent).sum(-1)
        out = out.reshape(-1, self.num_asp)
        out = F.normalize(out, p=1, dim=-1)
        return out

    def predict_spec_pref(self, x, y, asp):
        user_latent = self.user_emb(x)
        user_latent = user_latent.unsqueeze(1).expand(-1, self.num_asp, -1)
        item_latent = self.item_emb(y)
        item_latent = item_latent.unsqueeze(1).expand(-1, self.num_asp, -1)
        user_latent = user_latent.reshape(-1, self.e_dim)
        item_latent = item_latent.reshape(-1, self.e_dim)
        out = (user_latent * item_latent).sum(-1)
        out = out.reshape(-1, self.num_asp)
        out = F.normalize(out, p=1, dim=-1)
        return out


INIT_ARGS = {
    'num_user': 10,
    'num_item': 8,
    'num_asp': 6,
    'e_dim': 4,
}

ARGS = {
    'x': torch.tensor([0, 1]),
    'y': torch.tensor([2, 3]),
    'asp': torch.tensor([[1.0, 0.5, 0.2, 0.1, 0.3, 0.4],
                         [0.2, 0.8, 0.1, 0.5, 0.2, 0.3]]),
}

if __name__ == '__main__':
    model = AMCF(**INIT_ARGS)
    model.eval()
    result = model(**ARGS)
    print("Forward pass successful")
    print(f"Output types: {[type(r) for r in result]}")
    print(f"Output shapes: {[r.shape if hasattr(r, 'shape') else 'N/A' for r in result]}")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
Aspect_emb Ran
ran on a synthesized input
pd90506/AMCF/amcf.py
code served (permissive licence) · get_code("ae16831a999042ce")
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 Tensor, ndim 3, dtype family float, shape (2, 5, 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 torch
import torch.nn as nn

class Aspect_emb(nn.Module):
    """
    module to embed each aspect to the latent space.
    """

    def __init__(self, num_asp, e_dim):
        super(Aspect_emb, self).__init__()
        self.num_asp = num_asp
        self.W = nn.Parameter(torch.randn(num_asp, e_dim))

    def forward(self, x):
        shape = x.shape
        x = x.reshape([x.shape[0], x.shape[1], 1])
        x = x.expand(-1, -1, self.W.shape[1])
        asp_latent = torch.mul(x, self.W)
        return asp_latent


INIT_ARGS = {
    'num_asp': 5,
    'e_dim': 4,
}

ARGS = {
    'x': torch.randn(2, 5),
}

if __name__ == '__main__':
    model = Aspect_emb(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Output:\n{output}")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float, shape (2, 5, 4) — shape (2, 5, 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)

Also present in other papers' code

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

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Latent factor collaborative filtering (CF) has been a widely used technique for recommender system by learning the semantic representations of users and items. Recently, explainable recommendation has attracted much attention from research community. However, trade-off exists between explainability and performance of the recommendation where metadata is often needed to alleviate the dilemma. We present a novel feature mapping approach that maps the uninterpretable general features onto the interpretable aspect features, achieving both satisfactory accuracy and explainability in the recommendations by simultaneous minimization of rating prediction loss and interpretation loss. To evaluate the explainability, we propose two new evaluation metrics specifically designed for aspect-level explanation using surrogate ground truth. Experimental results demonstrate a strong performance in both recommendation and explaining explanation, eliminating the need for metadata. Code is available from https://github.com/pd90506/AMCF.

For agents

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

get_harvested_code_for_paper("2007.06133")
get_code_for_paper("2007.06133")
have("2007.06133")

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

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

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

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

Connect an agent — have() is free.