# Dynamic Graph Convolutional Crowd Flow Prediction Model Based on Residual Network Structure
## 3 Proposed Method
### Loss Function  
To facilitate the training of the model, this paper combines prediction training with region segmentation training to achieve better solutions. We shall introduce the two tasks successively in this section. Prediction Training Task. Since the SA module and ScondConv module are added to the original model in this paper, it increases the complexity of the model, which will lead to overfitting. Secondly, the analysis of the dataset used for this experiment using the 3-Sigma criterion shows (see Section 4.1) that there are a large number of outliers in it. Therefore, in this paper, Huber loss is chosen as the loss function to replace the mean square error (MSE) loss function used in the original model, which outperforms the MSE loss function in both problems mentioned above. The Huber loss function has the following advantages: (1) Strong Robustness: Compared to the Mean Squared Error (MSE) function, the Huber loss is less sensitive to outliers. It can better adapt to data with a higher presence of noise or outliers. (2) Continuously Differentiable: The Huber loss is continuously differentiable for the majority of points, which allows it to be used in conjunction with other continuously differentiable optimization methods such as backpropagation and the Adam optimizer. This facilitates the process of solving model parameters. (3) Parameter Control: During the parameter estimation process, the Huber loss can balance the convergence speed and robustness to outliers through the parameter \(\alpha\). Compared to more traditional approaches for handling outliers, it provides a better balance. Equation (8) depicts the loss function for the prediction task:  
\[L_{Huber}\big{(}Y,\hat{Y}\big{)}=\begin{cases}\frac{1}{2}\big{(}Y-\hat{Y} \big{)}^{2},\big{|}Y-\hat{Y}\big{|}\leq\alpha\\ \alpha\big{|}Y-\hat{Y}\big{|}-\frac{1}{2}\alpha^{2},\big{|}Y-\hat{Y  
may have different functions in the city, such as residential or commercial areas. Different regions exhibit similar temporal trends during the same time intervals on workdays or holidays. Therefore, using the traffic road network to perform irregular segmentation of regions is more suitable for data analysis and learning spatial-temporal correlations.  
To solve the aforementioned issues, [PERSON] et al. [11] proposed a method in which nodes are partitioned into separate subsets, and different parameter weights are assigned to each partition. The number of partitions is fixed, while the number of nodes within each partition varies. They utilized POI (Point of Interest) data to aggregate the attributes of each region, transforming nodes into regions with POI attributes. The original model used K-means clustering to group the POI features \(f\) of \(N\) regions into K partitions. The partition of region \(v_{i}\) is represented as \(\{\Omega_{i}|i=1,2,3,\ldots,K\}\). Spatial GCN layers were employed for node partitioning, with node features \(F\in R^{N\
eq|C|}\) as the input. The expression for the output \(Z\) is given by Equation (9):  
\[Z=Softmax\left(\overset{-}{A}\sigma\left(\overset{-}{A}FV_{(1)}^{s}\right)W_{( 2)}^{s}\right) \tag{9}\]  
where \(W_{(1)}^{s}\in R^{|C|*C^{\prime}}\) and \(W_{(2)}^{s}\in R^{C*K}\) are the parameters for each layer, where \(C^{\prime}\) represents the number of channels in the hidden layer. Since the GCN model in this study does not consider the temporal relationship of the data, the average of \(\hat{A}_{t}\) is used as the adjacency matrix. The average is computed as \(\overset{-}{A}=\frac{1}{T}\sum\limits_{t=0}^{T}\hat{A}_{t}\), where \(\hat{A}_{t}\) is the normalized adjacency matrix with self-loops at time t, and T is the total number of time slices in the dataset.