# Detecting Urban Mobility Structure and Learning Functional Distribution with Multi-Scale Features
## 3 Method
### Model 1: Urban Mobility Structure Embedding with Multi-Scale Features  
The objective of embedding urban mobility structures is to map a mobility network into a low-dimensional vector space, thereby generating vector representations for each region. However, existing self-supervised learning methods primarily rely on contrastive strategies to learn the proximity features of nodes, which have limitations in capturing the global mobility structure features [31]. To address this issue, we proposed a city activity structure embedding model that incorporates multi-scale features. We simultaneously performed local node contrast and global mobility structure learning by the enhanced mobility network. Furthermore, an epoch decay coefficient is introduced to integrate the local node contrast loss with the global contrast loss. The model architecture, as depicted in Figure 2, consists of two key components: graph enhancement and multi-scale contrastive learning. **Step1. Graph enhancement**  
We enhanced the mobility network by randomly masking the node features and randomly discarding the edges. The node feature masking is obtained by multiplying the random mask vectors \(\mathbf{m}\), as follows:  
\[\widetilde{\mathbf{X}}=\ [\mathbf{X}[1,:]\odot m;\ldots;\mathbf{X}[N,:]\odot m] \tag{1}\]  
Figure 1: Framework of the proposed method. Figure 2: Multi-scale contrastive learning. where \(\odot\) is the Hadamard product, \(X\) is the original node feature matrix, and \(\mathbf{m}\) is the random noise vector, following the Bernoulli distribution: \(\mathbf{m}[i]\sim Bernoulli(1-p_{v})\), \(p_{v}\) is the random discard rate of node features. Edge randomly discard is obtained by multiplying the random mask matrix \(\mathbf{M}\in\{0,1\}^{N\times N}\), as follows:  
\[\overset{\sim}{\mathbf{A}}\ =\ \mathbf{A}\odot\mathbf{M} \tag{2}\]  
where \(\mathbf{A}\) is the original adjacency matrix, \(\mathbf{M}\) follows a Bernoulli distribution \(\mathbf{M}_{i,j}\sim Bernoulli(1-p_{e})\). Through the graph enhancement operations of feature masking and edge discarding, we obtained two enhanced views, respectively: \(\mathbf{X}^{1},\mathbf{A}^{1}\ =\ T^{1}(\mathbf{X},\mathbf{A})\) and \(\mathbf{X}^{2},\mathbf{A}^{2}\ =\ T^{2}(\mathbf{X},\mathbf{A})\). Then, we obtained the node embedding vectors of the two enhanced views, respectively, through the GCN of parameter sharing, as follows:  
\[\mathbf{Z}^{1}\ =\ f_{\theta}\Big{(}\mathbf{X}^{1},\mathbf{A}^{1}\Big{)} \tag{3}\]  
\[\mathbf{Z}^{2}\ =\ f_{\theta}\Big{(}\mathbf{X}^{2},\mathbf{A}^{2}\Big{)} \tag{4}\]  
where \(f_{\theta}\) is a graph convolution, and its calculation principle is as follows:  
\[\mathbf{H}^{l+1}\ =\ \sigma\Big{(}\mathbf{\widehat{A}}\mathbf{H}^{l}\mathbf{W}^{l}\Big{)} \tag{5}\]  
where \(\mathbf{\widehat{A}}\) is the normalized adjacency matrix, \(\mathbf{\widehat{A}}\ =\ \mathbf{D}^{-\frac{1}{2}}(\mathbf{A}+\mathbf{I})\mathbf{D}^{-\frac{1}{2}}\), \(A\) is the adjacency matrix, \(\mathbf{I}\) is the identity matrix, and \(\mathbf{D}\) is the degree matrix, \(\mathbf{H}^{l}\) is the node feature matrix of the \(l\)-th layer, \(\mathbf{H}^{0}\ =\ \mathbf{X}\) is the initial node feature, \(\mathbf{W}^{l}\) is the weight matrix of the \(l\)-th layer, and \(\sigma\) is the activation function. **Step2. Multi-scale contrastive learning**  
**1. Local contrastive learning**  
Upon generating the vector embeddings for the two enhanced views, we employed the node contrast loss function, InfoNCE, to learn the node embeddings, effectively capturing the mobility patterns of the crowd at the nodes.