Traffic flow speed estimation method based on gaussian mixture model and hierarchical bayes

By combining Gaussian mixture models and hierarchical Bayesian methods, the problems of heterogeneity characterization and model simplicity in traffic flow speed estimation are solved, achieving high-precision and high-generalization traffic flow speed prediction, which is suitable for intelligent transportation systems.

CN121564980BActive Publication Date: 2026-04-07HARBIN INST OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-01-26
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

Existing traffic flow speed estimation methods cannot effectively characterize the heterogeneity of traffic flow, and suffer from problems such as too many model parameters, high computational cost, and insufficient generalization ability.

Method used

We employ a Gaussian mixture model and a hierarchical Bayesian approach to divide traffic flow into several significantly heterogeneous subgroups through unsupervised clustering analysis. We then construct a hierarchical Bayesian stochastic parameter model, use the Markov chain Monte Carlo method for parameter estimation, and perform model validation and performance evaluation.

Benefits of technology

It achieves high accuracy and high generalization capability in traffic flow speed prediction, with a prediction interval coverage of up to 94.4%. The root mean square error and mean absolute error are significantly reduced, and it has stable and accurate prediction performance, supporting the state identification and control decisions of actual traffic systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121564980B_ABST
    Figure CN121564980B_ABST
Patent Text Reader

Abstract

The application relates to a traffic flow speed estimation method based on a Gaussian mixture model and a hierarchical Bayesian method, and belongs to the technical field of intelligent transportation systems. The method comprises four steps of data preparation and preprocessing, traffic state clustering division, hierarchical Bayesian random parameter model construction, model verification and performance evaluation. Through the deep fusion of the Gaussian mixture model and the hierarchical Bayesian model, the application realizes data-driven traffic state recognition and random parameter estimation, can effectively depict traffic flow heterogeneity, avoids model parameter explosion, and improves the model prediction precision and generalization ability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of intelligent transportation systems technology, specifically relating to a traffic flow speed estimation method based on Gaussian mixture model and hierarchical Bayesian. Background Technology

[0002] Traffic fundamental maps are core models describing the relationships between macroscopic characteristics of traffic flow (volume, density, speed). Traditional deterministic fundamental map models (such as the Greenshields model) cannot characterize the inherent randomness and heterogeneity of traffic flow, resulting in limited prediction accuracy. To improve this, stochastic parametric models have been proposed and applied. However, existing stochastic parametric models typically suffer from two main problems: First, they ignore multimodal characteristics, i.e., they do not consider the intrinsic mechanistic differences between different states such as free flow and congested flow, using a uniform random distribution to describe all situations, resulting in insufficient model expressive power; second, parameter explosion and overfitting occur. If parameters are estimated completely independently for each road segment or time slice, it leads to an excessive number of model parameters, high computational costs, and a lack of generalization ability.

[0003] Therefore, there is an urgent need in this field for a traffic flow speed estimation method that can effectively characterize traffic flow heterogeneity while maintaining model simplicity and generalization ability. Summary of the Invention

[0004] The purpose of this invention is to address the shortcomings of existing technologies and provide a traffic flow velocity estimation method based on Gaussian mixture model and hierarchical Bayesian methods.

[0005] To achieve the above objectives, the technical solution adopted by the present invention is as follows:

[0006] The traffic flow velocity estimation method based on Gaussian mixture model and hierarchical Bayes includes the following steps:

[0007] S1. Data Preparation and Preprocessing:

[0008] Historical traffic flow data for bicycles is acquired, and then the acquired bicycle data is cleaned to remove abnormal data that clearly does not conform to physical patterns. The cleaned bicycle data is then subjected to time aggregation processing to generate a... The dataset is aggregated at minute intervals; then, the data in the aggregated dataset is further cleaned to remove outlier data points with densities exceeding the effective range; next, the dataset is divided into training and test sets; =1~5;

[0009] S2. Traffic Condition Clustering Classification:

[0010] Based on the density and speed of the observed samples in the training set, an unsupervised clustering analysis of traffic states is performed using a Gaussian mixture model. The traffic flow is divided into G subgroups with significant heterogeneity. Each subgroup represents a typical traffic state. By assigning each data point to the subgroup with the highest posterior probability, the traffic state label of all observed samples is assigned, thus achieving traffic state classification.

[0011] S3. Construction of a hierarchical Bayesian stochastic parameter model:

[0012] A hierarchical Bayesian stochastic parameter model is constructed based on the traffic state classification results obtained from S2.

[0013] The hierarchical Bayesian stochastic parameter model includes an observation data layer, a group parameter layer, and a global hyperparameter layer, and uses the Markov chain Monte Carlo method for parameter estimation.

[0014] S4. Model Validation and Performance Evaluation:

[0015] The hierarchical Bayesian stochastic parameter model is validated using the training and test sets, including point estimation and posterior prediction checks for the training set with known groups, and a hybrid prediction strategy based on the posterior marginal probability of a Gaussian mixture model for the test set with unknown groups.

[0016] Furthermore, the specific method of S1 is as follows:

[0017] S11. Data Acquisition: Acquire historical traffic flow data for individual vehicles, including time, lane number, speed, and headway to the vehicle in front.

[0018] S12. Data cleaning: Set the effective speed range to [0, 140] km / h and the effective headway range to [1, +∞) s, and remove single-vehicle data that exceed the above effective range;

[0019] S13. Data Aggregation: Aggregate the cleaned data according to a two-minute time window, and use the aggregated data as the observation sample;

[0020] S14. Dataset partitioning: Further clean the aggregated data, set the effective density range to [0, 120] pcu / km / ln, and remove outlier data points that exceed this range; then partition the dataset into training set and test set.

[0021] Furthermore, during aggregation, the resulting data includes traffic flow, small vehicle traffic flow, large vehicle traffic flow, speed, small vehicle proportion, and density.

[0022] Furthermore, the specific method of S2 is as follows:

[0023] S21. Feature Space Construction:

[0024] Construct the original feature matrix Then, standardization is performed to obtain the standardized feature matrix, denoted as . :

[0025]

[0026] In the formula, For the first The feature vectors of the observed samples, i=1,2,……,n; For the first The density of each observation sample is expressed in pcu / km / ln. For the first The speed of each observed sample is expressed in km / h. The total number of observed samples in the training set;

[0027] Z-score standardization is adopted, specifically as follows:

[0028]

[0029]

[0030] In the formula, It is the first The standardized feature vector of each observation sample; For the first Standardized density of each observation sample; For the first Standardized velocity of each observation sample; , These are the mean and standard deviation of the density on the training set, respectively; , These are the mean and standard deviation of the velocity features on the training set, respectively. It is the standardized feature matrix;

[0031] S22. Clustering Algorithm Selection:

[0032] The training set is grouped using a Gaussian mixture model as the clustering algorithm, assuming that all data points are... The traffic flow is generated by mixing multiple Gaussian distribution components (i.e., dividing the traffic flow into G significantly heterogeneous subgroups). Each component... This represents a potential traffic flow pattern, whose probability density function is:

[0033]

[0034] In the formula, It is the first Standardized feature vector of each observation sample The overall probability density; It is the number of Gaussian distributions, i.e., the preset number of clusters; It is a grouped index. ; It is the first The mixing coefficients of a Gaussian distribution satisfy the following conditions: and , representing the prior weight of each group in the population; It is the first The probability density function of a multivariate Gaussian distribution;

[0035] The complete expansion of the probability density function of the multivariate Gaussian distribution is as follows:

[0036]

[0037] In the formula, It is the first A vector of mean values ​​from a Gaussian distribution; It is the first The covariance matrix of a Gaussian distribution; It is the dimension of the feature space, that is, the length of the feature vector; It is the covariance matrix The determinant of; It is the covariance matrix The inverse matrix;

[0038] S23, Model Training:

[0039] The parameter set of the Gaussian mixture model is obtained by using the expectation-maximization algorithm. Make an estimate to maximize the training set The likelihood function; the expression for the likelihood function is as follows:

[0040]

[0041] In the formula, For a given set of parameters Next training set The probability likelihood.

[0042] The expectation-maximization algorithm performs iterative optimization by alternating between the E-step (expectation step) and the M-step (maximization step). When the increment of the log-likelihood function is less than a preset threshold, the model is considered to have converged.

[0043] S24, State Division:

[0044] Based on the trained Gaussian mixture model, the state of any observation sample is divided.

[0045] Furthermore, in S22, This represents two groups, with the first group labeled 0 and the second group labeled 1; in S23, the preset threshold is... .

[0046] Furthermore, the specific method of S24 is as follows:

[0047] S24.1, Probability Division:

[0048] for First, standardization is performed using S21 to obtain the... Standardized feature vector of each observation sample Subsequently, it is calculated that it belongs to the first... Posterior probabilities of a Gaussian distribution:

[0049]

[0050] In the formula, In the given number Standardized feature vector of each observation sample Under the condition that it belongs to the first Posterior probabilities of a Gaussian distribution; It is a latent categorical variable. Indicates that the sample belongs to the first A Gaussian distribution; It is the circular index in the summation operation of the denominator. For the first The mixing coefficients of a Gaussian distribution; For the first A vector of mean values ​​from a Gaussian distribution; For the first The covariance matrix of a Gaussian distribution.

[0051] S24.2, Category Determination:

[0052] If a specific traffic state label needs to be assigned to a data point, it should be grouped into the group with the highest posterior probability:

[0053]

[0054] In the formula, It is the first Standardized feature vector of each observation sample The final category label assigned corresponds to the traffic state to which it is most likely to belong; This represents the label index that maximizes the posterior probability. .

[0055] Furthermore, the specific method of S3 is as follows:

[0056] The hierarchical Bayesian stochastic parameter model is constructed, which includes a three-layer hierarchical structure of observation data layer, group parameter layer and global hyperparameter layer;

[0057] Among them, the observation data layer defines the likelihood function of the actual observed velocity data, and the velocity expectation value is calculated based on group-specific random parameters;

[0058] Grouping parameter layer: Set specific random parameter distributions for each traffic state group to capture heterogeneity between and within groups;

[0059] Global hyperparameter layer: sets the prior distribution for the random parameters in the group parameter layer, enabling information sharing between groups;

[0060] Then, model inference and parameter solving are performed, and the posterior distribution of all unknown parameters is solved using the Markov chain Monte Carlo method.

[0061] Furthermore, the expected value of speed The calculation formula is:

[0062]

[0063] In the formula, Let g be the free-flow velocity of group g, in km / h. Here is the critical density for group g, expressed in pcu / km / ln; denoted by g, representing the grouping influence coefficient for small vehicles, in km / h. The proportion of small cars; Density, in units of pcu / km / ln;

[0064] In the grouping parameter layer, when setting a random parameter distribution for each traffic state group, the mean parameter and the within-group variance parameter are set;

[0065] The distribution of the mean parameter is as follows:

[0066]

[0067] In the formula, , , They are respectively , , The global mean hyperparameter; , , They are respectively , , The global variance hyperparameter;

[0068] The within-group variance parameter follows a semi-normal distribution, as expressed below:

[0069] , ,

[0070] In the formula, , , These are the within-group variances of free-flow velocity, critical density, and small vehicle influence coefficient for group g, respectively. It represents a semi-normal distribution.

[0071] Furthermore, the specific method of S4 is as follows:

[0072] Based on the trained hierarchical Bayesian stochastic parameter model, group-specific stochastic parameter prediction is used for the training set. After prediction, the fitting performance of the training set is evaluated. The evaluation includes point estimation evaluation and posterior prediction check, and the root mean square error, mean absolute error and mean absolute percentage error are calculated.

[0073] Meanwhile, based on the trained hierarchical Bayesian random parameter model, a mixture prediction based on the posterior probability of the Gaussian mixture model is used for the test set. The model prediction value of the observed sample under each group condition is calculated, and then a weighted average is performed according to the obtained group probability. The observation error is added to generate the speed prediction value after taking into account the observation error.

[0074] Furthermore, it also includes: S5, traffic flow speed estimation:

[0075] For the same road segment, the density and proportion of small vehicles are obtained and input into the trained hierarchical Bayesian stochastic parameter model, and the hybrid prediction strategy described above can be used to predict the traffic flow speed.

[0076] This invention provides a traffic flow velocity estimation method based on Gaussian mixture model and hierarchical Bayesian model. This method can effectively characterize the heterogeneity of traffic flow, avoid model parameter explosion, and improve the model prediction accuracy and generalization ability.

[0077] Compared with the prior art, the beneficial effects of this invention are as follows:

[0078] (1) Model Fitting Performance: This invention successfully achieves a high degree of unity between prediction accuracy and uncertainty quantification capability. The posterior predictive check (PPC) of the model shows that its 95% prediction interval coverage is as high as 94.4%, which fully verifies the accuracy and reliability of the uncertainty quantification results. At the same time, the performance indicators of PPC prediction are highly consistent with the point estimation results, indicating that the model not only has excellent goodness of fit, but also has excellent generalization ability and practical robustness, and can stably reproduce its fitting performance in practical applications.

[0079] (2) Model generalization ability: The present invention has good generalization ability and maintains high prediction accuracy on unknown data. The root mean square error (RMSE) is 7.51 km / h, the mean absolute error (MAE) is 5.47 km / h, and the mean absolute percentage error (MAPE) is as low as 6.12%, indicating that the model has stable and accurate prediction performance under different traffic conditions and can effectively support state discrimination and control decisions in actual traffic systems.

[0080] (3) Model advantages: This invention achieves data-driven traffic state identification and stochastic parameter estimation through the deep integration of Gaussian mixture model and hierarchical Bayesian model. Its core lies in the systematic integration of four sources of uncertainty: state attribution, parameter posterior, individual behavior variation and observation error, and completes its derivation and propagation within a rigorous probabilistic framework, thereby achieving a more rigorous and reliable traffic flow basic graph model in theory. Attached Figure Description

[0081] Figure 1 This is a flowchart of the traffic flow velocity estimation method based on Gaussian mixture model and hierarchical Bayes in this invention.

[0082] Figure 2 This is a clustering result diagram of traffic states based on Gaussian mixture model in an application example of the present invention; where (a) and (b) are schematic diagrams of the density and speed relationship of traffic state group 0 and group 1, respectively; (c) and (d) are schematic diagrams of the density and flow relationship of traffic state group 0 and group 1, respectively; (e) is a density feature probability density histogram; subplot (f) is a speed feature probability density histogram;

[0083] Figure 3 This is a basic traffic flow map based on a Gaussian mixture model and Bayesian inference, as shown in an application example of this invention; (a) and (b) are the fitting results of the density-speed relationship for traffic state group 0 and group 1, respectively.

[0084] Figure 4 A hierarchical Bayesian random parameter model posterior prediction test coverage diagram provided for application examples of the present invention;

[0085] Figure 5 The probability distribution diagram of the Gaussian mixture model grouping is provided as an application example of the present invention. Detailed Implementation

[0086] The present invention will now be described in further detail with reference to the embodiments.

[0087] Those skilled in the art will understand that the following embodiments are for illustrative purposes only and should not be construed as limiting the scope of the invention. Where specific techniques or conditions are not specified in the embodiments, they are performed in accordance with the techniques or conditions described in the literature in the field or according to the product instructions. Materials or equipment whose manufacturers are not specified are all conventional products that can be obtained by purchase.

[0088] Example 1

[0089] The traffic flow velocity estimation method based on Gaussian mixture model and hierarchical Bayes includes the following steps:

[0090] S1. Data Preparation and Preprocessing:

[0091] Historical traffic flow data for bicycles is acquired, and then the acquired bicycle data is cleaned to remove abnormal data that clearly does not conform to physical patterns. The cleaned bicycle data is then subjected to time aggregation processing to generate a... The dataset is aggregated at minute intervals; then, the data in the aggregated dataset is further cleaned to remove outlier data points with densities exceeding the effective range; next, the dataset is divided into training and test sets; =1~5;

[0092] S2. Traffic Condition Clustering Classification:

[0093] Based on the density and speed of the observed samples in the training set, an unsupervised clustering analysis of traffic states is performed using a Gaussian mixture model. The traffic flow is divided into G subgroups with significant heterogeneity. Each subgroup represents a typical traffic state. By assigning each data point to the subgroup with the highest posterior probability, the traffic state label assignment for all observed samples is completed.

[0094] S3. Construction of a hierarchical Bayesian stochastic parameter model:

[0095] A hierarchical Bayesian stochastic parameter model is constructed based on the traffic state classification results obtained from S2.

[0096] The hierarchical Bayesian stochastic parameter model includes an observation data layer, a group parameter layer, and a global hyperparameter layer, and uses the Markov chain Monte Carlo method for parameter estimation.

[0097] S4. Model Validation and Performance Evaluation:

[0098] The hierarchical Bayesian stochastic parameter model is validated using the training and test sets, including point estimation and posterior prediction checks for the training set with known groups, and a hybrid prediction strategy based on the posterior marginal probability of a Gaussian mixture model for the test set with unknown groups.

[0099] Example 2

[0100] The traffic flow velocity estimation method based on Gaussian mixture model and hierarchical Bayes includes the following steps:

[0101] S1. Data Preparation and Preprocessing:

[0102] Historical traffic flow data for bicycles is acquired, and then the acquired bicycle data is cleaned to remove abnormal data that obviously does not conform to physical laws. The cleaned bicycle data is then aggregated over time to generate an aggregated dataset with 2-minute intervals. The data in the aggregated dataset is then further cleaned to remove abnormal data points with a density exceeding the effective range. Finally, the dataset is divided into a training set and a test set.

[0103] S2. Traffic Condition Clustering Classification:

[0104] Based on the density and speed of the observed samples in the training set, an unsupervised clustering analysis of traffic states is performed using a Gaussian mixture model. The traffic flow is divided into G subgroups with significant heterogeneity. Each subgroup represents a typical traffic state. By assigning each data point to the subgroup with the highest posterior probability, the traffic state label assignment for all observed samples is completed.

[0105] S3. Construction of a hierarchical Bayesian stochastic parameter model:

[0106] A hierarchical Bayesian stochastic parameter model is constructed based on the traffic state classification results obtained from S2.

[0107] The hierarchical Bayesian stochastic parameter model includes an observation data layer, a group parameter layer, and a global hyperparameter layer, and uses the Markov chain Monte Carlo method for parameter estimation.

[0108] S4. Model Validation and Performance Evaluation:

[0109] The hierarchical Bayesian stochastic parameter model is validated using the training and test sets, including point estimation and posterior prediction checks for the training set with known groups, and a hybrid prediction strategy based on the posterior marginal probability of a Gaussian mixture model for the test set with unknown groups.

[0110] The specific method for S1 is as follows:

[0111] S11. Data Acquisition: Acquire historical traffic flow data for individual vehicles, including time, lane number, speed, and headway to the vehicle in front.

[0112] S12. Data cleaning: Set the effective speed range to [0, 140] km / h and the effective headway range to [1, +∞) s, and remove single-vehicle data that exceed the above effective range;

[0113] S13. Data Aggregation: Aggregate the cleaned data according to a two-minute time window, and use the aggregated data as the observation sample;

[0114] S14. Dataset partitioning: Further clean the aggregated data, set the effective density range to [0, 120] pcu / km / ln, and remove outlier data points that exceed this range; then partition the dataset into training set and test set.

[0115] When aggregated, the resulting data includes traffic flow, small vehicle traffic flow, large vehicle traffic flow, speed, small vehicle ratio, and density.

[0116] The specific method for S2 is as follows:

[0117] S21. Feature Space Construction:

[0118] Construct the original feature matrix Then, standardization is performed to obtain the standardized feature matrix, denoted as . :

[0119]

[0120] In the formula, For the first The feature vectors of the observed samples, i=1,2,……,n; For the first The density of each observation sample is expressed in pcu / km / ln. For the first The speed of each observed sample is expressed in km / h. The total number of observed samples in the training set;

[0121] Z-score standardization is adopted, specifically as follows:

[0122]

[0123]

[0124] In the formula, It is the first The standardized feature vector of each observation sample; For the first Standardized density of each observation sample; For the first Standardized velocity for each observation sample; , These are the mean and standard deviation of the density on the training set, respectively; , These are the mean and standard deviation of the velocity features on the training set, respectively. It is the standardized feature matrix;

[0125] S22. Clustering Algorithm Selection:

[0126] The training set is grouped using a Gaussian mixture model as the clustering algorithm, assuming that all data points are... Generated by mixing multiple Gaussian distribution components, each component This represents a potential traffic flow pattern, whose probability density function is:

[0127]

[0128] In the formula, It is the first Standardized feature vector of each observation sample The overall probability density; It is the number of Gaussian distributions, i.e., the preset number of clusters; It is a grouped index. ; It is the first The mixing coefficients of a Gaussian distribution satisfy the following conditions: and , representing the prior weight of each group in the population; It is the first The probability density function of a multivariate Gaussian distribution;

[0129] The complete expansion of the probability density function of the multivariate Gaussian distribution is as follows:

[0130]

[0131] In the formula, It is the first A vector of mean values ​​from a Gaussian distribution; It is the first The covariance matrix of a Gaussian distribution; It is the dimension of the feature space, that is, the length of the feature vector; It is the covariance matrix The determinant of; It is the covariance matrix The inverse matrix;

[0132] S23, Model Training:

[0133] The parameter set of the Gaussian mixture model is obtained by using the expectation-maximization algorithm. Make an estimate to maximize the training set The likelihood function; the expression for the likelihood function is as follows:

[0134]

[0135] In the formula, For a given set of parameters Next training set The probability likelihood.

[0136] The expectation-maximization algorithm performs iterative optimization by alternating between the E-step (expectation step) and the M-step (maximization step). When the increment of the log-likelihood function is less than a preset threshold, the model is considered to have converged.

[0137] S24, State Division:

[0138] Based on the trained Gaussian mixture model, the state of any observation sample is divided.

[0139] In S22, This represents two groups, with the first group labeled 0 and the second group labeled 1; in S23, the preset threshold is... .

[0140] The specific method for S24 is as follows:

[0141] S24.1, Probability Division:

[0142] for First, standardization is performed using S21 to obtain the... Standardized feature vector of each observation sample Subsequently, it is calculated that it belongs to the first... Posterior probabilities of a Gaussian distribution:

[0143]

[0144] In the formula, In the given number Standardized feature vector of each observation sample Under the condition that it belongs to the first Posterior probabilities of a Gaussian distribution; It is a latent categorical variable. Indicates that the sample belongs to the first A Gaussian distribution; It is the circular index in the summation operation of the denominator; For the first The mixing coefficients of a Gaussian distribution; For the first A vector of mean values ​​from a Gaussian distribution; For the first The covariance matrix of a Gaussian distribution.

[0145] S24.2, Category Determination:

[0146] If a specific traffic state label needs to be assigned to a data point, it should be grouped into the group with the highest posterior probability:

[0147]

[0148] In the formula, It is the first Standardized feature vector of each observation sample The final category label assigned corresponds to the traffic state to which it is most likely to belong; This represents the label index that maximizes the posterior probability. .

[0149] The specific method for S3 is as follows:

[0150] The hierarchical Bayesian stochastic parameter model is constructed, which includes a three-layer hierarchical structure of observation data layer, group parameter layer and global hyperparameter layer;

[0151] Among them, the observation data layer defines the likelihood function of the actual observed velocity data, and the velocity expectation value is calculated based on group-specific random parameters;

[0152] Grouping parameter layer: Set specific random parameter distributions for each traffic state group to capture heterogeneity between and within groups;

[0153] Global hyperparameter layer: sets the prior distribution for the random parameters in the group parameter layer, enabling information sharing between groups;

[0154] Then, model inference and parameter solving are performed, and the posterior distribution of all unknown parameters is solved using the Markov chain Monte Carlo method.

[0155] Expected speed The calculation formula is:

[0156]

[0157] In the formula, Let g be the free-flow velocity of group g, in km / h. Here is the critical density for group g, expressed in pcu / km / ln; denoted by g, representing the grouping influence coefficient for small vehicles, in km / h. The proportion of small cars; Density, in units of pcu / km / ln;

[0158] In the grouping parameter layer, when setting a random parameter distribution for each traffic state group, the mean parameter and the within-group variance parameter are set;

[0159] The distribution of the mean parameter is as follows:

[0160]

[0161] In the formula, , , They are respectively , , The global mean hyperparameter; , , They are respectively , , The global variance hyperparameter;

[0162] The within-group variance parameter follows a semi-normal distribution, as expressed below:

[0163] , ,

[0164] In the formula, , , These are the within-group variances of free-flow velocity, critical density, and small vehicle influence coefficient for group g, respectively. It represents a semi-normal distribution.

[0165] The specific method for S4 is as follows:

[0166] Based on the trained hierarchical Bayesian stochastic parameter model, group-specific stochastic parameter prediction is used for the training set. After prediction, the fitting performance of the training set is evaluated. The evaluation includes point estimation evaluation and posterior prediction check, and the root mean square error, mean absolute error and mean absolute percentage error are calculated.

[0167] Meanwhile, based on the trained hierarchical Bayesian random parameter model, a mixture prediction based on the posterior probability of the Gaussian mixture model is used for the test set. The model prediction value of the observed sample under each group condition is calculated, and then a weighted average is performed according to the obtained group probability. The observation error is added to generate the speed prediction value after taking into account the observation error.

[0168] Also includes: S5, traffic flow speed estimation:

[0169] For the same road segment, the density and proportion of small vehicles are obtained and input into the trained hierarchical Bayesian stochastic parameter model, and the hybrid prediction strategy described above can be used to predict the traffic flow speed.

[0170] Application Examples

[0171] like Figure 1 As shown, the traffic flow velocity estimation method based on Gaussian mixture model and hierarchical Bayesian method includes the following steps:

[0172] S1. Data Preparation and Preprocessing:

[0173] Obtain historical traffic flow data for individual vehicles, including time, lane number, speed, and headway to the vehicle in front;

[0174] The acquired bicycle data is then cleaned to remove outliers that clearly do not conform to physical laws. The cleaned bicycle data is then time-aggregated to generate an aggregated dataset with 2-minute intervals. The aggregated dataset is further cleaned to remove outliers with densities exceeding the effective range. Next, the dataset is split into a training set for model training and a test set for verifying the model's generalization ability. It is necessary to ensure that both the training and test sets cover typical traffic conditions, as congestion is rare in hard shoulder closure construction areas. Therefore, during the splitting process, both datasets must contain some congestion data.

[0175] The aggregated dataset includes traffic flow, small vehicle traffic flow, large vehicle traffic flow, speed, small vehicle ratio, and density.

[0176] Specifically, it includes the following sub-steps:

[0177] S11, Data Acquisition:

[0178] This example uses traffic flow data from the hard shoulder closure construction area of ​​the G85 Yinkun Expressway (Gongshan to Xiaopu section, hereinafter referred to as "Gongxiao Expressway") as the research object. The data comes from a microwave radar detector located at chainage k2015+270. The raw data is single-vehicle traffic flow data, with each record corresponding to the passage information of a single vehicle, including time, lane number, speed, and headway to the vehicle in front. The data collection period spans from May 1, 2025 to August 19, 2025. It should be noted that due to equipment debugging during this period, approximately 7 days of data are partially missing or incomplete.

[0179] S12, Data Cleaning:

[0180] The single-vehicle data is subjected to quality checks, and abnormal data that clearly does not conform to physical laws is removed. Specifically, the effective speed range is set to [0, 140] km / h, and the effective headway range is set to [1, +∞) s. Data that exceeds the above effective ranges is removed.

[0181] S13, Data Aggregation:

[0182] The cleaned data was aggregated into two-minute time windows, resulting in the following data:

[0183] Traffic flow (unit: pcu / 2min / ln) is the total traffic flow through a single lane within a 2-minute time window. Its value has been uniformly converted to the standard vehicle equivalent value according to vehicle type.

[0184] Small vehicle flow (unit: veh / 2min): the number of small vehicles naturally passing through the detection section within a 2-minute time window.

[0185] Large vehicle flow (unit: veh / 2min): the number of large vehicles naturally passing through the detection section within a 2-minute time window.

[0186] Speed ​​(unit: km / h) is the average speed of all passing vehicles within a 2-minute time window, representing the operational status of traffic flow.

[0187] The proportion of small vehicles (e.g., 0.78) represents the ratio of the number of small vehicles to the total number of vehicles within a 2-minute time window, characterizing the traffic flow composition structure.

[0188] Density (unit: pcu / km / ln), the average density within a 2-minute time window, is calculated from the headway.

[0189] The flow rate calculation formula is as follows:

[0190]

[0191] In the formula, The flow rate is expressed in pcu / 2min / ln. This represents the flow rate of small vehicles, measured in veh / 2min. This represents large traffic volumes, measured in veh / 2min. The vehicle conversion factor for large vehicles is 2.5, based on the "Technical Standards for Highway Engineering" (JTG B01—2014). The number of lanes is 2 in this example.

[0192] The formula for calculating density is:

[0193]

[0194] In the formula, Density, in units of pcu / km / ln; Let be the instantaneous speed of the i-th vehicle, in km / h; The time distance between the i-th vehicle and the vehicle in front of it is expressed in seconds per veh. The total number of vehicles within a 2-minute time window; r represents the proportion of small cars.

[0195] S14. Dataset partitioning:

[0196] The aggregated data was further cleaned, with the effective density range set to [0, 120] pcu / km / ln, and outlier data points outside this range were removed. Considering that severe congestion within the closed working area of ​​highway hard shoulders is relatively rare, to ensure the test set covers a certain proportion of congestion data, the dataset was divided into training and test sets based on time. The training set covers May 1, 2025 to July 25, 2025 (excluding July 18, 2025), and the test set covers July 26, 2025 to August 19, 2025, as well as data from July 18, 2025 (including some congestion data). Ultimately, the training set had 50,400 samples, accounting for 73.8% of the total samples; the test set had 17,867 samples, accounting for 26.2% of the total samples.

[0197] S2. Traffic Condition Clustering Classification:

[0198] Based on the density and velocity in the training set, an unsupervised clustering analysis of traffic states is performed using a Gaussian Mixture Model (GMM). This divides the traffic flow into G significantly heterogeneous subgroups, providing a foundation for subsequent hierarchical modeling. Each subgroup represents a typical traffic state. By assigning each data point to the subgroup with the highest posterior probability, the labeling of the samples and the classification of traffic states are completed.

[0199] Specifically, it includes the following sub-steps:

[0200] S21. Feature Space Construction:

[0201] S21.1 Original Feature Extraction:

[0202] Density and velocity are extracted as key feature variables from the training set data to construct the original feature matrix. :

[0203]

[0204] In the formula, For the first The feature vectors of the observed samples, i=1,2,……,n; For the first The density of each observation sample is expressed in pcu / km / ln. For the first The speed of each observed sample is expressed in km / h. The total number of observed samples in the training set;

[0205] S21.2 Feature standardization processing:

[0206] To eliminate the impact of differences in the units and numerical ranges of different features on the clustering results, the original features are standardized using Z-score:

[0207]

[0208] In the formula, It is the first The standardized feature vector of each observation sample; For the first Standardized density of each observation sample; For the first Standardized velocity of each observation sample; , These are the mean and standard deviation of the density on the training set, respectively; , These are the mean and standard deviation of the velocity features on the training set, respectively. It is the standardized feature matrix;

[0209] S22. Clustering Algorithm Selection:

[0210] In the constructed standardized feature matrix The Gaussian Mixture Model (GMM) is used as the clustering algorithm to group the training set. Its core idea is to assume that all data points are clustered by... Generated by mixing multiple Gaussian distribution components, each component This represents a potential traffic flow pattern, whose probability density function is:

[0211]

[0212] In the formula, It is the first Standardized feature vector of each observation sample The overall probability density; It is the number of Gaussian distributions, i.e., the preset number of clusters; It is a grouped index. ; It is the first The mixing coefficients of a Gaussian distribution satisfy the following conditions: and , representing the prior weight of each group in the population; It is the first The probability density function of a multivariate Gaussian distribution;

[0213] The complete expansion of the probability density function of the multivariate Gaussian distribution is as follows:

[0214]

[0215] In the formula, It is the first The mean vector of a Gaussian distribution represents the central position of the group in the feature space; It is the first The covariance matrix of a Gaussian distribution defines the shape, size, and spatial orientation of the group; It is the dimension of the feature space, that is, the length of the feature vector, which is 2 in this example; It is the covariance matrix The determinant of the Gaussian distribution geometrically represents the scaling factor of the volume enclosed by the Gaussian distribution. It is the covariance matrix The inverse matrix.

[0216] S23, Model Training:

[0217] The Expectation-Maximization (EM) algorithm is used to optimize the parameter set of the Gaussian mixture model. Make an estimate to maximize the training set The likelihood function is given by the following expression:

[0218]

[0219] In the formula, For a given set of parameters Next training set The probability likelihood.

[0220] The expectation-maximization algorithm iteratively optimizes the algorithm by alternating between E-steps (expectation steps) and M-steps (maximization steps). This optimization occurs when the increment of the log-likelihood function is less than a preset threshold. The model is determined to be convergent.

[0221] S24, State Division:

[0222] Based on a trained Gaussian Mixture Model (GMM), the state of any traffic flow observation data can be classified. This process can be used to validate the model's performance on the training set data, or it can be applied to new observation data for state identification.

[0223] S24.1, Probability partitioning (soft partitioning):

[0224] For any observation data point (Can be derived from the training set or a new dataset), firstly, feature standardization is performed using S21.2 to obtain the... Standardized feature vector of each observation sample Then, it is calculated that it belongs to the first... Posterior probabilities of a Gaussian distribution:

[0225]

[0226] In the formula, In the given number Standardized feature vector of each observation sample Under the condition that it belongs to the first Posterior probabilities of a Gaussian distribution; It is a latent categorical variable. Indicates that the sample belongs to the first A Gaussian distribution; It is the circular index in the summation operation of the denominator; For the first The mixing coefficients of a Gaussian distribution; For the first A vector of mean values ​​from a Gaussian distribution; For the first The covariance matrix of a Gaussian distribution.

[0227] S24.2, Category Determination (Hard Classification):

[0228] If a specific traffic state label needs to be assigned to a data point, a hard partitioning strategy is used, dividing it into the group with the highest posterior probability:

[0229]

[0230] In the formula, It is the first Standardized feature vector of each observation sample The final category label assigned corresponds to the traffic state to which it is most likely to belong; This represents the label index that maximizes the posterior probability. .

[0231] S24.3 Relationship between soft partitioning and hard partitioning

[0232] The soft partitioning outputs the posterior probability distribution of data points belonging to each group, fully preserving the uncertainty information of state assignment. This probability distribution will serve as a key input, directly used for mixture prediction in subsequent hierarchical Bayesian models.

[0233] The hard partition output is a deterministic class label for the most likely category of a data point; it is the maximum a posteriori decision result of the soft partition probability distribution. This deterministic label will be used to solve the parameters of the hierarchical Bayesian stochastic parametric model to estimate its specific parameter distribution for different traffic states.

[0234] S25. Determining the optimal number of groups:

[0235] To determine the optimal number of groups that best characterize the heterogeneity of traffic flow states This example uses the system grid search method to test five schemes with 2 to 6 groups, and selects the best scheme by combining multiple internal evaluation indicators. The results are shown in Table 1.

[0236] Table 1. Traffic flow state classification results based on Gaussian mixture model

[0237]

[0238] Final selection of group number As the optimal solution, this solution exhibits a significantly higher silhouette coefficient (0.7634) than other solutions with varying group numbers (0.2681–0.3571), and the lowest Davies-Bouldin index (0.93) among all solutions. This indicates that its clustering results achieve the best intra-group compactness and inter-group separation, resulting in optimal clustering performance with the fewest number of groups. While increasing the number of groups may improve model fitting complexity, this comes at the cost of a sharp deterioration in clustering performance.

[0239] S26. Cluster center calculation and label assignment:

[0240] The aforementioned S23 model training and S24 state partitioning steps essentially complete the GMM-based clustering process: that is, the parameters of each Gaussian distribution are learned through the EM algorithm (i.e., S23 model training). The training data is then hard-split by calculating the posterior probability (i.e., the S24 state partition) to evaluate the clustering effect. Based on this, the cluster centers are the mean vectors of the Gaussian groups obtained during training. Provided.

[0241] Based on the clustering algorithm described above, the cluster centers of each group are calculated, as follows: Figure 2 As shown, Group 0 has a mean density of 4.45 pcu / km / ln and a mean speed of 96.6 km / h, representing a group of vehicles traveling at relatively high speeds under steady free-flow conditions. Group 1 has a mean density of 19.5 pcu / km / ln and a mean speed of 60.33 km / h, representing a group of vehicles traveling at relatively low speeds under both steady free-flow and transitional flow conditions. The two groups exhibit significant spatial separation in the density-speed feature space, with very little overlap. Furthermore, the cluster center locations clearly show significant differences in the typical feature points of the two states.

[0242] For each sample in the training set, the model calculates its posterior probability of belonging to each Gaussian distribution and uses a hard partitioning strategy to assign the sample to the group with the highest posterior probability. Based on this deterministic rule, we assign a unique hard clustering label (group 0 or group 1) to all samples in the training set, thus completing the traffic state clustering and providing a foundation for parameter estimation in the subsequent hierarchical Bayesian stochastic parameter model.

[0243] S3. Construction of a hierarchical Bayesian stochastic parameter model:

[0244] Based on the traffic state classification results obtained from S2, a three-layer hierarchical Bayesian model is constructed, comprising a global hyperparameter layer, a group parameter layer, and an observation data layer. This model uses stochastic parameters to characterize the heterogeneity of key traffic flow parameters under different traffic states and performs posterior inference based on the Markov Chain Monte Carlo (MCMC) method, thereby achieving systematic quantification of parameter uncertainty and collaborative modeling of group specificity and global uniformity.

[0245] Collaborative modeling refers to the grouping parameters following a normal distribution composed of global hyperparameters.

[0246] Specifically, it includes the following sub-steps:

[0247] S31. Model Structure Design:

[0248] The constructed hierarchical Bayesian stochastic parameter model adopts a three-layer hierarchical structure, from bottom to top: the observation data layer, the group parameter layer, and the global hyperparameter layer, to separate and quantify the uncertainties of traffic flow parameters at the global level and at each state group level. For ease of understanding, the design of each layer is explained from bottom to top, starting with the lowest level, the observation data layer:

[0249] The observation data layer defines the likelihood function of the actual observed velocity data, thereby linking the theoretical model with the measured data;

[0250] The grouping parameter layer is based on the clustering results of the Gaussian mixture model in S2. It estimates the unique random parameter probability distribution for each traffic state group, thereby capturing the inter-group heterogeneity of key parameters under different traffic states.

[0251] The global hyperparameter layer defines hyperparameters shared by all groups, enabling information sharing and regularization constraints between different groups, and ensuring the overall stability of the model.

[0252] S32, Observation Data Layer:

[0253] The observation data layer defines the generation mechanism for actual observed traffic flow data, linking the theoretical model with the dataset formed in the S13 data aggregation step. For each observed sample's measured speed (i.e., the dataset formed in the S13 data aggregation step, where each observed sample represents a two-minute aggregated data point), its generation process is described by the following normal distribution:

[0254]

[0255] In the formula, Speed, in km / h The expected speed value is calculated using specific random parameters for grouping, and the unit is km / h. The total variance of the observed velocity is shown in S35 for detailed decomposition.

[0256]

[0257] In the formula, The free-flow velocity of group g (estimated as a parameter), in km / h; The critical density for group g (estimated as a parameter) is expressed in pcu / km / ln. The grouped small vehicle influence coefficient for g (estimated as a parameter), in km / h; The proportion of small cars; Density, in units of pcu / km / ln.

[0258] This structure clarifies the generation link from grouping parameters to the final observation value, reflecting the differentiated impact of different traffic state groups on the expected speed value.

[0259] S33, Grouping Parameter Layer:

[0260] Two traffic state groups (g=0, 1) were obtained based on Gaussian mixture model clustering. Specific random parameter distributions were assigned to each group to capture inter-group and intra-group heterogeneity. The mean parameter distribution is as follows:

[0261]

[0262] In the formula, , , They are respectively , , The global mean hyperparameter is used to characterize the average characteristics of traffic flow at the macro level. , , They are respectively , , The global variance hyperparameter is used to quantify the inter-group variability and uncertainty of parameters under different traffic conditions.

[0263] To characterize intragroup heterogeneity, a unique intragroup variance parameter was further defined for each group, assuming it follows a semi-normal distribution:

[0264] , ,

[0265] In the formula, , , These are the within-group variances of free-flow velocity, critical density, and small vehicle influence coefficient for group g, respectively. It represents a semi-normal distribution.

[0266] S34, Global Hyperparameter Layer:

[0267] The global hyperparameter layer aims to set a prior distribution for the random parameters in the grouping parameter layer, enabling information sharing and statistical constraints among groups of different traffic states. This layer contains the following key hyperparameters:

[0268]

[0269]

[0270]

[0271]

[0272]

[0273]

[0274]

[0275] In the formula, the variance of the observation error Used to characterize residual variation that the model fails to explain. Represents a truncated normal distribution. middle, The mean, For variance, The lower bound for this distribution is set to 30. In this example, a weakly informative prior distribution is set for all unknown parameters to drive their estimation based on actual data.

[0276] S35, Total Variance Decomposition

[0277] This step will elaborate on the total variance of the observation data layer. The theoretical framework reveals the heterogeneity between the global hyperparameter layer and the grouped parameter layer, and how this heterogeneity propagates jointly through nonlinear velocity-density relationships and influences the variation in observation velocities. Within-group variance ( , , The variance of the global hyperparameters ( ) characterizes the random fluctuations of traffic flow parameters within each group, while the variance of the global hyperparameters ( ) , , This quantifies the parameter differences between different traffic state groups. The total uncertainty of each parameter is the sum of its within-group and between-group variances:

[0278]

[0279]

[0280]

[0281] In the formula, , , These represent the total variances of free-flow velocity, critical density, and the influence coefficient of small vehicles, respectively.

[0282] The total uncertainty of these parameters propagates to the observation velocity through the Drake model. This is achieved by adjusting the grouping parameters. , , A first-order Taylor expansion yields the expression for the total variance. This modeling strategy eliminates the need to set individual layer parameters for each observation sample, ensuring the feasibility of model inference.

[0283]

[0284] In the formula, , , These are the first-order partial derivatives of the expected velocity value with respect to the corresponding parameters.

[0285] S36. Model Inference and Parameter Solving:

[0286] The goal of this step is to infer the complete posterior distribution of all unknown parameters using observed data, based on the traffic states determined by the S2 traffic state clustering and the model structure constructed from S31 to S34. Mathematically, this problem boils down to: given observed data... Solve the model parameter set under the conditions of (i.e., speed, density, and proportion of small cars). posterior distribution This parameter set encompasses all the random parameters to be estimated in the global hyperparameter layer, the grouped parameter layer, and the observation data layer. The model is constructed based on a hierarchical Bayesian framework, with the inference objective being to obtain the complete posterior distribution of the parameters. According to Bayes' theorem, the posterior distribution is expressed as:

[0287]

[0288] In the formula, Given observation data Under these conditions, model parameter set The posterior probability distribution; the likelihood function Indicates that under known parameters Data observed under these circumstances The probability is defined by the S32 observation data layer; It is the prior distribution, the joint prior of all unknown parameters in the model, including the prior settings of global hyperparameters, group parameters and observation error terms, specifically defined by the S33 group parameter layer and the S34 global hyperparameter layer.

[0289] Since the posterior distribution is difficult to handle analytically, a Markov Chain Monte Carlo (MCMC) method is used for approximate inference. Four independent Markov chains are used for parallel sampling. Each chain performs 5000 iterations of sampling, with the first 2000 iterations serving as a burn-in period for algorithm stabilization and adaptive tuning, and the subsequent 3000 iterations used for effective posterior sample collection and parameter estimation.

[0290] The model inference and solution process mainly relies on probabilistic programming and Bayesian computation tools such as PyMC, ArviZ, and PyTensor in the Python environment. PyMC is used to define the hierarchical stochastic parameter model and MCMC sampling settings; ArviZ is responsible for posterior diagnosis, convergence evaluation, and result visualization; and PyTensor provides high-performance tensor operations and automatic differentiation support. Table 2 shows the computation results of the hierarchical Bayesian stochastic parameter model. The R-hat values ​​for all parameters are <1.01, indicating that MCMC sampling has converged sufficiently.

[0291] The model successfully estimated the core parameters for both traffic flow states, revealing significant heterogeneity. The estimation results for each parameter report their posterior mean and the 95% highest density interval (95% HDI).

[0292] (1) Free-flow velocity: The average free-flow velocity of group 0 was 79.64 km / h (95% HDI: [79.33,79.95]), which was significantly higher than that of group 1 (63.74 km / h (95% HDI: [62.00, 65.37]). This indicates that the model successfully identified two different traffic flow states, “fast” and “slow”, from the data.

[0293] (2) Critical density: The mean optimal density of group 0 is 45.12 pcu / km / ln (95% HDI: [40.95,49.62]), which is much higher than that of group 1 (27.59 pcu / km / ln (95% HDI: [25.56, 29.49]), confirming the different traffic conditions of the two groups.

[0294] (3) Small vehicle influence coefficient: The small vehicle influence coefficient for group 0 is 20.39 (95% HDI: [20.02, 20.77]), which is higher than that for group 1 (6.28, 95% HDI: [3.93, 8.72]). This indicates that under free-flow conditions, the marginal effect of the proportion of small vehicles on increasing the average speed is more significant.

[0295] (4) Randomness measurement: Except for the critical density parameter of group 0, the posterior mean of the standard deviation of the other group parameters is between 2 and 7, indicating that there is significant individual randomness within each group, which verifies the necessity of using a random parameter model.

[0296] Table 2. Parameter estimation results of the hierarchical Bayesian stochastic parameter model

[0297]

[0298] S4. Model Validation and Performance Evaluation:

[0299] A phased prediction strategy is adopted, and dual evaluation (point estimation and posterior prediction check) is performed on the training set with known groups to verify the model's goodness of fit. For the test set, mixed prediction is performed based on the marginal probability of GMM. The prediction uncertainty is fully quantified by weighting the group probabilities, sampling individual parameters, and superimposing observation errors. Finally, the generalization ability and prediction reliability of the model are comprehensively evaluated by using indicators such as root mean square error (RMSE), mean absolute error (MAE), and mean absolute percentage error (MAPE).

[0300] Specifically, it includes the following sub-steps:

[0301] S41. Predicted implementation structure:

[0302] Based on the trained hierarchical Bayesian stochastic parameter model, a phased prediction strategy is implemented, distinguishing between two scenarios: training set fitting evaluation and test set generalization prediction. For the training set with known group labels, group-specific parameters are used for prediction; for the test set with unknown groups, a hybrid prediction strategy based on the posterior marginal probability of the GMM is adopted.

[0303] S42. Evaluation of training set fitting performance (given group predictions):

[0304] Based on the pre-trained hierarchical Bayesian stochastic parameter model, a dual evaluation strategy is implemented on the training set data to comprehensively verify the model's fitting performance and predictive reliability. Since the training set data has known GMM grouping identifiers, group-specific parameters can be used for accurate prediction evaluation.

[0305] S42.1, Design of a dual evaluation strategy:

[0306] The training set fit performance is evaluated using a dual validation strategy that combines point estimation evaluation with posterior predictive check (PPC).

[0307] (1) Point estimation evaluation: Deterministic prediction is made using the mean parameter of the posterior distribution to evaluate the maximum potential fit performance of the model under ideal conditions and reflect the theoretical expressive power of the model structure.

[0308] (2) Posterior prediction check (PPC): Considering the full probability prediction of parameter uncertainty and observation error, evaluate the fitting quality of the model in practical applications and the degree of calibration of the prediction interval, and test the model's overall ability to describe the data generation process.

[0309] S42.2, Point Estimation Assessment Implementation:

[0310] (1) Extract the posterior mean of each grouping parameter from the posterior sample of MCMC:

[0311]

[0312] In the formula, Here are the posterior mean values ​​of the free-flow velocity parameters for group g, in km / h. Here are the posterior mean values ​​of the critical density parameters for group g, in units of pcu / km / ln; The posterior mean of the influence coefficient parameters for grouped small vehicles (g); For chain index; For sampling index; For the first Chain, First In the next iteration, grouping The free-flow velocity sample values ​​are in km / h. For the first Chain, First In the next iteration, grouping The critical density sample value, in units of pcu / km / ln; The first Chain, First In the next iteration, grouping Sample values ​​of the influence coefficient for small vehicles.

[0313] (2) Point estimation prediction calculation:

[0314] Based on the selected grouping parameters, calculate the observed samples for each training set. Predicted velocity point values:

[0315]

[0316] In the formula, The predicted speed is estimated at a point, in km / h. For training set observation samples The density is expressed in pcu / km / ln; For training set observation samples The proportion of small cars.

[0317] S42.3 Implementation of Posterior Predictive Check (PPC):

[0318] (1) Posterior sample extraction:

[0319] Randomly selected from all 12,000 posterior samples 10 samples (indexed as) This is used for posterior prediction checking (PPC) to ensure a balance between computational efficiency and statistical accuracy. Simultaneously, it maintains the correlation structure between parameters during the sampling process.

[0320] (2) PPC prediction process:

[0321] For each drawn posterior sample s and grouping Perform the following steps:

[0322] ① Parameter sampling: Observation samples for each training set From group A set of individual parameter values ​​is sampled from the parameter distribution to characterize intragroup heterogeneity.

[0323]

[0324]

[0325]

[0326] In the formula, , , The test set number The nth observation sample, based on the nth observation sample s The posterior sample and the first Individual free-flow velocity parameter value, individual critical density parameter value, and individual small vehicle influence coefficient parameter value for each group; , , The first s In the nth posterior sample, the nth The sample mean of free flow velocity, the sample mean of critical density, and the sample mean of small vehicle influence coefficient for each group; , , The first s In the nth posterior sample, the nth The standard deviations of the free-flow velocity sample parameters, the critical density sample parameters, and the small vehicle influence coefficient sample parameters for each group.

[0327] ② Velocity prediction: based on sampled individual parameters and training set observation samples Features, calculate grouping Predicted velocity values ​​under given conditions.

[0328]

[0329] In the formula, For the first The training set observation samples, based on the nth training set observation samples, s Grouped in each posterior sample The predicted speed value is calculated from individual parameters and is expressed in km / h. For the first Density values ​​of observation samples in the training set, in units of pcu / km / ln; For the first The proportion of small cars in the training set observation samples.

[0330] ③ Likelihood sampling: Based on the normal distribution assumption, generate complete prediction samples that take into account observation errors.

[0331]

[0332] In the formula, This is a sample of predicted speeds after accounting for observation errors, in km / h. For the first s The total variance of a posterior sample, in units of .

[0333] (3) Calculation and evaluation of PPC statistics:

[0334] ① Posterior predictive mean:

[0335]

[0336] In the formula, For the training set The posterior predicted mean of each observation sample, in km / h; This represents the sample size for posterior sampling.

[0337] ②Construction of 95% prediction interval:

[0338]

[0339] In the formula, For training set observation samples The 95% prediction range; , These are the 2.5% and 97.5% quantile functions, respectively, used to calculate the 2.5th percentile and 97.5th percentile of their input sets. For the training set The observed samples corresponding to A set of deterministic velocity predictions.

[0340] ③ Coverage verification:

[0341]

[0342] In the formula, 95% prediction interval coverage, in percentage; 50400 is the total number of observation samples in the training set. This is an indicator function that takes the value 1 if the condition is true, and 0 otherwise. For the training set The measured speed values ​​of each observation sample, in km / h.

[0343] S42.4 Comprehensive evaluation of training set fitting performance:

[0344] (1) Parameter estimation results and characteristic analysis of heterogeneous traffic flow

[0345] Figure 3This paper demonstrates the fitting effect of the traffic baseline model constructed using a hierarchical Bayesian stochastic parameter model, clearly reflecting the mapping relationship between density and speed and the corresponding uncertainties in two traffic state groups. The scatter points in the figure represent the actual observed data from the training set, the solid lines represent the fitted curves corresponding to the posterior means of each group, the shaded areas represent the 95% prediction intervals of each curve, and the proportion of small vehicles used is the mean of the corresponding group.

[0346] from Figure 3 The data clearly shows that the two groups have significantly different traffic flow characteristics: Group 0 is generally located in a high-speed, low-density region; while Group 1 is concentrated in a medium-low speed, medium-high density region. The fitting curves of each group can fit the data distribution of the corresponding state well, and the 95% prediction interval can also cover the vast majority of the observed data. This indicates that the model can not only effectively identify the inherent heterogeneity of traffic flow, but also make accurate and reliable estimates of the speed-density relationship under different states, and provide good uncertainty quantification.

[0347] (2) Interval Coverage Analysis

[0348] Figure 4 This paper demonstrates the coverage effect of the prediction interval based on posterior prediction check (PPC), with the observed samples sorted by density. The curve represents the PPC prediction mean, the shaded area represents the 95% posterior prediction interval, and the scatter plot represents the actual observed data from the training set. The model's empirical coverage on the test set is 94.4%, which is highly close to the theoretical target value of 95%, indicating that the model can accurately quantify prediction uncertainty and effectively capture random variation in the data.

[0349] (3) Comprehensive evaluation of fitting performance

[0350] The root mean square error (RMSE), mean absolute error (MAE), and mean absolute percentage error (MAPE) are used as evaluation metrics to verify the model performance. The specific calculation formulas are as follows:

[0351]

[0352]

[0353]

[0354] In the formula, For the training set The predicted speed values ​​for each observation sample are in km / h.

[0355] As shown in Table 3, the hierarchical Bayesian stochastic parameter model constructed in this example exhibits excellent fitting performance and uncertainty quantification capability on the training set. Specifically, the point estimation performance index is based on the deterministic predicted value calculated from the posterior mean of the grouping parameters (…). ) calculation; the posterior predictive performance index is based on the mean of 2000 PPC sampled predictive values ​​( )calculate.

[0356] Table 3 Comparison of performance metrics between training point estimation and PPC estimation

[0357]

[0358] (1) The point estimation and PPC estimation are highly consistent in accuracy: the two are close in RMSE, MAE and MAPE, indicating that the point estimation provided by the posterior mean of the model is highly representative and the PPC process does not introduce significant bias.

[0359] (2) High model fitting accuracy: MAPE is less than 7%, indicating that the model can accurately capture the main change patterns in the data.

[0360] In summary, this model demonstrates excellent point estimation capabilities on the training set and achieves accurate measurement of prediction uncertainty, providing a reliable guarantee for the model's generalization performance on the test set.

[0361] S43. Test set fitting performance evaluation (unknown grouping prediction):

[0362] To test the generalization ability of the hierarchical Bayesian stochastic parameter model, a test set that was not used in the training was used for evaluation. Since the test set data does not have known GMM grouping identifiers, a hybrid prediction method based on GMM marginal probabilities is required to simulate prediction scenarios in real-world applications.

[0363] S43.1 Principle of Hybrid Forecasting Strategy:

[0364] The core challenge of test set prediction is that the grouping state is unknown; it's impossible to directly determine which traffic state group a new observation sample should belong to. This example employs the following hybrid prediction strategy:

[0365] (1) Group probability inference

[0366] Using the GMM model parameters estimated during the training phase, the posterior probability of each group is calculated based on the density features of the test set.

[0367] (2) Weighted prediction synthesis

[0368] The model predictions for each group condition are calculated separately, and then a weighted average is calculated based on the obtained group probabilities to obtain the final mixed prediction result.

[0369] S43.2, Grouping Probability Inference:

[0370] (1) GMM marginal probability model:

[0371] Based on the GMM clustering results during the training phase, the marginal distribution parameters of each group in the density dimension are extracted. For each group... Its density dimension marginal distribution is a one-dimensional Gaussian distribution, denoted as:

[0372]

[0373] In the formula, For the first The mixing coefficients of a Gaussian distribution; Grouping The mean in the density dimension, Grouping Variance in the density dimension.

[0374] (2) Calculation of posterior probability:

[0375] For the test set density observations after standardization according to "S21.2 feature standardization processing" It belongs to the group. The formula for calculating the posterior probability is as follows:

[0376]

[0377] In the formula, for Belongs to group The posterior probability; For the first The probability density function of a one-dimensional Gaussian distribution of a group in the density dimension; For summation of the circular index; For the first The probability density function of a one-dimensional Gaussian distribution in the density dimension of a group.

[0378] S43.3, Grouping Condition Prediction:

[0379] (1) Posterior sample extraction:

[0380] Randomly selected from all 12,000 posterior samples 10 samples (indexed as) This is used for subsequent predictions, and the correlation structure between parameters is maintained during the sampling process.

[0381] (2) Group prediction:

[0382] For each posterior sample s and grouping Perform the following steps:

[0383] ① Parameter sampling: Observation samples for each test set From group A set of individual parameter values ​​is sampled from the parameter distribution to characterize intragroup heterogeneity.

[0384]

[0385]

[0386]

[0387] In the formula, , , The test set number The nth observation sample, based on the nth observation sample s The posterior sample and the first Individual free-flow velocity parameter value, individual critical density parameter value, and individual small vehicle influence coefficient parameter value for each group; , , The first s In the nth posterior sample, the nth The sample mean of free flow velocity, the sample mean of critical density, and the sample mean of small vehicle influence coefficient for each group; , , The first s In the nth posterior sample, the nth The standard deviations of the free-flow velocity sample parameters, the critical density sample parameters, and the small vehicle influence coefficient sample parameters for each group.

[0388] ② Velocity prediction: based on sampled individual parameters and observed samples from the test set. Features, calculate grouping Predicted velocity values ​​under given conditions.

[0389]

[0390] In the formula, For the first The test set observation samples, based on the first test set observation samples, s Grouped in each posterior sample The predicted speed value is calculated from individual parameters and is expressed in km / h. For the first Density values ​​of the observed samples in the test set, in units of pcu / km / ln; For the first The proportion of small cars observed in each test set.

[0391] S43.4, Mixed Probability Prediction:

[0392] (1) Weighted average

[0393] Observation samples for each test set The conditional predicted values ​​of the above groups According to its corresponding group posterior probability The posterior sample is obtained by performing a weighted average. s The following are mixed predictions:

[0394]

[0395] In the formula, Observation samples for the test set In the posterior sample s The mixed weighted speed prediction value at time, in km / h; Observation samples for the test set Belongs to group The posterior probability.

[0396] (2) Add observation error

[0397] Sampling from a normal distribution, observation errors are added to each mixed-weighted velocity prediction to generate velocity predictions that take observation errors into account:

[0398]

[0399] In the formula, The speed prediction value is taken into account for observation errors, and the unit is km / h.

[0400] (3) Prediction and estimation

[0401] Based on all A posterior prediction sample with added observation error The final velocity prediction results are as follows:

[0402]

[0403] In the formula, Observation samples for the test set The final speed prediction value.

[0404] S43.5, Generalization ability analysis:

[0405] (1) Complementary distribution relationship of group probability with density

[0406] exist Figure 5The Gaussian mixture model group probability distribution diagram shown illustrates the density-based dynamic group probability allocation mechanism in the mixture prediction model. The probabilities of group 0 and group 1 exhibit obvious complementary distribution characteristics as density changes. In low-density regions such as (0–12 pcu / km / ln), group 0 dominates, with a significantly higher probability than group 1; as density increases, the probability of group 1 gradually rises, and it becomes the dominant group in other density ranges (greater than 14 pcu / km / ln).

[0407] (2) Predictive performance evaluation

[0408] To evaluate the effectiveness of the proposed hierarchical Bayesian stochastic parameter model in this example, a Bayesian stochastic parameter model was simultaneously calibrated for comparison. This model ignores the heterogeneity of traffic flow states, treating all data as the same population, but introduces randomness into key parameters. Its expression is:

[0409]

[0410]

[0411] In the formula, , , and , , These are the global mean and global variance of the corresponding parameters, respectively.

[0412] The generalization performance of the model was quantitatively evaluated on the test set. The comparison model used the same velocity-density relationship and the same Bayesian modeling method as the present invention for parameter estimation. The RMSE, MAE, and MAPE indices defined in S42.4 were used for evaluation. The comparison results of the generalization prediction performance of the models are shown in Table 4.

[0413] Table 4. Evaluation results of test set prediction performance

[0414]

[0415] The results show that the hierarchical Bayesian stochastic parameter model proposed in this invention outperforms the two comparative models in all prediction performance metrics on the test set. Specifically, the model achieves the lowest values ​​in the three metrics of root mean square error (RMSE), mean absolute error (MAE), and mean absolute percentage error (MAPE), which are 7.51 km / h, 5.47 km / h, and 6.12%, respectively, thus outperforming both the Bayesian stochastic parameter model without the grouping mechanism and the Bayesian fixed parameter model.

[0416] Compared with Bayesian stochastic parameter models without grouping mechanisms, the model of this invention reduces RMSE, MAE, and MAPE by approximately 5.3%, 9%, and 8.5%, respectively. This indicates that by introducing a grouping mechanism based on GMM clustering, this invention can more effectively capture the heterogeneity in traffic flow data, thereby significantly improving the model's predictive stability for actual observations.

[0417] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely illustrative of the principles of the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the present invention as claimed. The scope of protection of this invention is defined by the appended claims and their equivalents.

Claims

1. A traffic flow velocity estimation method based on Gaussian mixture model and hierarchical Bayesian method, characterized in that, Includes the following steps: S1. Data Preparation and Preprocessing: Historical traffic flow data for bicycles is acquired, and then the acquired bicycle data is cleaned to remove abnormal data that clearly does not conform to physical patterns. The cleaned bicycle data is then subjected to time aggregation processing to generate a... The dataset is aggregated at minute intervals; then, the data in the aggregated dataset is further cleaned to remove outlier data points with densities exceeding the effective range; next, the dataset is divided into training and test sets; =1~5; S2. Traffic Condition Clustering Classification: Based on the density and speed of the observed samples in the training set, an unsupervised clustering analysis of traffic states is performed using a Gaussian mixture model. The traffic flow is divided into G subgroups with significant heterogeneity. Each subgroup represents a typical traffic state. By assigning each data point to the subgroup with the highest posterior probability, the traffic state label assignment for all observed samples is completed. S3. Construction of a hierarchical Bayesian stochastic parameter model: A hierarchical Bayesian stochastic parameter model is constructed based on the traffic state classification results obtained from S2. The hierarchical Bayesian stochastic parameter model includes an observation data layer, a group parameter layer, and a global hyperparameter layer, and uses the Markov chain Monte Carlo method for parameter estimation. S4. Model Validation and Performance Evaluation: The hierarchical Bayesian stochastic parameter model is validated using the training and test sets, including point estimation and posterior prediction checks for the training set with known groups, and a hybrid prediction strategy based on the posterior marginal probability of a Gaussian mixture model for the test set with unknown groups.

2. The traffic flow velocity estimation method based on Gaussian mixture model and hierarchical Bayes as described in claim 1, characterized in that, The specific method for S1 is as follows: S11. Data Acquisition: Acquire historical traffic flow data for individual vehicles, including time, lane number, speed, and headway to the vehicle in front. S12. Data cleaning: Set the effective speed range to [0, 140] km / h and the effective headway range to [1, +∞) s, and remove single-vehicle data that exceed the above effective range; S13. Data Aggregation: Aggregate the cleaned data according to a two-minute time window, and use the aggregated data as the observation sample; S14. Dataset partitioning: Further clean the aggregated data, set the effective density range to [0, 120] pcu / km / ln, and remove outlier data points that exceed this range; then partition the dataset into training set and test set.

3. The traffic flow velocity estimation method based on Gaussian mixture model and hierarchical Bayes as described in claim 2, characterized in that, When aggregated, the resulting data includes traffic flow, small vehicle traffic flow, large vehicle traffic flow, speed, small vehicle ratio, and density.

4. The traffic flow velocity estimation method based on Gaussian mixture model and hierarchical Bayes as described in claim 2, characterized in that, The specific method for S2 is as follows: S21. Feature Space Construction: Construct the original feature matrix Then, standardization is performed to obtain the standardized feature matrix, denoted as . : ; In the formula, For the first The feature vectors of the observed samples, i=1,2,……,n; For the first The density of each observation sample is expressed in pcu / km / ln. For the first The speed of each observed sample is expressed in km / h. The total number of observed samples in the training set; Z-score standardization is adopted, specifically: ; ; In the formula, It is the first The standardized feature vector of each observation sample; For the first Standardized density of each observation sample; For the first Standardized velocity for each observation sample; , These are the mean and standard deviation of the density on the training set, respectively; , These are the mean and standard deviation of the velocity features on the training set, respectively. It is the standardized feature matrix; S22. Clustering Algorithm Selection: The training set is grouped using a Gaussian mixture model as the clustering algorithm, assuming that all data points are... Generated by mixing multiple Gaussian distribution components, each component This represents a potential traffic flow pattern, whose probability density function is: ; In the formula, It is the first Standardized feature vector of each observation sample The overall probability density; It is the number of Gaussian distributions, i.e., the preset number of clusters; It is a grouped index. ; It is the first The mixing coefficients of a Gaussian distribution satisfy the following conditions: and , representing the prior weight of each group in the population; It is the first The probability density function of a multivariate Gaussian distribution; The complete expansion of the probability density function of the multivariate Gaussian distribution is as follows: ; In the formula, It is the first A vector of mean values ​​from a Gaussian distribution; It is the first The covariance matrix of a Gaussian distribution; It is the dimension of the feature space, that is, the length of the feature vector; It is the covariance matrix The determinant; It is the covariance matrix The inverse matrix; S23, Model Training: The parameter set of the Gaussian mixture model is obtained by using the expectation-maximization algorithm. Make an estimate to maximize the training set The likelihood function; the expression for the likelihood function is as follows: ; In the formula, For a given set of parameters Next training set The probability likelihood; The expectation-maximization algorithm iteratively optimizes by alternating between E-steps and M-steps. When the increment of the log-likelihood function is less than a preset threshold, the model is considered to have converged. S24, State Division: Based on the trained Gaussian mixture model, the state of any observation sample is divided.

5. The traffic flow velocity estimation method based on Gaussian mixture model and hierarchical Bayes as described in claim 4, characterized in that, In S22, This represents two groups, with the first group labeled 0 and the second group labeled 1; in S23, the preset threshold is... .

6. The traffic flow velocity estimation method based on Gaussian mixture model and hierarchical Bayes as described in claim 4, characterized in that, The specific method for S24 is as follows: S24.1, Probability Division: for First, standardization is performed using S21 to obtain the... Standardized feature vector of each observation sample ; Subsequently, it is calculated that it belongs to the first Posterior probabilities of a Gaussian distribution: ; In the formula, In the given number Standardized feature vector of each observation sample Under the condition that it belongs to the first Posterior probabilities of a Gaussian distribution; It is a latent categorical variable. Indicates that the sample belongs to the first A Gaussian distribution; It is the circular index in the summation operation of the denominator; For the first The mixing coefficients of a Gaussian distribution; For the first A vector of mean values ​​from a Gaussian distribution; For the first The covariance matrix of a Gaussian distribution; S24.2, Category Determination: If a specific traffic state label needs to be assigned to a data point, it should be grouped into the group with the highest posterior probability: ; In the formula, It is the first Standardized feature vector of each observation sample The final category label assigned; This represents the label index that maximizes the posterior probability. .

7. The traffic flow velocity estimation method based on Gaussian mixture model and hierarchical Bayes as described in claim 1, characterized in that, The specific method for S3 is as follows: The hierarchical Bayesian stochastic parameter model is constructed, which includes a three-layer hierarchical structure of observation data layer, group parameter layer and global hyperparameter layer; Among them, the observation data layer defines the likelihood function of the actual observed velocity data, and the velocity expectation value is calculated based on group-specific random parameters; Grouping parameter layer: Set specific random parameter distributions for each traffic state group to capture heterogeneity between and within groups; Global hyperparameter layer: sets the prior distribution for the random parameters in the group parameter layer, enabling information sharing between groups; Then, model inference and parameter solving are performed, and the posterior distribution of all unknown parameters is solved using the Markov chain Monte Carlo method.

8. The traffic flow velocity estimation method based on Gaussian mixture model and hierarchical Bayes as described in claim 7, characterized in that, Expected speed The calculation formula is: ; In the formula, Let g be the free-flow velocity of group g, in km / h. Here is the critical density for group g, expressed in pcu / km / ln; denoted by g, representing the grouping influence coefficient for small vehicles, in km / h. The proportion of small cars; Density, in units of pcu / km / ln; In the grouping parameter layer, when setting a random parameter distribution for each traffic state group, the mean parameter and the within-group variance parameter are set; The distribution of the mean parameter is as follows: ; In the formula, , , They are respectively , , The global mean hyperparameter; , , They are respectively , , The global variance hyperparameter; The within-group variance parameter follows a semi-normal distribution, as expressed below: , , ; In the formula, , , These are the within-group variances of free-flow velocity, critical density, and small vehicle influence coefficient for group g, respectively. It represents a semi-normal distribution.

9. The traffic flow velocity estimation method based on Gaussian mixture model and hierarchical Bayes as described in claim 1, characterized in that, The specific method for S4 is as follows: Based on the trained hierarchical Bayesian stochastic parameter model, group-specific stochastic parameter prediction is used for the training set. After prediction, the fitting performance of the training set is evaluated. The evaluation includes point estimation evaluation and posterior prediction check, and the root mean square error, mean absolute error and mean absolute percentage error are calculated. Meanwhile, based on the trained hierarchical Bayesian random parameter model, a mixture prediction based on the posterior probability of the Gaussian mixture model is used for the test set. The model prediction value of the observed sample under each group condition is calculated, and then a weighted average is performed according to the obtained group probability. The observation error is added to generate the speed prediction value after taking into account the observation error.

10. The traffic flow velocity estimation method based on Gaussian mixture model and hierarchical Bayes as described in claim 1, characterized in that, Also includes: S5. Traffic flow speed estimation: For the same road segment, the density and proportion of small vehicles are obtained and input into the trained hierarchical Bayesian stochastic parameter model, and the hybrid prediction strategy described above can be used to predict the traffic flow speed.

Citation Information

Patent Citations

  • Real-time traffic state evaluation method based on Gaussian mixture model

    CN105938655A

  • Vehicle trajectory predicting method based on hybrid dynamic bayesian networks and gaussian process

    CN110304075A