# Predicting Dynamic User-Item Interaction with Meta-Path Guided Recursive RNN
## 4 Methodology
### Auxiliary Information Extraction  
For the user-item interaction data, auxiliary information can be acquired from the sequences and the graphs, which will be introduced in detail as follows. **Features extraction from the interaction sequence. ** We can regard the interaction sequence of one user as a sentence and then learn the sequential information from it. As shown in the white box of Figure 2, each item interacted by the user in the sequence can be regarded as a word in a sentence. Thus, we can project the representations of items and users to a common latent space by word2 vec. For example, as illustrated in Figure 3, this is an interaction sequence of user [PERSON] with items. He first buys a basketball, and shortly he buys a basketball jersey, sneakers, and knee pads. Obviously, these four items share some common features because they all belong to the category of sporting goods. Thus it is meaningful to make them close to each other in the projected latent feature space. Given an interaction sequence of \(user_{j}\) which is denoted as \(x_{j}=[z_{1},z_{2},...,z_{T}]\), where \(z_{t}\in\mathbb{R}^{d_{0}\times 1}\) denotes the \(t\)-th item interacted by \(user_{j}\), \(d_{0}\) is the initial dimension of item. For each position \(t=I\),...,\(T\), our task is to predict the context words within a window of size \(m\), given the center word \(z_{c}\). The likelihood function can be formulated as follows  
\[L(\theta)=\prod_{t=1}^{T}\prod_{ \begin{subarray}{c}w\leq c\leq w\\ c\
eq 0\end{subarray} }P(z_{t+c}|z_{t};\theta). \tag{1}\]  
Figure 3: An illustration of the interaction sequence of a user with items. Figure 2: The framework of the proposed MRRNN-S. The objective function \(J(\theta)\) is the average negative log likelihood as follows  
\[J(\theta)=-\frac{1}{T}logL(\theta)=-\frac{1}{T}\sum_{t=1}^{T}\sum_{ \begin{subarray}{c}-\frac{\omega\leq\omega}{c\
eq 0}\\ \varepsilon\
eq 0\end{subarray} }logP(z_{t+c}|z_{t};\theta). \tag{2}\]  
Our goal is to find the parameters \(\theta\) to minimize the objective function \(J(\theta)\), and we will acquire the initial embedding of users and items which contains the sequence information. **Features extraction from graphs. ** The user-item interaction data can be also treated as a graph. As shown in the blue box in Figure 2, the user-item interaction graph consists of users' historical interaction data. There are two types of nodes including users and items. A solid line connects one user node and one item node if the user interacts with the item. As depicted in Figure 4, one can see \(user1\) interacts with \(item1\), \(item2\), and \(item4\) while \(user2\) interacts with \(item2\), \(item3\), and \(item4\) in this user-item interaction graph. It is reasonable to infer that \(item2\) and \(item4\) are more similar because both of them are interacted by users at the same time. When \(user3\) interacts with \(item2\), it is appropriate to recommend \(item4\) to \(user3\). Thus, the user-item interaction graph is able to preserve rich auxiliary information. In addition, in order to make use of the heterogeneity, inspired by [44], we define the metapath which is able to reflect the semantic information between nodes in the graph. For example, given the metapath \(U\)-\(I\)-\(U\), (\(U\)-\(I\)) means a user interacts with an item, and (\(I\)-\(U\)) means the item is interacted by another user. We can sample some instances of the predefined metapaths in the graph by random walk, and embed each node with a skip-gram model to capture the heterogeneity and structure information from the graph. Given the user-item interaction graph \(G(V,\,E,\,T)\), in which each node \(v\) and each link \(e\) are associated with their mapping functions \(\phi(v):\,V\to T_{V}\) and \(\phi(e):\,E\to T_{E}\), respectively. For a given node \(v\), we aim to maximize the probability of correctly predicting its' neighborhood nodes \(N_{t}(v)\), \(t\in T_{V}\).