Recommending Locations Based on Users ’ Periodic Behaviors

The research of location recommendation system is an important topic in the field of LBSN (Location-Based Social Network). Recently, more and more researchers began focusing on researching how to recommend locations based on user’s life behavior. In this paper, we proposed a new model recommending locations based on user’s periodic behaviors. In view of multiple periodic behaviors existing in time series, an algorithm which can mine all periods in time series is proposed in this paper. Based on the periodic behaviors, we recommend locations using item-based collaborative filtering algorithm. In this paper, wewill also introduce our recommendation systemwhich can collect users’ GPS trajectory, mine user’s multiple periods, and recommend locations based user’s periodic behavior.


Introduction
LBSN (Location-Based Social Network) is a new kind of social network which combines the user's friendship and the user's position.There are two hot research hotspots in the filed of LBSN: recommendation system and mining user's life pattern.For recommending system, the user can get more suggestion for deciding where he can choose to go to.For mining life pattern, the recommendation system can better understand the use's preference.Periodic behavior is a kind of life pattern.In this paper, we proposed a new kind of recommendation model based on the user's periodic behaviors.For solving the problem of mining multiple periods, we proposed a new algorithm which can mine multiple periods in the time sequence.
The research of recommendation systems in the field of LBSN has attracted many researchers' attention and produced a lot of research results.Currently, the recommendation system of LBSN is divided into good friends recommended [1], location recommended [2], activities recommended [3], and event recommended [4].In the field of friend recommendation, Papadimitriou et al. proposed a friend recommendation algorithm based on user social network [1].For location recommendation, Bellotti et al. proposed a personalized location recommendation algorithm based on social network and location influence [3].The activities recommendation is recommending a place for users' preferred activities.Bellotti et al. proposed a system which can recommend the preferred location of activities.The event recommendation is a special case of activities recommending; the main research directions in the field is event detection.Papadimitriou et al. proposed a [2] position information label incident detection algorithm.Furthermore, Gao et al. [5] proposed a location recommendation model which can solve the cold start problem.Zhang et al. [6] proposed a personalized and efficient geographical location recommendation framework called iGeoRec.Huang [7] proposed a novel context similarity measure to quantify the similarity between any two contexts and develop three context-aware collaborative filtering methods for recommending locations.Yuan and Li [8] proposed a location recommendation algorithm based on temporal and geographical similarity in location-based social networks.
With the gradual accumulation of user' location data, the research of users' life behavior has aroused the interest of some researchers and has produced the relevant research results.Rekimoto et al. proposed a user interest point travel sequence mining algorithm based on GPS trajectory and proposed an algorithm which can predict the next destination based on the user's current location [9].Ye et al. proposed a user behavior pattern mining algorithm based on WIFI's location monitoring technology [10].Lahiri and Berger-Wolf proposed a LP-Mine algorithm which can mine user's behavior patterns from the original GPS trajectory data [11].
Periodic behavior is a kind of life behavior.The user arriving in a certain area periodically is called a periodic behavior.For example, a user goes shopping every weekend and a user reaches the company for working every Friday to Monday.In order to obtain periods, we should use some period mining algorithm.In this paper, we proposed a new algorithm for mining periods and proposed a new model for recommending locations based on users' periodic behaviors.
Recently, some researchers have proposed some period mining algorithms.Li et al. used the periodogram and selfcorrelation method for mining the user periodic behaviors [12,13], and to combine the periodic behavior, the authors proposed a kind of location predicting model based on the thought of probability.Wang proposed the basic thought of periodogram [14].After several years of development, this algorithm has been successfully applied in different areas for mining periods, for example, hydrological time series analysis [15] and medical time series analysis [16].The basic idea of the period diagram is based on the power density spectrum estimation which is based on Fourier transform.Because of the leakage of the spectrum, this algorithm is not accurate for mining all periods.In order to avoid this problem [17], windowing technique is proposed by the researcher, but this technology is not accurate enough.Self-correlation method has been proposed.Compared with the periodogram, this algorithm can solve the problem of mining periods from arbitrary length time sequence.In addition, Parthasarathy et al. proposed an algorithm for obtaining [18] time series based on cross entropy; the algorithm can get into one of the most significant periods of time series.By using this algorithm, it is possible to find out the periodic behavior of the users in the purchase of electronic goods.Wang et al. also proposed a time series period mining algorithm [19], which is designed based on the frequent features of periodic behavior and the basic idea of the structure.Xu et al. proposed an [20] algorithm model of hydrologic sequence period based on Mexhat wavelet; this model can be used to dig out periodic behavior from the monthly rainfall in Shanghai.
In real life, some users go to a certain area with multiple periods.For example, a user goes to an area not only every Friday but also every two weeks on Monday.In this paper, we proposed a period acquisition algorithm which can mine multiple periods in time sequence correctly.In our research, we found that there are multiple periods existing in some time sequence generated by users.For example, a teacher not only comes to a campus every Monday but also comes to this campus on Tuesday every two weeks.For this teacher, there are two periodic behavior in his daily work behavior.The classical algorithm, periodogram and self-correlation function, cannot mine all correct periods because multiple periods affect each other while mining periods.In our experience, they cannot mine multiple periods in the time sequence generated by restrict multiple periodic behaviors.
The main thought of periodogram is DFT (Discrete Fourier Transform), and an explanation of DFT is that a Fourier coefficient is a relativity between its sine curve and original time sequence.So it cannot avoid the interference of other periodic behaviors.Self-correlation function calculates correlation of time sequence with different time delay and cannot avoid the interference of other events happening in other time stamps.These two algorithms cannot get the start time stamp and all time stamps at which a periodic behavior happened, so we cannot know the time stamp at which the periodic behavior happened.In this paper, we proposed a multiple period acquisition algorithm which can not only mine all periodic behaviors but also get the time stamp at which a periodic behavior happened.So it can help us to predict a user's future behavior based on these periodic behaviors.
After mining the user's periodic behaviors, we have done some researches on how to recommend location based on the user's periodic behaviors.In the field of location recommendation system, some researchers have proposed some models based on the user's preference and friendships.But we found few location recommendation models based on the user's periodic behaviors during our search work.Collaborative filtering is a famous recommendation algorithm.Item CF and User CF are the basic algorithms of collaborative filtering.In this paper, because there are no friendships in our data, we use Item CF for recommending location based on the users' preference and the periodic behaviors.We designed and developed a recommendation system.This system includes an android application for showing recommending locations and collecting GPS trajectory and the server for mining periodic behaviors and recommending locations for the users based on the users' periodic behaviors.
The rest of the paper is organized as follows.Section 2 introduces the multiple periods mining algorithm which is proposed in this paper.Section 3 introduces the location recommendation model based on the periodic behaviors proposed in this paper.Section 4 introduces the thought and the architecture of our location recommendation system and we report our experimental results in Section 4. Section 5 introduces the conclusion and our future works.

Mining Multiple Periods in Time Sequence
In users' daily life, the user comes to a certain area not only with single period but also with multiple periods.The search of periodic behavior has attracted many researchers' attention.Recently, some algorithms proposed for mining periods are not accurate for mining multiple periods.In this section, we will introduce the proposed algorithm for mining multiple periods.For solving the problem of mining multiple periods, we proposed a new algorithm based on the thought of matrix, the thought of item hitting, and the thought of changing the matrix dynamically for reducing the execution time.Using this algorithm, we can mine all periods from time sequence.

Input: S (time sequence) st (support threshold) ts (target state)
Out put: period (all periods in the time sequence) begin (1) matrix,map, T = GeneratingMatrix (S, ts) // creating the suspected periods matrix based on the time-stamps the target state happened (2) periods = MiningPeriods (matrix, st,map,T) (3) return periods end Algorithm 1: Mining multiple periods.
This algorithm [17] uses the matrix for storing all suspected periods in the time sequence.In order to access elements in the matrix according to the time stamp, this algorithm constructs a hash mapping relationship between the time stamps and the number of the rows and columns of the matrix and all the items in the matrix are suspected periods.For mining true periods from the matrix, this algorithm judges all the suspected periods by counting the number of successful hitting times.If the count of hitting is more than the support threshold, the value of the current suspected period is a true period of this time sequence and if not this algorithm will judge the next suspected period by the same way.For reducing the execution time of mining all periods, this algorithm will change the value of hitting items in the matrix to be zero dynamically.This algorithm can be shown as in Algorithm 1.
In Algorithm 1, GeneratingMatrix(, ts) is the progress of creating all suspected periods' matrix based on the time stamps at which the target state happened which will be introduced in Section 2.1.MiningPeriods(matrix, st,map,) is the progress of mining all true periods stored in the matrix which will be introduced in Section 2.2.

Creating the Suspected Periods Stored Matrix.
In the time sequence, the period of a target sate is greater than 1 and less than len()/2.len() is the length of the time sequence.If we judge whether the value from 1 to len()/2 is a true period, the algorithm may require a higher time complexity.Based on the characteristic that the periodic behavior always occurs at the same time interval, the period of the time series can only be the time difference between any two time stamps at which the target state happened.The algorithm of generating all suspected periods can be shown in formula (1).  and   are the time stamp at which the target state happened.sp is the suspected period. is the time stamps at which the target state happened and  is the set of all suspected periods.This progress is shown in the following: Example 1.The time sequence is "0001100101010011."The target state is "1."The time stamps at which the target state happened are {3, 4, 7, 9, 11, 14, 15}.The all suspected periods can be gotten according to formula (1) as shown as {1, 4, 6, 8, 11, 12, 3, 5, 7, . ..}.And the true periods {4, 5} are stored in this suspected periods stored set.
In the above analysis, the time interval between any time stamps can be calculated as the suspected periods of this algorithm.While storing all suspected periods, if we choose a set or a list for storing the suspected time, the complexity of accessing the target item is ().Therefore, this algorithm uses hash mapping algorithm and matrix to store the suspected periods and the number of the rows and the columns of the matrix mapping to the time stamps at which the target state happened.So this algorithm can access the item in the matrix according to the time stamps.And the complexity of accessing the item is  (1).Another advantage of this method is that it can execute the hitting method according to the time stamps which simplify the progress of judging the suspected periods.
The progress of establishing suspected periods stored matrix can be shown in Algorithm 2. From lines (5) to (13), the algorithm acquires all time stamps at which the target state happened and creates the mapping relation to the number of rows and columns of the matrix.The hash mapping algorithm is shown in formula (2).In this formula, ℎ is a hash value. is the time stamp at which the target state happened. is the time sequence.len() is the length of the time sequence.ℎ = %len () . ( From lines (15) to (22), the algorithm calculates the suspected periods according to the time stamps at which the target state happened and changes the value of the period which is bigger than len()/2 or less than zero to be zero for reducing the count of judging steps.In Example 2, we introduce an example for explaining the progress of Algorithm 2.
Example 2. According to the time sequence shown in Example 1, the suspected periods stored matrix can be created as

Input: S(time sequence) ts (target state) Output: matrix (the suspected periods stored matrix) map (hash mapping relation) T (the time stamps the target state happened) begin:
(1) map = new HashMap (key, value) // hash mapping relation between time stamps and the number of the row and column in the matrix (2)  = [] // the time stamps the target state happened (3)  = 0 // the number of the row in the matrix (4)  = 0 (5) While  < len() do (6) if  (3)

Acquiring True Periods and Changing the Matrix Dynamically.
In this step, the multiple periods mining algorithm will mine all true periods stored in the matrix step by step.The algorithm proposed in this paper will count the times the suspected period happened actually by using item hitting method.Then, the algorithm calculates the period of the target period.If the support is more than the threshold, the target period is a true period and the matrix is changed dynamically for reducing execution time.If not, the algorithm will judge the next suspected period.
During mining all true periods, the values stored in the matrix are called suspected periods.The row number of the suspected period is the first time the target state happened in this period and the column number is the second time.After mining a true period, the algorithm then changes the hitting item in the matrix to be zero.Then, the next steps will not judge the same periodic behavior.If the current item is not a true period, the algorithm will judge the next item.After judging all suspected periods stored in the matrix, the algorithm will stop and generate all mined true periods of this time sequence.The main thought of mining periods from the matrix can be shown in Algorithm 3.
In Algorithm 3, the input of the algorithm includes the storage matrix of the suspected period, the occurrence time stamp collection of the target state, the support threshold value, the hash mapping between time stamps, and the number of rows and columns of the matrix.In line (1), the algorithm initializes the period object set.Each period object contains two fields, that is, the period and the first time the periodic behavior happened.From lines (2) to (21), the algorithm mines all true periods from the matrix.Lines ( 9) to (15) are the progress of item hitting method.The hitting count is the times the target suspected periodic behavior happened.From lines (13) to (14) is more than the length of time sequence, the hitting progress of the suspected periods will stop.
After executing the hitting method, the algorithm will execute the code from lines ( 16) to (19).Line ( 16) is calculating the support of the suspected period.The method of calculating support is shown in formula (4).In formula (4), SP is the support, ℎ is the hitting count,  is the length of the time sequence,  is the time stamp at which the period happened firstly, and  is the value of the period.If the support is more than the support threshold, the algorithm will execute lines (17) to (18).In line (17), the algorithm will change the hitting items' value to be zero.Line (18) will store the mined period in the set.The method of change the matrix dynamically is shown in Algorithm 4.

𝑆𝑃
In Algorithm 4, the method will execute the item hitting method one more time.But the difference is that in this time the algorithm will change the hitting item's value to be zero for avoiding judging the same periodic behavior more times.The full progress is shown in Algorithm 4.
In Algorithm 4, we describe the progress of the proposed multiple periods mining algorithm in detail.Example 3 will introduce the full progress according to a detailed example.In this example, we will give the situation of matrix after judging two items.
The process of this example is shown as follows.
(1) For the value of M [3][4] is 1, the algorithm executes the hitting method based on the period of 1 and this periodic behavior starts from the third locations of time series.We can get that the support value of M [3][4] is 7/13.And the support  Firstly, we mine multiple periodic behaviors by using the proposed algorithm in this paper.The result can be seen in Table 1.We can find that the result of this experiment is correct.
Then, we mine the periodic behaviors by using the algorithm of periodogram.The result of density of power spectrum is shown in Figure 1.The -axis is the frequency and the -axis is the density of power spectrum.We take the frequency of the power spectrum in the top as the true frequency.According to formula (9), we can calculate the period.Because the period is an integer, we get the period of 7. In formula (9), len() means the length of the time sequence.period = len () frequency .
In this experiment, we found that the periodogram cannot mine all true periods because of spectral leakage.The period of 14 cannot be divided by 77 (the length of this time sequence).So when we mine periodic behavior by periodogram, we cannot get the period of 14 directly.And the periodogram cannot tell us when the behavior happens in a period.Based on this period, we cannot predict the user's behavior in future.The proposed algorithm in this paper solved this problem.

Location Recommendation Experiment.
In our location recommendation experiment, we use the GPS trajectory collected in our system as our experiment's data.We mine the user's periodic behavior by using the method proposed in Section 2. Based on the periodic behaviors, we generate the recommending location list by using the method proposed in Section 3. In this section, we will use the accuracy to evaluate the recommendation method proposed in this paper.The accuracy of our recommendation method is shown in  the blue line is the result of the user-based CF algorithm.In Figure 2, we evaluate the item-based CF algorithm without using the characteristic of periodic behaviors.We can see that the recommendation method proposed in this paper is higher than the raw item-based CF algorithm.We also recommend the location to the user by using user-based CF algorithm and it is less accurate than our model.From this result, we can know that mining users' behavior is important for recommending the users locations, because the user may always go a location which is near his frequent or periodic arrival area.For example, we may go shopping near our home, go to a restaurant for a dinner near our working place, and so on.We give an example of the result of location recommendation as follows.

The Location Recommendation System
Based on the User's Periodic Behaviors.In our system, we developed the mobile application and the server-side application.In the mobile side, the application includes GPS trajectory collection module and the location recommendation module.In the server side, the application includes the GPS trajectory storage module, the stay-points mining module, the frequent arrival area mining module, and the periodic behavior mining module.For recommending location to the users, we also developed the location recommendation module based on the user's periodic behaviors in the server side.In Figure 3, the architecture of our system can be seen.We divided the system into three layers.They are the mobile application layer, the service providing layer, and the data storage layer.The mobile application layer can access the service providing layer through HTTP and the service providing layer can access the data storage layer through JDBC technology.In this section, we will introduce the data processing flow of this system in Section 4.3.1.

The Data Processing Flow of This
System.In our system, we design the data processing flow as shown in Figure 4.The server-side application receives the GPS data from the mobile client and stores the data in database.Then, it mines the stay points from the raw GPS data of each user, because a stay point means a staying behavior of a user and the GPS positions of all stay points in a frequent arrival area are not the same.The server then mines semantic area by using OPTICS [21] clustering algorithm.The OPTICS algorithm is a kind of the clustering algorithms based on the density of data.Because it does not need to set the number of classes and we cannot understand the number of the user's frequent arrival area, we choose it for mining the user's frequent arrival area.Such as the K-Means clustering algorithm, we should give the number of classes firstly and then the algorithm can mine all classes effectively; it is not suitable for our application.The OPTICS clustering algorithm is used in many areas widely such as web clustering.Based on the frequent arrival areas mined by the OPTICS algorithm, the server-side application mines the periods of each frequent arrival area by using the periods mining algorithm proposed in this paper.
After mining the user's periodic arrival areas and the periods, we designed the location recommendation module based on the user's periodic behaviors.For each periodic arrival area, we generated the recommending location list by using item-based CF algorithm.In the server side, the system can predict the user's future arrival area based on the periodic behavior.After predicting the future arrival area, this system pushes the recommending location list to the mobile application.The user can consider these locations as a future choice.As introduced above, the architecture of the data processing flow can be seen in Figure 4.

Conclusion and Future Works
In this paper, we proposed a new periods mining algorithm which can mine all periods in the time sequence and proposed a periodic behaviors based recommendation method for recommending the locations to the users.From this paper, we can see that our periods mining algorithm is more accurate than some other algorithms and the recommending model is more accurate than the raw item-based CF algorithm.But in this paper we do not consider the effect of the user's friendship in our recommending methods.And we found that the group's periodic behavior is also a true phenomenon in our daily life.So in the future, we will go on doing some research in a location recommending methods based on the friendship and the user's periodic behaviors.And we will do some research on how to mine the group's periodic behaviors.

Disclosure
This paper is extended from the paper named "Mining Multiple Periods in Event Time Sequence" in APSCC 2015.
shown in the following based on the algorithm shown in Algorithm 2

Example 3 .
In this example, we will continue to use the time sequence of Example 1 and the suspected periodic matrix of Example 2, while the support threshold value is 80%.(5) is the algorithm after determining whether the M[3][7] and M[3][4] are true periods.Among them, because M[3][7] is a true period, the value of the hitting element in the suspected periodic matrix is changed to 0.The state of the matrix after judging M[3][4]  and M[3][7] is as follows:

Figure 1 :
Figure 1: The power spectrum of periodogram.
Figure 2. The -axis of the figure is the count of recommending locations.And the -axis of this figure is the accuracy.The red line is the result of the algorithm proposed in this paper.The black line is the result of item-based CF algorithm and

Figure 2 :
Figure 2: The result of recommendation experiment.

Figure 3 :Figure 4 :
Figure 3: The architecture of our system.
, the algorithm generates the next hitting item's row and column number.If the column number

Table 1 :
The result of the proposed algorithm.