## 4 The Proposed Method
### Random Walk Mechanism  
We take advantage of the skip-gram model [21] to learn the feature representation of users and POIs. Let \(N_{R}(u)\subset U\) be the set of user \(u\)'s neighbors in graph \(G_{1}\). To have the contexts in the skip-gram model, we generate \(N_{R}(u)\) through a devised random walk mechanism. Below we first present the probability associated with each edge, then describe the random walk mechanism. We consider that nodes with strong social connections with each other tend to be treated as neighbors. Thus we introduce two _affinity_ scores to quantify the social strength between users \(i\) and \(j\). The first is _social affinity_\(\pi_{s}(i,j)\), defined as:  
\[\pi_{s}(i,j)=\frac{|N_{G_{1}}(i)\cap N_{G_{1}}(j)|}{|N_{G_{1}}(i)\cup N_{G_{1} }(j)|},\]  
where \(G_{1}\) is the social network, \(N_{G_{1}}(i)\) is the neighborhood of user \(i\) in \(G_{1}\). The second is _co-visiting affinity_\(\pi_{c}(i,j)\), defined as:  
\[\pi_{c}(i,j)=\frac{|N_{G_{2}}(i)\cap N_{G_{2}}(j)|}{|N_{G_{2}}(i)\cup N_{G_{2} }(j)|},\]  
where \(G_{2}\) is the check-in network, \(N_{G_{2}}(i)\) is the neighborhood of user \(i\) in \(G_{2}\). Since \(\pi_{c}\) shows the affinity based on user-POI interactions, if there are more co-visited POIs between users, \(\pi_{c}\) gets higher. Two users are more likely to possess similar POI visiting preferences in the future. On the other hand, \(\pi_{s}\) shows the affinity based on the social network. If two users have more common friends, \(\pi_{s}\) gets higher, i.e., the two users are more likely to affect each other. Then we define the edge weight (probability) \(w_{ij}\) between users \(i\) and \(j\) in the social network by combining social affinity and co-visiting affinity, given by:  
\[w_{ij}=\pi_{s}(i,j)+\pi_{c}(i,j),\forall e_{ij}\in E_{1},\]  
where \(E_{1}\) is the edge set of social network \(G_{1}\). Here we present examples to demonstrate the derived neighboring POIs sampled by random walks of co-visiting affinity and social affinity, in Figure 1, in which different colors mean various venue categories. We can find that the random walk by co-visiting affinity tends to collect neighbors with the same category as the target POI. The random walk by social affinity has a higher potential to bring neighbors with diverse venue categories. Hence, we would like to have both effects so that the representation learning can generate similar embeddings that not only encode similar categories but also distinguish from each other due to different social interests. We also propose a penalization-based LBSN2 vec (PLBSN2 vec) by adding a penalty parameter in the random walk: a return parameter \(\rho\) (\(0<\rho<1\)) and a parameter \(|Path_{nr}|\) effect. The return parameter \(\rho\) is the penalty value to avoid traversing the same nodes. In addition, we think that near-by nodes of a user tend to have similar preferences. Hence, we let those close to each other have a high possibility of being traversed as the neighbors. Given the starting user \(u\), the next user \(n\), and the previous user \(r\), we devise the penalty weight \(p_{nu}\) as:  
\[p_{nu}=\left\{ \begin{array}{ll}\frac{1}{|Path_{nr}|}\cdot w_{nu}&\text{if } |Path_{nr}|\geq 1\\ \rho\cdot w_{nu}&\text{if }|Path_{nr}|=0\\ 0&\text{otherwise}\end{array} \right.\]  
where \(|Path_{nr}|\) is the shortest path length between \(n\) and \(r\). Lower values of return parameter \(\rho\) make the walk have a lower opportunity to repeat the previous user. By contrast, a larger return parameter \(\rho\) will increase the chance of walking back to the previously traversed users. In addition, longer paths between nodes get a larger penalty in \(|Path_{nr}|\), which will decrease the probability. Then we present the random walk mechanism. Formally, given the current node \(c\), we simulate a random walk of length \(l\). Let \(r_{i}\) be the \(i\)-th node in the random walk. For LBSN2 vec, we define the conditional probability of the next node \(n\) given the current node \(c\):  
\[P(r_{i}=n,r_{i-1}=c)=\left\{