## 3 Methodology
### Generative Adversarial Network
The predicted check-in vector and the next POI location can be calculated based on the following equations, respectively:  
\[o_{c}=softmax(ReLU(o_{a}\times w_{c_{1}}+b_{c_{1}})\times w_{c_{2}}+b_{c_{2}}), \tag{2}\]  
\[o_{l}= sigmoid(ReLU(h_{l}\times w_{l_{1}}+b_{l_{1}})\times w_{l_{2}}+b_{l_{2}}), \tag{3}\]  
where \(o_{c}\) is considered as a fake check-in preference (i.e., a fake sample) for the user \(u_{i}\) according to the current temporal check-ins and geographical location. **Discriminator**: Figure 3 illustrates the proposed discriminator in the framework where the discriminator also comprises an embedding layer, an attention layer, and an output layer. Similar to the structure of the proposed generator, the discriminator also exploits the user ID, the temporal check-ins, and the geographical location to generate the dynamical user preference (i.e., an embedding vector) based on the latest historical check-in records. However, the goal of the discriminator is to distinguish the real samples (i.e., actual check-in records) and the fake samples (i.e., predicted check-in vectors) for helping the generator improve the performance of capturing the actual user preference based on the contextual information. Therefore, besides the user ID, the temporal check-ins, the geographical location, and the check-in vectors, including the actual records and the generated ones, are transformed into a latent vector using a fully connected layer in the embedding layer. The transformed vector, which has the same dimension with the dynamical user preference, represents the user preference based onthe current check-in vector. In the attention layer, the generated and transformed user preferences are concatenated into a long vector, which is considered as the output of the attention layer. For the output layer, the discriminator transforms the output of attention layer into a single value where the value is equal to 0 if the generator produces the check-in vector while the value is equal to 1 if the check-in vector is an actual check-in record:  
\[o_{d}=sigmoid(ReLU(o_{a}\times w_{d_{1}}+b_{d_{1}})\times w_{d_{2}}+b_{d_{2}}), \tag{4}\]  
where \(o_{a}\) is the output of attention layer in the discriminator. **Adversarial Learning**: The core of the generative adversarial network is the adversarial game between the generator and the discriminator. In other words, promoting the quality of generated check-in records will improve the performance of distinguishing real or fake samples to the discriminator while the improvement of discriminator will also promote the performance of capturing the actual distribution of user preference to the generator. Therefore, different from traditional models, the generator and the discriminator have individual objective functions. The objective function of the generator consists of the prediction loss, the geographical location loss, and the generation loss. The prediction loss is calculated based on the following equation:  
Figure 3: The structure of discriminator in the framework. Figure 2: The structure of generator in the framework. \[loss_{pred}=-\sum_{j=1}^{n}(v_{j}log(\hat{v}_{j})+(1-v_{j})log(1-\hat{v}_{j})), \tag{5}\]  
where the binary variables \(v_{j}\in\{0,1\}\) is the actual check-in record on the \(j\)-th POI in \(V\) for the current user (i.e., User ID), where 0 means that the user has never been to the \(j\)-th POI and 1 means that the user has been to the \(j\)-th POI. The variables \(\hat{v}_{j}\in[0,1]\) are the predicted check-in record on the \(j\)-th POI in \(V\). The geographical location loss is calculated as below:  
\[loss_{loc}=\frac{1}{2}((l^{lat}-\tilde{l}^{lat})^{2}+(l^{lon}-\tilde{l}^{lon} )^{2}), \tag{6}\]  
where \(l^{lat}\) and \(l^{lon}\) are the normalized latitude and longitude of actual check-in POI while \(\tilde{l}^{lat}\) and \(\tilde{l}^{lon}\) are the normalized latitude and longitude of predicted check-in POI.