A Time-Aware Graph Neural Network for Session-Based Recommendation

Recently, Graph Neural Networks (GNNs) have attracted increasing attention in the field of session-based recommendation, due to its strong ability on capturing complex interactive transitions within sessions. However, existing GNN-based models either lack the use of user’s long-term historical behaviors or fail to address the impact of collaborative filtering information from neighbor users on the current session, which are both important to boost recommendation. In addition, previous work only focuses on the sequential relations of interactions while neglects the time interval information which can imply the correlations between different interactions. To tackle these problems, we propose a Time-Aware Graph Neural Network (TA-GNN) for session-based recommendation. Specifically, we first construct a user behavior graph by linking the interacted items of the same user according to their corresponding time order. A time-aware generator is designed to model the correlations between different nodes of the user behavior graph by considering the time interval information. Moreover, items from the neighbor sessions of the current session are selected to build a neighborhood graph. Then the two graphs are respectively processed by two different modules to learn the representation of the current session, which is applied to produce the final recommendation list. Comprehensive experiments show that our model outperforms state-of-the-art baselines on three real world datastes. We also investigate the performance of TA-GNN on different numbers of historical interactions and on different session length, finding that our model presents consistently advantages under different conditions.


I. INTRODUCTION
In the information explosion era, recommender systems (RS) have become increasingly important to help user pick out the information he (or she) actually needs in many domains, e.g., web search, e-commerce, and music. Conventional RS makes recommendation mainly based on a static user rating matrix, which neglects the chronological order of user's interactions. As a result, conventional RS is deficient in catching user's short-term intent from his (or her) recent interactions. To tackle this problem, session-based recommender system (SBRS) is proposed to learn user's recent preference of the ongoing session. In SBRS, a session denotes an ordered sequence of items which are interacted by the same user within a period.
The associate editor coordinating the review of this manuscript and approving it for publication was Eyhab Al-Masri .
Current studies mostly employ the Recurrent Neural Network (RNN) to handle the session sequence in SBRS [1]- [4], while Wu et al. [5] argue that RNN-based methods can only model single-way transitions between consecutive items and neglect contextual transitions among the entire session sequence. To handle the complex transitions among distant items, Wu et al. [5] first propose a SR-GNN model to introduce Graph Neural Networks for SBRS, which achieves strong performance. Furthermore, Xu et al. [6] combine GNN and Self-Attention Network (SAN) to capture long-range dependencies in sessions. Yu et al. [7] propose a novel target attentive graph neural network to take candidate items into consideration when generating the session representation. Considering that the above work only relies on anonymous sessions lacking users' long-term profiles, Wu et al. [8] propose to build user behavior graph based on both user's long-term and short-term interactions. VOLUME 8, 2020 This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/ Despite that existing GNN-based methods have made remarkable progress on SBRS, they mostly neglect collaborative information from neighbor sessions that has been proved critical to help provide satisfying recommendation for current session. Moreover, previous works only consider the chronological order of interactions while the time interval between two interactions has not been well-studied as it may help to understand the correlations of different interacted items. Take Fig. 1 as an example, if a user interact with a item after another with a short time interval, it may indicate that the two items are highly correlated by user's ongoing interest. While a long time interval between two items may indicate a low correlation since user's interest has drifted. To address the above issues, we propose a Time-Aware Graph Neural Network (TA-GNN) for session-based recommendation task. In detail, we first construct a user behavior graph by linking the interacting items of the same user based on their time order in sessions. Then we apply the idea of K-nearest neighbor [9] to find neighbor sessions for the current session and use them to build the neighborhood graph. Based on the user behavior graph, we propose a profile-based representation learning module consisting of a time-aware generator and a general generator, which build adjacency matrices according to the time interval and the number of edges between two nodes, respectively. In detail, the timeaware generator can assign a larger value to the corresponding position of the adjacency matrices when the time interval between two adjacent items is smaller, which allows the two items with shorter time internal between them to get more information from each other when generating their representations. The representation of each node in the user behavior graph is learned by a graph neural network, and an attention mechanism is applied to generate the representation of the current session by a linear combination of node representations in the current session. As to the neighborhood graph, we use a general graph neural network to obtain another representation of the current session. After that, we combine the two representations, i.e., the profile-based and neighbor-based representations to characterize the current session and produce the recommendation. We conduct extensive experiments on three real-world datasets and the results show that our TA-GNN model outperforms the stateof-art baselines in terms of Recall@20 and MRR@20.
Our main contribution can be summarized as: • We propose a TA-GNN model for session-based recommendation, which can effectively leverage the effect of collaborative information and long-term behaviors on the short-term session to make personalized and rich recommendations.
• To the best of our knowledge, we are the first to introduce the time interval information to session-based recommendation. We construct a time-aware generator that can infer the correlation of two items from the detail of the time interval between interactions.
• We conduct extensive experiments on three publicly available datasets. Our experimental results show that TA-GNN can improve the performance on session-based recommendation task.
The remainder of this paper is organized as follows. First, we introduce the related works in section II. Then, we formulate the session-based task and detail our TA-GNN in section III. Next, in section IV and V, we present the experimental settings and results, respectively. Finally, we conclude our work and list the suggestions for future work.

II. RELATED WORK
In this section, we briefly introduce the previous work on session-based recommendation ( §II-A) at first. Then we introduce the development of Graph Neural Network ( §II-B) in RS.

A. SESSION-BASED RECOMMENDATION
Session-based Recommender System (SBRS) is a sub-task of sequential recommendation [10]. Early session-based approaches are based on Markov Chain (MC) models [11]- [13] to capture sequential patterns between user-item interactions. Then the Markov Decision Processes (MDP) models [14]- [16] are proposed to overcome the weakness of MC on sparse data. However, Markov-based models neglect considering sequentiality between discontinuous items, which leads to imbalance between user's general performance and sequential behavior [17]. Recently, RNN becomes a primary structure in SBRS due to its strong sequence processing ability [18]. Hidasi et al. [1] first employ RNN with Gated Recurrent Unit (GRU) in SBRS. Their model is widely known as GRU4rec which inspires much following work [19], [20]. For instance, Tan et al. [4] further improve GRU4rec by adopting data augmentation and a method to account for shifts in the input data distribution. Later, Li et al. [3] propose a Neural Attentive Recommendation Machine (NARM), which uses attention mechanism to balance local and global preference of users. To combine long-term and short-term behaviors, Quadrana et al. [20] propose a hierarchical RNN structure that involves historical information in generating the representation of the ongoing session. Furthermore, Li et al. [21] propose a Bi-LSTM structure on users' entire historical interaction profiles to make recommendation for the current session. To distinguish the influence of different historical sessions, Sun et al. [22] apply a two-layer nonlocal architecture to identify relevant historical sessions and then learn accurate short-term preference. With the same purpose, Chen et al. [23] apply a co-attention network to capture the dynamic interactions between the user's long-term and short-term interaction behaviors.
Besides RNN structures, memory networks also show superiority on sequential recommendation in recent years. For example, Liu et al. [24] propose a Short-Term Attention/Memory Priority Model (STAMP), which beats the RNN-based method NARM in SBRS. Moreover, a growing number of work incorporate the idea of collaborative filtering into sequential recommendations. For example, Bonnin and Jannach [25] propose SKNN to consider each session as a whole in sequential recommendation and its improved version KNN-RNN [26] combines KNN and RNN to achieve better performance. Later, Wang et al. [27] build an end-toend model, which contains two modules to model user's own information in the current session and exploit collaborative information to better predict the intent in the current session, respectively.
Compared with the approaches outlined above, our TA-GNN model utilizes both the user's long-term behaviors and collaborative information from neighbor sessions into consideration, and employs the graph neural network to leverage the above information in a unified framework. Our approach differs from previous work in that we first introduce the time interval information to session-based recommendation task.

B. GRAPH NEURAL NETWORKS
Neural networks are widely used for generating representation for graph-structured data, r.g., knowledge base and social network. However, traditional graph representation methods, such as DeepWalk [28], LINE [29] and Deep Graph Kernels [30], mainly focus on unsupervised tasks and have difficulty in scaling to large graphs. In order to learn graph embedding in the supervised scenario, Yanardag and Vishwanathan [30] propose the concept of Graph Neural Network, which is extended by Micheli [31] and Scarselli et al. [32]. These methods mainly learn the representations of target nodes based on the recurrent neural unit. Following their work, Li et al. [33] propose a Gated Graph Neural Network (GGNN) to the sequential output, which makes a great improvement on SBRS.
Inspired by the success of attention mechanism in various tasks, numerous researchers apply attention mechanisms on graphs [34]. For example, Velickovic et al. [35] applies attention mechanism to learn node representation in a graph, which leads to the Graph Attention Network (GAT) model. With the help of attention mechanism, GAT can aggregate more information from the most critical part of the graph. Extending the superiority of GAT to SBRS, Zheng et al. [36] apply a multi-head attention to decide the importance of neighbor items of the current session. Wu et al. [8] use the self-attention mechanism to explore the effect of the historical interactions on the items of the current session. Different from the above GNN-based models, we apply a time-aware generator when modeling the graph structure, which determines the adjacency matrix according to the time interval between two interactions.

III. METHOD
In this section, we first formalize the task of session-based recommendation and present an overall framework of our solution. Then, the proposed Time-Aware Graph Neural Network (TA-GNN) is introduced in detail.

A. OVERVIEW
i=0 be the items set in the dataset, each item v i can be represented as a vector e v i after being transformed by an embedding matrix W emb . The set of all sessions are defined as S, where sessions belonging to the user u can be defined as where n is the number of sessions for user u. From S u , the current session in which we make recommendation is defined as S u c = S u n , while the historical sessions before S u c are defined as The neighbor sessions of the current session from other users are defined as is an interaction sequence from the corresponding user u, where v i,j ∈ I represents the interactive item in the session S u i and m i is the number of items in S u i . Sessions and items are ordered by timestamps. Given users' current session S u c , the target of session-based recommendation is to predict the next clicled item v i,m i +1 for S u c based on the historical sessions S u h and the neighbor sessions S u n . Fig. 2 presents an overview of our proposed TA-GNN model, which mainly consists of three modules, i.e., the profile-based representation module (see §III-B), the neighborhood-based representation module (see §III-C) and the prediction module (see §III-D). In the profile-based representation module, the user behavior graph G u is created based on users' current session S u c and historical sessions S u h . Then G u is used as the input to the profile-based generator, which aims to generates the profile-based representation s p for the current session. Similarly, in the neighborhood-based representation module, the neighborhood graph G n is built by looking up the neighbor relationship between the items of the current session S u c and of the neighbor sessions S u n . Then G n is used to generate the neighbor-based presentation s n for the current session. Finally, we concatenate s p and s n to obtain a unified presentation s of the current session. Using s, our model outputs the probability vectorŷ which indicates the recommendation scores of the candidate items.

B. PROFILE-BASED REPRESENTATION MODULE
The profile-based representation module aims to represent the current session from the perspective of user's own behavior information. We build a user behavior graph based on uers's historical and current sessions, moreover design two GNN-based generators to learn the representation of current session. VOLUME 8, 2020 , where a node i ∈ V u represents an item v i ∈ V that the user interacted with, an edge e i,j ∈ ξ u between nodes v i and v j indicates that user u interacts with item v j after v i in one of his session. Based on the user behavior graph, we design a profile-based generator which includes two subordinate generators, i.e., time-aware generator and general generator, to enrich the analysis of transition relationships in the user behavior graph and generates the representation for the current session.
Time-Aware Generator builds two time-aware adjacency matrices A I T , A O T ∈ R m×m according to the time interval between two nodes. In detail, A I T and A O T indicate the in-degree and out-degree time-aware adjacency relationships respectively. We argue that two interactions are more relevant when the time interval between them is shorter, so we set the weight of the edges ξ u inversely proportional to the time interval. In order to reduce the complexity of calculation, we adopt a linear interpolation to determine the weight between two nodes as follows: where t v i ,v j is the time interval between nodes v i and v j , if there are multiple edges from v i to v j , t v i ,v j is generated by averaging the time intervals of these edges. t max and t min are the longest and the shortest time intervals, respectively. ω t i,j denotes the time-aware weight from v i to v j , which is directed and tends to increase from 0 to 1 when the time interval decreases from t max to t min . In order to consider the self-effect of nodes, ω t i,i , i ∈ [1, m] are set to 1. Then the time-aware transition relationships in the user behavior graph G u can be represented by the two adjacency matrices A I T and A O T , which can be written as:  General Generator builds two general adjacency matrices A I G , A O G ∈ R m×m , indicating in-degree and out-degree general adjacency relationships respectively. Different from the time-aware generator, the general generator calculates the directed weights between two nodes based on the number of links between them. The weights can be denoted as follows: where num(x, y) indicates the number of occurrence that item y is interacted by the user after item x. N out represents the set of predecessor nodes of v i on a edge and N in represents the set of successor nodes of v i . Then the general adjacency can be written as: Similarly with the time-aware generator, ω are also set to 1 considering the influence of the nodes on themselves.
After obtaining the A O T , A I T and A I G , A O G , we aggregate information for the target node v i according to the above four adjacency matrices. The aggregation process contains t step with identical operation to update the representations of nodes. The t-th step can be denoted as follow: where is the list of nodes representation vectors at t −1 step. It is worth noting that h 0 i represents the item embedding e v i for node v i when t = 1 at the beginning of the aggregation process. After drawing out the contextual information, we concatenate them to keep information integrity and obtain final contextual information representation of node v i , which can be written as the following operation: (9) where || is the concatenation operation. a t i ∈ R 1×4d is the vector representation of node v i , which contains four types of contextual information. Then we incorporate the contextual information with the nodes representation of the previous timestep to update each node's representation based on a gated recurrent units (GRU) [37] as follows: where W z , W r , W o ∈ R 4d×d , U z , U r , U o ∈ R d×d , are learnable parameters. σ (·) is the sigmoid function and represents element-wise multiplication. z t i and r t i are the reset and update gates respectively, which control preserving and discarding the information respectively. After t update steps, we get the final representation v t i of each node in G u . For simplicity, we use h i instead of h t i .
Then we select item representations in the current session to characterize the profile-based presentation s p . Take Fig. 2 as an example, the items in the current session are v 1 , v 3 , v 4 and v 6 , after aggregation process, their corresponding representations which can be defined as h 1 , h 3 , h 4 and h 6 , respectively, will be selected to build s p . SR-GNN [5] and NARM [3] adopt a soft-attention mechanism, which are proved to have a strong ability to extract the user's main purpose in the current session. Inspired by the success of the soft-attention, we adopt the same way to build global representation and local representation respectively. The global representation can be calculate as: where W 0 ∈ R d is a parameter vector, W 1 , W 2 ∈ R d×d are parameter matrices, b c ∈ R d is a bias vector. σ (·) indicates the sigmoid function and α i is the weight of v i in the current session. The local representation is always simply defined as the representation of the last item in the current session: Finally, in order to maintain the integrity of local information and global information, we adopt concatenation operation to aggregate s global p and s local p as the profile-based representation for the current session:

C. NEIGHBORHOOD-BASED REPRESENTATION MODULE
We build a Neighborhood Graph G n based on the current session and its neighbor sessions to incorporate the collaborative information to enrich the representation learning of the current session. The process consists of three steps, namely neighbor sessions retrieval, neighbor graph construction and neighbor-based generator. Neighbor Sessions Retrieval aims to construct neighbor set N s for the current session. Following [36], we start by looking for the possible neighbor sessions which have co-occurrence items with the current session from the entire dataset. Then we adopt a strategy of selecting m most recent sessions from the possible neighbor sessions to build candidate neighbor session set S, which is proved to be effective in [38]. In our paper, we set m = 1000 based on [38]. After obtaining S, we begin to select neighbor sessions of the current session from it. First, we calculate similarities between the current session S u c and every other session S o ∈ S based on the number of the co-occurrence item as follows: where co(S u c , S o ) is the number of items that appear in both S u c and S o . l(S u c ) and l(S o ) indicates the length of S u c and S o respectively. After filtering out the sessions of which the similarity is lower than 0.5 in S, we select top-k similar sessions to construct the neighbor set N s for the current session. VOLUME 8, 2020 Neighbor Graph Construction: Based on N s and current session sequence, we build a neighborhood graph G n to model the transition relationship between items in the current session and its neighbor sessions. As shown in Fig. 2, only the first-order neighbors of items in the current session are included in the neighborhood graph. In that graph, each edge(v i−1 , v i ) is single and undirected, which represents that item v i is interacted before or after item v i−1 . The motivation of why we use undirected graph is similar as in [36], which argues that related items might be located in different relative positions for target items in the current session.
Neighbor-Based Generator: Similarly with in the profile-based generator, the first step in neighbor-based generator is to obtain representation for each nodes in the neighborhood graph. We do not consider time interval between two nodes in the neighborhood graph G n , because its nodes are interacted by different users, whose average interaction time intervals are different. This means that even facing the same two nodes, different users may interact in different time intervals. In this case, using time interval to judge the the correlation between two nodes may disturbs the performance of recommendation. Furthermore, we do not consider in-degree and out-degree transition between two nodes, as G n is single undirected. Thus, we only use the graph's adjacency matrix A N to model the transitions between nodes. In particular, if there is edge e ij between two nodes v i and v j , we set the corresponding element A ij to 1, otherwise to 0. We further set the diagonal elements A ii to 1 to ensure the self-correlation of nodes in G n . Learning item representations in neighbor-based generator is similar with the process from the equation (8) to the equation (10), which can be written as follows: where the corresponding parameters play the same role as the parameters in equation (10) and he upper right slash is used to distinguish them. In order to distinguish item representations obtained by profile-based representation module, we useh i to denote the updated latent vector of node v i in the neighborhood graph in the neighborhood-based representation module.
After obtaining the representations of each nodes, the same attention mechanism as in profile-based representation module are used to model neighborhood-based representation of the current session as follows: where the parameters W 0 , W 1 , W 2 , b c play the similar role as W 0 , W 1 , W 2 , b c in the profile-based module. s n indicates the neighborhood-based representation for the current session S u c .

D. PREDICTING PROCESS
After obtaining the profile-based representation s p and the neighborhood-based representation s n , which aggregates user's long-term behavior and collaborative information into the current session respectively, we concatenate them together to construct the final representation for the current session: Then we can give recommendation scores for each candidate item in the whole dataset by combining s with global items embedding matrix W emb : where B ∈ R d×4d is a learnable parameters andẑ ∈ R |I | is the score vector which denotes the recommendation scores over all candidate items. Finally we apply a softmax function to generate the final probability distribution vectorŷ where the corresponding positionŷ i inŷ indicates the probabilities of item i becoming the final choose of user u in the current session S u c . To learn the parameters in our models, we take each session as a sample and process them separately. In the training phases, a fixed number of samples are filled into a mini-batch and the gradient descent algorithm is used on cross-entropy loss: (21) where y is a one-hot encoding vector and indicates the truly probability distribution. Our model is trained by a Back-Propagation Through Time (BPTT) algorithm [39] in the learning process.

IV. EXPERIMENTS
In this section, we first present the datasets in Section IV-A. Then research questions and evaluation metrics are described in Section IV-B. Finally we briefly introduce the baseline models used for comparison in this paper and the parameter settings in Section IV-C.

A. DATASETS
We conduct experiments on three real-world datasets, namely 30MUSIC, Nowplaying and Tmall. 30MUSIC is collected based on the listening events in a whole year through Last.fm API [40]. Nowplaying is created from music-related tweets, where users posted which tracks they were currently listening [41]. Tmall is published by Tmall competition, which is composed of interaction logs of the tmall.com for one year [38].
Following our previous work [42], we preprocess each dataset as follows. First, with the purpose to ensure each session has a sequential form, we filter out the sessions containing more than one interaction. Then, we remove items with supports less than 10 to improve the item density and reduce the size of items embedding matrix to make training faster. Finally, we delete the users with less than two sessions from each dataset to ensure that each user graph contains interactions from historical sessions. The statistics of the datasets after preprocessing are shown in Table 1. For each user, the last session are picked up as the test set and the previous sessions as the training set. In every session, the last interaction is selected as the ground truth for training and the remaining interactions together with the interactions in the historical sessions from the same user and the interactions in neighbor sessions are used as the input to SBRS models.

B. RESEARCH QUESTIONS AND EVALUATION METRICS
We list the following research questions to guide our experiments: With the purpose to answer these questions, we use Recall@N and MRR@N , which are frequently-used metrics in sequential recommendation, to measure the effect of the recommendation given by different models. In the following, the test dataset is defined as Test, the number of test samples is |Test|.

RQ1
• Recall@N indicates the proportion of the correctly recommended items amongst top-N items, which can be calculated as follows.
where N indicates the number of recommended items and hit i = 1 when the correctly recommended item i is in the recommendation list, otherwise hit i = 0.
• MRR@N is the average of reciprocal ranks of the correctly recommended items, which is calculated as follows.
where rank i is the ranking of the correctly recommended items in the recommendation lists. The reciprocal ranks is set to zero when the ranking is larger than N. For simplicity, we set N = 20 to compare the model performance.

C. BASELINES AND PARAMETER SETTINGS
We compare our TA-GNN model to six methods to examine its effectiveness on SBRS.
• Pop recommends the most popular items in the dataset to each user, though simple, Pop is a strong baseline in many studies.
• Item-KNN [9] adopts the idea of nearest neighbor and recommends items most similar to the last clicked item in the session to the user. The similarity of two items is defined as the frequency with which they appear in the same session.
• NARM [3]: employs an attention mechanism to capture user's main purpose and sequential behavior based on a RNN structure. It is an essential RNN-based model in SBRS.
• I3GN [36] constructs intra-session graph and intersession graph for the current session to capture the current sequence and collaborative information. GNN and multi-head attention are employed to encode information of two graphs, respectively.
• BINN [21] adopt a behavior-intensive neural network on the whole historical interaction sequence to incorporate both long-term preference and short-term consumption motivations to make recommendation in SBRS.  Model performance in terms of Recall@20 and MRR@20. The results produced by the best performer and the best baseline in each column are boldfaced and underlined. ( means our model is statistical significantly better than the best baseline on a t -test for α = .01).
training for all neural modes, we use Adam Optimizer [43] with learning rate 0.01 to learn the hyper parameters. The mini-batch size is set as 256.

A. OVERALL PERFORMANCE
To answer (RQ1), we compare our TA-GNN model to baselines in terms of Recall@20 and MRR@20 on three datasets. The result is shown in Table 2.
Let us discuss baselines first. As shown in Table 2, we can find traditional methods, i.e., Pop and Item-KNN, both lag obviously behind the neural models. This indicates neural networks are powerful in SBRS. Comparing two GNN-based baslines, i.e., I3GN and A-PGNN, we can find that A-PGNN often leads in terms of MRR@20 and I3GN is more advantageous in terms of Recall@20. This may reveal that the addition of historical interactions contributes more to the promotion of MRR, while the collaborative filtering information from neighbors contributes more to the promotion of Recall.
Then we focus on the comparison between our model and baselines. From Table 2 we can see that TA-GNN shows obvious superiority over baselines on all datasets in terms of both metrics, which clearly demonstrates its effectiveness on the session-based recommendation task. Specifically, TA-GNN respectively produces 7.2%, 22.2% and 14.0% improvements over the best baseline on three dataset in terms of Recall@20, and the improvements in terms of MRR@20 reach up to 8.9%, 12.0% and 6.8%. As has been demonstrated in [44] that, although the performance of existing models on the offline datasets seem to be at a low level in terms of Recall and MRR, these models still have practical significance in real-world applications. Moreover, even small improvements in the performance of offline models can increase user satisfaction in actual online testing. Compared with RNN-based models, i.e., NARM and BINN, our TA-GNN model uses GNN as main structure and shows obvious superiority. This indicates that GNN is more powerful than RNN in SBRS, which may be due to the fact that GNN has strong ability to handle the complex transitions in session sequence. Further compared to I3GN, our model applies user's historical interactions to personalize the recommendation and achieves average increases of 18.1% and 18.9% on three datasets in terms of Recall@20 and MRR@20, respectively. It indicates that the participation of historical information can really help boost the recommendation. Compared to A-PGNN, which gains best performance in most times among baselines, TA-GNN achieves significant improvements. We attribute this performance improvement to the time-aware generator and the used neighbor information in our model taht greatly help enrich the recommendation. Thus we study the effect of time-aware generator and neighbor information in V-B.

B. COMPONENTS ANALYSIS
Next, we turn to (RQ2). We compare TA-GNN with its different variants to confirm the effectiveness of the time-aware generator and the use of neighbor information. The variant models include: The performance of different variants is presented in Table 3. We can draw the following conclusions: • We can see that TA-GNN(-N-T) lags behind TA-GNN(-T) and TA-GNN(-N) in terms of both metrics, which illustrates that both the utilization of time-aware generator and the collaborative information from neighbors can help improve the performance in terms of both Recall@20 and MRR@20.
• Comparing TA-GNN(-T) and TA-GNN(-N), we can find that TA-GNN(-T) performs better in terms of Recall@20 while TA-GNN(-N) shows advantages in terms of MRR@20. This phenomenon can be explained from two aspects: on one hand, time-aware generator can  help accurately analyse the correlation between different interactions of the same user, so as to deeply understand the user's behaviors and preferences. This can help rank items closest to the user's preference at top positions in the recommendation list, so that MRR is improved; On the other hand, neighborhood graph contains the information about the similarities between items, which can help to find the most similar items for the current session, and further increase the probability that the ground truth is included in the list.
• Compared with TA-GNN(-T) and TA-GNN(-N), TA-GNN has a significant improvement in terms of both metrics, which indicates that sequential recommendations contain complex transition relationships, and it is necessary to take various factors into account to make accurate personalized recommendations.  Table. 2), we only present the results of neural models in the following experiments. Fig. 4 shows the results. As shown in Fig. 4, our proposed TA-GNN achieves best performance with various history length on all datasets, which presents its robustness to different historical interaction number conditions.
There is also an interesting phenomenon: TA-GNN shows greater advantages when longer history is available. For example, the performance gap between TA-GNN and A-PGNN, i.e., the best baseline, reaches maximum at the fifth group (N ∈ [400, 500]) on both 30MUSIC and Nowplaying in terms of Recall@20. Similarly, the performance gap between TA-GNN and I3GN are most obvious at the sixth group(N ∈ [500, 600]) on Tmall in terms of Recall@20. This indicates that an appropriate number of historical interactions can help TA-GNN show greater advantages, which may be FIGURE 5. Effect on the performance of neural models in terms of Recall@20 and MRR@20 with different session length, tested on three datasets.
due to the fact that too few historical interactions are not conducive to extract personalized information while too many historical interactions may interfere with the intent analysis of the current session.

D. IMPACT OF SESSION LENGTH
To answer RQ4, we examine model performance with different length of current session. We divide the test sets of three datasets into three parts according to their corresponding current session length, i.e., short (no more 5 clicks), medium (6 to 15 clicks) and long (more than 15 clicks). The result is plot in Fig. 5.
From the results we can draw some interesting conclusions. In 30MUSIC and Tmall, all the methods achieve their best performance at the short group in terms of both metrics on all datasets. It actually reflects the fact that the longer a user's current session is, the more difficult it is to get an accurate prediction of the user's true intentions, as the user's interest shifts as he clicks away. Conversely, if the user's current session is short, which indicates his intention is straightforward, it is easier to make recommendations. However, on Nowplaying dataset, model performance seems to be better on long sessions. This may be attributed to that the user's history and neighborhood information are sparse on Nowpalying dataset, and more information from current session helps make appropriate recommendations.
Compared to baselines, the proposed TA-GNN model consistently achieves the best performance on all datasets under various session lengths. The superiority of our model tends to be more obvious when the sessions are longer. For example, TA-GNN achives 17% improvement over A-PGNN on long sessions, while only 5% on short sessions in terms of Recall@20 on 30MUSIC. This shows that our model has a stronger grasp of complex user intentions than other models.

VI. CONCLUSIONS AND FUTURE WORK
We propose a time-aware graph neural network for session-based recommendation task, which can leverage user's historical interactions, neighbor information and time interval to help generate the representation for user's current session. Our extensive experiments on three real-world datasets show the superiority of our model over the stateof-art baselines in terms of Recall and MRR. From the analysis of the components of our model, we find that our proposed time-aware generator can really boost the recommendation, especially can help improve the performance in terms of MRR, which provide a evidence that the time interval between two interactions reflects the correlation between them.
As for future work, we would like to examine the scalability of TA-GNN by evaluating its effectiveness on other datasets. Most importantly, We want to put our model into practical application and see how it behaves. In addition, we would like to investigate the performance of different point-wise loss or pair-wise loss functions on session-based recommendation.
YUPU GUO received the B.S. degree in information system engineering from the National University of Defense Technology, Hunan, China, in 2018, where he is currently pursuing the M.S. degree in management science and engineering.
His research interests include recommendation systems and information retrieval.
YANXIANG LING received the M.S. degree in information system engineering from the National University of Defense Technology, Hunan, China, in 2013, where she is currently pursuing the Ph.D. degree in management science and engineering.
Her research interests include dialog systems and information retrieval.
HONGHUI CHEN received the Ph.D. degree in operational research from the National University of Defense Technology, Hunan, China, in 2007.
He is currently a Professor with the National University of Defense Technology, Hunan, China. He has published several articles at SIGIR, IPM, and other top journals. His research interests include information systems and information retrieval.