Abstract

With the development and popularization of e-commerce and Internet, more and more attention has been paid to personalized recommendation for users. The traditional user interest model only considers the user’s behavior on the project, ignoring the user’s context at that time. Pointing to the shortage that context-related factors are not considered in previous works, combining the characteristics of a mobile computing environment, this paper studies the algorithm and model of mobile service recommendation. A recommendation algorithm based on specified context filtering in mobile computing environment is proposed. The context of the classification is aggregated, by grouping the scenarios of the same category together. Through experiments, we found that the improved personalized recommendation algorithms are superior to the common collaborative filtering algorithm.

1. Introduction

The data included information of major websites and mobile APPs. If the data had given a certain treatment, the information could have been more user-friendly and more efficient. Meanwhile, users would have been provided with a friendly experience, and the information provided could have had higher revenue [1]. So, the recommendation system came into being.

The recommendation algorithm is the important part of the recommendation system [2]. The main recommendation algorithms are collaborative filtering recommendation algorithm, content-based recommendation algorithm, and hybrid recommendation algorithm [38]. In-depth research on the recommendation system allows users to get personalized recommendations, which greatly saved them time to search for information. At the same time, while the recommendation system is being improved, the user’s personalized demand for recommendation gets higher and higher; more accurate recommendation is the future development direction [9]. The improved recommendation algorithm on the existing algorithm is a lot, so many scholars turning to the context-aware recommendation [1015]. The context information becomes an essential role to enhance the effect of the recommendation.

The introduction of context information brings more ideas to improve the efficiency of the recommendation algorithm. The main context information includes user context information, such as users’ ages, occupation, region; physical context, such as location, weather, time. There is much context information that could be considered by recommendation algorithm [16]. The context information can bring more accurate recommendations to the users of the recommendation system. There are three commonly used context-aware recommendation methods, and they are contextual prefiltering, contextual postfiltering, and contextual modeling [17]. As a result, the context-aware recommendation algorithm has gradually become a popular research trend. In this paper, combining the characteristics of the mobile computing environment, a recommendation algorithm based on specified context filtering in mobile computing environment is proposed.

The reminder of this paper is structured as follows: Section 2 introduces the related work. In Section 3, it proposes the conceptual model of context-awareness based on the context-aware recommendation system theory. Section 4 proposed a context-based recommendation algorithm in the mobile computing environment. Section 5 presents the experimental process and results. The summary of the related work of our proposed model and algorithm and the conclusion of the paper are given in Section 6.

After the introduction of the collaborative filtering algorithm, scholars have more research on the recommendation system. The most important recommendation algorithms are a collaborative filtering algorithm and content-based recommendation algorithm [18]. However, there are certain problems hard to be solved in the two basic algorithms, such as collaborative filtering algorithm has a cold start and high sparsely, and content-based recommendation algorithm is difficult to deal with multiple attributes. Therefore, the accuracy of a single recommendation algorithm recommendation is difficult to improve [19]. Many scholars have shifted their goals from traditional recommendation algorithms, focusing on the research of context-based recommendation systems [20].

Foreign researches have been quite rich. The research direction and application fields include shopping, tourism, catering, and other aspects. But they focused on proposing improved algorithms, which are based on traditional algorithms. The contrast of advantages and disadvantages of various algorithms based on context perception is relatively rare. The fields and data types applicable to different context-aware algorithms are not studied. Among them, Kang et al. [21] proposed not only paying attention to the explicit context information but also implicit context information. And they used packet sniffing technique. Kwona and Kim [22] proposed a way to discover the user’s portrait by depicting the user’s outline tree. Tuan et al. [23] combined user preferences and contextual interaction information and proposed a location-based advertising recommendation algorithm. Sánchez-Pi et al. [24] proposed the construction of a knowledge-based context-aware system. Sánchez-Pi et al. [25] proposed a localized adaptive modification model using a vector space model and saved time to obtain user-related information.

Lee et al. [26] proposed a novel TV system that combines gesture control, tag ranking, and context-awareness, providing personalized recommendations. Cai et al. [27] used collaborative filtering to generate a contextual concept ontology. Ji et al. [28] proposed an improved matrix approximate based on the clustering model. Wang et al. [29] proposed a hierarchical recommendation model based on a context tree structure, calculated situation transfer in the first layer, and recommended items in the second layer. Unger et al. [30] made a breakthrough in the acquisition of contexts, improving the accuracy of recommendations by extracting implicit context information from users’ data.

3. Conceptual Model of Context-Awareness

3.1. Classification of Context Information

The so-called context information is a general concept, which can be divided into user context information, physical context information, time context information, network context information, and so on. The user context information includes some personal information, such as users’ gender, age, region, occupation, and mood. The physical context information includes geographical location, temperature, and weather. The time context information includes season, morning or evening, and weekend or working day. The acquisition of this context information is conducive to better recommendation. If the system had those contexts, it could recommend suitable advertisements according to the geographical location, suitable music according to emotions, and decide whether videos are automatically loaded according to the network speed.

As shown in Figure 1, the types of context information currently defined are very diverse, but not all context information is readily available. The application of the context-aware algorithm is based on context acquisition. The shallow-level situation acquisition technology can already be achieved. The mobile device can obtain the user’s latitude and longitude position, weather conditions, time information, etc., and can obtain the user’s further information through the survey, such as age and gender. However, deep-level information processing is relatively rare at present, such as obtaining the user’s location type and time type. Deep context information is helpful for the recommendation algorithm. In the current research, that information is mainly obtained through users’ voluntary survey.

3.2. Model Construction

Related research on the context information recommendation is increasing, and the situation plays an important role in the personalized recommendation. Under the scope of user interests, there are some drifts in different context interests, and better recommendation can be obtained by studying the changes in the situation. At present, the context-aware model has a relatively consistent definition.

Context information is a collection of information about users, generally denoted by , which is , representing a set of contexts. And denotes a context element in the set, while denotes a common context element. The classification of context information has been as described in Section 3.1. Some of the context in Section 3.1 can be selected into the set to form the contextual collection of this paper. The influence of some context information on the recommendation model can be explored.

The context-aware recommendation model mainly collects the user’s context information, historical behavior tendency, personal preference, and other information. Through filtering and calculating, they can be applied to personalized recommendations to provide with more accurate recommendations.

As showed in Figure 2, the context-awareness recommendation model can be divided into three layers. The first layer is the data acquisition layer, which collects various types of data of users. The second layer is the data processing layer, which filters and processes the data. The third layer is the recommended service layer, which is operated by the algorithm to form a personalized recommendation. The association of services at each level provides a means of contextual awareness.

In the traditional recommendation algorithm, the score matrix is associated with user and item, called user-item model, expressed as . represents the user set, , and indicates the item set, . denotes a score set; denotes a score of the user for the item . denotes the number of users, and denotes the number of items. The above formulas constitute a two-dimensional score matrix between the user and the item and can be operated using a collaborative filtering algorithm to obtain a recommended result.

In the context-awareness recommendation model, the context factor is introduced, which is no longer a two-dimensional model, that is, it becomes a user-item-context model, expressed as . represents the user collection, . denotes a set of items, . denote a set of contexts, . denotes the number of users, denotes the number of items, and indicates the number of situations. The meaning of is still the user’s rating of the project.

In the three-dimensional model, the score is represented as each of the small cubes that are segmented out. The cube in the three-dimensional coordinate system is the set of scoring data R.

4. Context-Awareness Recommendation

4.1. Specific-Context Based Recommendation Algorithm

In the same situation, the user’s choice may have similarities. Based on this theory, the algorithm experiment can be further developed. When exploring the context factors, this paper selects three types of situations for classification. There is an inclusion relationship between single-situation factors and multisituation factors, such as context (at home), including (weekend, weekday, and holiday), and (alone, with friends, with family, and with lovers). It is actually compound context information. Through the aggregation of context information, it is explored whether there is consistency in user selection in the context of aggregation.

This algorithm is a context-based prefiltering algorithm, which is a process of context selection. The algorithm aims at transforming the three-dimension model into a two-dimension model through context filtering. The score prediction function, should be represented as the following formula (1): where represents the score matrix in the three-dimensional model, and the threshold of the context set indicates that the context information is . is the estimated score according to the collaborative filtering algorithm based on the user’s similarity in a given situation.

After getting the score matrix, the similarity between users is calculated. The Pearson correlation coefficient calculation should be represented as the following formula (2): where represents the score of a user for item . represents the average value of a user score. represents the score of a user for item . represents the average value of a user score. By calculating their similarities, the similarity matrix is formed as below:

Having got the similarities of user’s interests, the predicted score can be calculated by the following formula (4).

The predicted score determines the degree of user interest. The higher the score is, the more the user is interested in. The process of Algorithm 1 can be summarized as follows:

Input: score matrix
Output: context-based predicted score matrix
  For
  For :
If :
Move to
  for item :
calculate
   
4.2. User-Based Contextual Recommendation Algorithm

In the algorithm proposed above, the context information is a separate factor. The context information is not incorporated into the algorithm model, so the contextual modeling algorithm is proposed.

The contextual modeling algorithm is divided into heuristic and model. There are many literature and papers in the research of contextual modeling algorithms based on models. It is not the focus of this paper. The algorithm proposed in this paper integrates the context information and processes three-dimension model. We propose a user-based contextual recommendation model.

The user-based context is scoring matrix is constructed, and the method and steps are the same as before. According to the formula for calculating the Pearson correlation coefficient, calculate the user’s context similarity.

In the algorithm, we use user as an example to predict its score on the item in the context . The nearest neighbor of user needs to be found, and the user similarity matrix can be obtained by substituting the required data into the formula. Among all the obtained user similarities, the top-N similar users are selected as the nearest neighbors, and the score of the item under the situation is predicted based on the score data of these users.

In order to obtain the rating of the user under the context , we find the rating context set of the most neighboring user for the item . The weighting operation is performed in combination with the user similarity and the context similarity obtained in the foregoing. where . is user’s similarity, and is similarity between target context and current context.

The result of the scoring can be obtained. The algorithm is based on the user’s contextual modeling algorithm, and the context plays an essential role in the model. The algorithm is described as following:

Input: score matrix
Output: predictions
  for each item:
   score = mean ()
  for each item ():
    
  for each user:
    
  for top-N users:
   for c in C(top-N):
    ,
     
4.3. Item-Based Contextual Recommendation Algorithm

The user-based heuristic contextual model is discussed above, and the algorithm to be discussed is similar with that. Item-based contextual recommendation model is also a recommendation algorithm based on context modeling.

Firstly, in order to build the item-based context matrix , the user’s information needs to be transformed first. We calculate the average score of the same item in the same situation.

Then, we calculate context similarity based on items using Pearson formula.

In the algorithm, we use user as an example to predict its score on the item in the context . The nearest neighbor of user needs to be found, and the item similarity matrix can be obtained by substituting the required data into the formula. Among all the obtained item similarities, the top-N similar items are selected as the nearest neighbors, and the score of the item under the situation is predicted based on the score data of these items.

In order to obtain the rating of the item under the context , we find the rating context set of the most neighboring item for the context . The weighting operation is performed in combination with the item similarity and the context similarity obtained in the foregoing.

. is item’s similarity, and is similarity between target context and current context.

Input: score matrix
Output: predictions
  for each user:
   score = mean ()
  for each user (I):
   calculate
  for each item:
   calculate
  for top-N items:
   for c in C(top-N):
     ,

5. Experiment Analysis

The hardware environment of this experiment is the Intel Core i5 processor, 8G memory. The software environment is the 64-bit Windows operating system, VMware Workstation Pro virtual machine, Cent OS7 operating system, Open JDK1.8, Python3.7, Anaconda for Python3.7, and PyCharm-community.

The data of this experiment is mainly from the questionnaire survey of college students about the context information of watching movies. A total of 107 users’ data is collected. In order to guarantee the accuracy of the algorithm, some invalid questionnaires are eliminated. The data of 96 users were retained, including 2145 data.

The quality of the recommendation system is mainly measured by some indicators. The accuracy of the prediction is extremely important in the recommendation system. It is mainly judged by Root Mean Squared Error (RMSE) and Mean Absolute Error (MAE).

The root mean square error and the mean absolute error are both the degree of deviation between the calculated predicted value and the true value. The value obtained by subtracting the predicted value from the true value is recalculated, and the larger the obtained result value, the greater the degree of deviation. On the contrary, the more accurate the prediction of the algorithm is. When judging the merits and demerits of the algorithm according to these two parameters, the value is expected to be small.

The traditional prediction algorithm is set as the control object of this experiment, so that the latter experiment is compared with the experimental results obtained by the two-dimensional algorithm.

In this paper, the user-based collaborative filtering algorithm is selected. According to the Pearson similarity coefficient, the nearest neighbor of the movie is calculated and we use them to predict. Several classical collaborative filtering algorithms and its improved algorithms are selected, which are KNN basic, KNN means, KNN Zscore, and KNN baseline, respectively, which represent the basic collaborative filtering algorithm, the collaborative filtering algorithm based on the scoring average, the collaborative filtering algorithm based on scoring standardization, and the collaborative filtering algorithm based on baseline scoring. At the same time, in order to avoid the contingency error, each of the following experiments set a five-fold cross-validation, and the obtained results were evaluated using the values of RMSE and MAE.

In the collaborative filtering algorithm, the recommended precision depends on the number of nearest neighbors. In this paper, four values are selected as the representative, and the different values represent the maximum number of nearest neighbors.

According to Tables 1 and 2, the KNN baseline algorithm (the collaborative filtering algorithm based on the baseline score) is obviously inferior to the other algorithms, indicating that it does not fit for the problem. So, we omit it in the following experiments.

It can be observed in Figures 3 and 4 that the pros and cons of the algorithm are not always the same. Under different values, the prediction effect of the recommendation algorithm changes. Overall, the increase of the maximum number of neighbors is accompanied by the prediction accuracy. It rises first and then falls. If the value is selected approximately, the prediction works best. The basic collaborative filtering has larger RMSE and MAE values when the value is smaller, but it shows an advantage when the k exceeds 10. The other two algorithms also show advantages when is less than 15, and the collaborative filtering algorithm based on scoring standardization is always better than the collaborative filtering algorithm based on scoring average.

In order to implement the recommendation algorithm based on the specific context, we initially screened and organized the data set. As shown in Figure 5, the context information has an inclusive relationship. The collection of context information is like a forest. Here, we choose three attributes of watching movies, and they are time, place, and company, forming three trees. There are parent nodes and their branches, each of which, respectively, represents the specific movie-watching behavior.

We select 6 to 12 context information to aggregate and the results are as follows.

According to the Table 3, this resulted in an aggregation of six different contexts, namely, at home, at the cinema, one person, on weekends, on weekdays, and on holidays. The selected situation has to be in conformity with the logic of reality. Usually, in this context information, the frequency of people watching movies will increase. For each context environment, we use the collaborative filtering algorithm to predict and get the recommended results in this context. For the different nearest neighbors number, we will get different results in Tables 4 and 5.

The performance of several selected contextual effects is different, in order to more intuitively observe the advantages and disadvantages of the algorithm and compare with those traditional collaborative filtering algorithm.

Through the above experimental results, it can be observed that the smaller the value of RMSE and MAE, the better the prediction effect. Conversely, the recommended algorithm is less effective. In Figure 6, the solid line indicates the result obtained by the conventional algorithm, and the broken line indicates the result obtained by the improved precontextual filtering algorithm.

In different situations, the performance of the algorithm is not the same. In the above six contexts, there are four contexts that are better than the traditional algorithm regardless of the value of the nearest neighbor. They are at home, one person, on weekends, and on holidays, and the best values for recent neighbors in different situations are not the same. The other two contexts, in the cinema and on the working day, do not apply to the precontextual filtering algorithm, and the prediction effect obtained is not as good as the traditional collaborative filtering algorithm. At the same time, it can be seen that the maximum value of the nearest neighbor have little influence on the algorithm.

6. Summary and Future Work

In this paper, context-based recommendation algorithms are proposed and implemented. In the comparison between the proposed algorithm and the traditional algorithm, the new algorithm is better than the traditional algorithm as a whole, but the new algorithm is not applicable in some contexts. Among the six contexts obtained after aggregation, only four contexts are superior to the common ones, and the other two contexts are not good enough to apply to the algorithm.

Data Availability

The data used to support the findings of this study are available upon request from the corresponding author.

Conflicts of Interest

The author declares that there are no conflicts of interest regarding the publication of this paper.

Acknowledgments

This work was supported in part by the Social Science Foundation of Hunan Province (16YBQ003), the Changsha Municipal Science and the Technology Bureau (k1705072), and the Hunan Provincial Social Science Achievement Evaluation Committee General Project (XSP18YBC166).