1 context-aware recommendation using role-based trust network · trust-based recommendation...

26
1 Context-aware Recommendation Using Role-based Trust Network LIANG HONG, Wuhan University LEI ZOU, Peking University CHENG ZENG, Wuhan University JIAN WANG, Wuhan University JILEI TIAN, Nokia Research Center, Beijing Recommender systems have been studied comprehensively in both academic and industrial fields over the past decades. As user interests can be strongly affected by context at any time and any place in mobile scenarios, rich context information becomes more and more important for personalized context-aware rec- ommendations. Although existing context-aware recommender systems can make context-aware recommen- dations to some extent, they suffer several inherent weaknesses: (1) Users’ context-aware interests are not modeled realistically, which reduces the recommendation quality; (2) Current context-aware recommender systems ignore the trust relations among users. Trust relations are actually context-aware and associated with certain aspects (i.e. categories of items) in mobile scenarios. In this paper, we define a term role to mod- el common context-aware interests among a group of users. We propose an efficient role mining algorithm to mine roles from “user-context-behavior” matrix, and a role-based trust model to calculate context-aware trust value between two users. During online recommendation, given a user u in a context c, an efficient weighted set similarity query algorithm is designed to build u’s role-based trust network in context c. Final- ly, we make recommendation to u based on u’s role-based trust network by considering both context-aware roles and trust relations. Extensive experiments demonstrate that our recommendation approach outper- forms the state-of-the-art methods in both effectiveness and efficiency. General Terms: Design, Algorithms, Performance Additional Key Words and Phrases: Recommendation, Context-aware, Trust network, Role ACM Reference Format: Hong, L., Zou, L., Zeng, C., Wang, J., and Tian, J. 2012. Context-aware Recommendation Using Role-based Trust Network ACM Trans. Know. Disc. Data. 0, 0, Article 1 (December 2012), 26 pages. DOI = 10.1145/0000000.0000000 http://doi.acm.org/10.1145/0000000.0000000 1. INTRODUCTION The amount of information has been exploding in the age of Big Data. To help users select relevant and valuable information from large amount of information, recom- mender systems are becoming more and more important. Recommender systems sug- gest items (such as commodities, web pages, music, images, etc.) that are likely to interest users. Typically, traditional recommender systems are based on Collaborative Filtering, in which rating predictions of user u are made based on the ratings of the users whose rating profiles are most similar to that of user u [Goldberg et al. 1992]. In real world recommendations, users usually ask trusted friends for recommenda- tions. For this reason, trust-based recommender systems have been proposed recently L. Hong, School of Information Management, Wuhan University; L. Zou, Institute of Computer Science and Technology, Peking University; C. Zeng and J. Wang, State Key Laboratory of Software Engineering, Wuhan University; J. Tian, Nokia Research Center, Beijing. 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 profit or commercial advantage and that copies show this notice on the first page or initial screen of a display along with the full citation. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is per- mitted. To copy otherwise, to republish, to post on servers, to redistribute to lists, or to use any component of this work in other works requires prior specific permission and/or a fee. Permissions may be requested from Publications Dept., ACM, Inc., 2 Penn Plaza, Suite 701, New York, NY 10121-0701 USA, fax +1 (212) 869-0481, or [email protected]. c 2012 ACM 1539-9087/2012/12-ART1 $15.00 DOI 10.1145/0000000.0000000 http://doi.acm.org/10.1145/0000000.0000000 ACM Transactions on Knowledge Discovery from Data, Vol. 0, No. 0, Article 1, Publication date: December 2012.

Upload: others

Post on 07-Aug-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1 Context-aware Recommendation Using Role-based Trust Network · Trust-based recommendation approaches usually assume a trust network among users. Massa et al. [Massa and Avesani

1

Context-aware Recommendation Using Role-based Trust Network

LIANG HONG, Wuhan UniversityLEI ZOU, Peking UniversityCHENG ZENG, Wuhan UniversityJIAN WANG, Wuhan UniversityJILEI TIAN, Nokia Research Center, Beijing

Recommender systems have been studied comprehensively in both academic and industrial fields over thepast decades. As user interests can be strongly affected by context at any time and any place in mobilescenarios, rich context information becomes more and more important for personalized context-aware rec-ommendations. Although existing context-aware recommender systems can make context-aware recommen-dations to some extent, they suffer several inherent weaknesses: (1) Users’ context-aware interests are notmodeled realistically, which reduces the recommendation quality; (2) Current context-aware recommendersystems ignore the trust relations among users. Trust relations are actually context-aware and associatedwith certain aspects (i.e. categories of items) in mobile scenarios. In this paper, we define a term role to mod-el common context-aware interests among a group of users. We propose an efficient role mining algorithmto mine roles from “user-context-behavior” matrix, and a role-based trust model to calculate context-awaretrust value between two users. During online recommendation, given a user u in a context c, an efficientweighted set similarity query algorithm is designed to build u’s role-based trust network in context c. Final-ly, we make recommendation to u based on u’s role-based trust network by considering both context-awareroles and trust relations. Extensive experiments demonstrate that our recommendation approach outper-forms the state-of-the-art methods in both effectiveness and efficiency.

General Terms: Design, Algorithms, Performance

Additional Key Words and Phrases: Recommendation, Context-aware, Trust network, Role

ACM Reference Format:Hong, L., Zou, L., Zeng, C., Wang, J., and Tian, J. 2012. Context-aware Recommendation Using Role-basedTrust Network ACM Trans. Know. Disc. Data. 0, 0, Article 1 (December 2012), 26 pages.DOI = 10.1145/0000000.0000000 http://doi.acm.org/10.1145/0000000.0000000

1. INTRODUCTIONThe amount of information has been exploding in the age of Big Data. To help usersselect relevant and valuable information from large amount of information, recom-mender systems are becoming more and more important. Recommender systems sug-gest items (such as commodities, web pages, music, images, etc.) that are likely tointerest users. Typically, traditional recommender systems are based on CollaborativeFiltering, in which rating predictions of user u are made based on the ratings of theusers whose rating profiles are most similar to that of user u [Goldberg et al. 1992].In real world recommendations, users usually ask trusted friends for recommenda-tions. For this reason, trust-based recommender systems have been proposed recently

L. Hong, School of Information Management, Wuhan University; L. Zou, Institute of Computer Science andTechnology, Peking University; C. Zeng and J. Wang, State Key Laboratory of Software Engineering, WuhanUniversity; J. Tian, Nokia Research Center, Beijing.Permission to make digital or hard copies of part or all of this work for personal or classroom use is grantedwithout fee provided that copies are not made or distributed for profit or commercial advantage and thatcopies show this notice on the first page or initial screen of a display along with the full citation. Copyrightsfor components of this work owned by others than ACM must be honored. Abstracting with credit is per-mitted. To copy otherwise, to republish, to post on servers, to redistribute to lists, or to use any componentof this work in other works requires prior specific permission and/or a fee. Permissions may be requestedfrom Publications Dept., ACM, Inc., 2 Penn Plaza, Suite 701, New York, NY 10121-0701 USA, fax +1 (212)869-0481, or [email protected]⃝ 2012 ACM 1539-9087/2012/12-ART1 $15.00

DOI 10.1145/0000000.0000000 http://doi.acm.org/10.1145/0000000.0000000

ACM Transactions on Knowledge Discovery from Data, Vol. 0, No. 0, Article 1, Publication date: December 2012.

Page 2: 1 Context-aware Recommendation Using Role-based Trust Network · Trust-based recommendation approaches usually assume a trust network among users. Massa et al. [Massa and Avesani

1:2 L. Hong et al.

[Jamali and Ester 2009b; Ma et al. 2009; Jamali and Ester 2009a], which make rec-ommendations based on the ratings of his trusted friends in the trust network. Trustin a person is a commitment to an action based on a belief that the future actions ofthat person will lead to a good outcome [Golbeck 2009]. The widely used smart mo-bile devices bring new challenges to recommender systems. First, there are growingneeds of high quality personalized recommendations due to the limitations of mobiledevices and mobile users’ limited spent time and effort. Second, users’ interests andpreferences change dynamically with different contexts in mobile scenario. As shownin Example 1, user u1 prefers to eat sea food in a restaurant, and he/she would like tobuy science fiction when in a book store. In this case, it is necessary to make context-aware recommendations to u1.

Example 1: Considering five users u1, u2, u3, u4 and u5, Fig. 1 shows the users’interests on different categories of items in different contexts.

War

movie

Restaurant Book Store Cinema

Sea foodScience

fiction

Comedy

movie

Sea foodClassic

novel

War

movie

BarbecueClassic

novel

War

movie

1u

2u

3u

ContextUser

Behavior

Role r1

Role r2

BuffetClassic

novel4u

Sea foodClassic

novel

Love

movie5u

Cafe

Espresso

Espresso

Mocha

Latte

Espresso

Fig. 1. Example of Roles

MotivationAlthough existing recommender systems can make context-aware recommendations

in mobile scenarios to some extent, they suffer several inherent weaknesses.First, existing context-aware recommender systems make recommendations based

on users’ common context-aware interests in one context (usually current context)[Anand and Mobasher 2007; Karatzoglou et al. 2010; Rendle et al. 2011]. However, inreal world recommendations, a group of users share common context-aware interestsin several correlated contexts instead of one context. If we only consider users’ commoninterests in one context, we can not make high quality context-aware recommendation.For example, in Fig. 1, user u2, u3 and u4 have a common interests on “Classic novel”and “War movie” in the contexts of “Book Store” and “Cinema”, respectively. Supposeu2’s current context is “Book Store”, we can find u3, u4 and u5 have common interest on“Classic novel” with u2. If we only consider u2’s interest in current context, u3, u4 andu5 are equally similar to u2. Note that, u3 and u4 have an additional common behavior“War movie” with u2 in the context “Cinema”, which is closely related to u2’s interestin current context. Thus, we should consider u2’s common interests with u3 and u4 inboth the contexts of “Book Store” and “Cinema”, so as to improve the recommendationquality.

Second, typical context-aware recommender systems assume that users are inde-pendent and identically distributed, while ignoring the relationships among users. Infact, a user’s interests and final choices are deeply affected by his/her trusted usersin real world recommendations [Massa and Avesani 2007; Ma et al. 2009]. Existingtrust-based recommender systems assume that trust value between users is fixed inall recommendations. However, the trust value may change with the user context. In

ACM Transactions on Knowledge Discovery from Data, Vol. 0, No. 0, Article 1, Publication date: December 2012.

Page 3: 1 Context-aware Recommendation Using Role-based Trust Network · Trust-based recommendation approaches usually assume a trust network among users. Massa et al. [Massa and Avesani

Context-aware Recommendation Using Role-based Trust Network 1:3

Example 1, when u1 is in a restaurant, trust value between u1 and u2 increases be-cause they share a common interest “Sea food” in the context “Restaurant”. However,the trust value is comparably low in the contexts “Book store” and “Cinema”.

Typical trust-based recommendation approaches always assume a trust network a-mong users, in which trust relations are established explicitly by users. Explicit truststatements in real applications are actually very sparse, as discussed in [Liu et al.2008]. We cannot make satisfactory recommendations based on such sparse trust net-work. Thus, in order to improve recommendation quality, we need to compute implicittrust values between users using trust model to enrich the trust network. Usually,trust model is based on an interesting sociology fact that the more similar two user-s are, the greater is the trust between them [McPherson et al. 2009]. Existing trustmodels evaluate the trust value between two users by measuring common interests[Golbeck 2009]. Example 1 illustrates a problem of such a simple measurement: Sup-pose user u2 is in a restaurant. Based on existing trust models, u1, u3, u4 and u5 aretrusted users of u2, because they all have two common interests with u2. However,considering u2’s context, u1 and u5 should be chosen as trusted users of u2 during rec-ommendation. Therefore, we cannot evaluate the trust value between users by simplymeasuring common interests, since the “trust” is related to aspects (i.e. certain cate-gories of items) and users’ current context.

From the above analysis, we propose role (formally defined in Definition4.2) in this paper, which represents common context-aware interests of agroup of users. Intuitively, a person plays different roles such as “Diner”,“Movie Fan” and “Reader”in daily life, and his/her roles change dynamicallyas context changes. When a user plays a role r in context c, he/she proba-bly prefers certain categories of items related to r. Such interests are sharedby a group of users who also play role r in context c. For example, in Fig.1, there are two roles r1 and r2, because u1, u2 and u5, as well as u2, u3 andu4 share common context-aware interests, respectively. If we want to makerecommendation for user u1 in the context “restaurant”, we should refer tothe preference of u2 and u5 as they play the same role r1 (named “Diner”) in“restaurant”. In fact, role has the following characteristics:• Role expresses context-aware behavior pattern shared by a group of user-

s. Thus, we can leverage user roles to make personalized context-aware Rec-ommendation.• Each user has a role set that contains all roles he/she has played. One role is

assigned different global weights to represent the role’s relevance to different contexts.Users with similar role sets have similar context-aware interests on certain aspects.• According to the role-based trust model, a user has different trusted users when

playing different roles in varied contexts.In this paper, we first propose a data mining algorithm to find roles from user-

context-behavior matrix (see Definition 3.4), and build a role set for each user. Eachrole’s relevance to different contexts is measured by a random walk model. Then, wedesign a role-based trust model to evaluate trust value between two users by consid-ering similarity of corresponding role sets. During online recommendation, given auser u in the context of c, based on the role-based trust model, we develop an efficientweighted set similarity query algorithm to find u’s trusted users, and build a personalrole-based trust network. Finally, using u’s role-based trust network, we can predictuser u’s ratings on different items in context c, and recommend highly rated items tou.

To summarize, in this work, we make the following contributions:• To the best of our knowledge, we first systematically propose role mined from rich

context information to model common context-aware interest among a group of users,

ACM Transactions on Knowledge Discovery from Data, Vol. 0, No. 0, Article 1, Publication date: December 2012.

Page 4: 1 Context-aware Recommendation Using Role-based Trust Network · Trust-based recommendation approaches usually assume a trust network among users. Massa et al. [Massa and Avesani

1:4 L. Hong et al.

and use role-based trust network to make personalized context-aware recommenda-tions.• We propose a role mining algorithm using conditional database to efficiently mine

minimum number of user roles. A role-based trust model is designed to realisticallycalculate users’ context-aware trust values.• We present an efficient weighted set similarity query algorithm to find a user u’s

trusted users and build u’s role-based trust network in the current context.• Extensive experiments on a large real dataset show that recommendation using

role-based trust network outperforms alternative approaches in recommendation qual-ity and time.

The rest of this paper is organized as follows. We review related work in Section 2.In Section 3, we discuss the preliminaries of this paper including the problem defi-nition and the framework of our approach. Our role mining algorithm is proposed inSection 4. We introduce role-based trust model in Section 5. We present weighted setsimilarity query algorithm to find similar users in Section 6. In Section 7, we give ourrecommendation approach. Experimental results are discussed in Section 8, followedby conclusions in Section 9.

2. RELATED WORKIn this section, we briefly review related work on context-aware recommendation,trust-based recommendation, cross-domain recommendation and weighted set simi-larity query processing.

As illustrated in [Forestier et al. 2012], user roles exist in social networks, andthey keep changing and evolving over different contexts. The general notion of contextand how it can be modeled in recommender system is discussed in [Adomavicius andTuzhilin 2008] and [Adomavicius et al. 2011]. In [Anand and Mobasher 2007], authorsproposed a novel approach to incorporate users’ contexts into the recommendation. Baoet al. [Bao et al. 2010] proposed an unsupervised approach to model personalized con-texts of mobile users. Context information is incorporated into recommender systemsin [Gediminas Adomavicius and Tuzhilin 2005] to make context-aware recommenda-tions. Karatzoglou et al. [Karatzoglou et al. 2010] proposed a multiverse recommen-dation approach that relies on Tucker decomposition and context-aware collaborativefiltering with any categorical context. Rendle et al. [Rendle et al. 2011] proposed to ap-ply Factorization Machines to model contextual information and provide context-awarerecommendations, which outperforms multiverse recommendation in both predictionaccuracy and computation complexity. The time cost of the above matrix factorization-based approaches is too high to be applied to context-aware recommendations in real-world mobile scenarios. Recently, there are a lot of works on context aware recom-mendations in various applications, such as music recommendation [Cai et al. 2007],citation recommendation [He et al. 2010] and news article recommendation [Li et al.2010]. None of the above approaches consider common context-aware interests of agroup of users, as well as social trust relations. Zeng et al. [Zeng et al. 2011] proposeda framework of role-based contextual recommendation. However, this work does notpresent a formal definition of role and the detailed recommendation approach.

Trust-based recommendation approaches usually assume a trust network amongusers. Massa et al. [Massa and Avesani 2007] proposed a trust-aware recommendationmethod by exploiting trust propagation over the trust network. Jamali et al. [Jamaliand Ester 2009a] proposed a random walk model TrustWalker, combining the trust-based and the collaborative filtering approach for recommendation. In [Jamali andEster 2009b], Jamali et al. also offered a novel top-N item recommendation methodwhich performs a weighted merge of the results from both trust-based and collabo-rative filtering approaches. In [DuBois et al. 2009], a new trust metric is applied to

ACM Transactions on Knowledge Discovery from Data, Vol. 0, No. 0, Article 1, Publication date: December 2012.

Page 5: 1 Context-aware Recommendation Using Role-based Trust Network · Trust-based recommendation approaches usually assume a trust network among users. Massa et al. [Massa and Avesani

Context-aware Recommendation Using Role-based Trust Network 1:5

cluster users into trust group and integrate these trust groups into recommendationalgorithms to improve accuracy. Ma et al. [Ma et al. 2008] developed a factor analysismethod based on the probabilistic graphical model, which fuses the user-item matrixwith a social trust network. In recent work [Ma et al. 2009], Ma et al. proposed a nov-el recommendation framework, which employs both the users’ own tastes and favorsof their trusted friends for the recommendation. However, these approaches do notconsider the aspects and contexts of trust relations, which deteriorates the quality oftrust-based recommendations. Moreover, it is difficult for trust-based recommendationapproaches to make context-aware recommendations.

Cross-domain recommendations utilize rating matrices in multiple related recom-mender systems (domains) to make recommendations. Li et al. [Li et al. 2009] pro-posed a rating-matrix generative model for cross-domain collaborative filtering. Panet al. [Pan et al. 2010] proposed a principled matrix-based transfer learning frame-work to address the data sparsity problem in collaborative filtering recommendation-s. Differently, our approach makes recommendations based on users’ interests in d-ifferent contexts rather than multiple domains. Thus, our approach cannot supportcross-domain recommendations. In addition, existing cross-domain recommendationapproaches cannot make context-aware recommendations.

As for weighted similarity query, Hadjieleftheriou et al. [Hadjieleftheriou et al. 2008]proposed various index structures and algorithms for evaluating queries by exploitingspecial semantic properties of some weighted similarity measures. Index constructionand incremental maintenance for weighted approximate string matching is discussedin [Hadjieleftheriou et al. 2009]. Recently, Hadjieleftheriou et al. [Hadjieleftheriou andSrivastava 2010] proposed a Heaviest First strategy for efficiently answering all-matchweighted string similarity query based on sorting tokens in the query string accordingto their weights. These algorithms can be further optimized for large datasets.

3. PRELIMINARIESIn this section, we formally define the problem to be addressed, and then present theframework of our proposed approach.

3.1. Problem DefinitionBefore defining our problem, we first give the following definitions.

Given a set of items and users, we use a “user-item-rating (UIR)” matrix (Definition3.1) to record item ratings of different users, where user u’s rating on item v express-es the extent of u’s favor on v. Items are classified into different categories such as“Science fiction”, “War movie”. In most online recommender systems such as Amazon,eBay, and Taobao, the classification of items are given by item taxonomy.

Definition 3.1 (UIR Matrix). A user-item-rating matrix is denoted as UIR, whereeach row denotes a user, each column denotes an item and each cell in UIR[i][j] recordsthe i-th user’s rating on the j-th item.

We define the context as follows.

Definition 3.2 (Context). Context is the set of spatio-temporal statuses includinglocation and time that have influence on interests or choice behavior of users.

Definition 3.3 (Behavior). A user’s behavior is defined as choosing one category ofitems.

We find a user u’s behavior from rating records of u. That is, if u chooses an itembelonging to a category c, we say u has a behavior of choosing the item in c.

ACM Transactions on Knowledge Discovery from Data, Vol. 0, No. 0, Article 1, Publication date: December 2012.

Page 6: 1 Context-aware Recommendation Using Role-based Trust Network · Trust-based recommendation approaches usually assume a trust network among users. Massa et al. [Massa and Avesani

1:6 L. Hong et al.

User-Context-

Behavior MatrixRoles

Role

MiningRole Sets

Random

Walk Model

Similar

Users

Role-Based

Trust Network

Weighted Set

Similarity Query

Role-Based

Trust Model

Context-aware

Recommendation

User-Item-

Rating Matrix

Online

Offline

Classify

Fig. 2. Framework

{r1, r2}

0.6

0.8

0.7

0.9u2

u1

u3

u4

u5

Fig. 3. Role-based Trust Network

Definition 3.4 (UCB Matrix). A user-context-behavior matrix is denoted as UCB,where each row denotes a user, each column denotes a context and each cell inUCB[i][j] records the behavior of the i-th user in the j-th context.

In most contexts, a user may have multiple types of behavior. For exam-ple, a user has two types of behavior (watching “War movie” and “Comedymovie”) in the cinema context, and likes both “Chinese food” and “Italianfood” in the restaurant context. We will discuss how to adapt our approachto both one-behavior and multiple-behavior cases in Section 4.

In this work, we consider a trust network, in which a user can explicitly set his/hertrusted friends. The explicit trust relation is a boolean value. That is, if user u sets useru′ as his/her trusted friend, the trust value between u and u′ is 1. Otherwise the trustvalue between them is 0. However, in reality, trust value is a real number in the range[0, 1], where 0 means no trust and 1 means full trust. Although the explicitly specifiedtrust relations are very sparse, they can be used as training data in learning our role-based trust model (see details in Section 5). The trust model is used to calculate non-boolean implicit trust values.

The problem to be addressed in this paper is defined as follows: Given two matri-ces UIR and UCB and explicit trust relations, for a user u in a context c, predict anunknown rating of item v by u in c, and recommend top k highly rated items to u.

3.2. FrameworkFig. 2 shows the whole framework of our method. There are two phases in our method:offline processing and online processing. In the offline processing, we propose a rolemining algorithm to find roles in UCB matrix. Role mining is inspired by the ideaof crowdsoursing that if a group of users have the same types of behavior in a set ofcontexts, there exist internal relations among the users and contexts. The commoncontext-aware behavior in correlated contexts can enhance the recommendation qual-ity. After the mining, each user is represented by a set of roles that he/she plays. Inorder to measure relationship strength between a role r and a context c (i.e. the role r’sweight in c), we propose a random walk model to assign weight to each role r in eachcontext c.

In the online processing, given a user u and his/her current context c, we proposean efficient weighted set similarity query algorithm to find all similar users of u. Asmentioned earlier, the more similar two users are, the greater is the trust value be-tween them, we build a role-based trust network for user u in context c by calculat-ing implicit trust values using our role-based trust model. Note that role-based trust

ACM Transactions on Knowledge Discovery from Data, Vol. 0, No. 0, Article 1, Publication date: December 2012.

Page 7: 1 Context-aware Recommendation Using Role-based Trust Network · Trust-based recommendation approaches usually assume a trust network among users. Massa et al. [Massa and Avesani

Context-aware Recommendation Using Role-based Trust Network 1:7

network is personalized and context-aware, in which users’ trust values and trustedfriends change dynamically with contexts and users’ roles. As shown in Fig. 3, in Ex-ample 1, user u2 has a role set containing role r1 and r2; when u2 is playing r1 in thecontext “Restaurant”, his trusted friends are u1 and u5, because they all have a com-mon behavior “Sea food” in the context “Restaurant”. When u2 is playing r2 as contextchanges to “Book Store”, his trusted friends become u3 and u4. Finally, based on therole-based trust network in the current context c and UIR matrix, we perform person-alized context-aware recommendations in two steps. The first step is to determine thecategory of recommended items. The second step is to predict any unknown rating ofitem v in the category based on ratings on v of the users in role-based trust network.We rank the items by predicted ratings and recommend the top k items to user u2 incontext c.

4. ROLE MINING4.1. Definition of RoleA role is a set of common behavior of a group of users in certain contexts. The dashedbox r2 in Fig. 1 denotes one role, since u2, u3, and u4 share the same types of behavior atcontext “Book Store” and “Cinema”, respectively. Specifically, role is defined as follows.

Definition 4.1 (Tile). A tile is a submatrix of UCB matrix, in which all cells in thesame column contain common type(s) of behavior.

Definition 4.2 (Role). A role is a tile that has at least mt rows and nt columns,where mt and nt are tuning parameters.

Intuitively, any role is a combination of particular sets of behavioral, social and con-textual attributes. Common types of behavior shared by a group of users in certaincontexts reveals a role. Moreover, users often guide their decisions of which items tochoose based on their current role. For example, in the contexts “Book Store” and “Cin-ema”, the role played by user u2, u3 and u4 can be regarded as “History Fan” as theseusers share common behavior “Classic novel” and “War movie”. As a result, u2, u3 andu4 may be interested in items related to “History” in the contexts “Book Store” and“Cinema”.

In our recommendation approach, we are interested in common context-aware be-haviors shared by at least mt users in nt contexts. The setting of the tuning parametersmt and nt is application-dependent.

4.2. Role Mining using Conditional DatabaseIn Role-Based Access Control (RBAC) [Vaidya et al. 2007], there are already role min-ing algorithms for boolean valued matrix (called User-Permission (UP) matrix). SinceUCB matrix is a non-boolean valued matrix, existing role mining algorithms in RBACcannot be directly applied to our role mining problem. Actually, the problem of min-ing roles from the UCB matrix is equivalent to minimum tiling problem [Vaidya et al.2007] (Definition 4.3), which has been proven an NP-complete problem.

Definition 4.3 (Minimum Tiling Problem). Minimal tiling problem is to find a min-imal number of tiles, which can cover all non-empty cells in UCB matrix.

Since minimum tiling problem is NP-complete, we propose the following heuristicrole mining algorithm using conditional database (Definition 4.4) to find roles from aUCB matrix.

ACM Transactions on Knowledge Discovery from Data, Vol. 0, No. 0, Article 1, Publication date: December 2012.

Page 8: 1 Context-aware Recommendation Using Role-based Trust Network · Trust-based recommendation approaches usually assume a trust network among users. Massa et al. [Massa and Avesani

1:8 L. Hong et al.

c1c2 c3 c4

u1 b1 b1 b1 0

u2 0 0 b2

u3 b1 b1 b2

u4 b3 b3 0

u5 b3 b3 0 b2

c1 c2 c3 c4

u1 b1

u2

u3

u4

u5

b2

b1 b2

b2b1

b3

b3

b3

b4

b4

b4

Fig. 4. UCB Matrix

1u

2u

3u

4u

5u

1r

2r

1c

2c

3c

4c

Users Roles Contexts

G1 G2

Fig. 5. Random Walk Model

Definition 4.4 (ci-conditional database). Given a UCB matrix with n columns {c1,c2,..., cn}, ci-conditional database (i = 1, ..., n − 1) is defined as follows: ci-cdb=

{(ci ∩

ci+1),...,(ci ∩ cn)}

, where ci ∩ ci+1 denotes the intersection (Definition 4.5) of ci and ci+1.

Definition 4.5 (Intersection). Given a UCB matrix, and two context columns ci andcj , the intersection ci ∩ cj is defined as to find all the tiles in the two columns.

Initially, we set the universal role set ROLES to be ϕ. For each column ci in UCBmatrix, we build ci-conditional database. Specifically, for each column ci, we considerall columns cj , where 1 ≤ i < j ≤ n. For each column pair (ci, cj), we find all tiles t inthese two columns, where t has at least mt rows (mt is a tuning parameter in Definition4.2). For each such tile t, we check if there exists one tile t′ ∈ ROLES, where t and t′ canbe merged together to form a larger tile. Two tiles t and t′ can be merged together ifand only if they have the same rows (i.e., users). If so, we merge t and t′; otherwise, weinsert t into ROLES directly. Finally, all tiles having less than nt columns are removedfrom ROLES. All left tiles in ROLES are roles that are mined from UCB.

The role mining algorithm is divided into two parts. First, the computa-tional complexity of determining intersections is O(n

2m2 ), where m and n2

2 de-note the computational complexity of finding tiles in each pair of columnsand the maximum possible number of pairs, respectively. Second, the com-putational complexity of merging tiles is O(n

2nr

2 (m+mt + nt)), where nr is thenumber of roles in ROLES, and m + mt + nt is the complexity of comparingtwo tiles. In practice, mt and nt are much smaller than m and n, respectively.Moreover, once mt and nt are given, nr can be approximated within the factorO(m). Therefore, the computational complexity of our role mining algorithmis bounded by O(n

2m2 + n2m

2 (2m+n)) = O(m2n2+mn3). Since the number of usersm is usually much larger than the number of contexts n, the computationalcomplexity can be simplified to O(m2n2).

For example, Fig. 4 is the corresponding UCB matrix of Fig. 1, where c1, c2, c3 andc4 corresponds to “Cafe”, “Restaurant”, “Book Store” and “Cinema”, and b1, b2, b3 andb4 corresponds to “Espresso”, “Sea food”, “Classic novel” and “War movie”, respectively.Assume that tuning parameters mt and nt are both 2, c1-conditional database is c1-cdb=

{(c1 ∩ c2),...,(c1 ∩ c4)

}, and c3-conditional database is c3-cdb=

{(c3 ∩ c4)

}. We can

find tiles c1 ∩ c2 and c3 ∩ c4, which correspond to the roles r1 and r2 respectively in Fig.1.

Based on found roles in ROLES, UCB matrix can be decomposed into Role-Context-Behavior (RCB) matrix and User-to-Role (UR) matrix.

ACM Transactions on Knowledge Discovery from Data, Vol. 0, No. 0, Article 1, Publication date: December 2012.

Page 9: 1 Context-aware Recommendation Using Role-based Trust Network · Trust-based recommendation approaches usually assume a trust network among users. Massa et al. [Massa and Avesani

Context-aware Recommendation Using Role-based Trust Network 1:9

Definition 4.6 (RCB Matrix). A role-context-behavior matrix is denoted as RCB,where each row denotes a role, each column denotes a context and each cell in RCB[i][j]records the i-th role’s behavior in the j-th context.

Definition 4.7 (UR Matrix). A user-to-role matrix is denoted as UR, where eachrow denotes a user, each column denotes a role and each cell in UR[i][j] records whetherthe i-th user plays the j-th role. If so, UR[i][j]=1. Otherwise, UR[i][j]=0.

After role mining, each user u is represented by his/her role set R(u, c) = {r1, ..., rk}in UR matrix, where ri (i = 1, ..., k) is a role played by user u, and c denotes the currentcontext.

For a new user u′, if u′ has the same context-aware behavior with a role r in RCBmatrix, then u′ plays a role r. If u′’s context-aware behavior changes over time, weshould update u′’s role set accordingly. Note that, some trivial tiles will be found duringthe role mining, each of which covers just a few cells in the UCB matrix. Since a roleshould have at least mt rows and nt columns, trivial tiles will be discarded. As a result,the universal role set ROLES will not change frequently. This is the reason why wemine roles in offline processing.

Note that there may exist some users that do not play any role in ROLES. Theseusers, relatively few in number, are regarded as “grey sheep” users whose context-aware interests do not consistently agree with any group of users. Although “greysheep” users do not play any role, they have a set of behavior in different contexts.For a “grey sheep” user u, we find u’s similar users based on common types of behaviorwith other users in a certain context. The similarities between u and other users arecalculated by the similarities between corresponding behavior sets.

Although we only show the role mining example of one-behavior case inFig. 4, the role mining algorithm can be directly extended to the multiple-behavior case. The only difference is: in one-behavior case, all cells in thesame column (i.e. context) contain the same behavior in a tile, while inmultiple-behavior case, all cells in the same column contain common type(s)of behavior in a tile. In multiple-behavior case, a user may have multipleroles in one context, which have equal weights in the context.

4.3. Context-aware Weight of RoleFinally, we propose a random walk with restart model to measure the weight of roler in context c, (i.e. the relationship strength between role r and context c ), denotedas W (r, c). The intuition is that when user u plays role r in context c, W (r, c) shouldbe larger than the weights of u’s other roles. In addition, the roles overlapping r inthe UCB matrix should be assigned relatively high weight in context c. As shown inFig. 5, given a set of users U and a set of roles ROLES, we build a bipartite graph G1

between U and ROLES, in which we link user u ∈ U and r ∈ ROLES if and only ifrole r ∈ R(u, c). We also build a bipartite graph G2 between ROLES and context setC. In G2 we link a role r ∈ ROLES with a context c ∈ C if and only if role r coverscontext column c in UCB matrix. We merge G1 and G2 to form a graph G. Given a role(node) r and a context (node) c in graph G, we measure W (r, c) by the random walkwith restart model, i.e., the steady-state probability that the particle will finally stayat node c starting from node r. More details about random walk with restart model canbe found in [Tong et al. 2006].

5. ROLE-BASED TRUST MODELIn this section, we design a role-based trust model to calculate the non-boolean implicittrust value between user u and u′ in context c, which is denoted as T (u, u′, c). There

ACM Transactions on Knowledge Discovery from Data, Vol. 0, No. 0, Article 1, Publication date: December 2012.

Page 10: 1 Context-aware Recommendation Using Role-based Trust Network · Trust-based recommendation approaches usually assume a trust network among users. Massa et al. [Massa and Avesani

1:10 L. Hong et al.

are two key components in our trust model: user similarity and interactions betweenusers.

Previous studies [McPherson et al. 2009; Golbeck 2009] have shown homophily isubiquitous in social networks, and can promote users’ mutual trust, i.e., the higherthe similarity between two users, the stronger the trust relation between them. In thispaper, we propose a role-based context-aware user similarity (see Definition 5.1) byconsidering users’ roles. Specifically, given two users u and u′ in context c, we measurethe user similarity by Jaccard similarity between R(u, c) and R(u′, c), where R(u, c)and R(u′, c) denote the role sets of user u and u′, respectively.

Definition 5.1 (User Similarity). Given two users u and u′ in context c, their corre-sponding role sets are R(u, c) and R(u′, c), respectively. The similarity between u andu′ at context c is defined as follows:

S(u, u′, c) =||R(u, c) ∩R(u′, c)||||R(u, c) ∪R(u′, c)||

=

∑r∈R(u,c)∩R(u′,c) W (r, c)∑r∈R(u,c)∪R(u′,c) W (r, c)

(1)

where W (r, c) denotes the relationship strength between role r and context c (see Sec-tion 4), and ||R(u, c)∩R(u′, c)|| and ||R(u, c)∪R(u′, c)|| are L1-norms of R(u, c)∩R(u′, c)and R(u, c) ∪R(u′, c), respectively.

Besides user similarity, we also consider interactions between users. In social net-works, interactions between a pair of users, such as chatting and commenting, reflecttheir mutual trusts[Liu et al. 2008]. For example, a user commenting on anotheruser’s post or photo is regarded as an ”interaction”. Generally speaking, a useru is more willing to trust the information provided by the users that have past inter-actions with u. In our model, we let Iuu′ be the number of interactions from user u tou′.

Given S(u, u′, c), Iuu′ and Iu′u, we discuss how to measure the trust value betweentwo users u and u′ in context c, i.e., T (u, u′, c). We model T (u, u′, c) as the conditionalprobability that u′ is u’s trusted friend by Eq. 2.

T (u, u′, c) = P (F (u, u′, c) = 1 | S(u, u′, c), Iuu′ , Iu′u) (2)

where F (u, u′, c) = 1 means that u′ is u’s trusted friend in context c.To model the impact of multiple factors S(u, u′, c), Iuu′ and Iu′u on T (u, u′, c), we use

the following logistic regression model in Eq.3

T (u, u′, c) = P (F (u, u′, c) = 1 | S(u, u′, c), Iuu′ , Iu′u)

=1

1 + e−(β1·S(u,u′,c)+β2·Iuu′+β3·Iu′u+β0)

(3)

where β0, β1, β2, and β3 are the parameters to be trained.In order to find the values of β0, β1, β2, and β3, we propose to utilize the explicit trust

statements as training data. Since few existing datasets contain context-aware truststatements, we have the following method. If users u and u′ have the same behav-ior in context c, and u sets an explicit trust statement to u′, then F (u, u′, c) = 1.Otherwise, F (u, u′, c) = 0. Thus, the setting of F (u, u′, c) is context dependent.Since both F (u, u′, c) and S(u, u′, c) are dependent on the context c, our trustmodel is also context dependent. For example, in Fig. 4, if u1 sets u2 as a trust-ed friend, then F (u1, u2, c1) = 1 and F (u1, u2, c2) = 1. This is because u1 and u2

have the same behavior in c1 and c2, respectively.Logistic regression model is widely used in estimating empirical impacts of multi-

ple factors. We choose logistic regression model to simulate the trust model becausethe model can adapt to binary trust statements, and predictor variables can be either

ACM Transactions on Knowledge Discovery from Data, Vol. 0, No. 0, Article 1, Publication date: December 2012.

Page 11: 1 Context-aware Recommendation Using Role-based Trust Network · Trust-based recommendation approaches usually assume a trust network among users. Massa et al. [Massa and Avesani

Context-aware Recommendation Using Role-based Trust Network 1:11

continuous (e.g. S(u, u′, c)) or discrete (e.g. Iuu′ and Iu′u). Moreover, logistic regressionmodel is more efficient than many other models for large scale dataset. Since our pa-per does not focus on designing an optimal trust model, we provide logistic regressionfunction as one choice to simulate the trust model. Other models can be also applicableto the trust model.

The parameters in Eq. 3 can be found by the following method. First, we build thelikelihood function:

L =∏

u,u′∈D

P (u, u′, c)F (u,u′,c)(1− P (u, u′, c))1−F (u,u′,c) (4)

where P (u, u′, c) denotes the probability of F (u, u′, c) being equal to 1. Taking the loga-rithm of Eq.(4), we get the data log-likelihood function:

lnL =∑

u,u′∈D

[F (u, u′, c) lnP (u, u′, c) + (1− F (u, u′, c)) ln(1− P (u, u′, c))

]=

∑u,u′∈D

[(F (u, u′, c)− 1)(β1S(u, u

′, c) + β2Iuu′ + β3Iu′u + β0)−

ln(1 + e−(β1S(u,u′,c)+β2Iuu′+β3Iu′u+β0))]

(5)

Since the logarithm of logistic function is concave, we use a gradient-based methodto estimate parameters β0, β1, β2 and β3 to maximize L. Let the first derivative of lnLwith respect to β1, β2 and β3 be equal to 0 respectively. The estimated values of β0,β1, β2 and β3 can be found using Newton-Raphson iteration method. Once parametersare fixed, in online recommendation, given S(u, u′, c), Iuu′ and Iu′u, we can computeT (u, u′, c) using Eq. 3. If T (u, u′, c) is larger than the trust value threshold τ , then uand u′ are trusted friends in context c.

Our role-based trust model is extensible to new model components, and can be usedto infer either directed or undirected trust value, depending on the way how we specifythe model components. In this work, we focus on the directed trust value, i.e., T (u, u′, c)could possibly be unequal to T (u′, u, c).

6. FINDING SIMILAR USERSFrom Eq. 3, we know that user similarity is a key component in the trust model. Givena user u in context c, we need to find his/her similar users u′ and the similarity valueS(u, u′, c), based on which, we can compute the trust value T (u, u′, c) by applying Eq.3. Specifically, we have the following task in online recommendations.

Given a user u in context c, a system-defined similarity threshold δ, we need to findall similar users u′, and similarity value S(u, u′, c) (Definition 5.1), where S(u, u′, c) ≥ δ.

Example 2: Fig. 6(a) shows a role-context matrix, in which each column correspondsto a role r, each row corresponds to a context c and each cell denotes role r’s weightin context c, i.e., W (r, c). Suppose the similarity threshold is δ=0.6. We need to find allsimilar users u′ and S(u, u′, c), such that S(u, u′, c) ≥ 0.6.

To tackle this task efficiently, we propose a Weighted Set Similarity Query (WSSQ)algorithm in this section.

6.1. Overview of WSSQWSSQ algorithm is divided to offline processing and online processing. In offline pro-cessing, we build an inverted index, which maps each role r to a list of users u (denotedas L(r)), where r ∈ R(u, c). Recall that W (r, c) depends on different contexts. There-fore, if there are k system-defined contexts ci, for one r, we maintain k inverted listsLi(r) for each context ci, i = 1, ..., k. Note that, each user u in Li(r) is denoted as its

ACM Transactions on Knowledge Discovery from Data, Vol. 0, No. 0, Article 1, Publication date: December 2012.

Page 12: 1 Context-aware Recommendation Using Role-based Trust Network · Trust-based recommendation approaches usually assume a trust network among users. Massa et al. [Massa and Avesani

1:12 L. Hong et al.

0.6 0.5 0.4 0.3 0.2 0.1

A B C D E F

0.4 0.3 0.5 0.4 0.1 0.2

1c

2c

rolescontexts

{ , , , }u B D E FQuery:

(a) Weights of roles in Different Contexts

0.5 0.3 0.2 0.1 { , , , }u B D E FQuery:

B

1 0.5 0.2 0.1{ , , }u B E F

2 0.5 0.3 0.1{ , , }u B D F

3 0.6 0.5 0.3 0.2{ , , , }u A B D E

5 0.6 0.5 0.4 0.3 0.2{ , , , , }u A B C D E

D

2 0.5 0.3 0.1{ , , }u B D F

3 0.6 0.5 0.3 0.2{ , , , }u A B D E

5 0.6 0.5 0.4 0.3 0.2{ , , , , }u A B C D E

E F

4 0.6 0.5 0.4 0.3 0.1{ , , , , }u A B C D F

4 0.6 0.5 0.4 0.3 0.1{ , , , , }u A B C D F

(b) Index for Context c1

0.4 0.3 0.2 0.1{ , , , }u D B F EQuery:

B

1 0.3 0.2 0.1{ , , }u B F E

2 0.4 0.3 0.2{ , , }u D B F

3 0.4 0.4 0.3 0.1{ , , , }u A D B E

D E F

4 0.5 0.4 0.4 0.3 0.2{ , , , , }u C A D B F

5 0.5 0.4 0.4 0.3 0.1{ , , , , }u C A D B E

2 0.4 0.3 0.2{ , , }u D B F

3 0.4 0.4 0.3 0.1{ , , , }u A D B E

4 0.5 0.4 0.4 0.3 0.2{ , , , , }u C A D B F

5 0.5 0.4 0.4 0.3 0.1{ , , , , }u C A D B E

(c) Index for Context c2

Fig. 6. Example of WSSQ Algorithm

role set R(u, ci). Thus, for ease of presentation, we use terms “user” and “role set” in-terchangeably in the following discussion. For each role set R(u, ci) in Li(r), we sortroles in R(u, ci) by descending order of their weights in context ci, i = 1, ..., k. Then,we sort role sets R(u, ci) in each inverted list in ascending order of ∥R(u, ci)∥1, where∥R(u, ci)∥1 =

∑r∈R(u,ci)

W (r, ci) is the L1-norm of R(u, ci).Note that, the ordering enables the pruning strategy and speeds up online query

processing, which will be discussed in the following. Fig. 6(b) and 6(c) show the twoinverted indexes in context c1 and c2, respectively. For instance, in Fig. 6(b), u1 hasthree roles B0.5, E0.2 and F0.1, where B0.5 means that W (B, c1) is 0.5. Thus, u1 is in theinverted lists of B, E and F ; and B, E and F are sorted in descending order of theirweights in u1’s role set.

In the online processing, given a user u in context c, we propose two pruning tech-niques (prefix filtering and L1-norm pruning) to find all candidate similar users u′. Inprefix filtering, we find which inverted lists need to be accessed (Section 6.2). Then,in L1-norm pruning, for each inverted index L(r) that needs to be accessed, it is notnecessary to access all role sets in L(r). Some role sets in L(r) can be pruned directly toreduce search space, which is discussed in Section 6.3. After the two pruning process-ing, we can find all candidate similar users u′ for u. Finally, for each candidate useru′, we compute S(u, u′, c). Note that, we compute S(u, u′, c) by using the optimizationtechnique in Section 6.4, rather than using Eq. 5.1 directly. Algorithm 1 shows thewhole processing for WSSQ.

6.2. Prefix FilteringWe propose prefix filtering technique to determine which inverted lists should be ac-cessed.

ACM Transactions on Knowledge Discovery from Data, Vol. 0, No. 0, Article 1, Publication date: December 2012.

Page 13: 1 Context-aware Recommendation Using Role-based Trust Network · Trust-based recommendation approaches usually assume a trust network among users. Massa et al. [Massa and Avesani

Context-aware Recommendation Using Role-based Trust Network 1:13

ALGORITHM 1: WSSQ AlgorithmInput: a query role set R(u, c); a similarity threshold δOutput: All similar users u′ and S(u, u′, c), such that S(u, u′, c) ≥ δ

1 Result set Γ← ϕ;2 Call Algorithm 2 to find maximal p-prefix {r1, ..., rp}; //prefix filtering3 for each role ri in p-prefix, i = 1, ..., p do4 for each role set R(u′, c) in ri’s inverted list do5 if there exists rj ∈ R(u′, c) and 1 ≤ j ≤ i− 1 then6 continue;7 if UB-L(u, u′, c) < δ then8 break; //L1-norm pruning9 Calculate S(u, u′, c) by calling Algorithm 3;

10 if S(u, u′, c) ≥ δ then11 Γ← Γ ∪

{u′};

12 return Γ;

Definition 6.1 (Ranked Role Set). Given a user u in context c, the ranked role setR(u, c) is denoted as R⃗(u, c), in which all roles are ranked by decreasing order of theirweights in context c.

Definition 6.2 (p-prefix). Given a ranked role set R⃗(u, c), the p-prefix is the first p

roles in R⃗(u, c), denoted by R⃗(u, c, p).

Definition 6.3 (Prefix Upper Bound). Given two users u and u′, if u′ does not containany role in the p-prefix of R⃗(u, c), the upper bound for S(u, u′, c) is

UB-P (u, u′, c) =1−∑

r∈R⃗(u,c,p) W (r, c)∑r∈R⃗(u,c) W (r, c)

The intuition behind prefix filtering principle is that: Given a user u in context c, foranother user u′, if R(u′, c) has no overlap with p-prefix of R⃗(u, c), prefix upper bound forS(u, u′, c) can be evaluated in Definition 6.3, based on which we can find the maximal p-prefix of R⃗(u, c). The maximal p-prefix means that: (1) if a user u′ has no overlap withR⃗(u, c, p-1), then UB-P (u, u′, c) ≥ δ; and (2) if u′ has no overlap with R⃗(u, c, p), thenupper bound UB-P (u, u′, c) < δ. Similarly, for each role r in R⃗(u, c, p), if u′’s role set isnot included in any L(r), then UB-P (u, u′, c) must be less than δ. Therefore, to find allsimilar role sets, we only need to access all inverted lists L(r), where r ∈ R⃗(u, c, p).

As shown in Example 2, given a query user role set R(u, c1) in context c1, the rolesin R(u, c1) are sorted by W (u, c1), i.e. R⃗(u, c1) = {B0.5, D0.3, E0.2, F0.1}. Given anotheruser u′, if 1-prefix of R⃗(u, c1) has no overlap with R(u′, c1), namely, R(u′, c1) has no roleB, then UB-P (u, u′, c1) is 1 − 0.5

0.5+0.3+0.2+0.1 = 0.545, which is less than δ = 0.6. In thiscase, the maximal prefix length p is 1. As shown in Fig. 6(b), if a user role set R(u′, c1)is not in role B’s inverted list, R(u′, c1) can be pruned safely, i.e., only B’s inverted listneeds to be accessed. As context changes to c2 in Fig. 6(c), the maximal prefix length pchanges to 2. That is, we need to access both B and D’s lists in context c2. Algorithm 2shows the steps to compute the maximal p-prefix.6.3. L1-norm PruningGiven a query user u in context c, according to Section 6.2, we can find u’s maximalp-prefix {r1, ..., rp}. Then, we need to access inverted list L(ri) one-by-one, i = 1, ..., p.Since one user may occur in different inverted lists, we have the following method: if

ACM Transactions on Knowledge Discovery from Data, Vol. 0, No. 0, Article 1, Publication date: December 2012.

Page 14: 1 Context-aware Recommendation Using Role-based Trust Network · Trust-based recommendation approaches usually assume a trust network among users. Massa et al. [Massa and Avesani

1:14 L. Hong et al.

ALGORITHM 2: Finding maximal p-prefix

Input: a ranked user role set R⃗(u, c) = {r1, ..., rn} in context c; a similarity threshold δOutput: Maximal p-prefix {r1, ..., rp}

1 H ← ∥R⃗(u, c)∥1;2 for i = 1...n do3 H = H −W (ri, c);4 if H < δ × ∥R⃗(u, c)∥1 then5 break;6 p← i− 1;7 return {r1, ..., rp} in R⃗(u, c);

a user’s role set R(u, c) in L(ri) has a role rj , where 1 ≤ j ≤ i − 1, R(u, c) will not beaccessed, since it has been accessed when visiting list L(rj) (Lines 5-6 in Algorithm 1).Furthermore, when visiting list L(ri), some role sets can be pruned using the followingsimilarity upper bound.

Definition 6.4. (L1-norm Upper Bound) Given a ranked query role set R⃗(u, c) ={r1, ..., rn}, and a user role set R(u′, c) in L(ri), 1 ≤ i ≤ p, if r1 /∈ R(u′, c) ∧ ... ∧ ri−1 /∈R(u′, c) ∧ ri ∈ R(u′, c), the L1-norm upper bound for S(u, u′, c) is defined as follows:

UB-L(u, u′, c) =

∑ni W (rj , c)∑

r′∈R(u′,c) W (r′, c)=

∑ni W (rj , c)

||R(u′, c)||1Let us consider a query user u at context c1 and another user u4 in Example 2, as

shown in Fig. 6(b). UB-L(u, u4, c1) =0.5+0.3+0.2+0.1

0.6+0.5+0.4+0.3+0.1 = 0.578 < δ, which means thatit is not necessary to access u4 in B’s list. Moreover, all user role sets after R(u4, c1)in B’s list can also be pruned safely (Lines 7-8 in Algorithm 1). The reason is that L1-norm upper bound is a monotonically decreasing function with regard to ∥R(u′, c)∥1,and user role sets are ranked by ascending order of their L1-norms in B’s inverted list.

6.4. Optimization for Similarity CalculationGiven a user u in context c, suppose a user u′’s role set R(u′, c) is not pruned by pre-fix filtering and upper bound pruning in context c. We should compute the similarityvalue S(u, u′, c) and add user u′ to the final result if S(u, u′, c) meets the similaritythreshold. Existing approaches scan each role in R(u, c) and R(u′, c) sequentially tocalculate the exact similarity value, thus, the time complexity of such computation isO(min(|R(u, c)|, |R(u′, c)|)). To save the cost of similarity calculation, we want to stopscanning as early as possible. Note that the similarity constraint S(u, u′, c) ≥ δ can betransformed into the following equivalent form:

S(u, u′, c) ≥ δ ⇔ ∥R(u, c) ∩R(u′, c)∥1 ≥ α,where α =δ

1 + δ

(∥R(u, c)∥1 + ∥R(u′, c)∥1

)(6)

Our idea is to tighten upper bound of ∥R(u, c) ∩ R(u′, c)∥1 (denoted by M ) as moreroles have been scanned, and stop scanning as long as the upper bound is less than thethreshold α. Algorithm 3 works as follows: It scans all the roles in the suffixes (i.e. rolesnot in the current prefix) of R(u, c) and R(u′, c) progressively. If the weights of currentprobing roles ri and rj in context c are equal, then ri ∈ R(u, c)∩R(u′, c), and ri’s weightshould be added to ∥R(u, c)∩R(u′, c)∥1 (Lines 6-8). Otherwise, if W (ri, c) is larger thanW (rj , c) (Line 9), and ri is in the maximum possible intersection (i.e. L1-norm of ri’scurrent suffix is no more than L1-norm of rj ’s current suffix, Line 10), then M shouldsubtract ri’s weight (Line 11). This is because ri is not a common role of R(u, c) andR(u′, c). Afterward, we compare M with the threshold α. If M is larger than α, the

ACM Transactions on Knowledge Discovery from Data, Vol. 0, No. 0, Article 1, Publication date: December 2012.

Page 15: 1 Context-aware Recommendation Using Role-based Trust Network · Trust-based recommendation approaches usually assume a trust network among users. Massa et al. [Massa and Avesani

Context-aware Recommendation Using Role-based Trust Network 1:15

pointer on R(u, c) should move forward and the scan will continue. Otherwise, thescan will stop according to Eq. 6. The above processing can be accordingly applied tothe situation that the maximum possible intersection is estimated by R(u′, c)’s suffix(Lines 15-20). The algorithm finally returns the similarity value S(u, u′, c), if M isalways no less than α (Line 21).

ALGORITHM 3: Similarity CalculationInput: R(u, c) and R(u′, c); pu and pu′ are current prefixes of R(u, c) and R(u′, c) respectively; r

is current probing common role of pu and pu′ ; a similarity threshold δOutput: S(u, u′, c), if S(u, u′, c) ≥ δ

1 lu ← u’s pointer on r, lu′ ← u′’s pointer on r;2 ∥R(u, c) ∩R(u′, c)∥1 ←W (r, c);3 M ← min

((∥R(u, c)−R(pu, c)∥1), (∥R(u′, c)−R(pu′ , c)∥1)

)+W (r, c);

4 α = δ1+δ

(∥R(u, c)∥1 + ∥R(u′, c)∥1

);

5 for each role ri in R(u, c)’s suffix, i = lu + 1, ..., |R(u, c)|; each role rj in R(u′, c)’s suffix,j = lu′ + 1, ..., |R(u′, c)| do

6 if W (ri, c) == W (rj , c) then7 ∥R(u, c) ∩R(u′, c)∥1+ = W (ri, c));8 i++, j++;9 else if W (ri, c) ≥W (rj , c) then

10 if(∥R(u, c)−R(pu, c)∥1

)≤

(∥R(u′, c)−R(pu′ , c)∥1

)then

11 M− = W (ri, c);12 if M < α then13 return 0;14 i++;15 else if W (ri, c) < W (rj , c) then16 if

(∥R(u, c)−R(pu, c)∥1

)≥

(∥R(u′, c)−R(pu′ , c)∥1

)then

17 M− = W (rj , c);18 if M < α then19 return 0;20 j++;21 S(u, u′, c) = ∥R(u, c) ∩R(u′, c)∥1/

(∥R(u, c)∥1 + ∥R(u′, c)∥1 − ∥R(u, c) ∩R(u′, c)∥1

);

In Example 2, R(u1, c1), R(u2, c1) and R(u3, c1) are selected as candidate sets afterprefix filtering and upper bound pruning. If we calculate the similarity value betweenR(u, c1) and R(u3, c1) using Algorithm 3, we can prune R(u3, c1) before scanning all theroles. Specifically, in Fig. 6(b) M = L1-norm{B,D,E} = 1, α = 0.6

1+0.6 (1.1 + 1.6) > M .Since the upper bound M is less than the threshold α, the scan can be terminated.

7. RECOMMENDATIONIn this section, we discuss how to make recommendations to user u in a given contextc. We first find all the roles that user u plays in the context c. Specifically, for each roler in R(u, c), we check if context c intersects role r in UCB matrix. If so, r is one rolethat u plays in c. As mentioned in Section 4, a role is a set of context-aware behavior;and behavior is defined as choosing some category of items. Therefore, when a user uplays a role in c, u is probably interested in the category of items corresponding to u’sbehavior in c. For each item v in this category, the recommender system predicts therating that user u would give to item v. As discussed in Section 1, users always turn totrusted friends for recommendations. Therefore, the recommender system finds all u’strusted friends u′ using Eq. 3 and computes the rating predictions of u using Eq. 7.

ACM Transactions on Knowledge Discovery from Data, Vol. 0, No. 0, Article 1, Publication date: December 2012.

Page 16: 1 Context-aware Recommendation Using Role-based Trust Network · Trust-based recommendation approaches usually assume a trust network among users. Massa et al. [Massa and Avesani

1:16 L. Hong et al.

RT (u, v, c) =

∑u′∈U(u,c) UIR[u′][v]T (u, u′, c)∑

u′∈U(u,c) T (u, u′, c)

(7)

where RT (u, v, c) is the prediction of the rating that user u would give item v in thecontext c, UIR[u′][v] is the rating that user u′ gave to item v in UIR matrix (see Defi-nition 3.1), U(u, c) is the set of u’s trusted users who have rated item v in the contextc, and T (u, u′, c) should be normalized. Finally, top k items with the highest predictedratings are recommended to user u in the context c.

Note that, there are three special types of users. The first type is “cold start” userswho have very few behavior, and the second type is “grey sheep” users (defined inSection 4) who have unique behavior that is not shared by many users. Thus, theabove two types of users play few roles in any context. For these users, we find theirsimilar users purely based on common context-aware behavior. Users of the third typedo not have any behavior in the current context, while playing many roles in othercontexts. For these users, we still find their similar users based on role set similarities.Based on user similarities, we can establish each special type user u’s trust networkin current context using our trust model. We recommend top k items with the highestpredicted ratings to u based on Eq. 7.

Example 3: Given a user u2 in the context “Cinema” in Fig. 1, we find that u2 playsrole r2, and the corresponding behavior of r2 is watching “War movie”. Thus, the rec-ommender system should suggest war movies to u2. In order to enable the recommen-dation, the recommender system finds all u2’s trusted friends, i.e. u3 and u4, in u2’srole-based trust network. We predict u2’s ratings on war movies in the UIR matrixusing Eq. 7. Suppose u3 and u4 have rated the movie “Saving Private Ryan” 5 and 4respectively in the UIR matrix, we can predict that “Saving Private Ryan” gets thehighest rating by u2. Based on the prediction, the recommender system will recom-mend “Saving Private Ryan” to u2 in the context “Cinema”.

8. EXPERIMENTAL EVALUATIONIn this section, we describe the dataset used in our experiments and comparing meth-ods. Then, we evaluate the performance of our role mining algorithm. Since our rec-ommendation approach considers both trust relation and context, we compare the rec-ommendation quality of our approach with a state-of-the-art trust-based recommen-dation method and two context-aware recommendation methods. Finally, we evaluatethe recommendation time of our approach by comparing WSSQ algorithm with a state-of-the-art weighted set similarity search algorithm and a recommendation method. Allexperiments are implemented in C++ on a 2.5GHZ Core class machine with 2GB RAMand a 7200 RPM SATA-IDE hard drive. Each data point comes from the averageresult of 10 runs, which has a 95% confidence level.

8.1. Dataset DescriptionThe first dataset used in our experiment is collected by crawling Dianping(http://www.dianping.com). The Dianping dataset consists of 100,000 active users whohave rated a total number of 1,054,119 ratings on 245,646 different items. Dianpingis the largest Web review service website in China, in which registered users can sub-mit their personal reviews or ratings on items such as restaurants, cinemas, shoppingmalls, or reviews issued by other users. These reviews and ratings will influence oth-er users’ opinions on different categories of items. Each user can explicitly set his/hertrusted friends. Dianping also provides location based service check-in, which allowsusers to “check in” different locations. Based on the check-in information, we define us-er context as a triple ⟨District, Location Class, T ime Period⟩. Take the dataset about

ACM Transactions on Knowledge Discovery from Data, Vol. 0, No. 0, Article 1, Publication date: December 2012.

Page 17: 1 Context-aware Recommendation Using Role-based Trust Network · Trust-based recommendation approaches usually assume a trust network among users. Massa et al. [Massa and Avesani

Context-aware Recommendation Using Role-based Trust Network 1:17

Shanghai city for example. There are 16 districts of Shanghai city, such as “HuangpuDistrict”, “Xuhui District” and “Minhang District”. All items (locations) are classifiedinto 5 classes: “Restaurant”, “Shop”, “Entertainment Place”, “Hotel” and “Life ServicesPlace”. Since each check-in data contains exact check-in time, we categorize check-in time into three time periods, i.e. “morning”, “afternoon” and “night”. Therefore, inour system, we predefine 240 different contexts. It is worth noting that Dianping usesexpert-defined taxonomy to classify items into 72 categories, such as “Electrical Ap-pliance”, “Youth Hostel” and so on. Since a user behavior is defined as choosing onecategory of items, there are 72 types of behavior in Dianping Dataset.

We also use an Extended Epinions dataset1. Epinions is a consumer opin-ion site in which users can review items and assign them numeric ratings inthe range 1 (min) to 5 (max). Users can explicitly express their Web of trustand their distrustful users. The extended Epinions dataset contains 132,000users, who issued 717,667 statements of trust and gave 13,668,319 ratings to1,560,144 articles. Since user ratings in this dataset is not context-dependent,we modify the original dataset using the same method proposed in [Karat-zoglou et al. 2010]. We add 10 new artificial features (i.e. contexts) to the o-riginal dataset, choose 90% items from the dataset, and randomly pick 50%of the ratings to modify. As a result, the contexts can affect ratings in themodified dataset.

8.2. Competing MethodsWe compare our Recommendation using Role-base Trust Network (RRTN) approachwith the following competing methods.

(1) The context-independent version of RRTN approach (RRTNt) computes simi-larity between users u and u′ only based on their common behaviors, so RRTNt usesT (u, u′) instead of T (u, u′, c) in recommendation.

(2) To evaluate the context part of RRTN separately, we also compare R-RTN with the RRTNc approach. RRTNc does not build a role-based trust net-work for each user, instead it makes recommendation for an active user u incontext c based on the roles played by u in c. Specifically, RRTNc uses the rat-ings from those users playing the same roles as u to calculate a prediction foru, which can be regarded as the user-based collaborative filtering enhancedby roles.

(3) Recommendation with Social Trust Ensemble (RSTE)[Ma et al. 2009] is a trust-based recommendation approach. The intuition of RSTE is that each user’s decisionson the items should include both the user’s favors and the user’s trusted friends’ recom-mendations. RSTE proposes a probabilistic matrix factorization framework, which fus-es the users’ and their trusted friends’ tastes together by a social trust ensemble. TheRSTE approach has been shown to consistently outperform alternative trust-basedmethods such as SoRec[Ma et al. 2008].The smoothing parameter α is set to 0.4,and the parameters λU and λV are both set to 0.001.

(4) MultiVerse (MV) recommendation approach [Karatzoglou et al. 2010] is specifi-cally designed for context-aware recommendations. MV introduces a Collaborative Fil-tering method based on Tensor Factorization by modeling the data as a User-Item-Context N-dimensional tensor instead of the traditional 2D User-Item matrix.Theregularization parameters λ and λS , the initial learning rate are set to de-fault values as MV method.

(5) Factorization Machines (FM) [Rendle 2012] is the state-of-the-art context-awarerecommendation method, which outperforms other context-aware recommendation

1http://www.trustlet.org/wiki/Extended Epinions dataset

ACM Transactions on Knowledge Discovery from Data, Vol. 0, No. 0, Article 1, Publication date: December 2012.

Page 18: 1 Context-aware Recommendation Using Role-based Trust Network · Trust-based recommendation approaches usually assume a trust network among users. Massa et al. [Massa and Avesani

1:18 L. Hong et al.

methods such as [Karatzoglou et al. 2010] in terms of predictive accuracy and recom-mendation time. FM can include both trust relations and context informationinto feature vectors, and therefore can make recommendations by consider-ing both trust and context. We use Stochastic Gradient Descent (SGD) algo-rithm to optimize factorization models. The learning rate η, regularizationvalue λ and initialization value σ are set to 0.1, ’0,0,0.01’ and 0,1, respectively.

Context-aware recommendation requires short recommendation time. In ourmethod, recommendation time is dominated by the response time of Weighted SetSimilarity Query (WSSQ) algorithm. Therefore, we compare our WSSQ algorithm withthe state-of-the-art Heaviest First algorithm [Hadjieleftheriou and Srivastava 2010;Hadjieleftheriou et al. 2008]. Heaviest First algorithm first sorts inverted lists of to-kens in the query string in a decreasing order of the tokens’ weights, i.e. from heaviestto lightest. Then the algorithm exhaustively traverses all the token lists from heaviestto lightest, and stores all new candidates in a candidate set. When a new list is beingtraversed, the algorithm prunes the candidates in the candidate set whose best-casesimilarity is below the similarity threshold. Heaviest First algorithm has been provedto outperform alternative algorithms such as NRA [Hadjieleftheriou et al. 2008], TA(the threshold algorithm)[Sarawagi and Kirpal 2004], and SSJoin [Chaudhuri et al.2006]. Therefore, we compare our algorithm with Heaviest First algorithm. In ad-dition, we also compare the runtime of our algorithm with FM method. Theruntime includes the time of one full iteration over all training examples andonline generation of a ranked list for one user. FM has shorter runtime thanother recommendation methods such as MV.

8.3. Evaluation of Role Mining and Trust ModelIn this section, we first evaluate the runtime of our role mining algorithm on Dianpingdataset. Then, we evaluate the number of mined roles by varying the tuning parame-ters mt and nt. Finally, we report the prediction accuracy of our trust model.

As shown in Fig. 7(a), the role mining time increases from 2540 seconds to 22379seconds as the number of users in UCB matrix changes from 10000 (10K) to 100000(100K). Since role mining is offline processing, the role mining time is acceptable. Fig.7(b) shows the impact of tuning parameter mt and nt on the number of mined roles,where mt and nt means a role should be played by at least mt users who have commonbehavior in at least nt contexts. For example, when mt = 500 and nt = 2, the largestnumber of mined roles is 3261. As mt and nt become larger, the number of mined rolesdecreases exponentially in Fig. 7(b).

0

0.5

1

1.5

2

2.5

10K 20K 40K 60K 80K 100K

* 104

Tim

e(s)

Number of Users

RM

(a) Role Mining Time

* 103

3 2.5 2

1.5 1

0.5

23

45

6nt 500

7501000

12501500

17502000

22502500

mt

0

0.5

1

1.5

2

2.5

3

3.5

Num

ber

of R

oles

(b) Number of Roles

Fig. 7. Evaluation of Role Mining Algorithm on Dianping Dataset

ACM Transactions on Knowledge Discovery from Data, Vol. 0, No. 0, Article 1, Publication date: December 2012.

Page 19: 1 Context-aware Recommendation Using Role-based Trust Network · Trust-based recommendation approaches usually assume a trust network among users. Massa et al. [Massa and Avesani

Context-aware Recommendation Using Role-based Trust Network 1:19

We set the trust value threshold τ to 0.7, and the similarity threshold δ to 0.6 bydefault. Under the default settings, the accuracy of predicted trust value is 89.1%.

8.4. Recommendation QualityIn this section, we first introduce the evaluation metrics of recommendation quality,then evaluate the impact of tuning parameter mt and nt on recommendation qualityof our method. After selecting optimal value of mt and nt, we compare the recommen-dation quality of RRTN with that of competing methods.

8.4.1. Evaluation Metrics. We use the following metrics to evaluate the accuracy of rat-ing predictions (MAE and RMSE) and the quality of top k recommendations (Precisionat k and NDCG at k).

MAE and RMSE: We use Mean Absolute Error (MAE) and Root Mean SquaredError (RMSE) to measure the accuracy of rating predictions. A smaller MAE or RMSEvalue means a higher prediction accuracy. MAE and RMSE are defined as follows:

MAE =

∑i,j

∣∣∣RTij − R̂T ij

∣∣∣N

RMSE =

√∑i,j(RTij − R̂T ij)2

N

where RTij and R̂T ij denotes the actual rating user ui gave to item vj and predictedrating respectively, and N denotes the number of tested ratings.

Precision at k: As the most intuitive metric for top k recommendation, for each useru in test set, precision at k reports the fraction of items ranked in the top k predictedratings that also appear in u’s test top k list. In our setting, we rank the items ratedby u in a descending order of u’s actual ratings, and choose the top k high-rated itemsto form u’s test top k list.

NDCG at k: The recommendation quality is also sensitive to the positions of topk recommended items, which cannot be evaluated by precision at k. Intuitively, it isdesirable that high-rated items appear earlier in the top k recommendation list. We usenormalized discounted cumulative gain (NDCG) to measure the top k recommendationquality. The NDCG value of a ranking list at position k is calculated as:

NDCG = Zk

k∑j=1

2RT (j) − 1

log2(1 + j)

where RT (j) is the rating of the j-th item in the ranking list, and the normalizationconstant Zk is chosen so that the perfect list gets a NDCG score of 1.

8.4.2. Impact of Parameters mt and nt . In our method, the tuning parameters mt andnt balance the number of roles and the abstraction level of each role. If the valuesof mt and nt are large, small number of roles will be mined from the UCB matrix.Thus, a large portion of users u play no role or few roles. As discussed in Section 4,our method finds u’s similar users based on common context-aware behavior if u playsno role. In this case, our method degenerates into a CF-based method, which reducesthe recommendation quality. On the contrary, if the values of mt and nt are small,there exist many “small” roles, in which only a few users have common behavior ina few contexts. Two users may not be very similar if they only share some of these“small” roles. In this case the recommendation quality can be reduced as well. To findthe values of mt and nt that optimize recommendation quality of our approach, we

ACM Transactions on Knowledge Discovery from Data, Vol. 0, No. 0, Article 1, Publication date: December 2012.

Page 20: 1 Context-aware Recommendation Using Role-based Trust Network · Trust-based recommendation approaches usually assume a trust network among users. Massa et al. [Massa and Avesani

1:20 L. Hong et al.

0.611 0.61

0.609 0.608

0.607 0.606 0.605

23

45

6nt 500

7501000

12501500

17502000

22502500

mt

0.602 0.603 0.604 0.605 0.606 0.607 0.608 0.609

0.61 0.611 0.612 0.613

MA

E

(a) Impact on MAE

0.815 0.813 0.811

0.809 0.807 0.805

23

45

6nt 500

7501000

12501500

17502000

22502500

mt

0.804

0.806

0.808

0.81

0.812

0.814

0.816

0.818

RM

SE

(b) Impact on RMSE

Fig. 8. Impact of Parameters mt and nt on Dianping dataset

perform two sets of experiments on MAE and RMSE respectively by varying mt andnt. We get each data point in Fig. 8(a) and Fig. 8(b) using 10-fold cross validation. Wepartition Dianping dataset into ten samples. Of the ten samples, a sample is randomlyselected as test data for rating prediction, and the remaining nine samples are usedto build a UCB matrix and a UIR matrix as training data. The ten cross-validationresults are averaged to produce a single estimation.

Fig. 8(a) and Fig. 8(b) show the impacts of mt and nt on MAE and RMSE. We observethat the values of mt and nt impact the MAE and RMSE greatly, which demonstratesthat balancing the number of roles and the abstraction level of each role improvesthe recommendation quality. As shown in Fig. 8(a), when mt = 750 and nt = 2, MAEreaches the lowest value 0.605. We also observe in Fig. 8(b) that RMSE reaches thelowest value 0.805 when mt = 750 and nt = 2. These results indicate that the optimalvalues of mt and nt are 750 and 2, respectively. Since top-k recommendation qualityis determined by the accuracy of rating predictions, top-k recommendations can alsobe optimized when mt = 750 and nt = 2. Thus, in the following comparison, we setmt to 750 and nt to 2, which means a role should be formed by at least 750 usersand 2 contexts on Dianping dataset. Using the above method, we find optimalparameter settings for Epinions dataset are mt = 920 and nt = 2.

8.4.3. Comparison. We use different percentages of training data from 20% to 99% tocompare the prediction accuracy of competing methods on MAE and RMSE. Trainingdata 90%, for example, means we randomly select 90% ratings from the dataset astraining data to predict the remaining 10% ratings. We use Precision at k and NDCGat k to evaluate the ranking quality by varying k from 10 to 50. Each data point isobtained using 10-fold cross validation.

As shown in Fig. 9 and 10, RRTN has higher prediction accuracy (MAE andRMSE) and recommendation quality (Precision at k and NDCG at k) thancompeting methods on both Dianping and Epinions datasets. For example, R-RTN outperforms the FM method by 4.7% (MAE) and 2.6% (RMSE) using 20%training data of Dianping dataset, and up to 13.5% (MAE) and 5.9% (RMSE)using 99% training data. MAE and RMSE of all the methods decrease as thepercentage of training data increases from 20% to 99%, which indicates thatbetter recommendation quality can be achieved using more training data.Fig. 9 and 10 also show that RRTN results in higher Precision at k and NDCGat k than other methods. Specifically, using Dianping dataset, RRTN outper-forms competing methods by at least 1.7% and up to 3.1% on Precision at k,and at least 3.1% and up to 7.3% on NDCG at k. As the value of k increases, the

ACM Transactions on Knowledge Discovery from Data, Vol. 0, No. 0, Article 1, Publication date: December 2012.

Page 21: 1 Context-aware Recommendation Using Role-based Trust Network · Trust-based recommendation approaches usually assume a trust network among users. Massa et al. [Massa and Avesani

Context-aware Recommendation Using Role-based Trust Network 1:21

0.6

0.7

0.8

0.9

1

20 35 50 65 80 90 99

MA

E

Training Set(%)

RRTNtRRTNcRSTE

MVFM

RRTN

(a) MAE

0.75

0.8

0.85

0.9

0.95

1

1.05

1.1

1.15

1.2

20 35 50 65 80 90 99

RM

SE

Training Set(%)

RRTNtRRTNcRSTE

MVFM

RRTN

(b) RMSE

0

0.02

0.04

0.06

0.08

0.1

0.12

0.14

10 20 30 40 50

prec

isio

n

Top k recommendations

RRTNtRRTNcRSTE

MVFM

RRTN

(c) Precision at k

0.8

0.81

0.82

0.83

0.84

0.85

0.86

0.87

0.88

0.89

0.9

10 20 30 40 50

ND

CG

Top k recommendations

RRTNtRRTNcRSTE

MVFM

RRTN

(d) NDCG at k

Fig. 9. Comparison of Recommendation Quality on Dianping Dataset

recommendation quality becomes higher because the top k recommendationresults are more likely to appear in the test set. Note that, although Epinionsdataset is denser than Dianping dataset, the recommendation quality of al-l the methods on Dianping dataset is higher than that on Epinions dataset.This is mainly because the artificial contexts added to Epinions dataset can-not perfectly simulate real context-aware ratings.

RRTN has a better recommendation quality than RRTNt because RRTN considerscontext information, which is consistent with real recommendations in mobile scenar-ios. For example, in Dianping, user u and user u′ have a common behavior “Starbucks”.User u′ usually goes to a “Starbucks” cafe in Minhang district and rated the “Starbuck-s” with high rating. And u usually goes to a “Starbucks” in Pudong district which isfar from Minhang. Without considering context, RRTNt will probably regard u and u′

have very close tastes on cafe. If u′ also rates another cafe “Cstraits Cafe” in Minhangwith high rating, RRTNt will recommend the “Cstraits Cafe” to u. Obviously, the rec-ommendation of RRTNt is not satisfactory for u because u normally will not go to afaraway cafe.

RRTN has a better recommendation quality than RRTNc because RRTNc

ignores trust relations between users. In real world, an user’s ratings onitems are usually affected by the tastes of his/her trusted friends. Similarly,RRTN also outperforms MV because MV is a context aware recommendationmethod, which ignores social trust relations in the recommendation. Notethat, RRTN outperforms both its trust-part RRTNt and context-part RRTNt,

ACM Transactions on Knowledge Discovery from Data, Vol. 0, No. 0, Article 1, Publication date: December 2012.

Page 22: 1 Context-aware Recommendation Using Role-based Trust Network · Trust-based recommendation approaches usually assume a trust network among users. Massa et al. [Massa and Avesani

1:22 L. Hong et al.

0.8

0.9

1

1.1

1.2

1.3

1.4

1.5

1.6

1.7

20 35 50 65 80 90 99

MA

E

Training Set(%)

RRTNtRRTNcRSTE

MVFM

RRTN

(a) MAE

1

1.2

1.4

1.6

1.8

2

2.2

2.4

20 35 50 65 80 90 99

RM

SE

Training Set(%)

RRTNtRRTNcRSTE

MVFM

RRTN

(b) RMSE

0.04

0.06

0.08

0.1

0.12

0.14

10 20 30 40 50

prec

isio

n

Top k recommendations

RRTNtRRTNcRSTE

MVFM

RRTN

(c) Precision at k

0.7

0.72

0.74

0.76

0.78

0.8

0.82

0.84

10 20 30 40 50

ND

CG

Top k recommendations

RRTNtRRTNcRSTE

MVFM

RRTN

(d) NDCG at k

Fig. 10. Comparison of Recommendation Quality on Epinions Dataset

which proves that trust relations and context information should be jointlyconsidered in the context-aware recommendation.

RRTN makes more accurate recommendations than RSTE because of two reasons.First, RSTE is not a context-aware recommendation approach, and therefore ignorescontext information. Second, RRTN makes recommendations based on a dense role-based trust network in which many implicit trust relations are computed using ourrole-based trust model, while RSTE makes recommendations based on only sparseexplicit trust relations.

Although FM considers both trust relations and contexts in the recommen-dation, RRTN still outperforms FM in recommendation quality. This is be-cause RRTN introduces role to represent common context-aware behaviorsamong a group of users. Role helps the recommender system to determineusers’ context-aware interests as well as context-aware trust relations. How-ever, FM ignores the implicit context-aware trust relations between users,and aspects of trust relations.

8.5. Recommendation PerformanceIn the first comparison, we evaluate the recommendation performance according tocandidate size (measured by the number of users that cannot be pruned), number ofscans (measured by the number of scans when calculating similarity value), and queryresponse time. In each run, we randomly select a user’s role set as the workload query

ACM Transactions on Knowledge Discovery from Data, Vol. 0, No. 0, Article 1, Publication date: December 2012.

Page 23: 1 Context-aware Recommendation Using Role-based Trust Network · Trust-based recommendation approaches usually assume a trust network among users. Massa et al. [Massa and Avesani

Context-aware Recommendation Using Role-based Trust Network 1:23

set. The experiments are performed on a 50,000 user Dianping dataset and a 100,000user Dianping dataset, respectively.

0

0.5

1

1.5

2

2.5

3

3.5

4

0.5 0.6 0.7 0.8 0.9 0.95

* 104

Can

dida

te S

ize

Similarity Threshold

50000 Users

Heaviest FirstWSSQ

(a) Candidate Size

0

0.5

1

1.5

2

0.5 0.6 0.7 0.8 0.9 0.95

* 105

Num

ber

of S

cans

Similarity Threshold

50000 Users

Heaviest FirstWSSQ

(b) Number of Scans

0

10

20

30

40

50

0.5 0.6 0.7 0.8 0.9 0.95

Tim

e(m

s)

Similarity Threshold

50000 Users

Heaviest FirstWSSQ

(c) Query Response Time

0

1

2

3

4

5

6

0.5 0.6 0.7 0.8 0.9 0.95

* 104

Can

dida

te S

ize

Similarity Threshold

100000 Users

Heaviest FirstWSSQ

(d) Candidate Size

0

0.5

1

1.5

2

2.5

3

0.5 0.6 0.7 0.8 0.9 0.95

* 105

Num

ber

of S

cans

Similarity Threshold

100000 Users

Heaviest FirstWSSQ

(e) Number of Scans

0

10

20

30

40

50

60

70

0.5 0.6 0.7 0.8 0.9 0.95

Tim

e(m

s)

Similarity Threshold

100000 Users

Heaviest FirstWSSQ

(f) Query Response Time

Fig. 11. Comparison of Query Performance

Candidate size. As shown in Fig. 11(a) and 11(d), WSSQ algorithm results in s-maller candidate size than Heaviest First. This is because prefix filtering and L1-normpruning techniques used in WSSQ algorithm have better pruning power than Heavi-est First. Note that the candidate sizes of these two algorithms both decrease as thesimilarity threshold δ becomes larger.

ACM Transactions on Knowledge Discovery from Data, Vol. 0, No. 0, Article 1, Publication date: December 2012.

Page 24: 1 Context-aware Recommendation Using Role-based Trust Network · Trust-based recommendation approaches usually assume a trust network among users. Massa et al. [Massa and Avesani

1:24 L. Hong et al.

100

101

102

103

104

10K 20K 40K 60K 80K 100K

Tim

e(s)

Number of users

FMRRTN

(a) Dianping Dataset

100

101

102

103

104

10K 20K 40K 60K 80K 130K

Tim

e(s)

Number of users

FMRRTN

(b) Epinions Dataset

Fig. 12. Comparison of Runtime

Number of Scans. Then, we compare the cost of similarity calculation with thatof Heaviest First (i.e. typical calculation method) by varying the similarity threshold.The cost of similarity calculation is dominated by the number of scans. As shown inFig. 11(b) and 11(e), the number of scans in similarity calculation can be greatly re-duced by WSSQ compared to Heaviest First in both 50,000 and 100,000 user datasets.This result confirms the fact that our approach can prune dissimilar role sets beforescanning all the roles. In fact, typical similarity calculation needs to scan all the rolesin both the query set and the candidate set, while our approach verifies whether tworole sets are possible to meet the similarity threshold each time a new role is scanned.

Query Response Time. Finally, we compare query response time of WSSQ algo-rithm with that of Heaviest First algorithm. Fig. 11(c) and 11(f) show that WSSQachieves much shorter query response time than Heaviest First. For example, in Fig.11(f), the maximum query response time of WSSQ algorithm is only 30 ms when thethreshold is 0.5. Note that the advantage of WSSQ algorithm decreases as the similar-ity threshold becomes larger. The reason is that the candidate sizes of both algorithmsbecome smaller accordingly. In addition, the advantage of WSSQ algorithm becomesmore obvious when the number of users increases, which indicates that WSSQ is morescalable than Heaviest First.

In the second comparison, we compare the runtime including trainingtime and prediction time of RRTN with FM by varying the number of users.Fig. 12 shows that RRTN greatly outperforms FM in runtime on both dataset-s. The advantage becomes more obvious when the number of users increases.One of the main disadvantages of FM is that the dimension of the feature vec-tor becomes high by including a large number of users, items, contexts andtrust relations. In particular, the number of social trust relations grows ex-ponentially with the number of users. As a result, the model training of FM istime-consuming for a large dataset containing both trust relations and con-text information.

9. CONCLUSIONSThis paper is motivated by the fact that users play different roles in varying con-texts, and users playing the same role may share common context-aware interests onitems related to the role. We propose a high quality context-aware personalized recom-mendation approach using role-based trust network. First, we present a role miningalgorithm to mine roles from UCB matrix. Then, a role-based trust model is designedto calculate context-aware trust value between two users. Afterwards, we develop an

ACM Transactions on Knowledge Discovery from Data, Vol. 0, No. 0, Article 1, Publication date: December 2012.

Page 25: 1 Context-aware Recommendation Using Role-based Trust Network · Trust-based recommendation approaches usually assume a trust network among users. Massa et al. [Massa and Avesani

Context-aware Recommendation Using Role-based Trust Network 1:25

efficient WSSQ algorithm to build a role-based trust network for a user u, in whichtrusted friends of u and trust values change dynamically with u’s context and role. Ex-periments on a large real dataset demonstrate that our recommendation approach canachieve higher recommendation quality and shorter online recommendation time thanstate-of-the-art approaches, and therefore is suitable for context-aware recommenda-tions in mobile scenarios. Considering explicit trust statements and user ratings aresparse in real applications, our approach alleviates the data sparsity problem by find-ing trusted users using role set similarities, and making recommendations based onrole-based trust network.

In our paper, contexts are predefined and roles are mined in an offline manner. If thesample of users is large enough to be statistically significant, new contexts and roleswill be rare. Nevertheless, in the future, we plan to design an efficient and scalablerole mining algorithm that can incrementally adapt to new contexts and users.

AcknowledgmentsThis paper is supported in part by National Science Foundation of China (NSFC) un-der Grant 61303025, 61370055 and 61232002, Shenzhen development Foundation (J-CYJ20130401160028781) and Tencent.

REFERENCESADOMAVICIUS, G., MOBASHER, B., RICCI, F., AND TUZHILIN, A. 2011. Context-aware recommender sys-

tems. In AI Magazine.ADOMAVICIUS, G. AND TUZHILIN, A. 2008. Context-aware recommender systems. In RecSys.ANAND, S. S. AND MOBASHER, B. 2007. Contextual recommendation. From Web to Social Web: Discovering

and Deploying User and Content Profiles.BAO, T., CAO, H., CHEN, E., TIAN, J., AND XIONG, H. 2010. An unsupervised approach to modeling person-

alized contexts of mobile users. In ICDM.CAI, R., ZHANG, C., WANG, C., ZHANG, L., AND MA, W.-Y. 2007. Musicsense: Contextual music recommen-

dation using emotional allocation modeling. In ACM MM.CHAUDHURI, S., GANTI, V., AND KAUSHIK, R. 2006. A primitive operator for similarity joins in data clean-

ing. In ICDE.DUBOIS, T., GOLBECK, J., KHOSHGOFTAAR, T. M., AND ZHU, X. 2009. Improving recommendation accuracy

by clustering social networks with trust. In RecSys.FORESTIER, M., STAVRIANOU, A., VELCIN, J., AND ZIGHED, D. A. 2012. Roles in social networks: Method-

ologies and research issues. Web Intelligence and Agent Systems, 117–133.GEDIMINAS ADOMAVICIUS, RAMESH SANKARANARAYANAN, S. S. AND TUZHILIN, A. 2005. Incorporating

contextual information in recommender systems using a multidimensional approach. ACM Transactionson Information Systems 21, 1.

GOLBECK, J. 2009. Trust and nuanced profile similarity in online social networks. ACM Transactions on theWeb 3, 4.

GOLDBERG, D., NICHOLS, D., OKI, B. M., AND TERRY, D. 1992. Using collaborative filtering to weave aninformation tapestry. Communications of the ACM 35, 12.

HADJIELEFTHERIOU, M., CHANDEL, A., KOUDAS, N., AND SRIVASTAVA, D. 2008. Fast indexes and algo-rithms for set similarity selection queries. In ICDE.

HADJIELEFTHERIOU, M., KOUDAS, N., AND SRIVASTAVA, D. 2009. Incremental maintenance of length nor-malized indexes for approximate string matching. In SIGMOD.

HADJIELEFTHERIOU, M. AND SRIVASTAVA, D. 2010. Weighted set-based string similarity. In Bulletin of theIEEE Computer Society Technical Committee on Data Engineering.

HE, Q., PEI, J., KIFER, D., MITRA, P., AND GILES, C. L. 2010. Context-aware citation recommendation. InWWW.

JAMALI, M. AND ESTER, M. 2009a. Trustwalker: A random walk model for combining trust-based anditem-based recommendation. In KDD.

JAMALI, M. AND ESTER, M. 2009b. Using a trust network to improve top-n recommendation. In RecSys.KARATZOGLOU, A., AMATRIAIN, X., BALTRUNAS, L., AND OLIVER, N. 2010. Multiverse recommendation:

N-dimensional tensor factorization for context-aware collaborative filtering. In RecSys.

ACM Transactions on Knowledge Discovery from Data, Vol. 0, No. 0, Article 1, Publication date: December 2012.

Page 26: 1 Context-aware Recommendation Using Role-based Trust Network · Trust-based recommendation approaches usually assume a trust network among users. Massa et al. [Massa and Avesani

1:26 L. Hong et al.

LI, B., YANG, Q., AND XUE, X. 2009. Transfer learning for collaborative filtering via a rating-matrix gener-ative model. In ICML.

LI, L., CHU, W., LANGFORD, J., AND SCHAPIRE, R. E. 2010. A contextual-bandit approach to personalizednews article recommendation. In WWW.

LIU, H., LIM, E.-P., LAUW, H. W., LE, M.-T., SUN, A., SRIVASTAVA, J., AND KIM, Y. A. 2008. Predictingtrusts among users of online communities: an epinions case study. In ACM conference on Electroniccommerce.

MA, H., KING, I., AND LYU, M. R. 2009. Learning to recommend with social trust ensemble. In SIGIR.MA, H., YANG, H., LYU, M. R., AND KING, I. 2008. Sorec: Social recommendation using probabilistic matrix

factorization. In CIKM.MASSA, P. AND AVESANI, P. 2007. Trust-aware recommender systems. In RecSys.MCPHERSON, M., SMITH-LOVIN, L., AND COOK, J. 2009. Birds of a feather: Homophily in social networks.

Annual Review of Sociology 27, 1.PAN, W., XIANG, E. W., LIU, N. N., AND YANG, Q. 2010. Transfer learning in collaborative filtering for

sparsity reduction. In AAAI.RENDLE, S. 2012. Factorization machines with libfm. ACM Transactions on Intelligent Systems and Tech-

nology (TIST) 3, 3, 57.RENDLE, S., GANTNER, Z., FREUDENTHALER, C., AND SCHMIDT-THIEME, L. 2011. Fast context-aware

recommendations with factorization machines. In SIGIR.SARAWAGI, S. AND KIRPAL, A. 2004. Efficient set joins on similarity predicates. In SIGMOD.TONG, H., FALOUTSOS, C., AND PAN, J.-Y. 2006. Fast random walk with restart and its applications. In

ICDM.VAIDYA, J., ATLURI, V., AND GUO, Q. 2007. The role mining problem: Finding a minimal descriptive set of

roles. In SACMAT.ZENG, C., HONG, L., WANG, J., HE, C., TIAN, J., AND YANG, X. 2011. Role-based contextual recommenda-

tion. In PhoneCom Workshop, co-located with IEEE CPSCom.

ACM Transactions on Knowledge Discovery from Data, Vol. 0, No. 0, Article 1, Publication date: December 2012.