Research Article

STGNN-FAM: A Traffic Flow Prediction Model for Spatiotemporal Graph Networks Based on Fusion of Attention Mechanisms

Table 1

STGNN-FAM model prediction algorithm.

Input: historical traffic flow speed data , historical time step P, forecast time step Q
Output: Predicted traffic flow speed data
(1) Use the Speed2Vec mechanism to process the historical traffic flow speed data into a form that can be sent to the GAT network for calculation
(2) function GAT()
(3)  for i = 1, …, N − 1, N do
(4)   
(5)   
(6)  end for
(7) 
(8) return
(9) end function
(10) Reshape feature output by GAT network back to
(11) for j = P − 1, …, 1, 0 do
(12)   If j = P − 1
(13)    
(14)    
(15)  end for
(16) 
(17) function Attention (H)
(18)  
(19)  
(20) return z
(21) end function
(22) 
(23) return