Ekar: An Explainable Method for Knowledge Aware Recommendation

Weiping Song, Zhijian Duan, Ziqing Yang, Hao Zhu, Ming Zhang, Jian Tang · DOI

Abstract

This paper studies recommender systems with knowledge graphs, which can effectively address the problems of data sparsity and cold start. Recently, a variety of methods have been developed for this problem, which generally try to learn effective representations of users and items and then match items to users according to their representations. Though these methods have been shown quite effective, they lack good explanations, which are critical to recommender systems. In this paper, we take a different route and propose generating recommendations by finding meaningful paths from users to items. Specifically, we formulate the problem as a sequential decision process, where the target user is defined as the initial state, and the edges on the graphs are defined as actions. We shape the rewards according to existing state-of-the-art methods and then train a policy function with policy gradient methods. Experimental results on three real-world datasets show that our proposed method not only provides effective recommendations but also offers good explanations.

Introduction

Recommender systems are essential for navigating the vast amount of online information, yet they frequently face challenges such as data sparsity and the "cold start" problem. Knowledge Graphs (KGs) have emerged as a powerful solution, providing structured background information about entities and their relationships. While recent embedding-based methods have achieved high accuracy by mapping users and items into latent spaces, they often function as "black boxes," offering little transparency into why a specific recommendation was made.

Explainability is increasingly critical in recommender systems to build user trust and improve satisfaction. Traditional path-based methods attempt to provide explanations by finding sequences of relations in the KG, but they often struggle with scalability or rely on rigid, manually defined rules. This paper introduces Ekar (Explainable Knowledge-Aware Recommendation), a framework that treats recommendation as a path-finding task within a unified graph, optimized via reinforcement learning (RL).

The User-Item-Entity graph structure, illustrating how paths between users and items provide explainable recommendations.

The Ekar Framework

Ekar formulates the recommendation process as a Markov Decision Process (MDP) over a heterogeneous graph consisting of users, items, and KG entities.

1. The RL Environment and State

The environment is a unified graph where nodes represent users, items, or entities, and edges represent various relations (e.g., "interacted," "starred in," "directed by"). The RL agent starts at a node representing the target user. To maintain context during the "walk," Ekar employs a Long Short-Term Memory (LSTM) network to encode the history of traversed nodes and relations into a state vector $s_t$.

2. Policy Network and Action Space

The policy network $\pi_\theta(a|s_t)$ determines the next edge to follow. To manage the potentially massive branching factor of a KG, the authors implement action space pruning, limiting the agent to the most relevant outgoing edges based on PageRank scores. Additionally, a "Stop Action" allows the agent to terminate the walk when it reaches a suitable item.

3. Reward Shaping: The Core Innovation

A primary challenge in graph-based RL is the sparsity of rewards; an agent might wander aimlessly before finding a relevant item. Ekar addresses this through Reward Shaping. Instead of a simple binary reward (success/failure), the framework utilizes a pre-trained Knowledge Graph Embedding (KGE) model (such as ConvE). This model provides "soft" rewards by estimating the likelihood of a relationship between the starting user and the current entity, effectively guiding the agent toward promising regions of the graph even before a final recommendation is reached.

The Ekar reinforcement learning framework, comprising the graph environment, the policy network, and the reward module with KGE-based shaping.

Experimental Evaluation

The authors evaluated Ekar on three real-world datasets: Last.FM (music), MovieLens-1M (movies), and DBbook2014 (books). These datasets represent varying levels of sparsity and domain-specific relationship types.

Performance and Accuracy

Ekar demonstrated significant improvements over state-of-the-art baselines, including RippleNet and KTUP. Notably, on the sparse Last.FM dataset, Ekar achieved a 31.31% improvement in Hit Ratio (HR@10). The use of reward shaping was found to be crucial for both accuracy and training efficiency, allowing the model to converge in under 10 minutes on the MovieLens-1M dataset.

Explainability and Qualitative Analysis

Beyond accuracy, Ekar provides human-readable explanations in the form of the paths traversed by the agent. For example, a user might be recommended a movie because it shares a director with a film they previously enjoyed. Qualitative analysis showed that the model learns different preference patterns across domains—relying more on collaborative filtering-style paths (user-item-user) in dense datasets and more on entity-based paths (item-actor-item) in sparse ones.

Conclusion

Ekar successfully bridges the gap between high-performance embedding methods and interpretable path-based approaches. By framing recommendation as a sequential decision process and leveraging reward shaping with pre-trained embeddings, it provides a scalable, accurate, and explainable solution for knowledge-aware recommendation. Future work may explore more sophisticated action pruning techniques and the integration of diverse domain-specific rewards to further enhance path meaningfulness.

Summary updated

BibTeX
@misc{song2019ekar,
  author = {Weiping Song and Zhijian Duan and Ziqing Yang and Hao Zhu and Ming Zhang and Jian Tang},
  title = {{Ekar: An Explainable Method for Knowledge Aware Recommendation}},
  year = {2019},
  eprint = {1906.09506},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1906.09506},
}
Figure