NAIRS: A Neural Attentive Interpretable Recommendation System · 3.2 Recommendation Module We...

4
NAIRS: A Neural Aentive Interpretable Recommendation System Shuai Yu , Yongbo Wang , Min Yang , Baocheng Li , Qiang , Jialie Shen SIAT, Chinese Academy of Sciences Newcastle University, United Kingdom {shuai.yu,yb.wang,min.yang,bc1.li,qiang}@siat.ac.cn,[email protected] ABSTRACT In this paper, we develop a neural aentive interpretable recom- mendation system, named NAIRS. A self-aention network, as a key component of the system, is designed to assign aention weights to interacted items of a user. is aention mechanism can distinguish the importance of the various interacted items in contributing to a user prole. Based on the user proles obtained by the self-aention network, NAIRS oers personalized high-quality recommendation. Moreover, it develops visual cues to interpret recommendations. is demo application with the implementation of NAIRS enables users to interact with a recommendation system, and it persistently collects training data to improve the system. e demonstration and experimental results show the eectiveness of NAIRS. KEYWORDS Collaborative ltering, Self-aention network, Interpretable recom- mendation, Item-based recommendation 1 INTRODUCTION With the huge volumes of online information, aention has been continuously paid to recommender systems [11, 12]. Item-based collaborative ltering (CF) is one of the most successful techniques in practice due to its simplicity, accuracy, and scalability [7, 8, 10]. It proles a user with the historically interacted items and recommends similar items in terms of user proles. Most of the existing item-based CF methods utilize statistical measures (e.g., cosine similarity) to estimate item similarities. How- ever, the assumption of equal weights is oen applied for the items in the measurement [7]. In other words, dierent items in the historical list are equally treated, which is not true for many of the real-world recommendation applications. On the other hand, interpretable recommendations are of increasing interest, which explain the underlying reasons for the potential user interest on the recommended items. Traditional methods oen generate ex- planations from the textual data such as the content and reviews Permission to make digital or hard copies of part or all of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for prot or commercial advantage and that copies bear this notice and the full citation on the rst page. Copyrights for third-party components of this work must be honored. For all other uses, contact the owner/author(s). CIKM’18, Italy © 2018 Copyright held by the owner/author(s). 123-4567-24-567/08/06. . . $15.00 DOI: 10.475/123 4 associated with the items [24, 13]. Yet, generating reasons of rec- ommendation remains unsolvable when the texts are unavailable. Inspired by the recent successes of aention-based neural net- works [1] in computer vision and natural language processing, this paper proposes a neural aentive interpretable recommenda- tion system (NAIRS) to alleviate the aforementioned limitations. e key to the design of NAIRS is an self-aention network that computes the aention weights of the historical items in a user prole according to their intent importance associated with the user’s preferences. With the learned aention weights, NAIRS provides a high-quality personalized recommendation to users ac- cording to their historical preferences. Meanwhile, it interprets the reasons of recommendation by visualizing the learned aention weights for the user’s historical list. e function of personalized and interpretable recommendation assists users and manufacturer in identifying results of interest and exploring alternative choices more eciently. In addition, NAIRS enables users to search for the users who have the similar results and search for the items which are similar to the chosen item. e two functions help the users to discover more potentially interesting items. Furthermore, NAIRS actively records users’ interactive behaviors in the system, such as their input queries, liked items, and clicked results. e logged information is then utilized to improve the quality of user proling for beer recommendation. 2 CORE ALGORITHM We denote a user-item interaction matrix as R R M×N , where M and N are the number of users and items, respectively. We use R = {( i , j )| R ij = 1} to denote the set of user-item pairs and use R + u to denote the set of items that user u has interacted with. As described in [7], each item has two embedding vectors p and q to distinguish its role of history item and prediction target. e FISM [7] is one of the most widely used collaborative ltering method, which achieves the state-of-the-art performance among the item- based methods. In its standard seing, the prediction of a user u to an item i can be calculated as below: ˆ r ui = b u + b i + ( 1 |R + u | α j ∈R + u p T j q i , (1) where b u and b i denote the user and item biases, respectively. Despite the eectiveness of FISM, we argue that its performance is hindered by assigning equal weight to each interacted item. To address this limitation, we propose a neural aentive network to assign dierent weights to the items according to their intent importance. Mathematically, the prediction of user u to item i can

Transcript of NAIRS: A Neural Attentive Interpretable Recommendation System · 3.2 Recommendation Module We...

Page 1: NAIRS: A Neural Attentive Interpretable Recommendation System · 3.2 Recommendation Module We implement the interpretable recommendation algorithm intro-duced in Section 2 to perform

NAIRS: A Neural A�entive Interpretable RecommendationSystem

Shuai Yu†, Yongbo Wang†, Min Yang†, Baocheng Li†, Qiang �†, Jialie Shen‡

† SIAT, Chinese Academy of Sciences‡ Newcastle University, United Kingdom

{shuai.yu,yb.wang,min.yang,bc1.li,qiang}@siat.ac.cn,[email protected]

ABSTRACTIn this paper, we develop a neural a�entive interpretable recom-mendation system, named NAIRS. A self-a�ention network, asa key component of the system, is designed to assign a�entionweights to interacted items of a user. �is a�ention mechanismcan distinguish the importance of the various interacted items incontributing to a user pro�le. Based on the user pro�les obtained bythe self-a�ention network, NAIRS o�ers personalized high-qualityrecommendation. Moreover, it develops visual cues to interpretrecommendations. �is demo application with the implementationof NAIRS enables users to interact with a recommendation system,and it persistently collects training data to improve the system. �edemonstration and experimental results show the e�ectiveness ofNAIRS.

KEYWORDSCollaborative �ltering, Self-a�ention network, Interpretable recom-mendation, Item-based recommendation

1 INTRODUCTIONWith the huge volumes of online information, a�ention has beencontinuously paid to recommender systems [11, 12]. Item-basedcollaborative �ltering (CF) is one of the most successful techniquesin practice due to its simplicity, accuracy, and scalability [7, 8,10]. It pro�les a user with the historically interacted items andrecommends similar items in terms of user pro�les.

Most of the existing item-based CF methods utilize statisticalmeasures (e.g., cosine similarity) to estimate item similarities. How-ever, the assumption of equal weights is o�en applied for the itemsin the measurement [7]. In other words, di�erent items in thehistorical list are equally treated, which is not true for many ofthe real-world recommendation applications. On the other hand,interpretable recommendations are of increasing interest, whichexplain the underlying reasons for the potential user interest onthe recommended items. Traditional methods o�en generate ex-planations from the textual data such as the content and reviews

Permission to make digital or hard copies of part or all of this work for personal orclassroom use is granted without fee provided that copies are not made or distributedfor pro�t or commercial advantage and that copies bear this notice and the full citationon the �rst page. Copyrights for third-party components of this work must be honored.For all other uses, contact the owner/author(s).CIKM’18, Italy© 2018 Copyright held by the owner/author(s). 123-4567-24-567/08/06. . .$15.00DOI: 10.475/123 4

associated with the items [2–4, 13]. Yet, generating reasons of rec-ommendation remains unsolvable when the texts are unavailable.

Inspired by the recent successes of a�ention-based neural net-works [1] in computer vision and natural language processing,this paper proposes a neural a�entive interpretable recommenda-tion system (NAIRS) to alleviate the aforementioned limitations.�e key to the design of NAIRS is an self-a�ention network thatcomputes the a�ention weights of the historical items in a userpro�le according to their intent importance associated with theuser’s preferences. With the learned a�ention weights, NAIRSprovides a high-quality personalized recommendation to users ac-cording to their historical preferences. Meanwhile, it interprets thereasons of recommendation by visualizing the learned a�entionweights for the user’s historical list. �e function of personalizedand interpretable recommendation assists users and manufacturerin identifying results of interest and exploring alternative choicesmore e�ciently. In addition, NAIRS enables users to search for theusers who have the similar results and search for the items whichare similar to the chosen item. �e two functions help the users todiscover more potentially interesting items. Furthermore, NAIRSactively records users’ interactive behaviors in the system, suchas their input queries, liked items, and clicked results. �e loggedinformation is then utilized to improve the quality of user pro�lingfor be�er recommendation.

2 CORE ALGORITHMWe denote a user-item interaction matrix as R ∈ RM×N , whereM and N are the number of users and items, respectively. We useR = {(i, j)|Ri j = 1} to denote the set of user-item pairs and useR+u to denote the set of items that user u has interacted with. Asdescribed in [7], each item has two embedding vectors p and q todistinguish its role of history item and prediction target. �e FISM[7] is one of the most widely used collaborative �ltering method,which achieves the state-of-the-art performance among the item-based methods. In its standard se�ing, the prediction of a user u toan item i can be calculated as below:

rui = bu + bi + (1|R+u |α

∑j ∈R+u

pTj ) · qi , (1)

where bu and bi denote the user and item biases, respectively.Despite the e�ectiveness of FISM, we argue that its performance

is hindered by assigning equal weight to each interacted item. Toaddress this limitation, we propose a neural a�entive networkto assign di�erent weights to the items according to their intentimportance. Mathematically, the prediction of user u to item i can

Page 2: NAIRS: A Neural Attentive Interpretable Recommendation System · 3.2 Recommendation Module We implement the interpretable recommendation algorithm intro-duced in Section 2 to perform

CIKM’18, October 22-26 2018, Italy Shuai Yu†, Yongbo Wang†, Min Yang†, Baocheng Li†, Qiang�†, Jialie Shen‡

Recommendation ModuleData Resource

Amazon, JD,

IMDB

Data Crawler

Online feed

Data Preprocessor

Data Storage

Neural Attentive

Recommendation Model

Model Trainer

Model Evaluation

Dataset Creator

Interpretation Module

Recommendation Results

Retrieval Module

AP

I Lay

er

Function

CallsFeed

Similar Users

Similar Items

Visual Cues

Logging module

Users Feedback

Figure 1: Architecture overview of NAIRS.

be calculated as

rui = bu + bi + (∑j ∈R+u

αujpTj ) · qi , (2)

where αuj is the a�ention weight of item j in contributing to useru’s representation. Speci�cally, we exploit self-a�ention to learnthe representation of user u, each of the historical items learnsto align to each other. �e weight αuj of each historical item j iscomputed by

αuj =exp(e(pj ))

[∑k ∈R+u exp(e(pk ))]β, (3)

e(pj ) = VTд(W · pj + b), (4)

where e(pj ) is an alignment model which scores the contribution ofitem j to the representation of user u. To form a proper probabilitydistribution over the items, we normalize the scores across theitems using so�max function and get a�ention score αuj . β isa smoothing hyper parameter that will be discussed later in thissection. V andW are the weight matrices, and д(·) is the activationfunction. In this paper, we choose tanh as activation function forits be�er performance compared with relu and siдmoid .

In practice, the standard a�ention network fails to learn fromusers’ historical data and perform accurate recommendation. Byanalyzing the a�ention weights outpu�ed by the model, we revealthat the performance of the model is largely hindered by the so�maxfunction, due to the large variances on the lengths of user histories.�e a�ention weights of the items from long history list are largelydecreased. To address this problem, we introduce a new symbol βto smooth the denominator of the original a�ention formula. β canbe set in a range of [0, 1]. If β = 1, then Eq. (3) degenerates into theoriginal so�max. One typically chooses the value of β between zeroand one. �is smooth se�ing leads to much be�er performancethan standard so�max function.

Following the strategy in the previous work [5], we treat theobservations as positive instances and randomly sample the unob-served items as negative instances. Cross entropy is adopted as theobjective function, which minimizes the regularized log loss:

L = − 1N

(u,i)∈R+urui logσ (rui ) +

∑(u,i)∈R−u

(1 − rui ) log(1 − σ (rui ))

+λ ‖θ ‖2(5)

where N denotes the number of the training instances, θ denotesthe parameters of the model.

3 SYSTEM ARCHITECTURE�e proposed NAIRS, overviewed in Figure 1, consists of �ve mainmodules. (1) �e Data crawler module collects user interactiveinformation from various websites such as Amazon, Jindong, andIMDB. (2) �e Recommendation module produces recommendationresults and interpretable partial scores of user-item pairs. (3) �eInterpretation module visualizes the interpretable reasons of therecommendation by scoring user’s historical list. (4) �e Retrievalmodule enables the users to i) �nd people with similar preferences(with historical lists) and ii) explore the items that are similar toa user-speci�ed item. �is module e�ectively assists the users in�nding more items in which they may be interested. (5) �e Loggingmodule collects user behaviors from the system, such as chosenitems. �e logging information is utilized to further improve therecommender system. In the rest of this section, we elaborate eachmodule of the above.

3.1 Data Crawler Module�e data crawler collects three types of user-item interactive data: (i)movie rating data from IMDB1; (2) books rating data from Amazon2;and (3) daily goods rating data from Jingdong3. For movie ratingdata, users are selected at random for inclusion. All selected usershave rated at least one movie. For book rating data, we focus onthe top 1000 popular books. We also collect six categories of dailygoods including clothes, shoes, cosmetics, foods, toys, and smartphones. In this work, all user-sensitive information is removed.

3.2 Recommendation ModuleWe implement the interpretable recommendation algorithm intro-duced in Section 2 to perform top-n item recommendation. Ourrecommendation model is implemented with the TensorFlow4 li-brary and trained on a NVIDIA Titan Xp GPU. A�er training, wecan obtain the user and item representations for each user and item,which are then used to predict the rating scores and assign weightsto items in user’s historical list for interpretation. In addition, wecan obtain the similar users and similar items results easily withthe learned user and item representations. �e results learned byRecommendation module can be directly used by the Interpretationmodule and the Retrieval module.

Note that during the bootstrap process NAIRS provides users anavigation page in which the users can choose the items that theyare interested in. �is process can alleviate the cold start problemin recommendation to some extent, especially for new users.

3.3 Interpretation ModuleGiven a user u, the historical items Ru , and a recommended itemqi , the Interpretation module provides the top-n recommendationresults and interprets the reasons of the recommendation by visual-izing the a�ention scores of user u’s historical list Ru . In particular,

1h�ps://www.imdb.com2h�ps://www.amazon.com3h�ps://www.jd.com4h�ps://www.tensor�ow.org/

Page 3: NAIRS: A Neural Attentive Interpretable Recommendation System · 3.2 Recommendation Module We implement the interpretable recommendation algorithm intro-duced in Section 2 to perform

NAIRS: A Neural A�entive Interpretable Recommendation System CIKM’18, October 22-26 2018, Italy

search similar userssearch similar items

The tag cloud shows the historical movies of the current user. It willchange when the users click recommendation list in the right.

Query Box

Figure 2: �e Neural A�entive Interpretable Recommendation System. �e top part shows the Interpretable Recommendationmodule, the bottom part shows the Retrieval Module. �e user’s historical interacted movies are displayed in the tag cloud.When the user clicks a movie in the recommendation list, the related movies in the tag cloud will become bigger. �e user caneither search similar items in the query box or click the movie’s name in the tag cloud. �e user can also click the link bellowthe user logo to explore the users who have similar interests to her/him.

we support the users to add interested movies into their pro�le listor delete the movies they do not like. NAIRS then demonstratesthe recommendation results (on the right of the interface) and in-terprets the reason of each recommendation with a tag cloud (inthe center of the interface), as shown in Figure 2. �e importanceof each item in the user’s historical list is shown with various fontsizes. �e larger the item names, the more important the itemsin contributing to the recommendation. For example, the movieMen in Black is recommended based on Nikata in the user’s his-torical list which has the highest a�ention score. We show thatthese two movies both belong to the action movie category. On theother hand, the movie Escape from New York contributes li�le torecommend movie In the Army Now since they belong to di�erentcategories.

3.4 Retrieval Module3.4.1 Similar Users. �e Similar Users module can assist end

users to �nd other users who have similar interests. �is moduleplays an important role in helping the users who might not knowexactly what they are looking for to discover potentially interestingitems based on the observation that people who agree in the pastare likely to agree again. In order to overcome the insensitive

of average value, we calculate the similarity between users withadjusted cosine similarity as follows:

sim(u,u ′) = 1 +∑k (uk − u)·(u′k − uk)√∑ (uk − u)2

√∑ (u′k − u′)2, (6)

where u and u ′ are the average values over the user’s embeddingdimensions. Note that we map the value space of the similarity from[-1, 1] to [0, 2] to provide positive similarity scores for be�er visu-alization. As shown in Figure 2, we visualize the similar users withtheir historical lists. In addition, we provide the “like” and “dislike”bu�ons for users to select/�lter the displayed items. �ese feedbackinformation can be used to update our Recommendation module.In NAIRS, the calculated similarities are cached a�er updating themodel to speed up the results retrieval process.

3.4.2 Similar Items. Intuitively, a user is likely to have similarlevel of interest for similar items. �e Similar items module �ndsitems similar to the items liked or chosen by the user. In particular,we provide the end user with a search window for searching anyitems in the system. �en the items whose similarities are above athreshold are returned as the search results. �e similarity between

Page 4: NAIRS: A Neural Attentive Interpretable Recommendation System · 3.2 Recommendation Module We implement the interpretable recommendation algorithm intro-duced in Section 2 to perform

CIKM’18, October 22-26 2018, Italy Shuai Yu†, Yongbo Wang†, Min Yang†, Baocheng Li†, Qiang�†, Jialie Shen‡

items is calculated as follows:

sim(i, i ′) = 1 +∑k (ik − i)·(i′k − ik)√∑ (ik − i)2

√∑ (i′k − i′)2. (7)

Similar to the Similar Users component, the similarities betweenitems are cached in the system. When the end user requests similaritems, we can obtain the results in O(1) time.

4 DEMOSTRATION4.1 Demonstration Setup�e NAIRS prototype has client and server ends. Clients can ac-cess the system by web, mainly for rendering recommendation,interpretation, search, and query results. �e server is deployed onApache Tomcat, which performs the recommendation algorithmand communicates with clients.

4.2 Walkthrough Example�e NAIRS demo consists of the following steps:

Step 1: �e user can access to the system by web either on PCsor smart phones. A�er logging onto the system, the user can selecta kind of recommendation service from three categories: movies,books, and daily goods.

Step 2: If the user is new to the system, a collection of randomlychosen items are presented, and the user is asked to choose someitems in which the user is interested. A�er submi�ing the chosenitems, the system o�ers the top-10 recommendation lists basedthe chosen items. Furthermore, the system shows tag cloud of theuser pro�le, which reveals why the system recommends the speci�citems to the user. �e user can click any item in the recommendationlist, and the user pro�le tag cloud change accordingly.

Step 3: �e user can query other users that have similar interestsby clicking the “similar users” bu�on. �en the similar users withtheir historical lists are returned to the user, and the user can chooseto follow them and �nd the potentially interesting items via thisfunction.

Step 4: �e user can also search the items similar to the iteminputed by the user. If our system has items for which the usersearch, similar items are returned; otherwise, a warning messageis shown. Note that to enhance user experience, we implement anAuto-suggestion query box.

5 QUANTITATIVE EVALUATIONIn this section, we evaluate the performance of NAIRS quantita-tively, then we investigate the interpretation of the proposed system.We conduct experiments on two widely used datasets: Movielens-1M and Pinterest, as the ones used in the study [5]. �e results arejudged with hit ratio(HR) and Normalized Discounted CumulativeGain(NDCG), which have been widely used in top-n recommen-dation [5, 7]. NAIR is compared with several baseline methodsincluding MF-BPR [9], MF-eALS [6], FISM [7], and MLP [5].

�e experimental results are shown in Figure 3. We observe thatour method outperforms other competitive methods for both of thedatasets, which shows the e�ectiveness of the proposed approachon top-n recommendation used in the demonstration.

8 16 32 64Embedding Size

62

64

66

68

70

Hit R

atio(%

)

MovieLens

MF-BPRMF-eALSMLPFISMOURS

(a) Movielens HR8 16 32 64

Embedding Size

34

36

38

40

42

44

NDCG

(%)

MovieLens

MF-BPRMF-eALSMLPFISMOURS

(b) Movielens NDCG

8 16 32 64Embedding Size

84

85

86

87

88

89

Hit R

atio

(%)

Pinterest

MF-BPRMF-eALSMLPFISMOURS

(c) Pinterest HR8 16 32 64

Embedding Size

52

53

54

55

56

57

NDCG

(%)

Pinterest

MF-BPRMF-eALSMLPFISMOURS

(d) Pinterest NDCG

Figure 3: Performance comparison.

6 CONCLUSION�e paper proposes NAIRS for interpretable recommendation. Aself-a�ention network is introduced to automatically assign di�er-ent a�ention weights to interacted items. �is a�ention mechanismcan distinguish the importance of the interacted items and provideinterpretable recommendations. In addition, the learned user anditem embeddings of user pro�les can be used in a variety of down-stream applications. Both the experiments and demonstration inthe paper show superiority of the proposed scheme.

REFERENCES[1] Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. 2015. Neural machine

translation by jointly learning to align and translate. ICLR (2015).[2] Konstantin Bauman, Bing Liu, and Alexander Tuzhilin. 2017. Aspect Based

Recommendations: Recommending Items with the Most Valuable Aspects Basedon User Reviews. In Proceedings of SIGKDD.

[3] Muthusamy Chelliah and Sudeshna Sarkar. 2017. Product RecommendationsEnhanced with Reviews. In Proceedings of RecSys.

[4] Li Chen and Feng Wang. 2017. Explaining Recommendations Based on FeatureSentiments in Product Reviews. In Proceedings of IUI.

[5] Xiangnan He, Lizi Liao, Hanwang Zhang, Liqiang Nie, Xia Hu, and Tat-SengChua. 2017. Neural collaborative �ltering. In Proceedings of WWW.

[6] Xiangnan He, Hanwang Zhang, Min-Yen Kan, and Tat-Seng Chua. 2016. Fastmatrix factorization for online recommendation with implicit feedback. In Pro-ceedings of SIGIR. ACM.

[7] Santosh Kabbur, Xia Ning, and George Karypis. 2013. Fism: factored itemsimilarity models for top-n recommender systems. In Proceedings of SIGKDD.ACM.

[8] Xia Ning and George Karypis. 2011. SLIM: Sparse Linear Methods for Top-NRecommender Systems. In Proceedings of ICDM.

[9] Ste�en Rendle, Christoph Freudenthaler, Zeno Gantner, and Lars Schmidt-�ieme. 2009. BPR: Bayesian personalized ranking from implicit feedback. InProceedings of UAI. AUAI Press.

[10] Badrul Munir Sarwar, George Karypis, Joseph A. Konstan, and John Riedl. 2001.Item-based collaborative �ltering recommendation algorithms. In Proceedings ofWWW.

[11] Jun Wang, Lantao Yu, Weinan Zhang, Yu Gong, Yinghui Xu, Benyou Wang, PengZhang, and Dell Zhang. 2017. Irgan: A minimax game for unifying generativeand discriminative information retrieval models. In Proceedings of SIGIR. ACM.

[12] Xuejian Wang, Lantao Yu, Kan Ren, Guanyu Tao, Weinan Zhang, Yong Yu, andJun Wang. 2017. Dynamic a�ention deep model for article recommendation bylearning human editors’ demonstration. In Proceedings of SIGKDD. ACM.

[13] Yongfeng Zhang, Guokun Lai, Min Zhang, Yi Zhang, Yiqun Liu, and ShaopingMa. 2014. Explicit factor models for explainable recommendation based onphrase-level sentiment analysis. In Proceedings of SIGIR.