Abstract
The popularity of location-based social networks has prompted researchers to study recommendation systems for location-based services. When used separately, each existing venue recommendation system algorithm has its own drawbacks (e.g. cold start, data sparsity, scalability). Another issue is that critical information about context is not commonly used in venue recommendation systems. This article proposes a hybrid recommendation model that combines contextual information, user-based and item-based collaborative filtering and content-based filtering. For this purpose, we collected user visit histories, venue-related information (distance, category, popularity and price) and contextual information (weather, season, date and time of visits) related to individual user visits from Twitter, Foursquare and Weather Underground. Experimental evaluation of the proposed hybrid system (HybRecSys) using a real-world dataset shows better results than baseline approaches.
1. Introduction
Location-related technologies such as global positioning system (GPS) on mobile devices have created new possibilities for user interaction. These technologies provide location and time information, making it possible for users to share their location. With the increasing use of location-based social networks has come an abundance of information about user locations and preferences. Location recommendation systems have been developed that make personalised location suggestions to users.
Recommendation systems use mainly three algorithm types: collaborative filtering (CF) systems, content-based filtering (CBF) systems and hybrids [1]. Contextual information is thought to increase the performance of recommendation systems [1], but most recommendation engines fail to consider it. Each algorithm has its own drawbacks. For instance, CF algorithms have cold start, scalability and sparsity issues, and they lack content-related information. With CBF, an item and its contents need to be machine recognisable and must contain sufficient information, but because this algorithm considers only venue-related characteristics, it may result in a focus that is too narrow.
This study presents a novel hybrid recommendation algorithm that combines user-based CF, item-based CF, CBF and contextual information, with the goal of eliminating the disadvantages of each individual approach. The proposed hybrid system will reduce the number of the drawbacks of each approach when they are used separately. To the best of our knowledge, this is the first study that combines distance, category, popularity and price in one CBF algorithm. Weather conditions, the season, the date and the time of each visit are used as venue features, and the contextual similarities of venues will be utilised in the algorithm.
2. Related work
CF is commonly used to provide location recommendations. Memory-based CF and model-based CF are subcategories of CF algorithms. Memory-based CF consists of user-based data, which considers user similarity in making recommendations [2–4], and item-based CF, which considers item similarity [5,6]. Model-based CF, however, generally uses data mining techniques such as artificial neural networks [7], naive Bayesian modelling [8,9], association rule mining [10] and singular value decomposition (SVD) [11].
In CBF, content information on locations is used to counteract data sparsity problems that occur in CF algorithms. The most frequently used types of content information on locations are presented in Table 1.
Most frequently used types of content information on locations.
Contexts represent a set of factors that surround user-item pairs and affect the rating of the user to the item accordingly [35]. Contextual information (e.g. time, weather) is crucial, especially for location recommendation systems, because users consider this information in deciding where to go, unlike recommendations for what to buy. In addition, despite the fact that contextual information is critical for recommending locations, it is not commonly used in existing systems. Adomavicius and Tuzhilin [35] have emphasised that a context-independent representation may lose predictive power if potentially useful information from multiple contexts is ignored. Zheng et al. [36] applied algorithms for pre-filtering, context relaxation and hybrid techniques for contextual variables (trip type, origin city and destination city). Using pre-filtering, Barranco et al. [37] used speed and travel direction as contextual variables. Mode of transportation (biking, walking and driving) is another contextual variable that has been used as a pre-filter [38]. Time is commonly used as context data [39–43], but it is used in different forms. For instance, Waga et al. [39] examined the timestamps of photos taken in touristic places. They also considered the season when the photos were taken. Majid et al. [40] discretized time as morning, afternoon, evening and night and days as weekday and weekend. The recommendations were generated by post-filtering those variables. Yuan et al. [41] examined venue similarity for different time periods during the day. Baral and Li [42] recommended locations according to a location category that is mostly visited in a specific time frame, and Hiesel et al. [43] examined location popularity in different time periods. Weather is yet another important contextual variable for location recommendation [44]. Majid et al. [40] used weather information that is specified as temperature and weather conditions. Hiesel et al. [43] examined location popularity in different weather conditions. Other studies have proposed frameworks for contextual location recommendation systems [12–15]. The most commonly used contextual information types for location recommendation are presented in Table 2.
Most commonly used contextual information for location recommendation.
Even though hybrid systems have been discussed in the literature, there are untouched points that would improve the performance of location recommender systems. Hybrid approaches combine at least two existing approaches to minimise or eliminate the drawbacks of those approaches when they are used on their own. Several studies consider different hybrid algorithms for location recommendation [11,16,40,42,43]. Seven types of hybridisation techniques are mentioned in the literature: weighted, switching, mixed, feature combination, cascade, feature augmentation and meta-level [46]. The advantages and disadvantages are shown in Table 3.
Advantages and disadvantages of hybridisation techniques [46].
For this study, a weighted hybrid approach was applied in a way that allowed us to include various algorithms with different weights. Venue category, price, popularity and distance were used as content-related variables. However, the tags of the venues were not included because they were generated by users and therefore difficult to categorize. Tips/comments were excluded because Foursquare provides only the last five comments about a particular venue, which is insufficient for sentiment analysis. Contextual variables (e.g. trip type, origin city/destination city, speed, travel direction and mode of transportation) were not included because this study does not deal with path planning. Finally, since temperature usually correlates with weather conditions, only time and weather conditions were used as contextual variables. This study presents a hybrid recommendation system that takes into account user and location similarity, location-related features (distance, category, popularity and price) and contextual information (weather, season, date and time of visit) in a weighted hybridisation method in order to achieve better performance with fewer drawbacks than a single method.
3. Material and methods
3.1. Data collection
Data were collected in three stages. First, Twitter was used because it allows direct crawling of its users’ check-in history (unlike Foursquare, etc.). Twitter also allows programmers to utilise REST APIs, which are frequently used for designing web APIs to use a pull strategy for data retrieval, and streaming APIs, which are used for continuous streaming of public data with a push strategy. A Twitter dataset was connected via PHP APIs (for Twitter API version 1.1), and MySQL database was used for storing the retrieved data.
Some Foursquare users link their accounts with Twitter and their check-in information can be crawled from Twitter. In order to access these tweets, the REST API ‘GET search/tweets’ was used. This API returned a collection of tweets that matched a specified query. When a user whose Foursquare account is linked to Twitter makes a check-in using Foursquare, related tweets, including all check-in information, appear on his or her Twitter timeline. The API returned the users who checked in and shared this check-in on their Twitter accounts. Location information shared by users via Foursquare was collected over a period of 2 months. All tweets of collected users were recorded to reach their check-in history.
Venue information on Foursquare was accessed using URLs on check-in tweets. The Foursquare API (https://developer.foursquare.com/docs/api/venues/details) which gives details about a venue was used, and the following attributes were collected:
Venue Name
Category
Latitude
Longitude
Check-in count
Visitor count
Tip count
Price classification
In order to identify the weather conditions at the time of check-ins, the weather history was collected from the Weather Underground website. Each check-in date was matched to the date in the weather history, and the weather information (e.g. sunny, rainy or snowy) was added to the check-in data. Weather Underground provides comma-separated value (CSV) files that include dates and weather conditions. The visit check-in dates were compared with the dates in the weather files, and the coding automatically added the related weather conditions to the check-in data.
3.2. Data preprocessing
Data collected from Twitter and Foursquare were filtered according to the city of the check-in (check-ins were limited to those from Istanbul so as to increase visit frequencies) and the venue category (limited to restaurants because these provided intensive check-in frequency). This preprocess yielded 2882 users, 1992 venues and 8019 visits.
Users who visited only one venue and venues that were visited by only one user were excluded from the dataset, leaving a total of 1101 users, 711 venues and 4694 visits.
The preprocessing of rating, distance, venue and context variables is explained in detail in the following subsections. The terms used in this study are shown in Table 4.
Terms used in this article.
3.2.1. The rating preprocess
First, the visit frequency of user-venue pairs was normalised linearly, and frequency values were converted to ratings ranging from 1 to 5. A rating of 1 was assigned when the maximum and minimum frequencies of an individual’s visits were equal
3.2.2. The distance preprocess
The latitude and longitude values of check-ins were converted to x, y and z coordinates for each visit. User centres were calculated by taking the average of all visits of a specific user. For each visit of a specific user, the Euclidean distance from the venue to the user centre was determined.
3.2.3. The venue property preprocess
The popularity variable was created from four venue properties that were collected using the Foursquare API, namely, the check-in count, the like count, the user count and the tip count. A principal component analysis (PCA), a multivariate analysis used for dimension reduction [47], was performed on 711 venues using the four venue properties. The value of the Kaiser–Meyer–Olkin (KMO) measure was 0.821 where the acceptable level is generally 0.6. Bartlett’s test of sphericity was significant at 1% alpha level (Table 5), indicating that the sample was adequate for PCA.
KMO and Bartlett’s test results.
KMO: Kaiser–Meyer–Olkin.
The results show that 93.69% of total variance is explained by a single component (Table 6), which we refer to as popularity. It consists of four variables.
Total variance explained.
High values on check-in count, like count, user count and tip count mean that these variables are overwhelmingly explained by a single component (Table 7).
Component matrix for popularity.
The popularity value of each venue was calculated from the results of the PCA, whereupon those values were normalised on a scale from 1 to 5.
A total of 34 restaurant categories were collected with the Foursquare API and included in the dataset. A user-category matrix that shows how many venues each user visited in each category is prepared.
Foursquare has four price categories: cheap, average, expensive and very expensive. The price category of each venue was collected from the Foursquare API, and a user-price matrix was prepared to show how many venues each user visited in each price category.
3.2.4. The contextual variable preprocess
Season, day, time frame and weather conditions are contextual variables used in this recommender system. The Unix time format provided by Twitter was converted to date and time stamp. Season was determined by the check-in date. Some periods have a similar number of check-ins; for example, some users have the same pattern of check-in behaviour for every day of a given week. Discretization of contextual variables performs better, so it was applied to all contextual variables. From the check-in date, days were determined and discretized as ‘weekday’ and ‘weekend’ [43,45]. Spring and summer were discretized as ‘hot season’, and autumn and winter were discretized as ‘cold season’ [45]. Majid et al. [40] discretized time as morning, afternoon, evening and night, whereas they discretized a day as morning and evening. However, examining check-in behaviours in the dataset, it is found that discretizing data as morning, noon and evening was more suitable for our purposes. The time range 07:00 to 11:59 was specified as morning, 12:00 to 16:59 as noon and 17:00 to 06:59 as evening.
More than 10 different weather conditions (e.g. sunny, rainy, snowy, rainy and stormy snowy and stormy) were included in the dataset. These conditions were discretized in three broad categories: sunny, rainy and snowy. A dataset that included contextual information for each venue was prepared, and the context percentages of each category were calculated (Table 8).
Sample contextual characteristics of venues.
H: hot; C: cold; Wday: weekday; Wend: weekend; M: morning; N: noon; E: evening; S: sunny; R: rainy; SW: snowy.
3.2.5. Development of the HybRecSys recommender system
Figure 1 presents the flowchart of the HybRecSys location recommendation system by explaining each step in the algorithm. Moreover, Figure 2 presents the framework of the HybRecSys location recommendation system, which consists of three main components: user similarities (based on check-in history, category, popularity and user price preferences), venue similarities (based on check-in history and venue context characteristics) and distance from the venue to the user centre.

Flowchart of HybRecSys.

Framework of HybRecSys.
3.2.6. Calculating user similarities
User similarities can be measured using Jaccard similarity, Cosine distance, Euclidean distance or correlation distance. Cosine distance, used to measure the degree of similarity between two vectors of an inner product space that measures the cosine of the angle between them [48], was employed in this study. First, we constructed the user-venue matrix, which keeps track of the user ratings to venues. User–user similarity was calculated with equation (2), using the user-venue matrix
Formula (3) was used to calculate the user ratings of the venues
Second, we constructed a user-category preference matrix that would keep track of the number of venues a specific user visits in each category. Popularity values were discretized as high, medium or low according to the normalised popularity values obtained from the PCA. Next, we generated a user-popularity preference matrix to keep track of the number of venues that a specific user visited in each popularity category. We also constructed a user-price preference matrix to keep track of the number of venues that a specific user visited in each price category. User–user similarities according to category, popularity and price preferences were also calculated, using a technique similar to the one used in equation (2). Predicted ratings using user similarity depend on the category, popularity and price preferences of users. These ratings were also calculated in a similar manner, using equation (3).
3.2.7. Calculating venue similarities
As with user similarities, we calculated venue similarity by utilising the cosine distance from the user-venue matrix. Venue–venue similarity was calculated using equation (4)
The predicted user ratings of venues were calculated using the following formula
Next, we prepared a venue–context matrix (Table 8) to keep track of venue contextual characteristics. This matrix presents the percentage of venue preferences in different contextual circumstances. With this matrix, venue similarities were calculated using equation (4). Predicted ratings that depended on the contextual similarity of venues were calculated using equation (5).
3.2.8. Constructing the distance equation
The calculation of ratings according to distance between a venue and a user assumed that if the distance between a venue and the user centre was short, the user would visit that venue more frequently [48–50]. Users are typically more willing to check in at venues near their centres, but each user’s perception of distance is different. For this reason, a power law distribution [41,49,51] was fitted to each user’s visits, and optimal coefficients (A, B and n) were found for each user to model the willingness of a user to check-in at a place to minimise the difference between actual rating and predicted rating
3.2.9. Developing the hybrid approach
In this study, we applied a weighted hybrid recommender that computed the score of recommended items from the results of all available recommendation techniques. Instead of using equal weights for each algorithm, we applied an artificial neural network analysis in order to find the optimal weights for each technique. A generalised feed forward artificial neural network model was applied using Weka 1 software. The following parameters were used
Learning rule: Momentum (momentum factor = 0.5);
Stopping criteria: Mean square error (minimum MSE = 0.005);
Learning rate: 0.1;
Activation function: Linear sigmoid;
Initial weight: Randomised;
The results of all available recommendation techniques were used as inputs, and actual ratings were used as output to be predicted. Final ratings were calculated by multiplying the weights coming from the results of the artificial neural networks by the ratings from various algorithms, as shown in equation (7)
Pseudocode of the HybRecSys algorithm can be found in Table 9.
Pseudocode of HybRecSys algorithm.
4. Experiments and evaluation
In this section, baseline approaches and evaluation methods are described and major findings are presented.
4.1. Baseline approaches
The HybRecSys was compared with a user-based K-nearest neighbourhood (KNN) algorithm, an item-based KNN algorithm, a biased matrix factorisation and a SVD++. These algorithms are used for rating prediction that is suitable for our dataset and are ready to use in the LibRec, 2 a Java library for recommender systems. The default settings of LibRec was used for each algorithm. Setting parameters are presented in Table 10.
Setting parameters of algorithms in LibRec.
KNN: K-nearest neighbourhood; SVD: singular value decomposition.
Because it was difficult to find the coding of other hybrid algorithms in previous studies, the HybRecSys was created step by step. In each step, the performance improvement was observed with the additional variables. Earlier versions of the HybRecSys (referred to here as Hybrid 1, 2 and 3) are explained in the following:
Hybrid 1 was created from a combination of only
Hybrid 2 was created by the combination of
Hybrid 3 was created by the combination of
The HybRecSys was created from the combination of
4.2. Evaluation
Generally, three types of experimental settings are used for evaluating recommender systems: (1) offline experiments that use a pre-collected dataset of users’ choices and rated items, (2) user studies where a set of test subjects is recruited and asked to perform several tasks requiring an interaction with the recommendation system and (3) an online evaluation that redirects a small percentage of the traffic to different alternative recommendation engines and records user interactions with those different systems [52]. Offline experiments were used in this study to validate the algorithm. To evaluate recommender systems, user ratings can be predicted and compared with actual user ratings (rating prediction); alternatively, a recommended set of items can be compared with the actual items in the user sets (ranking prediction). Different metrics were used for rating and ranking prediction. Metrics used for the evaluation of the HybRecSys are presented in Figure 3.

Evaluation metrics.
The root-mean-squared error (RMSE) is one of the most popular metrics used for evaluating the accuracy of predicted ratings. The mean absolute error (MAE) is an alternative to RMSE. Coverage indicates what percentage of visits can be predicted in all test sets. Precision indicates the percentage of correctly recommended items over total recommended items, while Recall shows the percentage of recommended items over the total number of liked items by the user. The F1-Measure, calculated using both precision and recall, measures the accuracy of the system.
The K-fold (K = 10) cross-validation technique was used to split the data into training and test sets. The dataset was split into 10 disjoint sets, making sure that each set contained about 10% of each user’s visits. For each fold, one set was used as a test set, and nine were used as training sets.
The RMSE, MAE and coverage values of the algorithms available in LibRec, earlier versions of HybRecSys (Hybrid 1, Hybrid 2 and Hybrid3) and the latest version of HybRecSys (HybRecSys) are presented in Table 11.
RMSE, MAE and coverage values based on different algorithms.
RMSE: root-mean-squared error; MAE: mean absolute error; KNN: K-nearest neighbourhood; SVD: singular value decomposition.
According to the RMSE and MAE values, the HybRecSys outperforms other algorithms. User-based KNN, item-based KNN, SVD++ and biased matrix factorisation follow HybRecSys according to RMSE and MAE values. The coverage is 100% for the HybRecSys. Although the RMSE and MAE values of user-based and item-based KNN are slightly higher than those of the HybRecSys, their coverage value is only 38%. The coverage value of SVD++ and biased matrix factorisation is also 100%, but their RMSE and MAE values are higher than those of HybRecSys.
When HybRecSys is compared with its earlier versions, it is clear that the addition of each variable increases the performance of the algorithm. The RMSE and MAE values decrease most dramatically after the addition of venue-related features (price, popularity and category). The HybRecSys algorithm performs better than its earlier versions and also outperforms other algorithms.
The precision, recall, and F1 values of the algorithms available in LibRec, earlier versions of the HybRecSys and the current HybRecSys are presented in Table 12.
Precision, recall and F1 measures of the algorithms.
KNN: K-nearest neighbourhood; SVD: singular value decomposition.
According to precision, recall and F1 values, the HybRecSys outperforms all other algorithms. User-based KNN, item-based KNN, biased matrix factorisation and SVD++ follow HybRecSys according to precision metrics. According to recall values, biased matrix factorisation, item-based KNN, SVD++ and user-based KNN follow the HybRecSys. Finally, according to the F1 measure, item-based KNN, biased matrix factorisation, user-based KNN and SVD++ follow HybRecSys.
When the precision, recall and F1 values of the HybRecSys are compared with its earlier versions, it clearly outperforms the earlier versions.
HybrecSys is also compared with the other algorithms according to the running times. Running times in seconds are presented in Figure 4. It is obvious that running times of item-based KNN and user-based KNN is lower than other algorithms. However, SVD++ and biased matrix factorisation have the highest values of running times. Hybrid 1, Hybrid 2, Hybrid 3 and HybRecSys follow user-based KNN accordingly. They also have lower running times than SVD++ and biased matrix factorisation. Although HybRecSys does not have the lowest running time, since its other metrics are better compared with other algorithms, it can be still preferred.

Running times of the algorithms.
5. Conclusion
This study proposed a hybrid recommendation model HybRecSys that combines user-based CF, item-based CF, CBF and contextual information in order to eliminate the disadvantages of each approach. For this purpose, users’ visit history, venue-related information (distance, category, popularity and price classification) and contextual information (weather, season, date and time of visits) related to each visit were collected from different sources (Twitter, Foursquare and Weather Underground). For CBF, the variables of distance, category, popularity and price, which had not previously been combined in a single algorithm, were used to determine content-based similarity of users by embedding more venue-related features. Weather conditions, the season, date and the time of each visit were used as venue features. Contextual similarities of venues were also utilised in the system. A weighted hybrid recommender that computed the score of recommended items from the results of all available recommendation techniques was applied. Instead of using equal weights for each technique, artificial neural network analysis was performed in order to find their optimal weights. The results of all available recommendation techniques were used as inputs, and actual ratings were the outputs that are predicted. Final ratings were calculated by multiplying the weights coming from the results of neural networks by the ratings from different algorithms. The hybrid system mitigated the drawbacks of each approach that occur when they are used separately. The use of multiple data sources provided variables that improved the performance of the recommendation system.
The HybRecSys was compared with four existing algorithms, namely, user-based and item-based KNN, biased matrix factorisation and SVD++, and with its previous versions. The four algorithms were evaluated using two types of metrics, rating prediction (RMSE, MAE and coverage) and ranking prediction (precision, recall and F1 measure). The K-fold cross-validation (K = 10) technique was used for data splitting and training, and test datasets were generated. We conducted extensive experiments to evaluate the effectiveness of the HybRecSys and to validate its advantages over other algorithms. The results of each metric show that the HybRecSys outperforms its earlier versions as well as the other four existing algorithms. The HybRecSys effectively overcomes the challenges arising from data sparsity by modelling user preferences from the venue category, popularity and price.
Data sparsity, which resulted from an insufficient number of user-rated venues, was compensated for by calculating different similarity measures (user, item, price, category, popularity-based and contextual similarity values). The problem of over-specialization caused by the recommendation of highly similar venues was circumvented by taking into account the preferences of users from numerous different aspects, not venue characteristics. The quality of recommendation was thus improved.
The contribution of this study can be summarised as follows:
Four different approaches (user-based CF, item-based CF, CBF and contextual recommendation) were combined to develop a hybrid recommender system.
To the best of our knowledge, this is the first study that combines the variables of distance, category, popularity and price classification in a CBF algorithm with the aim of determining content-based similarity of users by embedding a venue-related feature.
Weather conditions, the season, the date and the time of each visit were combined as venue features. Contextual similarities of venues were also utilised in the system.
Our study is not without limitations. Although the size of the collected data is large, after the filtration it became relatively small. However, this small dataset generated meaningful results and it is possible that it may produce better results with larger datasets. In addition, HybRecSys algorithm was unable to generate recommendations for new users. Cold start problem will be addressed in a future study. Second, contextual variables were not used in a personalised way, which means a user may like a particular venue in one contextual circumstance, where another may like the same venue in a different context. For all similarity calculations, Cosine similarity was used. The performance might improve if other similarity measures (adjusted cosine similarity, Jaccard similarity, etc.) are implemented. When it came to venue opening and closing hours, these were not checked because it is not possible to know whether the venue was open the entire day. Finally, we aim to improve the performance of the HybRecSys by using real user reaction via user surveys.
Footnotes
Declaration of conflicting interests
The author(s) declared no potential conflicts of interest with respect to the research, authorship and/or publication of this article.
Funding
This study was supported by the Bogazici University Scientific Research Projects Fund (project no. 11463).
