# 多任务特征学习知识图谱增强推荐

## Abstract

Collaborative filtering often suffers from sparsity and cold start problems in real recommendation scenarios, therefore, researchers and engineers usually use side information to address the issues and improve the performance of recommender systems. In this paper, we consider knowledge graphs as the source of side information.

We propose MKR, a Multi-task feature learning approach for Knowledge graph enhanced Recommendation.

MKR is a deep end-to-end framework that utilizes knowledge graph embedding task to assist recommendation task. The two tasks are associated by cross & compress units, which automatically share latent features and learn high-order interactions between items in recommender systems and entities in the knowledge graph. We prove that cross & compress units have sufficient capability of polynomial approximation, and show that MKR is a generalized framework over several representative methods of recommender systems and multi-task learning.

Through extensive experiments on real-world datasets, we demonstrate that MKR achieves substantial gains in movie, book, music, and news recommendation, over state-of-the-art baselines.

MKR is also shown to be able to maintain a decent performance even if user-item interactions are sparse.

## Introduction

Recommender systems (RS) aims to address the information explosion and meet users personalized interests. One of the most popular recommendation techniques is collaborative filtering CF , which utilizes users' historical interactions and makes recommendations based on their common preferences. However, CF-based methods usually suffer from the sparsity of user-item interactions and the cold start problem. Therefore, researchers propose using in recommender systems, including social networks , attributes , and multimedia (e.g., texts , images ). KGs are one type of side information for RS, which usually contain fruitful facts and connections about items. Recently, researchers have proposed several academic and commercial KGs, such as NELL http://rtw.ml.cmu.edu/rtw/ , DBpedia http://wiki.dbpedia.org/ , Google Knowledge Graph https://developers.google.com/knowledge-graph/ and Microsoft Satori https://searchengineland.com/library/bing/bing-satori . Due to its high dimensionality and heterogeneity, a KG is usually pre-processed by KGE methods , which embeds entities and relations into low-dimensional vector spaces while preserving its inherent structure. Inspired by the success of applying KG in a wide variety of tasks, researchers have recently tried to utilize KG to improve the performance of recommender systems . Personalized Entity Recommendation (PER) and Factorization Machine with Group lasso (FMG) treat KG as a heterogeneous information network, and extract meta-path/meta-graph based latent features to represent the connectivity between users and items along different types of relation paths/graphs.

## 简介

Existing KG-aware methods

Inspired by the success of applying KG in a wide variety of tasks, researchers have recently tried to utilize KG to improve the performance of recommender systems (Yu et al., 2014; Zhao et al., 2017; Wang et al., 2018d; Wang et al., 2018c; Zhang et al., 2016). Personalized Entity Recommendation (PER) (Yu et al., 2014) and Factorization Machine with Group lasso (FMG) (Zhao et al., 2017) treat KG as a heterogeneous information network, and extract meta-path/meta-graph based latent features to represent the connectivity between users and items along different types of relation paths/graphs. It should be noted that PER and FMG rely heavily on manually designed meta-paths/meta-graphs, which limits its application in generic recommendation scenarios. Deep Knowledge-aware Network (DKN) (Wang et al., 2018d) designs a CNN framework to combine entity embeddings with word embeddings for news recommendation. However, the entity embeddings are required in advance of using DKN, causing DKN to lack an end-to-end way of training. Another concern about DKN is that it can hardly incorporate side information other than texts. RippleNet (Wang et al., 2018c) is a memory-network-like model that propagates users’ potential preferences in the KG and explores their hierarchical interests. But the importance of relations is weakly characterized in RippleNet, because the embedding matrix of a relation R can hardly be trained to capture the sense of importance in the quadratic form${ v}^\top{ R}{ h}$ (v and h are embedding vectors of two entities).

Collaborative Knowledge base Embedding (CKE) (Zhang et al., 2016) combines CF with structural knowledge, textual knowledge, and visual knowledge in a unified framework. However, the KGE module in CKE (i.e., TransR (Lin et al., 2015)) is more suitable for in-graph applications (such as KG completion and link prediction) rather than recommendation. In addition, the CF module and the KGE module are loosely coupled in CKE under a Bayesian framework, making the supervision from KG less obvious for recommender systems.

The proposed approach

We probe the expressive capability of MKR and show, through theoretical analysis, that the cross&compress unit is capable of approximating sufficiently high order feature interactions between items and entities. We also show that MKR is a generalized framework over several representative methods of recommender systems and multi-task learning, including factorization machines (Rendle, 2010, 2012), deep&cross network (Wang et al., 2017a), and cross-stitch network (Misra et al., 2016). Empirically, we evaluate our method in four recommendation scenarios, i.e., movie, book, music, and news recommendations. The results demonstrate that MKR achieves substantial gains over state-of-the-art baselines in both click-through rate (CTR) prediction (e.g., 11.6% AUC improvements on average for movies) and top-K recommendation (e.g., 66.4% Recall@10 improvements on average for books). MKR can also maintain a decent performance in sparse scenarios.

Contribution

It is worth noticing that the problem studied in this paper can also be modelled as cross-domain recommendation (Tang et al., 2012) or transfer learning (Pan et al., 2010), since we care more about the performance of recommendation task. However, the key observation is that though cross-domain recommendation and transfer learning have single objective for the target domain, their loss functions still contain constraint terms for measuring data distribution in the source domain or similarity between two domains. In our proposed MKR, the KGE task serves as the constraint term explicitly to provide regularization for recommender systems. We would like to emphasize that the major contribution of this paper is exactly modeling the problem as multi-task learning: We go a step further than cross-domain recommendation and transfer learning by finding that the inter-task similarity is helpful to not only recommender systems but also knowledge graph embedding, as shown in theoretical analysis and experiment results.

## Our Approach

In this section, we first formulate the knowledge graph enhanced recommendation problem, then introduce the framework of MKR and present the design of the cross & compress unit, recommendation module and KGE module in detail. We lastly discuss the learning algorithm for MKR.

Figure 1. (a) The framework of MKR. The left and right part illustrate the recommendation module and the KGE module, respectively, which are bridged by the cross&compress units. (b) Illustration of a cross&compress unit. The cross&compress unit generates a cross feature matrix from item and entity vectors by cross operation, and outputs their vectors for the next layer by compress operation.

## 我们的方法

### 2.1 Problem Formulation 问题表述

We formulate the knowledge graph enhanced recommendation problem in this paper as follows. In a typical recommendation scenario, we have a set of $M$ users $\mathcal U = {u_1, u_2, ..., u_M}$ and a set of $N$ items $\mathcal V = {v_1, v_2, ..., v_N}$ . The user-item interaction matrix ${ Y}\in\mathbb R^{M \times N}$ is defined according to users' implicit feedback, where $y_{uv} = 1$ indicates that user $u$ engaged with item $v$ , such as behaviors of clicking, watching, browsing, or purchasing; otherwise $y_{uv} = 0$ . Additionally, we also have access to a knowledge graph $\mathcal G$ , which is comprised of entity-relation-entity triples $(h, r, t)$ . Here $h$ , $r$ , and $t$ denote the head, relation, and tail of a knowledge triple, respectively. For example, the triple (, , ) states the fact that Quentin Tarantino directs the film Pulp Fiction. In many recommendation scenarios, an item $v \in\mathcal V$ may associate with one or more entities in $\mathcal G$ . For example, in movie recommendation, the item "Pulp Fiction" is linked with its namesake in a KG, while in news recommendation, news with the title "Trump pledges aid to Silicon Valley during tech meeting" is linked with entities "Donald Trump" and "Silicon Valley" in a KG. Given the user-item interaction matrix $Y$ as well as the knowledge graph $\mathcal G$ , we aim to predict whether user $u$ has potential interest in item $v$ with which he has had no interaction before. Our goal is to learn a prediction function ${\hat y}{uv} = \mathcal F(u, v | \Theta, Y, \mathcal G)$ , where ${\hat y}{uv}$ denotes the probability that user $u$ will engage with item $v$ , and $\Theta$ is the model parameters of function $\mathcal F$ .

### 2.2 Framework 框架

The framework of MKR is illustrated in Figure framework.

MKR consists of three main components: recommendation module, KGE module, and cross & compress units.

(1) The recommendation module on the left takes a user and an item as input, and uses a multi-layer perceptron (MLP) and cross & compress units to extract short and dense features for the user and the item, respectively.

The extracted features are then fed into another MLP together to output the predicted probability.

(2) Similar to the left part, the KGE module in the right part also uses multiple layers to extract features from the head and relation of a knowledge triple, and outputs the representation of the predicted tail under the supervision of a score function $f$ and the real tail.

(3) The recommendation module and the KGE module are bridged by specially designed cross & compress units.

The proposed unit can automatically learn high-order feature interactions of items in recommender systems and entities in the KG.

MKR 的框架在图中展示。 MKR 由三个主要组件组成：推荐模块，KGE 模块和 Cross & Compress 单元。
（1）左侧的推荐模块带有用户和项目作为输入，并使用多层的 Perceptron（MLP）和 Cross & Compress 单元，分别为用户和项目提取短致密功能。然后将提取的特征馈入另一 MLP 以输出预测的概率。
（2）与左侧部分类似，右侧部分中的 KGE 模块也使用多个层来从 Read 和知识三倍的关系中提取特征，并在得分函数$f$的监督下输出预测尾部的表示和真正的尾巴。
（3）推荐模块和 KGE 模块通过专门设计的 Cross & Compress 单元桥接。建议的单位可以自动学习 kg 中推荐系统和实体中项目的高阶功能交互。

### 2.3 Cross & compress Unit 交叉和压缩单元

To model feature interactions between items and entities, we design a cross & compress unit in MKR framework. As shown in Figure cross_feature_sharing_unit, for item $v$ and one of its associated entities $e$ , we first construct $d \times d$ pairwise interactions of their latent feature ${ v}_l \in\mathbb R^d$ and ${ e}_l \in\mathbb R^d$ from layer $l$ :

$${ C}_l = { v}_l { e}_l^\top = \begin{bmatrix} v_l^{(1)} e_l^{(1)} & \cdots & v_l^{(1)} e_l^{(d)} \cdots & & \cdots v_l^{(d)} e_l^{(1)} & \cdots & v_l^{(d)} e_l^{(d)} \end{bmatrix},$$

where ${ C}_l \in\mathbb R^{d \times d}$ is the cross feature matrix of layer $l$ , and $d$ is the dimension of hidden layers. This is called the operation, since each possible feature interaction $v_l^{(i)} e_l^{(j)}, \forall(i, j) \in{1, ..., d{(i)}0{(i)}1$ between item $v$ and its associated entity $e$ is modeled explicitly in the cross feature matrix. We then output the feature vectors of items and entities for the next layer by projecting the cross feature matrix into their latent representation spaces: where ${ w}_l^{\cdot \cdot}\in\mathbb R^d$ and ${ b}_l^\cdot\in\mathbb R^d$ are trainable weight and bias vectors. This is called the operation, since the weight vectors project the cross feature matrix from $\mathbb R^{d \times d}$ space back to the feature spaces $\mathbb R^d$ . Note that in Eq. (compress), the cross feature matrix is compressed along both horizontal and vertical directions (by operating on ${ C}_l$ and ${ C}_l^\top$ ) for the sake of symmetry, but we will provide more insights of the design in Section unified_view. For simplicity, the cross & compress unit is denoted as:

$$[{ v}{l+1}, { e}{l+1}] = \mathcal C ({ v}_l, { e}_l),$$

and we use a suffix $[{ v}]$ or $[{ e}]$ to distinguish its two outputs in the following of this paper.

$${ C}_l = { v}_l { e}_l^\top = \begin{bmatrix} v_l^{(1)} e_l^{(1)} & \cdots & v_l^{(1)} e_l^{(d)} \cdots & & \cdots v_l^{(d)} e_l^{(1)} & \cdots & v_l^{(d)} e_l^{(d)} \end{bmatrix},$$

，其中${ C}_l \in\mathbb R^{d \times d}$是$l$的横向特征矩阵，而$d$是隐藏图层的尺寸。这被称为操作，因为每个可能的特征交互$v_l^{(j)} e_l^{(j)}, {(j)}, \forall(i, j) \forall{(i)}1$在项目$v$和其相关的实体$e$之间明确地建模在交叉特征矩阵中。然后，我们通过将横向特征矩阵投影到其潜在表示空间中输出项目和实体的特征向量：其中${ w}_l^\mathbb R^d$和${ b}\in\cdot R^d$是可培养的重量和偏置矢量。这被称为操作，因为权重向量将交叉特征矩阵从$\mathbb R^{d \times d}$空间投影回特征空间$\mathbb R^d$。请注意，在 EQ 中（Compress），跨功能矩阵沿水平和垂直方向压缩（通过在${ C}_l$和${ C}_l^\top$上操作，以便对称性，但我们将在统一_VIVIE 中提供更多的设计见解。为简单起见，Cross & Compress 单元表示为：

$$[{ v}{l+1}, { e}{l+1}] = \mathcal C ({ v}_l, { e}_l),$$

Through cross & compress units, MKR can adaptively adjust the weights of knowledge transfer and learn the relevance between the two tasks. It should be noted that cross & compress units should only exist in low-level layers of MKR, as shown in Figure framework. This is because:

(1) In deep architectures, features usually transform from general to specific along the network, and feature transferability drops significantly in higher layers with increasing task dissimilarity . Therefore, sharing high-level layers risks to possible negative transfer, especially for the heterogeneous tasks in MKR.

(2) In high-level layers of MKR, item features are mixed with user features, and entity features are mixed with relation features.

The mixed features are not suitable for sharing since they have no explicit association.

（1）在深度架构中，功能通常从一般转换为沿网络特定，并且具有较高层的特征可转换性随着任务异化而增加。因此，共享高级层风险与可能的负转移，特别是对于 MKR 中的异构任务。

（2）在 MKR 的高级层中，项目功能与用户功能混合，实体功能与关系功能混合。混合功能不适合分享，因为它们没有明确的关联。

### 2.4 Recommendation Module 推荐模块

The input of the recommendation module in MKR consists of two raw feature vectors $u$ and $v$ that describe user $u$ and item $v$ , respectively. $u$ and $v$ can be customized as one-hot ID , attributes , bag-of-words , or their combinations, based on the application scenario. Given user $u$ 's raw feature vector $u$ , we use an $L$ -layer MLP to extract his latent condensed feature We use the exponent notation L in Eq. (\ref{eq:mlp}) and following equations in the rest of this paper for simplicity, but note that the parameters of L layers are actually different. :

$${ u}_L = \mathcal M (\mathcal M (\cdots\mathcal M ({ u}))) = \mathcal M^L ({ u}),$$

where $\mathcal M ({ x}) = \sigma({ W}{ x} + { b} M (0$ is a fully-connected neural network layer Exploring a more elaborate design of layers in the recommendation module is an important direction of future work. with weight $W$ , bias $b$ , and nonlinear activation function $\sigma(\cdot)$ .

For item $v$ , we use $L$ cross & compress units to extract its feature:

$$v_L = \mathbb E_{e \sim \mathcal S(v)}\left[\mathcal C^L ({ v}, { e})[{ v}]\right],$$

where $\mathcal S(v)$ is the set of associated entities of item $v$ .

After having user $u$ 's latent feature ${u}_L$ and item $v$ 's latent feature
${v}L$ , we combine the two pathways by a predicting function $f{RS}$ , for example, inner product or an $H$ -layer MLP.

The final predicted probability of user $u$ engaging item $v$ is:

$$\hat y_{uv} = \sigma\big(f_{RS}({ u}_L, { v}_L) \big).$$

MKR 中推荐模块的输入包括两个原始特征向量$u$和$v$，它们分别描述了用户$u$和 ITEM $v$。 $u$和$v$可根据应用方案根据应用方案作为单热门 ID，属性，文字袋或其组合定制。给定用户$u$的原始特征矢量$u$，我们使用$L$ -layer mlp 提取他的潜在浓缩功能，我们使用指数表示法在 eq 中 l 。 （\ ref {eq：mlp}）和以下纸张其余部分的方程式为简单起见，但请注意 l dlayers 的参数实际上是不同的。 ：
$${ u}_L = \mathcal M (\mathcal M (\cdots\mathcal M ({ u}))) = \mathcal M^L ({ u}),$$

$$v_L = \mathbb E_{e \sim \mathcal S(v)}\left[\mathcal C^L ({ v}, { e})[{ v}]\right],$$

，其中$\mathcal S(v)$是项目$v$的关联实体集。用户$u$潜伏功能${ u}_L$和项目$v$潜在特征${ v}L$，我们通过预测函数$f{RS}$组合两个路径，例如，内部产品或$H$ -Layer MLP。用户$u$接合项$v$的最终预测概率是：

$$\hat y_{uv} = \sigma\big(f_{RS}({ u}_L, { v}_L) \big).$$

### 2.5 Knowledge Graph Embedding Module 知识图嵌入模块

Knowledge graph embedding is to embed entities and relations into continuous vector spaces while preserving their structure. Recently, researchers have proposed a great many KGE methods, including translational distance models and semantic matching models . In MKR, we propose a deep semantic matching architecture for KGE module. Similar to the recommendation module, for a given knowledge triple $(h, r, t)$ , we first utilize multiple cross & compress units and nonlinear layers to process the raw feature vectors of head $h$ and relation $r$ (including ID , types , textual description , etc.), respectively. Their latent features are then concatenated together, followed by a $K$ -layer MLP for predicting tail $t$ : where $\mathcal S(h)$ is the set of associated items of entity $h$ , and $\hat t$ is the predicted vector of tail $t$ . Finally, the score of the triple $(h, r, t)$ is calculated using a score (similarity) function $f_{KG}$ :

$$score(h, r, t) = f_{KG}({ t}, { \hat t}),$$
where $t$ is the real feature vector of $t$ . In this paper, we use the normalized inner product $f_{KG}({ t}, { \hat t}) = \sigma({ t}{KG}0{KG}1{KG}2$ as the choice of score function , but other forms of (dis)similarity metrics can also be applied here such as Kullback–Leibler divergence.

### 2.6 Learning Algorithm 学习算法

The complete loss function of MKR is as follows: In Eq. (loss), the first term measures loss in the recommendation module, where $u$ and $v$ traverse the set of users and the items, respectively, and $\mathcal J$ is the cross-entropy function. The second term calculates the loss in the KGE module, in which we aim to increase the score for all true triples while reducing the score for all false triples. The last item is the regularization term for preventing over-fitting, $\lambda_1$ and $\lambda_2$ are the balancing parameters. \lambda_1 can be seen as the ratio of two learning rates for the two tasks. Note that the loss function in Eq. (loss) traverses all possible user-item pairs and knowledge triples. To make computation more efficient, following , we use a negative sampling strategy during training.

1:Interaction matrix Y, knowledge graph G

2:Prediction function F(u,v|Θ,Y,G)

3:Initialize all parameters

4:for number of training iteration do

6:   for t steps do

7:      Sample minibatch of positive and negative interactions from Y;

8:      Sample e∼S(v) for each item v in the minibatch;

9:      Update parameters of F by gradient descent on Eq. (1)-(6), (9);

10:   end for

11: // knowledge graph embedding task

12:   Sample minibatch of true and false triples from G;

13:   Sample v∼S(h) for each head h in the minibatch;

14:   Update parameters of F by gradient descent on Eq. (1)-(3), (7)-(9);

15:end for


The learning algorithm of MKR is presented in Algorithm 1, in which a training epoch consists of two stages: recommendation task (line 3-7) and KGE task (line 8-10). In each iteration, we repeat training on recommendation task for $t$ times ( $t$ is a hyper-parameter and normally $t > 1$ ) before training on KGE task once in each epoch, since we are more focused on improving recommendation performance. We will discuss the choice of $t$ in the experiments section.

MKR 的完全损耗功能如下：在 EQ 中。 （丢失），推荐模块中的第一项措施损失，其中$u$和$v$分别遍历一组用户和项目，而$\mathcal J$是跨熵函数。第二个术语计算 KGE 模块中的损失，其中我们的目标是增加所有真正的三元组的分数，同时减少所有虚假三元组的得分。最后一项是用于防止过度拟合的正则化术语，$\lambda_1$和$\lambda_2$是平衡参数。 \ lambda_1 可以被视为两个任务的两个学习率的比率。请注意，EQ 中的损耗功能。 （丢失）遍历所有可能的用户项目对和知识三元组。为了使计算更有效，遵循培训期间使用负面采样策略。 MKR 的学习算法在算法 1 中呈现，其中训练时期由两个阶段组成：推荐任务（第 3-7 行）和 KGE 任务（第 8-10 行）。在每次迭代中，我们在每个时代训练后，我们对$t$次的推荐任务进行培训我们将讨论实验部分中$t$的选择。

## Theoretical Analysis 理论分析

In this section, we prove that cross & compress units have sufficient capability of polynomial approximation. We also show that MKR is a generalized framework over several representative methods of recommender systems and multi-task learning.

### 3.1 Polynomial Approximation 多项式近似

According to the Weierstrass approximation theorem , any function under certain smoothness assumption can be approximated by a polynomial to an arbitrary accuracy. Therefore, we examine the ability of high-order interaction approximation of the cross & compress unit. We show that cross & compress units can model the order of item-entity feature interaction up to exponential degree:

`Theorem 1 () Denote the input of item and entity in MKR network as${ v}=[v_{1}\cdots\ v_{d}]^{\top}$and ${ e}=[e_{1}\ \cdots\ e_{d}]^{\top}$ respectively. Then the cross terms about v and e in ∥vL∥1 and ∥eL∥1 (the L1-norm of vL and eL) with maximal degree is

$$k_{{\alpha},{\beta}}v_{1}^{\alpha_{1}}\cdots v_{d}^{\alpha_{d}}e_{1}^{% \beta_{1}}\cdots e_{d}^{\beta_{d}}$$
$$L\geq 1,{ v}{0}={ v},{ e}{0}={ e}$$

$k_{\bm{\alpha},\bm{\beta}}\in\mathbb{R}$

In recommender systems, $\prod_{i=1}^d v_i^{\alpha_i} e_i^{\beta_i}$ is also called feature, as it measures the interactions of multiple original features. Theorem 1 states that cross & compress units can automatically model the combinatorial features of items and entities for sufficiently high order, which demonstrates the superior approximation capacity of MKR as compared with existing work such as Wide & Deep , factorization machines and DCN . The proof of Theorem 1 is provided in the Appendix. Note that Theorem 1 gives a theoretical view of the polynomial approximation ability of the cross & compress unit rather than providing guarantees on its actual performance. We will empirically evaluate the cross & compress unit in the experiments section.

### 3.2 Unified View of Representative Methods 统一视图的代表方法

In the following we provide a unified view of several representative models in recommender systems and multi-task learning, by showing that they are restricted versions of or theoretically related to MKR. This justifies the design of cross & compress unit and conceptually explains its strong empirical performance as compared to baselines.

#### Factorization machines 分解机

Factorization machines are a generic method for recommender systems. Given an input feature vector, FMs model all interactions between variables in the input vector using factorized parameters, thus being able to estimate interactions in problems with huge sparsity such as recommender systems. The model equation for a 2-degree factorization machine is defined as

$$\hat y({ x}) = w_0 + \sum\nolimits_{i=1}^d w_i x_i + \sum\nolimits_{i=1}^d \sum\nolimits_{j=i+1}^d \langle{ v}_i, { v}_j \rangle x_i x_j,$$

where $x_i$ is the $i$ -th unit of input vector $x$ , $w_\cdot$ is weight scalar, ${ v}_\cdot$ is weight vector, and $\langle\cdot, \cdot\rangle$ is dot product of two vectors. We show that the essence of FM is conceptually similar to an 1-layer cross & compress unit: It is interesting to notice that, instead of factorizing the weight parameter of $x_i x_j$ into the dot product of two vectors as in FM, the weight of term $v_i e_j$ is factorized into the sum of two scalars in cross & compress unit to reduce the number of parameters and increase robustness of the model.

，$x_i$是输入载体$x$的$i$。 ，$w_\cdot$是重量标量，${ v}_\cdot$是重量载体，$\langle\cdot, \cdot\rangle$是两个向量的点产品。我们表明 FM 的本质在概念上类似于 1 层 Cross & Compress 单元：注意到，请注意，而不是将$x_i x_j$的重量参数分解为 FM 中的两个向量的点产品，术语$v_i e_j$的权重被归档为 Cross & Compress 单元中的两个标量的总和，以减少参数的数量并增加模型的鲁棒性。

#### Deep \& Cross Network

DCN learns explicit and high-order cross features by introducing the layers:
DCN 通过引入图层来学习显式和高阶交叉功能：

$$x_{l+1} = { x}_0 { x}_l^\top{ w}_l + { x}_l + { b}_l,$$

where ${ x}_l$ , ${ w}_l$ , and ${ b}_l$ are representation, weight, and bias of the $l$ -th layer. We demonstrate the link between DCN and MKR by the following proposition: It can be proven that the polynomial approximation ability of the above DCN-equivalent version (i.e., the maximal degree of cross terms in ${ v}_l$ and ${ e}_l$ ) is $O(l)$ , which is weaker than original cross & compress units with $O(2^l)$ approximation ability.

，其中${ x}_l$，${ w}_l$和${ b}_l$是$l$-t1-t1-第 1 层的表示，权重和偏置。我们通过以下命题展示 DCN 和 MKR 之间的链接：可以证明上述 DCN 等效版本的多项式近似能力（即，$T4222_0_l$和${ e}_l$中的跨术率最大程度$O(l)$比原始 Cross & Compress 单位弱，具有$O(2^l)$近似能力。

#### Cross-stitch Networks Cross-stitch 网络

Cross-stitch networks is a multi-task learning model in convolutional networks, in which the designed cross-stitch unit can learn a combination of shared and task-specific representations between two tasks. Specifically, given two activation maps $x_A$ and $x_B$ from layer $l$ for both the tasks, cross-stitch networks learn linear combinations $\tilde x_A$ and $\tilde x_B$ of both the input activations and feed these combinations as input to the next layers' filters. The formula at location $(i, j)$ in the activation map is

$$[ x_A^{ij} x_B^{ij} ]= [ [\alpha_{AA} , \alpha_{AB} \alpha_{BA} , \alpha_{BB} ] x_A^{ij} x_B^{ij} ]$$

where $\alpha$ s are trainable transfer weights of representations between task A and task B. We show that the cross-stitch unit in Eq. (csn) is a simplified version of our cross & compress unit by the following proposition:
The transfer matrix in Eq. (cross-stitch) serves as the cross-stitch unit
$[\alpha_{AA}\alpha_{AB}; \alpha0\alpha1\alpha2\alpha3\alpha4\alpha5\alpha6\alpha7$ in Eq. (csn). Like cross-stitch networks, MKR network can decide to make certain layers task specific by setting ${ v}_l^\top{ w}l^{EV}$ ( $\alpha{AB}$ ) or ${ e}_l^\top{ w}l^{VE}$ ( $\alpha{BA}$ ) to zero, or choose a more shared representation by assigning a higher value to them. But the transfer matrix is more fine-grained in cross & compress unit, because the transfer weights are replaced from scalars to dot products of two vectors. It is rather interesting to notice that Eq. (cross-stitch) can also be regarded as an , as the computation of transfer weights involves the feature vectors ${ v}_l$ and ${ e}_l$ themselves.

$[\alpha_{AA}\alpha_{AB}; \alpha0\alpha1\alpha2\alpha3\alpha4\alpha5\alpha6\alpha7$

## Experiments

In this section, we evaluate the performance of MKR in four real-world recommendation scenarios: movie, book, music, and news The source code is available at https://github.com/hwwang55/MKR.

\Dataset # users # items # interactions # KG triples Hyper-parameters
\MovieLens-1M 6,036 2,347 753,772 20,195 L = 1 , d = 8 , t = 3 , \lambda_1 = 0.5
Book-Crossing 17,860 14,910 139,746 19,793 L = 1 , d = 8 , t = 2 , \lambda_1 = 0.1
Last.FM 1,872 3,846 42,346 15,518 L = 2, d = 4 , t = 2 , \lambda_1 = 0.1
Bing-News 141,487 535,145 1,025,192 1,545,217 L = 3 , d = 16 , t = 5 , \lambda_1 = 0.2

## 实验

### Datasets

We utilize the following four datasets in our experiments:

• {MovieLens-1M}{https://grouplens.org/datasets/movielens/1m/} is a widely used benchmark dataset in movie recommendations, which consists of approximately 1 million explicit ratings (ranging from 1 to 5) on the MovieLens website.
• {Book-Crossing}{http://www2.informatik.uni-freiburg.de/cziegler/ BX/} dataset contains 1,149,780 explicit ratings (ranging from 0 to 10) of books in the Book-Crossing community.
• {Last.FM}{https://grouplens.org/datasets/hetrec-2011/} dataset contains musician listening information from a set of 2 thousand users from Last.fm online music system.
• {Bing-News} dataset contains 1,025,192 pieces of implicit feedback collected from the server logs of Bing News\footnote{https://www.bing.com/news} from October 16, 2016 to August 11, 2017. Each piece of news has a title and a snippet.

Since MovieLens-1M, Book-Crossing, and Last.FM are explicit feedback data (Last.FM provides the listening count as weight for each user-item interaction), we transform them into implicit feedback where each entry is marked with 1 indicating that the user has rated the item positively, and sample an unwatched set marked as 0 for each user. The threshold of positive rating is 4 for MovieLens-1M, while no threshold is set for Book-Crossing and Last.FM due to their sparsity. We use Microsoft Satori to construct the KG for each dataset. We first select a subset of triples from the whole KG with a confidence level greater than 0.9. For MovieLens-1M and Book-Crossing, we additionally select a subset of triples from the sub-KG whose relation name contains "film" or "book" respectively to further reduce KG size. Given the sub-KGs, for MovieLens-1M, Book-Crossing, and Last.FM, we collect IDs of all valid movies, books, or musicians by matching their names with tail of triples (), , or , respectively. For simplicity, items with no matched or multiple matched entities are excluded. We then match the IDs with the head and tail of all KG triples and select all well-matched triples from the sub-KG. The constructing process is similar for Bing-News except that: (1) we use entity linking tools to extract entities in news titles; (2) we do not impose restrictions on the names of relations since the entities in news titles are not within one particular domain. The basic statistics of the four datasets are presented in Table statistics. Note that the number of users, items, and interactions are smaller than original datasets since we filtered out items with no corresponding entity in the KG.

### 数据集

• {movielens-1m} \ socknote {https:///gouplens.org/datasets/movielens/1m/}是一个广泛使用的电影建议中的基准数据集，其中包括在内在 Movielens 网站上大约 100 万只明确的评级（范围从 1 到 5）。
• {book-crossing} \ opetnote {http://www2.informatik.uni-freiburg.de/cziegler/ bx /}数据集包含 1,149,780 个在书籍交叉社区中的书籍的明确评级（从 0 到 10）。 - {last.fm} \ socknote {https://grouplens.org/datasets/hetrec-2011/}数据集包含来自 Last.fm 在线音乐系统的一组 2,000 个用户的音乐家侦听信息。
• {Bing-News} DataSet 包含从 2016 年 10 月 16 日至 2017 年 8 月 11 日的 Bing 新闻\脚注{https://www.bing.com/news}的服务器日志收集了 1,025,192 件隐式反馈。每件新闻有标题和片段。

### Baselines

We compare our proposed MKR with the following baselines. Unless otherwise specified, the hyper-parameter settings of baselines are the same as reported in their original papers or as default in their codes. - {PER} treats the KG as heterogeneous information networks and extracts meta-path based features to represent the connectivity between users and items. In this paper, we use manually designed user-item-attribute-item paths as features, i.e., "user-movie-director-movie", "user-movie-genre-movie", and "user-movie-star-movie" for MovieLens-20M; "user-book-author-book" and "user-book-genre-book" for Book-Crossing; "user-musician-genre-musician", "user-musician-country-musician", and "user-musician-age-musician" (age is discretized) for Last.FM. Note that PER cannot be applied to news recommendation because it's hard to pre-define meta-paths for entities in news.

• {CKE} combines CF with structural, textual, and visual knowledge in a unified framework for recommendation. We implement CKE as CF plus structural knowledge module in this paper. The dimension of user and item embeddings for the four datasets are set as 64, 128, 32, 64, respectively. The dimension of entity embeddings is 32 .
• {DKN} treats entity embedding and word embedding as multiple channels and combines them together in CNN for CTR prediction.In this paper, we use movie/book names and news titles as textual input for DKN. The dimension of word embedding and entity embedding is 64, and the number of filters is 128 for each window size 1, 2, 3. - {RippleNet} is a memory-network-like approach that propagates users’ preferences on the knowledge graph for recommendation. The hyper-parameter settings for Last.FM are d=8 , H=2 , \lambda_1 = 10^{-6} , \lambda_2=0.01 , \eta=0.02 .
• {LibFM} is a widely used feature-based factorization model. We concatenate the raw features of users and items as well as the corresponding averaged entity embeddings learned from TransR as input for LibFM. The dimension is {1, 1, 8} and the number of training epochs is 50. The dimension of TransR is 32.
• {Wide & Deep} is a deep recommendation model combining a (wide) linear channel with a (deep) nonlinear channel. The input for Wide & Deep is the same as in LibFM. The dimension of user, item, and entity is 64, and we use a two-layer deep channel with dimension of 100 and 50 as well as a wide channel.

\Model MovieLens-1M Book-Crossing Last.FM Bing-News
AUC ACC AUC ACC AUC ACC AUC ACC
\PER 0.710 (-22.6%) 0.664 (-21.2%) 0.623 (-15.1%) 0.588 (-16.7%) 0.633 (-20.6%) 0.596 (-20.7%) - -
CKE 0.801 (-12.6%) 0.742 (-12.0%) 0.671 (-8.6%) 0.633 (-10.3%) 0.744 (-6.6%) 0.673 (-10.5%) 0.553 (-19.7%) 0.516 (-20.0%)
DKN 0.655 (-28.6%) 0.589 (-30.1%) 0.622 (-15.3%) 0.598 (-15.3%) 0.602 (-24.5%) 0.581 (-22.7%) 0.667 (-3.2%) 0.610 (-5.4%)
RippleNet 0.920 (+0.3%) 0.842 (-0.1%) 0.729 (-0.7%) 0.662 (-6.2%) 0.768 (-3.6%) 0.691 (-8.1%) 0.678 (-1.6%) 0.630 (-2.3%)
LibFM 0.892 (-2.7%) 0.812 (-3.7%) 0.685 (-6.7%) 0.640 (-9.3%) 0.777 (-2.5%) 0.709 (-5.7%) 0.640 (-7.1%) 0.591 (-8.4%)
Wide \| Deep 0.898 (-2.1%) 0.820 (-2.7%) 0.712 (-3.0%) 0.624 (-11.6%) 0.756 (-5.1%) 0.688 (-8.5%) 0.651 (-5.5%) 0.597 (-7.4%)
\MKR 0.917 0.843 0.734 0.704 0.797 0.752 0.689 0.645
MKR-1L - - - - 0.795 (-0.3%) 0.749 (-0.4%) 0.680 (-1.3%) 0.631 (-2.2%)
MKR-DCN 0.883 (-3.7%) 0.802 (-4.9%) 0.705 (-4.3%) 0.676 (-4.2%) 0.778 (-2.4%) 0.730 (-2.9%) 0.671 (-2.6%) 0.614 (-4.8%)
MKR-stitch 0.905 (-1.3%) 0.830 (-1.5%) 0.721 (-2.2%) 0.682 (-3.4%) 0.772 (-3.1%) 0.725 (-3.6%) 0.674 (-2.2%) 0.621 (-3.7%)

### 基准

• {CKE}将 CF 与结构，文本和视觉知识相结合，以统一框架进行推荐。我们在本文中实施 CKE 作为 CF Plus 结构知识模块。四个数据集的用户和项目嵌入的维度分别设置为 64,128,32,64。实体嵌入的维度为 32 美元。
• {DKN}将实体嵌入和单词嵌入为多个通道，并将它们组合在 CNN 中用于 CTR 预测。在本文中，我们使用电影/书籍名称和新闻标题作为 DKN 的文本输入。单词嵌入和实体嵌入的维度为 64，每个窗口大小为 1,2,3 的滤波器的数量为 128，3. - {ripplenet}是一种类似的内存网络类似的方法，可在知识图上传播用户的偏好推荐。 Last.fm 的超参数设置为 d = 8 h = 2 \ lambda_1 = 10 ^ { - 6} \ lambda_2 = 0.01 \ eta = 0.02
• {libfm}是一种广泛使用的基于功能的分解模型。我们连接用户和项目的原始功能以及从 Transr 中学到的相应平均实体嵌入物作为 Libfm 的输入。维度是\ {1,1,8 }，训练时期的数量是 50. Transr 的维度为 32.
• {Wide & Deep} 是一个（宽）线性通道的深度推荐模型一个（深）非线性通道。广泛 \＆ Deep 的输入与 Libfm 中的相同。用户，项目和实体的维度为 64，我们使用具有 100 和 50 的尺寸以及宽通道的双层深度通道。

### Experiments setup

In MKR, we set the number of high-level layers $K = 1$ , $f_{RS}$ as inner product, and $\lambda_2 = 10^{-6}$ for all three datasets, and other hyper-parameter are given in Table statistics. The settings of hyper-parameters are determined by optimizing $AUC$ on a validation set. For each dataset, the ratio of training, validation, and test set is $6 : 2 : 2$ . Each experiment is repeated $3$ times, and the average performance is reported. We evaluate our method in two experiment scenarios: (1) In click-through rate (CTR) prediction, we apply the trained model to each piece of interactions in the test set and output the predicted click probability. We use $AUC$ and $Accuracy$ to evaluate the performance of CTR prediction. (2) In top- $K$ recommendation, we use the trained model to select $K$ items with highest predicted click probability for each user in the test set, and choose $Precision@K$ and $Recall@K$ to evaluate the recommended sets.

### Empirical study

We conduct an empirical study to investigate the correlation of items in RS and their corresponding entities in KG. Specifically, we aim to reveal how the number of common neighbors of an item pair in KG changes with their number of common raters in RS. To this end, we first randomly sample 1 million item pairs from MovieLens-1M. We then classify each pair into 5 categories based on the number of their common raters in RS, and count their average number of common neighbors in KG for each category. The result is presented in Figure case_study_1, which clearly shows that . Figure case_study_2 shows the positive correlation from an opposite direction. The above findings empirically demonstrate that , thus the cross knowledge transfer of items benefits both recommendation and KGE tasks in MKR.

### 结果

#### Comparison with baselines

The results of all methods in CTR prediction and top- $K$ recommendation are presented in Table ctr and Figure precision, recall, respectively. We have the following observations: - PER performs poor on movie, book, and music recommendation because the user-defined meta-paths can hardly be optimal in reality. Moreover, PER cannot be applied to news recommendation. - CKE performs better in movie, book, and music recommendation than news. This may be because MovieLens-1M, Book-Crossing, and Last.FM are much denser than Bing-News, which is more favorable for the collaborative filtering part in CKE. - DKN performs best in news recommendation compared with other baselines, but performs worst in other scenarios. This is because movie, book, and musician names are too short and ambiguous to provide useful information. - RippleNet performs best among all baselines, and even outperforms MKR on MovieLens-1M. This demonstrates that RippleNet can precisely capture user interests, especially in the case where user-item interactions are dense. However, RippleNet is more sensitive to the density of datasets, as it performs worse than MKR in Book-Crossing, Last.FM, and Bing-News. We will further study their performance in sparse scenarios in Section \ref{sec:sparse}. - In general, our MKR performs best among all methods on the four datasets. Specifically, MKR achieves average Accuracy gains of 11.6% , 11.5% , 12.7% , and 8.7% in movie, book, music, and news recommendation, respectively, which demonstrates the efficacy of the multi-task learning framework in MKR. Note that the top- K metrics are much lower for Bing-News because the number of news is significantly larger than movies, books, and musicians.

\Model r
10\% 20\% 30\% 40\% 50\% 60\% 70\% 80\% 90\% 100\%
\PER 0.598 0.607 0.621 0.638 0.647 0.662 0.675 0.688 0.697 0.710
CKE 0.674 0.692 0.705 0.716 0.739 0.754 0.768 0.775 0.797 0.801
DKN 0.579 0.582 0.589 0.601 0.612 0.620 0.631 0.638 0.646 0.655
RippleNet 0.843 0.851 0.859 0.862 0.870 0.878 0.890 0.901 0.912 0.920
LibFM 0.801 0.810 0.816 0.829 0.837 0.850 0.864 0.875 0.886 0.892
Wide \| Deep 0.788 0.802 0.809 0.815 0.821 0.840 0.858 0.876 0.884 0.898
\MKR 0.868 0.874 0.881 0.882 0.889 0.897 0.903 0.908 0.913 0.917

### Deep Recommender Systems

Recently, deep learning has been revolutionizing recommender systems and achieves better performance in many recommendation scenarios.

Roughly speaking, deep recommender systems can be classified into two categories:

(1) Using deep neural networks to process the raw features of users or items ;

For example, Collaborative Deep Learning designs autoencoders to extract short and dense features from textual input and feeds the features into a collaborative filtering module; DeepFM combines factorization machines for recommendation and deep learning for feature learning in a neural network architecture.

(2) Using deep neural networks to model the interaction among users and items . For example, Neural Collaborative Filtering replaces the inner product with a neural architecture to model the user-item interaction.

The major difference between these methods and ours is that MKR deploys a multi-task learning framework that utilizes the knowledge from a KG to assist recommendation.

### 深层推荐系统

（1）使用深神经网络来处理用户或物品的原始功能;例如，协作深度学习设计 AutoEncoders 从文本输入中提取短和密集的功能，并将其特征馈送到协作过滤模块中; DeepFM 在神经网络架构中结合了构建和深度学习的因子化机器。
（2）使用深神经网络来模拟用户和项目之间的互动。例如，神经协作滤波用神经架构替换内部产品以模拟用户项交互。这些方法和我们的主要区别在于 MKR 部署了一个多任务学习框架，利用 KG 的知识来协助推荐。

## Conclusions and Future Work

This paper proposes MKR, a multi-task learning approach for knowledge graph enhanced recommendation. MKR is a deep and end-to-end framework that consists of two parts: the recommendation module and the KGE module. Both modules adopt multiple nonlinear layers to extract latent features from inputs and fit the complicated interactions of user-item and head-relation pairs.

Since the two tasks are not independent but connected by items and entities, we design a cross & compress unit in MKR to associate the two tasks, which can automatically learn high-order interactions of item and entity features and transfer knowledge between the two tasks.

We conduct extensive experiments in four recommendation scenarios. The results demonstrate the significant superiority of MKR over strong baselines and the efficacy of the usage of KG.

For future work, we plan to investigate other types of neural networks (such as CNN) in MKR framework. We will also incorporate other KGE methods as the implementation of KGE module in MKR by redesigning the cross & compress unit.

We omit the proofs for Proposition 2 and Proposition 3 as they are straightforward.