Managing Irrelevant Contextual Categories in a Movie Recommender System ∗ Ante Odić Marko Tkalčič Andrej Košir University of Ljubljana, Faculty Johannes Kepler University University of Ljubljana, Faculty of Electrical Engineering Department for Computational of Electrical Engineering Tržaška cesta 25 Perception Tržaška cesta 25 Ljubljana, Slovenia Altenberger Str. 69 Ljubljana, Slovenia ante.odic@ldos.fe.uni-lj.si Linz,Austria andrej.kosir@ldos.fe.uni- marko.tkalcic@jku.at lj.si ABSTRACT formation (e.g. weather), contextual condition refers to a Since the users’ decision making depends on the situation the specific value for a contextual factor (e.g. sunny), and con- user is in, contextual information has shown to improve the textual situation refers to a specific set of these contextual recommendation procedure in context-aware recommender conditions that describe the context in which the user con- systems (RS). In our previous work we have shown that sumed the item. relevant contextual factors have significantly improved the In our previous work [10] we have proposed a method- quality of rating prediction in RS, while the irrelevant ones ology for detecting the relevancy of contextual factors, and have degraded the prediction. In this work we focus on the have shown that relevant contextual factors significantly im- detection of relevant contextual conditions (i.e., values of proved the quality of rating prediction in RS, while the ir- contextual factors) which influence the users’ decision mak- relevant ones degraded the prediction. Similar results were ing process. The goals are (i) to lower the intrusion for the achieved in [3] by assessing the relevancy of contextual fac- end user by simplifying the acquisition process, and (ii) to tors. reduce the sparsity of the acquired data during the contex- In this work we focus on the detection of relevant contex- tual modeling. The results showed significant improvement tual conditions, i.e., the values of contextual factors, which in the rating prediction task, when managing the irrelevant influence the users’ decision making process, with the goal of contextual conditions by the approach that we propose in lowering the intrusion for the end user by simplifying the ac- this paper. quisition process, and to reduce the sparsity of the acquired data during the contextual modeling. Keywords 1.1 The Problems of Many Contextual Condi- context-aware, recommender systems, user modeling tions: Sparsity and Acquisition One of the main problems with contextual factors with 1. INTRODUCTION many contextual conditions is the sparsity of rating data. For example, let us say a specific user rated 20 items in dif- Over the past decade, employing contextual information ferent contextual situations. For uncontextualized modeling in recommender systems (RS) has been a popular research that would be a fair amount of ratings from that specific topic. Contextual information is defined as the information user. However, let us say some contextual factor contains that can be used to describe the situation and the environ- ten contextual conditions and users ratings are equally dis- ment of the entities involved in such systems [5]. Since users’ tributed across those conditions. That would mean that for decision making depends on the situation the user is in, con- each condition we only have two ratings from that user. For textual information has shown to improve the recommenda- this reason it would be better to have a lower number of tion results in context-aware recommender systems (CARS) contextual conditions per contextual factor. [1, 3, 10], as well as other personalized services [11]. In addition, since the contextual data is often explicitly In this work we follow the terminology described in [4]: acquired through questionnaires (e.g. in [2] or [10]), lowering contextual factor refers to a specific type of contextual in- the number of questions and possible conditions shortens the ∗Corresponding author. questionnaire. This is important for lowering the amount of time required from users to provide ratings and the associ- ated context. To summarize, the acquisition and usage of contextual factors with many contextual conditions has two negative sides: RecSys’13, October 12–16, 2013, Hong Kong, China. Paper presented at the 2013 Decisions@RecSys workshop in conjunc- • questionnaire size (effort required from a user) tion with the 7th ACM conference on Recommender Systems. Copyright c 2013 for the individual papers by the papers’ authors. Copying permit- • sparsity (ratings are distributed in many categories) ted for private and academic purposes. This volume is published and copy- righted by its editors.. Therefore, it would be beneficial to reduce the number of 29 contextual conditions of the relevant contextual factors. conditions. Instead these ratings should be used for train- ing the parameters that depend on the relevant contextual 1.2 Problem Statement conditions. Hence, by merging categories we are able to The problem with the reduction of the number of contex- use the rating data for the more meaningful task (which tual condition is how to select the conditions to remove and consequently reduces the sparsity of ratings), which would how to merge the contextual conditions in order to reduce result in a better trained model. We will evaluate this task their number. by comparing the root mean square error (RMSE) of the By avoiding the relevant contextual conditions we might rating prediction with and without merging of context cat- lose valuable information. Hence, we need to detect irrel- egories, and the results form random merging of contextual evant conditions, identify how they should be merged and conditions as a baseline. handled during the acquisition, and during the training and Figure 1 shows the whole procedure described in the arti- the preparation of recommendations. cle. In this article we propose an approach by which we achieve the following goals: • we identify contextual conditions which should be avoided or merged in questionnaires Contextual factor C1 C2 C3 C4 C5 … Cn • we manage irrelevant categories during training to uti- lize provided ratings and decrease the sparsity In the following sections we describe the approach, dataset contextual-conditions- used and the experimental results. relevancy detection 1.3 Experimental Design In this subsection we describe the experimental design Contextual factor used in this study. For each contextual variable available C1 C2 C3 C4 C5 … Cn in the dataset we do the following steps in order to manage irrelevant categories. Yes No Yes Yes No … Yes First we do the contextual-condition-relevancy de- tection. At this stage we use statistical testing in order to detect which contextual conditions of a specific contex- contextual-conditions- tual factor are irrelevant and do not have the impact on the merges determination ratings. We consider a contextual condition to be relevant if the users’ behavior (how users rate items) is different for that condition than for other conditions. If the users do not rate items differently for that contextual condition than Contextual factor otherwise, we consider the condition to be irrelevant. C1 C2 C3 C4 C5 … Cn The next step is to determine whether these irrelevant conditions could be merged with the relevant ones. For ex- C1 C2 + C1 C3 C4 C5 + C3 … Cn ample, if rainy weather would be detected as irrelevant, but cloudy weather as relevant, perhaps they could be merged into a combined category cloudy/rainy weather. Hence, we call this step the context-categories-merging determi- improving the improving the nation. Once the merging possibilities are determined, we questionnaire model may use them for two separate tasks: (i) improving the ques- tionnaire, and (ii) improving the contextualized model of users decisions. Improving the questionnaire. If in a system, after Figure 1: Experimental design. For each contex- a sufficient amount of data was collected, it is determined tual variable, the relevancy of categories is detected, that several contextual-factors’ conditions are irrelevant and merging possibilities are determined and used to im- could be merged with others, the questionnaire used for the prove both the data acquisition and the modeling data acquisition should be modified. (Similarly, if the data procedure. is being collected implicitly through sensors, the acquisition procedure should be modified). In this way the number of questions in the questionnaire could be reduced and thus the time required from users to fill-in these questionnaires would 2. MATERIALS AND METHODS be reduced. However, it might be the case that the merges In this section we describe the dataset used in this study are too complex to employ them in the questionnaire as we and describe each step of the experimental design in more will show in the following sections. details. Improving the model. In addition to improving the questionnaire, merges should be employed in the model as 2.1 Dataset well. By using the irrelevant conditions in the model during For the purposes of this work we have used the Context training, the rating data is being used to train the contextu- Movie Dataset (LDOS-CoMoDa), that we have acquired in alized parameters which depend on the irrelevant contextual our previous work [10]. 30 We have created an online application for rating movies of users. which users are using in order to track the movies they watched and obtain the recommendations (www.ldos.si/ 2.3 Contextual-Condition-Merges Determina- recommender.html). Users are instructed to log into the tion system after watching a movie, enter a rating for a movie Once the irrelevant conditions of each contextual factor and fill in a simple questionnaire created to explicitly acquire are detected, we proceed to merge them with relevant cat- the contextual information describing the situation during egories. In order to determine which categories should be the consumption. merged, we compare the distribution of ratings for each ir- The part of the dataset used in this study consists of 1611 relevant condition with the distribution for each relevant ratings from 89 users to 946 items with 12 associated con- condition separately (e.g. sunny vs. rainy, sunny vs. cloudy, textual factors. Additional information about our Context sunny vs. snowy and sunny vs. stormy). Once again, this is Movies Database (LDOS-CoMoDa) can be found in [9] and tested with the Wilcoxon rank-sum test. In this case, if [10]. the test determined that the medians of the ratings distri- All the contextual factors and conditions acquired are butions for the irrelevant and relevant conditions are equal, listed in Table 1. we determine that these conditions can be merged. This is because there is no difference in rating when users were in Table 1: Contextual factors in the LDOS-CoMoDa these two separate conditions. dataset. However, the proposed methodology might yield a type of error during merges. It might occur that we determine the Contextual variable Description two conditions could be merged when in fact they should time morning, afternoon, evening, night not. This exception might occur if the distributions were daytype working day, weekend, holiday similar, yet, for different user-item pairs ratings were drasti- season spring, summer, autumn, winter cally different on different contextual conditions. This is an location home, public place, friend’s house open issue we plan to address in the future work. weather sunny/clear, rainy, stormy, snowy, cloudy social alone, partner, friends, colleagues, par- 2.4 Merging Contextual Conditions ents, public, family Once we determine which contextual condition should be endEmo sad, happy, scared, surprised, angry, merged we implement merging in two separate tasks: (i) disgusted, neutral improving the questionnaire and (ii) improving the model. dominantEmo sad, happy, scared, surprised, angry, disgusted, neutral 2.4.1 Merging in Questionnaires mood positive, neutral, negative physical healthy, ill In our system we acquire the contextual information ex- decision user’s choice, given by other plicitly through questionnaire. Hence, we implement merg- interaction first, n-th ing in the questionnaire by modifying the list of possible contextual conditions users choose from. For example, in our system we have the contextual factor season, which contains the following contextual conditions: spring, sum- 2.2 Contextual-Condition-Relevancy Detection mer, autumn, winter. Let us say that we have determined In order to determine if a contextual condition of a specific summer to be an irrelevant condition and that it should contextual factor is relevant, we use the Wilcoxon rank- be merged with the relevant condition autumn. We would sum test in the following way. For each condition (e.g., simply change possible answers in the questionnaire into: sunny weather) of a specific contextual factor (e.g., weather), spring, summer/autumn, winter. In this way we lower the we observe two populations of ratings: ratings associated amount of possible answers, and stop associating ratings with that condition only (e.g., sunny weather), and ratings with irrelevant contextual condition. Of course, if possible, associated with any other condition of the same contextual a new name for the combined condition could be used in the factor (e.g.,rainy, cloudy, snowy and stormy). We use the questionnaire. Wilcoxon rank-sum test to compare these two popula- If contextual information would be acquired implicitly tions. More specifically, we test the null hypothesis that the through sensors, merging would be implemented in the step ratings from these two populations are sampled from a con- of processing sensor data into contextual conditions. tinuous distributions with equal medians. If we reject the null hypothesis, the medians are different, which means that 2.4.2 Merging during Modeling the users tend to rate items differently during the tested con- In this study we used the contextualized matrix factor- dition (e.g., sunny) compared to the other conditions (e.g. ization algorithm for modeling the interaction between the rainy, cloudy, snowy and stormy). If this is the case, we users and the movie items. Matrix factorization (MF) is a determine that the tested contextual condition is relevant. latent-factor model that is widely used in RS ([8, 3, 6, 7]). Otherwise we determine that since there is no difference in We implement the contextualization by making users’ rating ratings, such condition has no impact and is thus irrelevant. biases context dependent as in [10]. The Wilcoxon rank-sum test was chosen over the t-test be- The contextualized users’ biases with the matrix factoriza- cause the compared samples were not normally distributed. tion (CUB-MF) approach uses the contextual information The described approach was done on the population level, for the contextualized users’ biases. Only the users’ biases i.e., on the data from the whole population and not for each are context dependent. This approach follows the idea that user separately. Hence, contextual conditions are detected the users’ rating behaviour is different on different occasions. as relevant or irrelevant with regards the whole population The matrix factorization in CUB-MF was made using the 31 following equation: In the cases of the time, daytype and location contextual qhT · p r̂ (u, h) = µ + bh + bu (c) + ~ ~u , (1) factors, all conditions were found irrelevant, hence no merges where r̂ (u, h) is the predicted rating for user u and item are possible. In the cases of the decision, interaction, and h, ~qh is the item’s latent-feature vector, p ~u is the user’s physical contextual factors, all conditions were found rele- latent-feature vector. The user’s bias bu and the item’s bias vant, hence no merges are needed. For the remaining contex- bh measure the deviations of the user’s u and the item’s h tual factors, table 2 contains the results of the contextual- ratings from the rating average µ. condition-relevancy detection, and merges determination. To inspect the impact of merging contextual conditions of The figures 2, 3, 4, 5, 6 and 7 show the results of the contextual factors on the rating prediction, we trained our matrix factorization rating prediction. model for each contextual factor separately, i.e. using only a single contextual factor at the time. The standard way, of training (without merging) the con- textualized model is done in the following way: the algo- rithm loops through all the ratings in the training set, and calculates the prediction error e(u, h, c) = r(u, h, c)−r̂(u, h, c) for each predicted rating r̂(u, h, c) and real rating r(u, h, c), for user u, item h and contextual condition c. Among other uncontextualized parameters, we modify the contextualized user’s u bias by the equation: bu (c) ← bu (c) + γ · (e(u, h, c) − λ · bu (c)). (2) Hence, if the contextual condition was, for example sum- mer, we would update bu (sunny). When we implement merging during modeling, for each calculated error of prediction, we update the contextualized parameters of all merged conditions, if such exist. There- Figure 2: Rating prediction results for dominant fore, if, for example, the contextual condition summer has emotion. to be merged with the condition autumn, we would use e(u, i, summer) to update bu (sunny) and bu (autumn) si- On each figure, boxplots are presented: one from our multaneously. In this way we reduce the negative impact of merging method (merge) and the second one from the ran- sparsity by utilizing ratings associated with irrelevant con- dom merge baseline (randMerge). Both boxplots represent ditions to train parameters contextualized by the relevant the RMSE difference between the basic model without merg- ones. In addition, during training, for each calculated er- ing (basic), and the merge and randMerge approaches. There- ror of prediction, we also train the uncontextualized users’ fore, if the result is above zero, the merging approach per- biases. Once the model is trained, on the testing set, the un- formed better (lower RMSE) than the basic approach with- contextualized users’ biases are used to predict the ratings out merging. associated with the irrelevant contextual conditions. In this way, the algorithm simply avoids the contextualized rating prediction in the case of the irrelevant contextual condition. 2.5 Random Merging as a Baseline In order to test the positive impact of our procedure for detecting irrelevant contextual conditions, and determining merges, it is important to compare the results from our approach with the fair baseline. It could be that the im- provement in the rating prediction is not due to our merging technique, but due to any type of merging simply because we lower the sparsity. In another words, it is important to test if we would get equally improved results by randomly merging several conditions. Therefore we have implemented a random merging method in the following way: for every contextual factor we count the exact number of irrelevant conditions and determined merges, and select the same amount of random conditions and random merges. In this way we replicate the same Figure 3: Rating prediction results for end emotion. amount of merges but select the conditions to be merged randomly. The Wilcoxon signed-rank test was used to test the The results for our approach and the random merges are statistical significance of the differences between basic and achieved on 10 different folds. merging approaches. If the difference was statistically sig- nificant the box plot is colored green, otherwise it is colored 3. RESULTS red. 32 Table 2: Results of the contextual-condition- relevancy detection, and merges determination. SEASON condition relevancy merges spring yes summer no autumn autumn yes winter yes WEATHER condition relevancy merges sunny no rainy no stormy no snowy snowy yes cloudy no Figure 4: Rating prediction results for mood. SOCIAL condition relevancy merges alone yes partner yes alone friends no partner family alone colleagues no partner family parents no alone family alone public no partner family family yes END EMOTION condition relevancy merges Figure 5: Rating prediction results for season. sad yes happy yes sad 3.1 Discussion fear no happy In the previous section we could observe different results surprised for different contextual factors. It is interesting to note that surprised yes contextual factors for which all the contextual conditions angry yes were detected as irrelevant (time, daytype and location) are disgusted yes those that were detected irrelevant themselves in our pre- neutral yes vious work [10]. Similarly, the contextual factors for which DOMINANT EMOTION all the contextual conditions were detected as relevant (deci- condition relevancy merges sion, interaction, and physical ) are those that were detected sad yes as relevant themselves in our previous work. Therefore, we happy yes might conclude that such contextual factor for which all sad the contextual conditions are detected as irrelevant, can be fear no happy observed as irrelevant and left out from the contextualized surprised modeling altogether. For the remaining contextual factors surprised yes we summarize the results in Table 3. angry no neutral Implementing merges in questionnaire can be easily achieved disgusted yes for season, weather and mood, by simply merging conditions between possible answers. However, for social contextual neutral yes condition, as it is shown in Table 2, there are conflicts which MOOD prevent us for merging. For example, the condition parents condition relevancy merges can be merged with alone and family, but not with partner, positive yes as it is the case with the conditions friends, colleagues and neutral yes public. negative no neutral Furthermore, for end emotion and dominant emotion, the irrelevant condition fear can be merged with multiple condi- 33 Table 3: Summary of the results. The table tells whether there is an improvement in the question- naire or in the model, for each contextual factor separately. improvement context questionnaire rating prediction season yes no weather yes yes social no yes endEmo ? yes domEmo ? no mood yes yes 4. CONCLUSION AND FUTURE WORK Figure 6: Rating prediction results for social. In this paper we proposed a procedure for detecting the relevancy of contextual conditions and how to manage such conditions by merging them with relevant ones. We imple- mented merging of contextual conditions on the question- naire for acquiring contextual data, and into contextualized modeling based on matrix factorization. The results showed significantly improved results by our method, except in the case of one specific contextual factor. For the future work we plan on researching further why anomalies can occur and how to predict and avoid them. Also, we are interested in solving conflicts described in this paper regarding the implementation of merges in question- naires. 5. REFERENCES [1] G. Adomavicius and A. Tuzhilin. Toward the next generation of recommender systems: a survey of the state-of-the-art and possible extensions. IEEE Transactions on Knowledge and Data Engineering, Figure 7: Rating prediction results for weather. 17(6):734–749, June 2005. [2] L. Baltrunas, B. Ludwig, S. Peer, and F. Ricci. Context-Aware Places of Interest Recommendations for Mobile Users. Design, User Experience, and tions (sad, happy, surprised ), however each of them is rele- Usability. Theory, Methods, Tools and Practice, pages vant and should be used alone as it is. Therefore, an opened 531–540, 2011. issue remains - how such cases should be handled in ques- tionnaires. [3] L. Baltrunas, B. Ludwig, S. Peer, and F. Ricci. By implementing the proposed procedure for the detec- Context relevance assessment and exploitation in tion of irrelevant contextual categories, and the proposed mobile recommender systems. Personal and way to manage merges during modeling, we achieved signif- Ubiquitous Computing, pages 1–20, June 2011. icantly better results than without merging for the contex- [4] V. Codina, F. Ricci, and L. Ceccaroni. tual factors weather, social, end emotion and mood. For the Semantically-enhanced pre-filtering for context-aware contextual factor season we achieved an improvement, how- recommender systems. In Proceedings of the 3rd ever it was not statistically significant (Figure 5). In each Workshop on Context-awareness in Retrieval and case our procedure outperformed random-merging baseline, Recommendation, pages 15–18. ACM, 2013. which did not lead to significantly improved results in any [5] A. Dey and G. Abowd. Towards a better case. However, even in the case of random merging there is understanding of context and context-awareness. tendency towards better results with fewer conditions which Proceedings of the 1st international symposium on confirms our assumption from the introduction: many con- Handheld and Ubiquitous Computing, pages 304–307, textual conditions have a large impact on the sparsity of 1999. ratings in the contextualized models. [6] Z. Gantner, S. Rendle, and L. Schmidt-Thieme. The only contextual factor for which we observed unex- Factorization Models for Context- / Time-Aware pected results is the dominant emotion. In this case we Movie Recommendations Encoding Time as Context. achieved significantly worse results for both our approach In Proceedings of the Workshop on Context-Aware and the random-merging baseline. We believe that this is Movie Recommendation, pages 14–19, 2010. an interesting open issue that we plan to address further in [7] B. Hidasi and D. Tikk. Enhancing matrix the future. factorization through initialization for implicit 34 feedback databases. In Proceedings of the 2nd Workshop on Context-awareness in Retrieval and Recommendation, CaRR ’12, pages 2–9, New York, NY, USA, 2012. ACM. [8] Y. Koren. Factorization Meets the Neighborhood : a Multifaceted Collaborative Filtering Model. In Proceeding of the 14th ACM SIGKDD international conference on Knowledge discovery and data mining, pages 426–434. 2008. [9] A. Košir, A. Odić, M. Kunaver, M. Tkalcic, and J. Tasic. Database for contextual personalization. ELEKTROTEHNIŠKI VESTNIK, 78(5):270–274, 2011. [10] A. Odić, M. Tkalčič, J. F. Tasič, and A. Košir. Predicting and detecting the relevant contextual information in a movie-recommender system. Interacting with Computers, 25(1):74–90, 2013. [11] F. Toutain, A. Bouabdallah, R. Zemek, and C. Daloz. Interpersonal Context-Aware Communication Services. IEEE Communications Magazine, (January):68–74, 2011. 35