# Spatial Performance Indicators for Traffic Flow Prediction
## 3 Materials and Methods
### Case Study
#### 3.2.2 Clustering Scenario  
In this study, we considered different clustering scenarios to evaluate and validate whether spatial KPIs can provide information related to the synthetic spatial clusters. We assume that the clusters formed in the traffic flow prediction results are influenced by the spatial characteristics present both in the traffic flow prediction methods and the traffic flow itself. For example, if traffic flow prediction utilizes traffic flow data from neighboring nodes (similar to convolution), we expect a higher positive spatial correlation between nodes with close proximity, resulting in spatially clustered nodes.  
A cluster of nodes with poor prediction accuracies is undesirable and should be avoided because it signals a systematic prediction accuracy problem. However, the average prediction accuracy did not provide any information regarding this. The analogy can be derived from image denoising problems, where speckle noises are harder to denoise compared to salt-and-pepper noises, owing to their multiplicative nature [32].  
\begin{table}
\begin{tabular}{c c} \hline Number of Nodes & 170 \\ Dataset Length & 17,856 \\ Dataset Interval & 5 min \\ Time Range & July 2016–August 2016 \\ Data Types & Traffic flow, traffic speed, occupancy, and adjacency matrix \\ \hline \end{tabular}
\end{table}
Table 1: Summary of the PeMSD8 dataset.  
Figure 2: Adjacency matrix of PeMSD8 datasets.  
A flowchart of the experiments based on traffic flow prediction for calculating the spatial KPIs is shown in Figure 3. We considered the RMSE of each node as the traffic prediction result. The traffic prediction results to be evaluated are a graph with RMSE as its node value, with the graph adjacency matrix defining its structure. Clustering scenarios were created based on the traffic prediction results of STSGCN [7] for the PeMSD8 dataset. Based on the prediction results, we created clusters of nodes with similar node values by swapping the node value of a group of nodes located close to each other with the value of the nodes with the largest or lowest prediction error. The location of the cluster is predetermined by selecting a group of nodes that naturally form a cluster.  
There are two types of clusters based on the node value considered: (1) high node values or hotspot denoted as \"H\" and (2) low node values or coldspot denoted as \"L\". We also considered two different types of cluster' topologies: (1) line clusters and (2) star clusters, as illustrated in Figure 4. The different cluster scenarios and the number of nodes in each cluster are summarized in Table 2. The line HH scenario refers to a scenario in which there are two high-value node clusters or hotspots in the form of a line cluster, and each cluster consists of five nodes. Because we only swap the node values, the topology of the network for both the original scenario and the clustering scenario remained identical. The locations of the clusters were similar for scenarios with similar numbers of clusters and cluster topologies. The locations of the clusters on each clustering scenario are shown in Figure 5. Each scenario had an identical average RMSE and was indistinguishable when evaluated using the standard prediction error measure.  
Figure 3: Flowchart of the experiment.  
Figure 4: Illustration of two types of cluster based on topology: (1) line cluster represented by yellow nodes and (2) star cluster represented by red nodes.  
Figure 5: Location of cluster for each clustering scenario represented by red nodes: (1) “1 Star Cluster” denotes locations for Star H and Star L, (2) “2 Star Clusters” denotes locations for Star HH, Star LL, and Star HL, (3) “1 Line Cluster” denotes locations for Line H and Line L, and (4) “2 Line Clusters” denotes locations for Line HH, Line LL, and Line HL. The graph network is automatically generated based on the adjacency matrix and does not represent real location.