Probability traffic flow prediction method based on road impedance and principal component analysis
By combining road impedance with principal component analysis, a dynamic impedance map is generated and orthogonalized, which solves the problem of insufficient handling of uncertainty causes and spatiotemporal correlation in existing traffic flow prediction, and realizes efficient and accurate traffic flow prediction and uncertainty estimation.
Patent Information
- Application Number
- CN202511562871.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-29
- Publication Date
- 2026-02-10
AI Technical Summary
Existing probabilistic traffic flow prediction methods fail to effectively reveal the causes of uncertainty, lack guidance from traffic domain knowledge, and struggle to efficiently handle spatiotemporal correlations, resulting in insufficient prediction accuracy and interpretability.
By integrating road impedance and principal component analysis, a dynamic impedance map is generated and subjected to Schmitt orthogonalization. The principal component network is then optimized by combining directional constraint loss and variance magnitude loss to generate spatiotemporal principal components for traffic flow prediction.
It achieves more accurate point prediction and more reliable uncertainty estimation, improves the computational efficiency and interpretability of the model, and is applicable to traffic flow prediction in different cities and at different times.
Smart Images

Figure CN121505852A_ABST
Abstract
Description
Technical Field
[0001] This disclosure belongs to the interdisciplinary field of intelligent transportation and machine learning, specifically involving a probabilistic traffic flow prediction method based on road impedance and principal component analysis. Background Technology
[0002] Traffic flow prediction is a core function of intelligent transportation systems. By analyzing historical traffic data patterns, it forecasts future traffic conditions, which is crucial for improving road network efficiency and alleviating traffic congestion. With the widespread adoption of navigation and travel services, providing only single-point predictions is no longer sufficient to meet practical needs. For example, sudden accidents during peak hours can cause drastic fluctuations in traffic flow. In such cases, not only are predicted values needed, but also their uncertainty needs to be assessed to determine the risk level and prediction reliability. Therefore, probabilistic traffic flow prediction (PTFF) has become a research hotspot, aiming to simultaneously output point prediction results and quantify uncertainty information.
[0003] Existing probabilistic prediction methods can be mainly divided into three categories: First, approximate Bayesian inference methods, such as Monte Carlo Dropout (MC Dropout) and DeepAR, which approximate the posterior distribution through multiple sampling, but have low computational efficiency and are difficult to capture spatiotemporal correlations; second, generative probabilistic models, such as DiffSTG based on diffusion models and STGNF based on normalized flow, which can fit complex distributions, but lack guidance from traffic mechanisms and have poor interpretability; and third, distribution parameterization methods, such as DER and SDER, which directly estimate distribution parameters, but ignore spatiotemporal joint variation, and the estimation results are often biased.
[0004] Existing methods suffer from two key shortcomings: First, they fail to reveal the causes of uncertainty—traffic fluctuations originate from vehicle movement between road segments, influenced by physical factors such as capacity and congestion, mechanisms that purely data-driven methods cannot model. Second, they do not efficiently handle spatiotemporal correlations—traffic flow is high-dimensional spatiotemporal data, making direct estimation of the covariance matrix computationally expensive, and traditional dimensionality reduction methods (such as static PCA) ill-suited to dynamic changes. These issues limit the accuracy, interpretability, and efficiency of existing methods, making them unsuitable for practical applications. Summary of the Invention
[0005] In view of the above-mentioned defects or deficiencies in the prior art, this disclosure aims to provide a probabilistic traffic flow prediction method and device based on road impedance and principal component analysis. By integrating traffic domain knowledge with spatiotemporal principal component learning, it achieves more accurate point prediction, more reliable uncertainty estimation and higher computational efficiency, while enhancing model interpretability.
[0006] To achieve one or more of the above objectives, this disclosure provides the following aspects.
[0007] According to a first aspect of this disclosure, a probabilistic traffic flow prediction method based on road impedance and principal component analysis is provided, comprising: acquiring historical traffic flow data, road network map, and road characteristic data of the area to be predicted; calculating historical road impedance based on the historical traffic flow data and road characteristic data; generating a dynamic impedance map based on the road network map and historical road impedance; inputting the historical traffic flow data and dynamic impedance map into a principal component network to generate an initial principal component representation; performing Schmitt orthogonalization on the initial principal component representation to generate spatiotemporal principal components; optimizing the principal component network based on directional constraint loss and variance magnitude loss; and generating a sample set along the direction of each spatiotemporal principal component based on the optimized principal component network and calculating the mean and variance of the sample set as point prediction and uncertainty estimation of traffic flow, respectively.
[0008] According to an exemplary embodiment, historical road impedance is calculated using the following road impedance function:
[0009]
[0010] Among them, T a (X) represents the historical road impedance of road segment a, t a Let X represent the free-flow travel time of road segment a, and let C represent the observed traffic flow value of road segment a. a σ represents the road capacity of road segment a. a and μ a α and β are the standard deviation and mean of the historical traffic flow data for road segment a, respectively, where α = 0.15 and β = 4.
[0011] According to an exemplary embodiment, generating a dynamic impedance map includes: extracting features from historical road impedances using a fully connected encoder to generate a hidden representation; calculating attention weights based on the hidden representation using a temporal attention mechanism, and determining future road impedances based on the attention weights; and generating the dynamic impedance map based on a road network map and future road impedances using the following formula:
[0012]
[0013] in, This represents the weight of segment a to segment b in the dynamic impedance diagram. This indicates an indicator function; if road segments a and b are connected, then... Otherwise, it is 0; FC(·) is a fully connected network; R a The hidden representation of the future road impedance of road segment a; and R b This represents the hidden representation of the future road impedance of road segment b.
[0014] According to an exemplary embodiment, generating an initial principal component representation includes: generating traffic flow mean prediction data based on historical traffic flow data and a road network map by predicting and training a mean predictor; extracting features from the historical traffic flow data and the traffic flow mean prediction data using an encoder to generate a hidden representation; generating temporal features by convolving the hidden representation using a temporal convolutional network, and then using a graph convolutional network to aggregate spatial features from the temporal features based on the road network map and a dynamic impedance map to generate spatial features; and generating an initial principal component representation based on the spatial features using a decoder.
[0015] According to an exemplary embodiment, the orientation constraint loss is calculated using the following formula:
[0016]
[0017] The variance magnitude loss is calculated using the following formula:
[0018]
[0019] in, This represents centralized traffic flow data. Represents real future traffic flow data. L represents predicted future traffic flow data. D L represents the directional constraint loss. V This represents the variance magnitude loss, K represents the number of principal components, k represents the index, and w k Let k be the orthogonalized spatiotemporal principal component, and This represents a temporary variable for orthogonalization.
[0020] According to an exemplary embodiment, the fully connected encoder consists of multiple fully connected layers, each followed by an activation function, which converts a one-dimensional sequence of historical road impedances into a high-dimensional hidden representation.
[0021] According to an exemplary embodiment, the graph convolutional network performs spatial feature aggregation based on the dynamic impedance map using the following formula: in This represents the spatial characteristics of the (l+1)th layer. This represents the spatial characteristics of the l-th layer. Let σ(·) represent the learnable weight matrix, and let σ(·) represent the activation function. This represents a dynamic impedance diagram.
[0022] According to an exemplary embodiment, the pre-trained mean predictor is a PDFormer model, which is trained using historical traffic flow data and is used to capture the spatiotemporal dependencies of traffic flow to output an initial mean prediction.
[0023] According to an exemplary embodiment, the temporal convolutional network adopts a causal convolutional structure with a preset kernel size, and captures long-term temporal dependencies of traffic flow by stacking multiple convolutional layers.
[0024] According to an exemplary embodiment, the overall loss function during model training is: in This is the impedance mean square error loss. For directional constraint loss, The variance magnitude loss is represented by λ1 and λ2, which are hyperparameters. λ1 is fixed at 1, and λ2 increases linearly from 0 to 1.
[0025] According to a second aspect of this disclosure, a probabilistic traffic flow prediction device based on road impedance and principal component analysis is provided, comprising: a data acquisition module configured to acquire historical traffic flow data, a road network map, and road characteristic data of the area to be predicted; a historical road impedance module configured to calculate historical road impedance based on historical traffic flow data and road characteristic data; a dynamic impedance map generation module configured to generate a dynamic impedance map based on the road network map and historical road impedance; a principal component network module configured to input historical traffic flow data and the dynamic impedance map into the principal component network to generate an initial principal component representation; a principal component orthogonalization module configured to perform Schmitt orthogonalization on the initial principal component representation to generate spatiotemporal principal components; an optimization module configured to optimize the principal component network based on directional constraint loss and variance magnitude loss; and a probabilistic prediction generation module configured to use the optimized principal component network to generate a sample set along the direction of each spatiotemporal principal component and calculate the mean and variance of the sample set as traffic flow point prediction and uncertainty estimation, respectively.
[0026] According to a third aspect of this disclosure, a probabilistic traffic flow prediction method based on road impedance and principal component analysis is provided, comprising the following steps:
[0027] Step S1: Obtain historical traffic flow data, road network map, and road feature data for the area to be predicted; wherein, the historical traffic flow data is denoted as X. H ∈R τ×N τ represents the number of historical time steps, and N represents the number of road segment nodes in the road network; the road network graph is represented by a node set V, an edge set E, and an adjacency matrix A, reflecting the connectivity between road segments; road feature data is denoted as P∈R. N×4 Includes the free-flow travel time t for each road segment. a Observe the maximum traffic flow X max Historical average speed s mean and historical average market share mean .
[0028] Step S2: Based on the data obtained in step S1, calculate the historical road impedance and road capacity; whereby the road capacity C... a Estimate using the following formula:
[0029]
[0030] In the formula, s a o a X was observed on road segment a. max Speed and occupancy at any time; if only traffic flow data is available, X can be taken. max As C a Replacement value; historical road impedance R H ∈R τ×N The modified BPR function is used for calculation, as shown in the following formula:
[0031]
[0032] In the formula, X represents the traffic flow on road segment a, and σ a μ a Here, α = 0.15 and β = 4 are the standard deviation and mean of historical traffic flow for road segment a, respectively, with empirical parameters T. a (X) represents the road impedance of road segment a.
[0033] Step S3: Construct the impedance evolution network and generate a dynamic impedance diagram; specifically including:
[0034] Historical road impedance R is obtained through a fully connected encoder. H Convert to compact hidden representation Right now F represents the hidden dimension;
[0035] Using a time attention mechanism to infer future road impedance R P Attention weight α i,j The calculation is as follows:
[0036]
[0037] In the formula, W Q W K W V ∈R F×F For learnable parameters, Let be the hidden representations at time steps i and j, respectively; and let be the impedance representation at the future time step i. The impedance of all future time steps constitutes R P ;
[0038] Dynamic impedance diagrams are generated by combining road network connectivity. (T is the number of prediction time steps), the formula is as follows:
[0039]
[0040] In the formula, FC(·) is a fully connected network used to decode the impedance as an impedance value; As an indicator function, if road segments a and b are connected (A a,b If the value is greater than 0, then it is 1; otherwise, it is 0. It reflects the directional traffic shift trend from road segment a to b.
[0041] Step S4: Construct a principal component network to predict spatiotemporal principal components; specifically including:
[0042] A pre-trained PDFormer model is used as the mean predictor to output the initial mean traffic flow prediction. Right now G = (V, E, A) is the road network diagram;
[0043] splicing X H and Hidden representation h extracted by encoder C ∈R T×N×F ,Right now
[0044] h is processed using L spatiotemporal graph blocks (ST-GraphBlocks) C Each spatiotemporal patch first uses a Temporal Convolutional Network (TCN) to capture temporal dependencies, as shown in the following formula:
[0045] h T =TCN(W T ,h C )
[0046] In the formula, W T ∈R k×F×F' The TCN convolutional kernel is used, where k is the kernel size and F' is the temporal feature dimension; then, a graph convolutional network (GCN) based on the dynamic impedance map is employed. To capture spatial dependencies, the formula is as follows:
[0047]
[0048] In the formula, W is the normalized form of the road network adjacency matrix. G ∈R F'×F' Here are the learnable parameters of GCN, and σ(·) is the ReLU activation function;
[0049] The decoder outputs the initial principal component representation d∈R K×T×N That is, d = Decoder(h) G K is the number of principal components.
[0050] Step S5: Perform Schmitt orthogonalization on the initial principal components to obtain the spatiotemporal principal components; specifically: for the k-th initial principal component d k First, calculate the orthogonalization temporary variable:
[0051]
[0052] Then perform unit norm normalization:
[0053]
[0054] In the formula, <·,·> F For the Frobenius inner product, ||·|| F Let w be the Frobenius norm; all orthogonalized principal components constitute w∈R K×T×N .
[0055] Step S6: Train the probabilistic traffic flow prediction model; the overall loss function of the model is as follows:
[0056] L=λ1L R +λ2(L D +L V )
[0057] In the formula, This is the impedance mean square error loss, used to monitor the accuracy of dynamic impedance prediction; For direction constraint loss ( To centralize the real traffic flow, ensure that the principal components fit the direction of the greatest change in traffic flow; To mitigate variance magnitude loss, the variance quantization accuracy in the principal component directions is constrained.
[0058] During training, λ1 = 1 and λ2 = 0 were fixed first to train the impedance evolution network; then, during the 20th to 50th epochs, λ2 was linearly increased from 0 to 1 to jointly train the principal component network; the Adam optimizer was used, the batch size was 12, and the initial learning rate was 1e-4; the data was divided into training set, validation set, and test set in a 6:2:2 ratio, and the Z-score was normalized using training set statistics.
[0059] Step S7, generate probabilistic traffic flow prediction results; specifically:
[0060] Based on the trained model, mean prediction is generated by expanding along the spatiotemporal principal component direction:
[0061]
[0062] In the formula, Variance in the principal component direction, t kThe coefficients are scalars (determined by binary search on the validation set); the mean of the sample set S is calculated as the final point prediction μ, and the variance is calculated as the uncertainty estimate σ.
[0063] As a preferred embodiment of this disclosure, the pre-trained mean predictor in step S4 can be replaced by STGCN, GMAN or ASTGNN models in addition to PDFormer, and the basic accuracy of the initial mean prediction can be ensured by pre-training on historical traffic flow data.
[0064] In a preferred embodiment of this disclosure, the number of spatiotemporal tiles in step S4 is L=16, and the number of temporal attention heads is 12; for road networks with fewer than 300 nodes (such as PEMS04 and PEMS08), the hidden dimension F=32; for road networks with more than 300 nodes (such as PEMS03 and Seattle), the hidden dimension F=64, in order to balance model capacity and computational efficiency.
[0065] As a preferred embodiment of this disclosure, the number of principal components K=3 in step S5. Experimental verification shows that the first 3 principal components can capture more than 90% of the information in the traffic flow covariance structure, taking into account both dimensionality reduction effect and uncertainty quantification accuracy.
[0066] According to a fourth aspect of this disclosure, a probabilistic traffic flow prediction device based on road impedance and principal component analysis is provided, including a data acquisition module, an impedance calculation module, an impedance evolution network module, a principal component network module, a model training module, and a prediction output module. The system comprises the following modules: a data acquisition module, a data processing module, and a model training module. The data acquisition module collects historical traffic flow data, road network maps, and road feature data for the area to be predicted, and performs data format standardization and missing value imputation. An impedance calculation module, connected to the data acquisition module, estimates road capacity based on road feature data and calculates historical road impedance using an improved BPR function. An impedance evolution network module, connected to the impedance calculation module, includes an encoder, a time attention submodule, and a dynamic impedance map generation submodule. This module evolves historical road impedance into future impedance and generates a dynamic impedance map. A principal component network module, connected to both the data acquisition and impedance evolution network modules, includes a mean prediction submodule, a spatiotemporal plot submodule, a decoder, and an orthogonalization submodule. This module predicts initial principal components and performs orthogonalization to obtain spatiotemporal principal components. A model training module, connected to both the impedance evolution and principal component network modules, defines the overall loss function and optimizes model parameters using a phased training strategy. A prediction output module, connected to the principal component network module, generates a sample set based on the spatiotemporal principal components, calculates and outputs the final point prediction results and uncertainty estimates.
[0067] The technical solution provided in this disclosure has the following beneficial effects: By combining road impedance with principal component analysis, a probabilistic traffic flow prediction method and device are constructed, effectively solving the problem of insufficient prediction accuracy caused by single-factor analysis in traditional traffic flow prediction. Principal component analysis can extract key influencing factors from massive and complex traffic data, reducing data redundancy and improving computational efficiency; the introduction of the road impedance model fully considers the dynamic impact of real-time traffic conditions on traffic flow, not only capturing vehicle directional transfer patterns driven by road capacity and congestion levels, but also revealing the core causes of traffic flow uncertainty, such as... Figure 1 The traffic flow fluctuations caused by the transfer of traffic between road segments, shown in (a) in the figure, solve the problem that purely data-driven methods cannot model such physical mechanisms. Furthermore, it clarifies the relationship between impedance differences and traffic flow changes, such as... Figure 2 As shown in (a), traffic flow shifts from high-impedance road sections to low-impedance road sections, and specific road sections exhibit clear inflow or outflow trends due to impedance characteristics, improving model interpretability and making prediction results more consistent with real-world scenarios. This method and device not only rapidly process multi-source heterogeneous traffic data to achieve high-precision probabilistic prediction of traffic flow, but also possess excellent generalization capabilities, making them applicable to traffic flow prediction scenarios in different cities and time periods. This provides strong data support for traffic management departments to formulate scientific traffic management strategies and optimize traffic resource allocation. Furthermore, it provides more accurate prediction basis for the real-time navigation and route planning functions of intelligent transportation devices, significantly improving urban traffic efficiency and public travel experience. The above-mentioned technical solutions of this disclosure only need to achieve one of the aforementioned effects; it is not required that each technical solution achieve all of the above-mentioned technical effects.
[0068] Furthermore, the effects of this disclosure include not only those set forth herein, but also other effects that will be apparent to those skilled in the art upon reference to the claims, the specification, and the accompanying drawings. Attached Figure Description
[0069] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0070] Figure 1 It is a diagram showing the patterns of traffic shifting affected by traffic flow and road type;
[0071] Figure 2 It is a graph showing the road impedance in reality and the changes in road impedance over a certain period of time;
[0072] Figure 3 This is an overall flowchart of the probabilistic traffic flow prediction method in the embodiments of this disclosure;
[0073] Figure 4 This is a schematic diagram of the impedance evolution network in an embodiment of this disclosure;
[0074] Figure 5 This is a schematic diagram of the internal structure of the spatiotemporal block in an embodiment of this disclosure; and
[0075] Figure 6 This is a schematic diagram of the principal component network structure in an embodiment of this disclosure.
[0076] in, Figure 3 S1-S7 correspond to the seven core steps of the method disclosed herein, namely, “data acquisition”, “impedance and capacity calculation”, “dynamic impedance map generation”, “principal component prediction”, “principal component orthogonalization”, “model training”, and “probability result output”. Figure 4 The diagram illustrates the connection relationships between the encoder, the time attention submodule, and the dynamic impedance map generation submodule. Figure 5 The input, output, and parameters of TCN and GCN are clearly labeled. Figure 6 The document demonstrates the collaborative workflow of the mean predictor, encoder, spatiotemporal plot, decoder, and orthogonalization submodule. Detailed Implementation
[0077] The technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this disclosure, and not all of them. The components of the embodiments of this disclosure described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. It should be noted that, unless otherwise specified, the embodiments and features in the embodiments of this disclosure can also be combined with each other.
[0078] It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. In the description of this disclosure, the terms "first," "second," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0079] Existing probabilistic traffic flow prediction methods suffer from two core problems: first, the lack of guidance from traffic domain knowledge makes it impossible to reveal the causes of uncertainty, resulting in poor interpretability; second, directly modeling high-dimensional spatiotemporal covariance is costly and makes it difficult to efficiently capture the spatiotemporal correlation of uncertainty. Based on this, this application provides a probabilistic traffic flow prediction method and apparatus based on road impedance and principal component analysis. By integrating road impedance theory with spatiotemporal principal component learning, it achieves more reliable uncertainty estimation and more accurate point prediction, while balancing computational efficiency and model interpretability.
[0080] This disclosure provides a probabilistic traffic flow prediction method based on road impedance and principal component analysis. For example... Figure 3 As shown, the probabilistic traffic flow prediction method based on road impedance and principal component analysis according to an embodiment of this disclosure includes: acquiring historical traffic flow data, road network map, and road feature data of the area to be predicted (S1); calculating historical road impedance based on historical traffic flow data and road feature data (S2); generating a dynamic impedance map based on the road network map and historical road impedance (S3); inputting historical traffic flow data and dynamic impedance map into a principal component network to generate an initial principal component representation (S4); performing Schmitt orthogonalization on the initial principal component representation to generate spatiotemporal principal components (S5); optimizing the principal component network based on directional constraint loss and variance magnitude loss (S6); and generating a sample set along the direction of each spatiotemporal principal component based on the optimized principal component network and calculating the mean and variance of the sample set as point prediction and uncertainty estimation of traffic flow, respectively (S7).
[0081] Step S1: Obtain historical traffic flow data, road network map, and road characteristic data for the area to be predicted. The historical traffic flow data is denoted as X. H ∈R τ×N Where τ is the number of historical observation time steps, N is the total number of road segment nodes in the road network, and X H Each element represents the traffic flow observation value of the corresponding time step and the corresponding road segment; the road network map is represented by a graph structure G = (V, E, A), reflecting the connectivity between road segments, where V is the set of road segment nodes, E is the set of connecting edges between road segments, and A ∈ R. N×N Given an adjacency matrix, if road segment i is connected to road segment j, then A i,j =1, otherwise A i,j =0; Road feature data is denoted as P∈R N×4 Includes the free-flow travel time t for each road segment. a (a∈V), historical maximum traffic flow X max Historical average speed of the entire road network (s) mean and the historical average occupancy rate of the entire road network. mean , where t a X is calculated from the road segment length and speed limit. max smean o mean It was obtained from historical traffic flow data.
[0082] This step requires preprocessing the acquired data: missing values in historical traffic flow data are filled using linear interpolation of observations from adjacent time steps; isolated nodes (road segments without connected edges) in the road network map are removed or connected based on the actual road network topology; outliers in road feature data, such as values exceeding a reasonable range, are addressed. a The 3σ criterion is used to identify and replace the average value of the road segment type.
[0083] Step S2: Based on the data obtained in step S1, calculate the historical road impedance and road capacity. For example, based on historical traffic flow data X... H Using road characteristic data P, historical road impedance R is calculated using an improved road impedance function. H ∈R τ×N .
[0084] According to an exemplary embodiment, historical road impedance is calculated using the following road impedance function:
[0085]
[0086] Among them, T a (X) represents the historical road impedance of road segment a, t a Let X represent the free-flow travel time of road segment a, and let C represent the observed traffic flow value of road segment a. a σ represents the road capacity of road segment a. a and μ a α and β are the standard deviation and mean of the historical traffic flow data for road segment a, respectively, where α = 0.15 and β = 4.
[0087] Based on the road feature data obtained in step S1, the road capacity of each road segment is first estimated, and then the historical road impedance is calculated by combining historical traffic flow data, which provides a basis for subsequent dynamic impedance evolution.
[0088] Road capacity estimation: Road capacity C a (a∈V) is the core indicator for measuring the traffic flow capacity of a road segment, and its estimation formula is as follows:
[0089]
[0090] In the formula, s a X was observed in road segment a max The speed at time, O a X was observed in road segment a max The occupancy rate at that time; if only historical traffic flow data is available (without speed and occupancy information), then X can be taken. maxAs C a The alternative value, namely C a =X max .
[0091] Historical road impedance calculation: Road impedance is used to quantify the degree of road congestion and is a key factor influencing vehicle movement behavior. This disclosure employs a modified BPR function, introducing a traffic flow variability coefficient to reflect the impact of flow fluctuations on impedance. Historical road impedance R H ∈R τ×N The improved BPR function calculation formula is as follows:
[0092]
[0093] In the formula, T a (X) represents the road impedance of road segment a, and X represents the observed traffic flow value of road segment a; σ a Let μ be the standard deviation of historical traffic flow for road segment a. a The mean of historical traffic flow for road segment a, and the two together constitute the coefficient of variation. Used to capture the degree of fluctuation in traffic flow; α and β are empirical parameters in the traffic field, used to characterize the nonlinear relationship between flow and impedance, for example, α = 0.15 and β = 4.
[0094] The greater the fluctuation in traffic flow (the larger the σ_a / μ_a), the more unstable it is, fluctuating between smooth and congested traffic. Drivers find it increasingly difficult to predict its state, resulting in a greater subjectively perceived "impedance." This transforms the statistical quantity of uncertainty into a physical quantity influencing driver behavior. It allows impedance to reflect not only the degree of congestion but also the reliability or uncertainty of a road segment, converting uncertainty into perceived impedance. This process transforms raw traffic flow data into road impedance data that reflects the nature of congestion and the causes of uncertainty.
[0095] Perform the above calculations on all historical time steps and all road segments to obtain the historical road impedance matrix R. H ∈R τ×N ,in
[0096] Step S3: Construct the impedance evolution network and generate a dynamic impedance diagram. The core function of the impedance evolution network is to learn the temporal evolution of impedance based on historical road impedance, infer future impedance, and generate a dynamic impedance map to capture directional traffic transfer patterns.
[0097] According to an exemplary embodiment, generating a dynamic impedance map includes: extracting features from historical road impedances using a fully connected encoder to generate a hidden representation; calculating attention weights based on the hidden representation using a temporal attention mechanism, and determining future road impedances based on the attention weights; and generating the dynamic impedance map based on a road network map and future road impedances using the following formula:
[0098]
[0099] in, This represents the weight of segment a to segment b in the dynamic impedance diagram. This indicates an indicator function; if road segments a and b are connected, then... Otherwise, it is 0; FC(·) is a fully connected network; R a The hidden representation of the future road impedance of road segment a; and R b This represents the hidden representation of the future road impedance of road segment b.
[0100] Traditional graph convolutional networks use a static, predefined adjacency matrix A, whose values are typically binary (0 or 1) or distance-based weights that do not change over time. It is based on the predicted future impedance value R a and R b The impedance difference is calculated and therefore varies over time, directly representing the congestion difference between two road segments. Thus, the impedance difference is transformed into a dynamic spatial relationship weight.
[0101] The impedance evolution network includes an encoder, a time attention submodule, and a dynamic impedance map generation submodule. The specific process is as follows: Figure 4 As shown.
[0102] Historical road impedance R is obtained through a fully connected encoder. H The historical impedance sequence is transformed into a compact hidden representation using a fully connected encoder. This transformation captures the complex features of the impedance. The formula is as follows:
[0103]
[0104] In the formula, F represents the encoded hidden representation, and F is the hidden dimension.
[0105] According to an exemplary embodiment, the fully connected encoder consists of multiple fully connected layers, each followed by an activation function, which converts a one-dimensional sequence of historical road impedances into a high-dimensional hidden representation.
[0106] The Encoder() function consists of multiple fully connected layers, each followed by a ReLU activation function.
[0107] Encoder(x) = σ(W) l ×σ(W1x+b1)+b l )
[0108] Where W1,…,W l Let b1,…,b be the weight matrix of the fully connected layer. l Let σ be the bias vector, and σ(·) be the ReLU activation function.
[0109] Future impedance inference employs a temporal attention mechanism, inferring the impedance representation for future time steps based on the hidden representation of historical impedance. First, the attention weights between time steps are calculated, as follows:
[0110]
[0111] In the formula, α i,j W represents the attention weight of the j-th historical time step to the i-th future time step. Q W K W V ∈R F×F A learnable query, key, and value matrix; These are the impedance hidden representations for time steps i and j, respectively.
[0112] Based on the attention weights, a weighted summation is performed to obtain the impedance hiding representation for future time steps:
[0113]
[0114] In the formula, Let be the impedance hiding representation for the i-th future time step; perform the above calculation for all future time steps (a total of T) to obtain the future impedance hiding representation.
[0115] Dynamic impedance map generation, combined with road network connectivity, decodes the hidden representation of future impedance into impedance values and calculates the impedance differences between road segments to generate a dynamic impedance map. First, the impedance values are decoded through a fully connected network (FC):
[0116]
[0117] In the formula, R a Let be the future impedance value of road segment a, and FC(·) be a single-layer fully connected network used to map the high-dimensional hidden representation to a one-dimensional impedance value.
[0118] Then, based on impedance differences and road network connectivity, a dynamic impedance diagram is generated. (T is the number of prediction time steps), the formula is as follows:
[0119]
[0120] In the formula, The weights from segment a to segment b in the dynamic impedance diagram; As an indicator function, if road segments a and b are connected (A a,b =1) then Otherwise, it is 0; the negative sign is used to convert "impedance difference" into "traffic shift trend"—if the impedance of road segment a is higher than that of road segment b, then A positive value indicates that the vehicle is more likely to move from a to b.
[0121] Step S4: Construct a principal component network to predict spatiotemporal principal components. For example, use historical traffic flow data X... H With dynamic impedance diagram Inputting a principal component network yields the initial principal component representation d∈R. K×T×N .
[0122] According to an exemplary embodiment, generating an initial principal component representation includes: generating traffic flow mean prediction data based on historical traffic flow data and a road network map; extracting features from the historical traffic flow data and the traffic flow mean prediction data using an encoder to generate a hidden representation; convolving the hidden representation to generate temporal features, and then using a graph convolutional network to aggregate spatial features based on the road network map and a dynamic impedance map to generate spatial features; and generating an initial principal component representation based on the spatial features using a decoder.
[0123] The core function of the Principal Component Network (PCN) is to predict the dominant eigenvectors (spatiotemporal principal components) of the future traffic flow covariance based on historical traffic flow data and dynamic impedance maps, thus achieving compact modeling of uncertain spatiotemporal correlations. The network includes a mean predictor, encoder, spatiotemporal tiles, decoder, and orthogonalization submodules. The specific process is as follows: Figure 5 As shown.
[0124] Initial mean prediction: A pre-trained mean predictor is used to output the initial mean prediction of future traffic flow based on historical traffic flow data and road network map. The formula is as follows:
[0125]
[0126] In the formula, The initial mean prediction result is used; MeanPredictor(·) is a pre-trained spatiotemporal prediction model (such as PDFormer, STGCN, etc.) used to capture the spatiotemporal dependencies of traffic flow. Its training process is independent of the principal component network and only needs to minimize the mean square error (MSE) between the predicted value and the true value.
[0127] Data splicing and encoding: Historical traffic flow data and initial mean prediction results are spliced together to form a complete "history-future" data sequence, and then the hidden representation is extracted through an encoder.
[0128]
[0129] In the formula, Indicates splicing X along the time dimension H and Get R (τ+T)×N Data sequence; h C ∈R T×N×F For the encoded hidden representation, the Encoder(·) structure is the same as the encoder in step S3, both being multi-layer fully connected networks.
[0130] Spatiotemporal tile processing: L stacked spatiotemporal tiles (ST-GraphBlocks) are used in conjunction with a dynamic impedance map to simultaneously capture the temporal and spatial dependencies of traffic flow. Each spatiotemporal tile includes a Temporal Convolutional Network (TCN) and a Graph Convolutional Network (GCN), with the internal structure as follows: Figure 6 As shown.
[0131] Temporal Convolutional Networks (TCNs) employ a causal convolutional structure with a preset kernel size. They capture long-term temporal dependencies in traffic flow by stacking multiple convolutional layers. The formula for modeling temporal dependencies using a causal convolutional TCN to capture these dependencies is as follows:
[0132] h T =TCN(W T ,h C )
[0133] In the formula, h T ∈R T×N×F' For time feature representation; W T ∈R k×F×F' Let k be the causal convolution kernel of TCN, and k be the kernel size; the calculation process of TCN(·) is as follows: Where h T,t h C,t-s The time features at time step t and the hidden representation at time step ts are respectively used to ensure that the convolution operation does not depend on future data.
[0134] Spatial Dependency Modeling (GCN): Based on Dynamic Impedance Maps The spatial dependency of traffic flow is captured by aggregating the features of adjacent road segments using GCN, as shown in the following formula:
[0135]
[0136] In the formula, h G ∈R T×N×F' Representation of spatial features; This is the normalized form of the road network adjacency matrix A, i.e. (D is the degree matrix of A+I, and I is the identity matrix); This represents the splicing of a normalized adjacency matrix and a dynamic impedance map along the channel dimension, integrating a fixed road network topology with dynamic traffic transfer trends; W G ∈R F'×F' Let be the learnable weight matrix of GCN; σ(·) is the ReLU activation function.
[0137] Initial principal component prediction: The spatiotemporal feature representation is mapped to the initial principal component representation through the decoder, as shown in the following formula:
[0138] d = Decoder(h) G )
[0139] In the formula, d∈R K×T×N The initial principal component representation is K, which is the number of principal components to be predicted. The Decoder(·) consists of multiple TCN layers and one fully connected layer. First, the TCN further captures the time dependence of the principal components, and then the fully connected layer maps the feature dimensions to K principal component channels.
[0140] According to an exemplary embodiment, the graph convolutional network performs spatial feature aggregation based on the dynamic impedance map using the following formula: in This represents the spatial characteristics of the (l+1)th layer. This represents the spatial characteristics of the l-th layer. Let σ(·) represent the learnable weight matrix, and let σ(·) represent the activation function. This represents a dynamic impedance diagram.
[0141] Step S5 involves performing Schmitt orthogonalization on the initial principal components. To ensure that the predicted principal components satisfy the properties of "orthogonality" and "unit norm" (which conform to the mathematical definition of principal component analysis), Schmitt orthogonalization needs to be performed on the initial principal component representation d. For example, performing Schmitt orthogonalization on the initial principal component representation d yields the spatiotemporal principal component w∈R. K×T×N The process is as follows: Figure 6 As shown.
[0142] For the k-th initial principal component d k (k∈[1,K]), the orthogonalization process consists of two steps:
[0143] Projection to eliminate correlation: Calculate d k The projection onto the orthogonalized first k-1 principal components, and from d k Subtracting the projection from the middle yields the orthogonalized temporary variable:
[0144]
[0145] In the formula, For orthogonalization of temporary variables; <·,·>F The Frobenius inner product is used to calculate the similarity between two tensors, i.e. w i Let i be the i-th orthogonalized principal component.
[0146] Unit norm normalization: for Normalize it to ensure its norm is 1:
[0147]
[0148] In the formula, ||·|| F It is the Frobenius norm, i.e. w k It is the kth orthogonalized spatiotemporal principal component.
[0149] Perform the above operation on all K initial principal components to obtain the final spatiotemporal principal component matrix w∈R. K×T×N .
[0150] Step S6: Train the probabilistic traffic flow prediction model. Model training employs a phased strategy: first, train the impedance evolution network, then jointly train the principal component network. Multiple loss functions are used to collaboratively optimize model parameters, ensuring both impedance prediction accuracy and principal component modeling performance. The principal component network is optimized based on directional constraint loss and variance magnitude loss.
[0151] Loss function definition:
[0152] The overall model loss function consists of the impedance mean square error (MSE) loss and the principal component analysis (PCA) loss, as shown in the following formula:
[0153] L=λ1L R +λ2(L D +L V )
[0154] In the formula, λ1 and λ2 are loss weighting coefficients used to balance the contributions of the two types of losses; L R To monitor the accuracy of dynamic impedance prediction, the MSE loss is used; L D To constrain the loss by direction, ensure that the principal components fit the direction of maximum change in traffic flow; L V To mitigate variance magnitude loss, the variance quantization accuracy in the principal component directions is constrained.
[0155] Impedance MSE loss (L R With real future impedance To monitor the signal, calculate and predict the future impedance. The formula for MSE relative to the true value is as follows:
[0156]
[0157] In the formula, The road impedance is calculated from real future traffic flow data (the calculation method is the same as T in step S2). a (X)); is the predicted future impedance output of the impedance evolution network; ||·||2 is the L2 norm.
[0158] Orientation constraint loss (L) D By maximizing the variance of traffic flow-centered data along the principal component direction, we ensure that the principal components capture the dominant direction of traffic flow changes. The formula is as follows:
[0159]
[0160] In the formula, For traffic flow centralized data, For real-world future traffic flow data; This indicates that X is in the k-th principal component w k The variance in direction; the negative sign is used to transform the "maximization problem" into a "minimization problem", which is suitable for gradient descent optimization logic.
[0161] Variance magnitude loss (L) V To ensure the accuracy of variance quantification, the norm of the temporary variables for principal component orthogonalization is consistent with the variance of traffic flow in the principal component direction. The formula is as follows:
[0162]
[0163] In the formula, These are the temporary variables for principal component orthogonalization obtained in step S5; The norm square of the temporary variable is used to approximate X in w. k Variance in direction.
[0164] Phased training strategy:
[0165] Phase 1: Training the Impedance Evolution Network Individually
[0166] With λ1 = 1 and λ2 = 0, optimize only the impedance MSE loss L. R The goal is to enable the impedance evolution network to learn the accurate impedance time evolution law. The training process is as follows:
[0167] A batch of historical traffic flow data was sampled from the training set. H With real future traffic flow data
[0168] Calculate the true future impedance (Step S2) and historical impedance R H (Step S2);
[0169] RH Input impedance evolution network, output predicts future impedance
[0170] Calculate L R The parameters of the impedance evolution network (weights and biases of the encoder, time attention submodule, and FC decoder) are updated by gradient descent.
[0171] Repeat the above steps until L R Converges on the validation set (the validation loss does not decrease over multiple consecutive epochs).
[0172] Phase 2: Jointly Training Impedance Evolution Network and Principal Component Network
[0173] Keeping λ1 = 1, linearly increasing λ2 from 0 to 1 (e.g., completing the increase within epochs 20-50), while optimizing L R With L D +L V The goal is to enable the principal component network to learn reliable spatiotemporal principal components while maintaining impedance accuracy. The training process is as follows:
[0174] Sample a batch of X from the training set H ,
[0175] Calculate R H , Output via impedance evolution network With dynamic impedance diagram
[0176] X H and Input a principal component network, output the initial principal component d, the orthogonalized principal component w, and the predicted initial mean.
[0177] calculate Calculate L again R L D L V And according to L=λ1L R +λ2(L D +L V Calculate the total loss;
[0178] The parameters of the impedance evolution network and the principal component network are updated simultaneously using gradient descent.
[0179] Repeat the above steps until the total loss L converges on the validation set, resulting in the final trained model.
[0180] The model training uses the Adam optimizer, and the learning rate update strategy is "cosine annealing," which means that the learning rate gradually decreases from its initial value to its minimum value as the epoch increases, as shown in the following formula:
[0181]
[0182] In the formula, η is the learning rate of the current epoch; η max η is the initial learning rate; min The minimum learning rate is 1; epoch is the current training epoch; max_epoch is the total number of training epochs.
[0183] Data partitioning adopts a "time-order partitioning" approach to avoid data leakage: all data is divided into a training set (60%), a validation set (20%), and a test set (20%) in chronological order; during training, "Z-score normalization" is used to preprocess the traffic flow data, with the following formula:
[0184]
[0185] In the formula, X norm The data is normalized; μ train σ train These represent the mean and standard deviation of the traffic flow data in the training set, respectively; the normalization parameters for both the validation and test sets are the μ values of the training set. train With σ train This ensures consistent data distribution.
[0186] Step S7: Generate probabilistic traffic flow prediction results. For example, generate a sample set along each spatiotemporal principal component direction, calculate the mean of the sample set as the traffic flow point prediction μ, and the variance as the uncertainty estimate σ.
[0187] Based on the trained model, multiple traffic flow samples are generated through "principal component direction sampling," and the final point prediction and uncertainty estimate are obtained through sample statistics. The specific process is as follows:
[0188] Along each spatiotemporal principal component direction, the initial mean prediction is extended by combining the corresponding variance magnitude. The formula for generating the sample set S is as follows:
[0189]
[0190] In the formula, S is the sample set, which contains K traffic flow samples (one sample for each principal component); The variance of the direction of the kth principal component (from step S5) (Calculated); t kThese are scalar coefficients used to adjust the magnitude and direction of the sample along the principal component direction (ensuring the sample covers the possible fluctuation range of traffic flow), t k The value is determined by binary search on the validation set—traversing candidate t. k Set, select the set t that makes the point prediction accuracy (MAE) of the sample set S optimal on the validation set. k .
[0191] Point prediction and uncertainty estimation calculation: Statistical analysis of the sample set S yields the final point prediction result μ and the uncertainty estimation result σ.
[0192] Point prediction: Calculate the mean of all samples in the sample set S using the following formula:
[0193]
[0194] In the formula, μ∈R T×N The accuracy of the final point prediction result is usually better than that of the initial mean prediction. —Because the sample set S incorporates the spatiotemporal correlation information captured by the principal components, it corrects… The deviation.
[0195] Uncertainty estimation: Calculate the standard deviation of all samples in the sample set S, using the following formula:
[0196]
[0197] In the formula, σ∈R T×N For the final uncertainty estimation result, each element represents the standard deviation of the traffic flow prediction for the corresponding time step and the corresponding road segment. The larger the standard deviation, the higher the risk of traffic flow fluctuation for that road segment at that moment, and the stronger the uncertainty of the prediction.
[0198] Results Output and Post-processing: μ and σ are "inversely normalized" to restore the original traffic flow scale (to offset the Z-score normalization in the above steps), as shown in the following formula:
[0199] μ raw =μ·σtrain+μ train
[0200] σ raw =σ·σ train
[0201] In the formula, μ raw The point prediction result after inverse normalization; σ raw The result is the uncertainty estimation after inverse normalization; μ train σ train The mean and standard deviation of the training set from the above steps are given. The final output is μ. raw With σ rawIt can be used for subsequent applications in intelligent transportation scenarios.
[0202] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles used, and is not intended to limit the scope of the claimed disclosure, but only to illustrate preferred embodiments of this disclosure. Those skilled in the art should understand that the scope of the invention involved in this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalent features without departing from the inventive concept. All other embodiments obtained by those skilled in the art based on the embodiments of this disclosure without inventive effort are within the scope of protection of this disclosure.
Claims
1. A probabilistic traffic flow prediction method based on road impedance and principal component analysis, characterized in that, include: Obtain historical traffic flow data, road network maps, and road characteristic data for the area to be predicted; Historical road impedance is calculated based on the historical traffic flow data and the road characteristic data. A dynamic impedance map is generated based on the road network map and the historical road impedance. The traffic flow history data and the dynamic impedance map are input into the principal component network to generate an initial principal component representation; The initial principal component representation is subjected to Schmitt orthogonalization to generate spatiotemporal principal components; The principal component network is optimized based on orientation constraint loss and variance magnitude loss. as well as Based on the optimized principal component network, a sample set is generated along the direction of each spatiotemporal principal component, and the mean and variance of the sample set are calculated as the prediction and uncertainty estimate of traffic flow points, respectively.
2. The probabilistic traffic flow prediction method based on road impedance and principal component analysis according to claim 1, characterized in that, The historical road impedance is calculated using the following road impedance function: Among them, T a (X) represents the historical road impedance of road segment a, t a Let X represent the free-flow travel time of road segment a, and let C represent the observed traffic flow value of road segment a. a σ represents the road capacity of road segment a. a and μ a Let α and β represent the standard deviation and mean of the historical traffic flow data for road segment a, respectively, where α = 0.15 and β = 4.
3. The probabilistic traffic flow prediction method based on road impedance and principal component analysis according to claim 1, characterized in that, Generating the dynamic impedance diagram includes: The historical road impedance features are extracted using a fully connected encoder to generate a hidden representation; Attention weights are calculated based on the hidden representation using a temporal attention mechanism, and future path impedance is determined based on these attention weights; and The dynamic impedance map is generated using the following formula based on the road network map and the future road impedance: in, This represents the weight of segment a to segment b in the dynamic impedance diagram. This indicates an indicator function; if road segments a and b are connected, then... Otherwise, it is 0; FC(·) indicates a fully connected network; R a The hidden representation of the future road impedance of road segment a; and R b This represents the hidden representation of the future road impedance of road segment b.
4. The probabilistic traffic flow prediction method based on road impedance and principal component analysis according to claim 1, characterized in that, Generating the initial principal component representation includes: Traffic flow mean prediction data is generated by training a mean predictor based on the historical traffic flow data and the road network map. The encoder extracts features from the historical traffic flow data and the traffic flow mean prediction data to generate a hidden representation; Temporal features are generated by convolving the hidden representation using a temporal convolutional network, and then spatial features are generated by a graph convolutional network based on the road network map and the dynamic impedance map. The initial principal component representation is generated by the decoder based on the spatial features.
5. The probabilistic traffic flow prediction method based on road impedance and principal component analysis according to claim 1, characterized in that, The orientation constraint loss is calculated using the following formula: The variance magnitude loss is calculated using the following formula: in, This represents centralized traffic flow data. Represents real future traffic flow data. L represents predicted future traffic flow data. D L represents the directional constraint loss. V The variance magnitude loss is represented by K, where K represents the number of principal components, k represents the index, and w k Let k be the orthogonalized spatiotemporal principal component, and This represents a temporary variable for orthogonalization.
6. The probabilistic traffic flow prediction method based on road impedance and principal component analysis according to claim 3, characterized in that, The fully connected encoder consists of multiple fully connected layers, each followed by an activation function, which converts the one-dimensional sequence of historical road impedances into a high-dimensional hidden representation.
7. The probabilistic traffic flow prediction method based on road impedance and principal component analysis according to claim 4, characterized in that, The graph convolutional network performs spatial feature aggregation based on the dynamic impedance map using the following formula: in, This represents the spatial characteristics of the (l+1)th layer. This represents the spatial characteristics of the l-th layer. Let σ(·) represent the learnable weight matrix, and let σ(·) represent the activation function. This represents the dynamic impedance diagram.
8. The probabilistic traffic flow prediction method based on road impedance and principal component analysis according to claim 4, characterized in that, The pre-trained mean predictor is a PDFormer model, which is trained using the historical traffic flow data and is used to capture the spatiotemporal dependencies of traffic flow to output an initial mean prediction.
9. The probabilistic traffic flow prediction method based on road impedance and principal component analysis according to claim 4, characterized in that, The temporal convolutional network adopts a causal convolutional structure with a preset kernel size. It captures long-term temporal dependencies of traffic flow by stacking multiple convolutional layers.
10. The probabilistic traffic flow prediction method based on road impedance and principal component analysis according to claim 1, characterized in that, The overall loss function during model training is in This is the impedance mean square error loss. For directional constraint loss, The variance magnitude loss is represented by λ1 and λ2, which are hyperparameters. λ1 is fixed at 1, and λ2 increases linearly from 0 to 1.