# Self-Supervised Spatio-Temporal Graph Learning for Point-of-Interest Recommendation
## 3 Methodology
### Spatio-Temporal-Aware Data Augmentation  
Some straightforward data augmentation operators have been proposed in the former work [12], including the node dropout, edge dropout, and random walk. However, these operators ignore the effect of spatio-temporal information, thus resulting in some low-quality graph structures, which in turn reduce the performance of POI recommendations. To take spatio-temporal information into account during data augmentation, in this section, we first defined the POI's temporal and spatial similarity matrices separately. Based on these similarity matrices, we defined the spatial-aware edge perturbation and temporal-aware edge perturbation operations. SSTGL uses these edge perturbation methods randomly at each epoch of training to generate new augmented graphs.  
In detail, based on Equation (1), the aggregation operation based on the data augmentation can be expressed as follows:  
\[\mathbf{Z}_{1}^{(l+1)} =f_{aggregate}(\cdot|\mathbf{Z}_{1}^{(l)},s_{1}(\mathcal{G})), \tag{7}\] \[\mathbf{Z}_{2}^{(l+1)} =f_{aggregate}(\cdot|\mathbf{Z}_{2}^{(l)},s_{2}(\mathcal{G})),\]  
where \(s_{1}(\cdot)\) and \(s_{2}(\cdot)\) are data augmentation operators. Note that, although the data augmentation can generate any number of views, SSTGL uses only two data augmentation operations to reduce the model complexity:  
* Spatial similarity matrix \(\mathcal{M}_{S}\in\{0,1\}^{|\mathcal{P}|\times|\mathcal{P}|}\): when the distance between two POIs is less than a certain threshold \(K_{S}\), then the similarity of these two POIs is 1; otherwise, it is 0.
* Temporal similarity matrix \(\mathcal{M}_{T}\in\{0,1\}^{|\mathcal{P}|\times|\mathcal{P}|}\): when two POIs have interacted with the same user in a period \(K_{T}\), then the similarity of these two POIs is 1; otherwise, it is 0.  
In practice, we set \(K_{T}\) to 2 h in following the former work [18], which discovered that users tended to visit the same POI consecutively within 2 h. In addition, we used the Geohash algorithm to transform the geographic coordinates of the POIs into region IDs and then determined whether the IDs were the same as a threshold condition of \(K_{S}\).  
Based on the spatial and temporal similarity matrices, we defined the following data augmentation operators:* Spatial-aware edge perturbation (SEP): It adds multiple implicit edges based on the spatial similarity to the original user-POI edges: \[\mathcal{E}_{imp_{S}}^{|\mathcal{U}|\times|\mathcal{P}|}=\mathcal{E}\cdot \mathcal{M}_{S},\] (8) \[s_{1}(\mathcal{G})=(\mathcal{V},\mathbf{\Theta_{1}}(\mathcal{E}_{imp_{S}}, \mathcal{E})),\;s_{2}(\mathcal{G})=(\mathcal{V},\mathbf{\Theta_{2}}(\mathcal{E}_{ imp_{S}},\mathcal{E})),\] (9) where \(\mathbf{\Theta_{1}}(a,b)\), and \(\mathbf{\Theta_{2}}(a,b)\) are perturbation vectors that pick elements from \(a\) in some ratio \(r_{\theta}\) and add it to \(b\).
* Temporal-aware edge perturbation (TEP): It adds multiple implicit edges based on temporal similarity to the original user-POI edges: \[\mathcal{E}_{imp_{T}}^{|\mathcal{U}|\times|\mathcal{P}|}=\mathcal{E}\cdot \mathcal{M}_{T},\] (10) \[s_{1}(\mathcal{G})=(\mathcal{V},\mathbf{\Theta_{1}}(\mathcal{E}_{imp_{T}}, \mathcal{E})),\;s_{2}(\mathcal{G})=(\mathcal{V},\mathbf{\Theta_{2}}(\mathcal{E}_{ imp_{T}},\mathcal{E})).\] (11)  
In following [12], we used the above data augmentation approaches at each epoch to generate multiple views and used the same ratio \(r_{\theta}\) on \(\mathbf{\Theta_{1}}\) and \(\mathbf{\Theta_{2}}\). We leave it as future work to use more than two data augmentation operators \(s(\cdot)\) simultaneously and to use different perturbation ratios \(r_{\theta}\) for different operators.