## 3 Methodology
### Time Domain Feature Extraction Module
#### 3.2.2 Spatial Feature Extraction Based on GAT  
Traffic flow data not only exhibits temporal features but also contains spatial relationships between the data points. While traditional time series models focus on extracting temporal features, modeling the spatial dependencies using network structures and attribute information is also crucial. A graph is composed of nodes and edges, and \(G=\left\{V,E,A\right\}\) is used to define a transportation network. In this context, \(V\) represents the set of nodes, which corresponds to the collection of sensors in the highway system; \(E\) represents the set of edges, indicating the relationships between the nodes, or the connections between pairs of sensors; and \(A\) denotes the network's adjacency matrix, typically a distance-weighted adjacency matrix that represents the connectivity between each node in the road network. By constructing this adjacency matrix, the original data can be transformed into graph data that captures spatial features. In this paper, nodes with a connection are assigned a value of 1, while nodes without a connection are assigned a value of 0, constructing an adjacency matrix that transforms the raw data into graph data \(A_{ij}\) with spatial correlations. During the spatial feature extraction process, \(A_{ij}\) is used as input to learn the correlations between sensors, capturing the spatial relationships within the time series. Traffic conditions can be measured by \(H\) sensors, and the adjacency matrix can represent the relationships between different traffic states. This can be specifically expressed as the following matrix:  
\[X_{(z,t)}= \begin{bmatrix}X_{(z,t_{0}-T+1)}\\ X_{(z,t_{0}-T+2)}\\ \vdots\\ X_{(z,t_{0}-1)}\\ X_{(z,t_{0})}\end{bmatrix} ^{T}= \begin{bmatrix}x_{(z_{1},t_{0}-T+1)}&x_{(z_{1},t_ {0}-T+2)}&\cdots&x_{(z_{1},t-1)}&x_{(z_{1},t_{0})}\\ x_{(z_{2},t_{0}-T+1)}&x_{(z_{2},t_{0}-T+2)}&\cdots&x_{(z_{2},t-1)}&x_{(z_{2},t_ {0})}\\ \vdots&\vdots&\cdots&\vdots&\vdots\\ x_{(z_{2},t_{0}-T+1)}&x_{(z_{2},t_{0}-T+2)}&\cdots&x_{(z_{2},t_{1}-1)}&x_{(z_{ 2},t_{0})}\end{bmatrix}  \tag{4}\]  
where: \(x_{(z_{i},t_{0})}\) denotes the data measured by the i-th sensor \(z_{i}\) at the moment \(t_{0}\); \(T\) denotes the length of historical time. Let \(X_{(z,t)}=\left[x_{(z,t_{0}-T+1)},x_{(z,t_{0}-T+2)},\ldots,x_{(z,t_{0}-1)},x_{ (z,t_{0})}\right]\) denote the traffic flow measured by \(H\) sensors in time period \(T\), where \(x_{(z,t_{0})}=\left[x_{(z_{1},t_{0})},x_{(z_{2},t_{0})},\ldots,x_{(z_{2},t_{0}) }\right]\) denotes the traffic flow of all sensors at moment \(t_{0}\), \(x_{(z_{i},t_{0})}\) denotes the traffic flow of the i-th sensor at moment \(t_{0}\). GAT can deal with irregular and unstructured data. GAT can effectively capture and model complex spatial relationships when extracting spatial features by means of adaptive weight allocation, combination of local and global information, and multi-head attention mechanism, making it suitable for a variety of graph-structured data. Using the attention mechanism, weights are dynamically assigned based on the relationships between nodes, thus focusing on more important neighbor nodes, and each node adaptively calculates a weighted average based on the characteristics and connection strength of its neighbors. The ability to adaptively regulate the attention locally and globally at the same time allows the model to better capture the relationships between nodes and enhances the ability to model complex graph structures. The GAT network is implemented by stacking multiple graph attention layers. The attention coefficients are primarily used to measure the relationship between nodes, representing the influence weight of neighbor node \(j\) on node \(i\). A higher weight indicates greater importance of the neighbor. This mechanism allows GAT to dynamically adjust the information propagation weights.