A machine learning and large model collaborative traffic flow prediction method

By integrating multi-source data through vehicle-road-cloud integration technology and combining machine learning with large-scale models, the shortcomings of traditional traffic flow prediction methods in complex scenarios have been solved, achieving high-precision and high-reliability traffic flow prediction.

CN120580862BActive Publication Date: 2025-11-25ZHEJIANG SUPCON INFORMATION TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202511093063.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-08-06
Publication Date
2025-11-25
Estimated Expiration
2045-08-06

AI Technical Summary

Technical Problem

Traditional traffic flow prediction methods rely on a single data source, making it difficult to cover the dynamic changes in complex traffic scenarios, unable to adapt to sudden events, and lacking the ability to perform multi-dimensional feature collaborative analysis.

Method used

By integrating multi-source data through vehicle-road-cloud integration technology, combining machine learning and large-scale model collaboration, collecting and preprocessing multi-dimensional features, and using LSTM and XGBoost models for feature fusion and optimization, the prediction accuracy is improved.

Benefits of technology

It improves the accuracy and reliability of traffic flow prediction, enhances the model's adaptability to complex scenarios and environmental changes, and improves the accuracy of prediction results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120580862B_ABST
    Figure CN120580862B_ABST
Patent Text Reader

Abstract

The application provides a traffic flow prediction method combining machine learning and a large model, collects vehicle-to-road cloud data to construct a road network, extracts basic multi-dimensional features in the data, uses a reasoning large model to preliminarily predict the flow, uses a machine learning model to recombine features and predict the flow based on the preliminary flow prediction result and the basic multi-dimensional features, optimizes the weight of the features, repeatedly iteratively trains, and improves the prediction accuracy. Through vehicle-to-road cloud data fusion, the feature dimension and information integrity can be improved; the phased cooperation of machine learning and the large model can take into account the global law and local fine prediction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of traffic flow prediction, and in particular relates to a traffic flow prediction method that combines machine learning and large models. Background Technology

[0002] With the rapid development of cities, traffic congestion has become an increasingly serious problem. Traditional traffic flow prediction methods are mostly based on a single data source (such as loop detectors or cameras), which has many shortcomings; traditional methods rely on historical traffic statistics or local sensor data, making it difficult to cover the dynamic changes in complex traffic scenarios; traffic flow is significantly affected by spatiotemporal correlations (such as the linkage between upstream and downstream intersections, peak-hour characteristics, etc.), and existing models have weak collaborative analysis capabilities for multi-dimensional features; static models cannot adapt to the real-time adjustment needs of sudden traffic events (such as accidents, weather changes).

[0003] Existing technology application publication number CN117437774A discloses an AI-based multimodal traffic flow prediction system, including a data collection module, a data preprocessing module, a data analysis and feature extraction module, an AI prediction model module, a real-time event response module, a prediction result analysis module, and a traffic control module. The data collection module collects multimodal traffic data, including vehicle flow, pedestrian flow, public transport flow, traffic signal status, and weather conditions. The data preprocessing module receives the raw data from the data collection module, cleans, standardizes, and integrates it, generates a data quality report, and transmits it to the real-time event response module. By analyzing multimodal traffic data in real time and adaptively adjusting control strategies, the AI-based prediction system effectively improves urban traffic efficiency, enhances residents' travel experience, and helps reduce environmental pollution. Summary of the Invention

[0004] The development of vehicle-road-cloud integrated technology has provided a new data foundation for traffic flow prediction. By integrating multi-source data from vehicle-to-everything (V2X), roadside radar, cameras, and cloud platforms, rich information such as vehicle trajectories, speeds, traffic flow, and road network topology can be obtained. Meanwhile, the strong logical reasoning and analysis capabilities of large-scale inference models are well-suited for handling multi-source data in complex scenarios, but their ability to provide refined predictions and analyze long-term time-series dependent information correlations is insufficient.

[0005] To address the aforementioned technical problems, the present invention provides a traffic flow prediction method that combines machine learning with large-scale models, comprising the following steps:

[0006] S1. Collect multi-source data from vehicle-road-cloud and perform data preprocessing to construct the road network;

[0007] S2. Extract basic multidimensional features, including temporal features, spatial features, environmental features, and weight matrix; environmental features include weather factors and holiday factors.

[0008] S3. Utilize the inference model to vectorize and analyze the basic multidimensional features, and output preliminary traffic prediction results;

[0009] S4. Using a machine learning model, based on the preliminary traffic prediction results and basic multidimensional features, re-combine features and predict traffic, and optimize the weight matrix in S2 based on the actual traffic.

[0010] S5. Repeat steps S1-S4 for iterative training to improve the final prediction accuracy and output the final flow prediction result.

[0011] Specifically, in step S1, data preprocessing includes aligning data with different sampling frequencies, performing linear interpolation on low-frequency data, and using time window aggregation on high-frequency data; it also fills in missing values ​​by using cubic spline interpolation to fill in missing values; and in S1, when constructing the road network, it generates a table of relationships between the entrances and exits of each intersection.

[0012] Specifically, in S2, the mean and variance of traffic flow, as well as headway and congestion index, are calculated based on a sliding window with a fixed time as temporal features. Spatial features are constructed by obtaining the temporal features of adjacent intersections of each intersection based on the correlation table of entrances and exits of each intersection. The weight matrix is ​​constructed jointly based on spatial features and environmental features.

[0013] Specifically, the weight matrix in S2 includes the spatial weights of the four intersections connecting the east, west, north, and south entrances of the target intersection. The spatial weights are obtained by multiplying the parameters of the temporal characteristics of each intersection and the parameters of the environmental characteristics by their respective empirical weight coefficients and then summing them up. The weather factor in the environmental characteristics is a traffic efficiency attenuation coefficient that is dynamically adjusted based on meteorological data.

[0014] Specifically, in each iteration of training, the empirical weight coefficients of the spatial weights in S2 are calculated and optimized by the machine learning model in S4 based on the actual traffic during the previous iteration of training.

[0015] Specifically, the S3 large model performs vectorization processing on basic multidimensional features, including time series embedding for temporal features and graph embedding for spatial features. At the same time, the weight matrix is ​​used as prior knowledge of the model to adjust the importance of different features in the inference process. For environmental features, a dynamic encoding strategy is adopted, and structured environmental data is normalized and discretized and then incorporated into the model using conditional embedding.

[0016] Specifically, in S4, an LSTM model based on the Attention mechanism is first used to process the basic multidimensional features of each intersection and optimize the preliminary traffic prediction results to obtain the LSTM model traffic prediction results. Then, the Extreme Gradient Boosting Tree (XGBoost) model is used to perform feature fusion and final prediction on all features and the preliminary traffic prediction results.

[0017] Specifically, the XGBoost model uses the parameters, weight matrix, weather factors, holiday factors, preliminary traffic prediction results, and LSTM model traffic prediction results of the acquired time-series features of each intersection as basic features and combines them in pairs. All basic features and combined features are used to build several regression trees to fit the data through iteration. By continuously calculating the split gain of each feature, the feature with the largest gain is selected for node splitting, thereby gradually building a tree model.

[0018] Specifically, during the XGBoost model's regression tree construction process, features are selected and nodes are split based on the split gain for each tree built. The number of times each feature, including basic features and combined features, is used for node splitting is recorded during the model construction process. After the model is built, the features selected most frequently are taken as important features.

[0019] Specifically, in S5, important features are processed and calculated using the XGBoost model to obtain the final traffic flow prediction results for each intersection in the future time period.

[0020] The beneficial effects of this invention are: by fusing vehicle, road, and cloud data, the feature dimension and information integrity are improved; the phased collaboration between machine learning and large models takes into account both global patterns and local refined predictions; and the introduction of attention mechanisms and external factors enhances the model's adaptability to environmental changes. Attached Figure Description

[0021] Figure 1 This is a flowchart of the method of the present invention.

[0022] Figure 2 This is a detailed flowchart of the machine learning part of the present invention. Detailed Implementation

[0023] The present invention will now be described in detail with reference to the accompanying drawings and embodiments.

[0024] Example 1: A traffic flow prediction method that combines machine learning and large models, such as... Figure 1 As shown, it includes the following steps:

[0025] S1. Collect multi-source data from vehicle-road-cloud and perform data preprocessing to construct the road network;

[0026] S2. Extract basic multidimensional features, including temporal features, spatial features, environmental features, and weight matrix; environmental features include weather factors and holiday factors.

[0027] S3. Utilize the inference model to vectorize and analyze the basic multidimensional features, and output preliminary traffic prediction results;

[0028] S4. Using a machine learning model, based on the preliminary traffic prediction results and basic multidimensional features, re-combine features and predict traffic, and optimize the weight matrix in S2 based on the actual traffic.

[0029] S5. Repeat steps S1-S4 for iterative training to improve the final prediction accuracy and output the final flow prediction result.

[0030] Step S1 involves multi-source data integration and preprocessing. First, multi-source data is acquired, including vehicle-side (vehicle speed), roadside (radar traffic flow, radar vehicle speed), and cloud-based (historical traffic situation database, road network information). Next, data alignment is performed. To address the issue of sensor sampling frequency differences, linear interpolation is used for low-frequency data (cloud-based), and time window aggregation is applied to high-frequency data (radar, etc.). Then, missing values ​​are filled using cubic spline interpolation. Finally, road network construction is performed, generating a relationship table for entrances and exits at each intersection based on rules.

[0031] In step S2, for the processed multi-source data, based on a 1-minute sliding window, the mean and variance of traffic flow, as well as statistics such as headway and congestion index, are calculated as temporal features. Weather factors and weekend / holiday impact factors are introduced as environmental features. Then, based on the generated correlation table of entrances and exits of each intersection, the temporal features of adjacent intersections of each intersection are obtained to construct spatial features, and combined with environmental features to construct an upstream and downstream spatial weight matrix. The weight matrix includes the spatial weights of the four intersections connecting the east, west, south, and north entrances of the target intersection. The spatial weights are obtained by multiplying the mean traffic flow, variance of traffic flow, headway, congestion index, weather factors, and holiday factors by their respective empirical weight coefficients and summing them. If there are no adjacent intersections, the weights are set to 0. The empirical weight coefficients of each parameter are calculated and optimized by the Long Short-Term Memory (LSTM) network based on the features and actual traffic flow results of the previous round. The weather factor is a traffic efficiency attenuation coefficient dynamically adjusted based on meteorological data.

[0032] In step S3, a large model is used for spatiotemporal feature analysis. After obtaining the temporal features, spatial features, weight matrices, and environmental features of each intersection, the large model can be used for inference and analysis.

[0033] The large model vectorizes the received basic multidimensional features, transforming the temporal, spatial, weight matrices, and environmental features of each intersection into numerical vectors that the model can understand. For temporal features, time series embedding is used to map traffic flow data and its derived features at different time points into a high-dimensional space, capturing the periodicity and trends of traffic flow over time. For spatial features, graph embedding is used to transform the relationships and distances between intersections into low-dimensional dense vectors to represent the spatial connections of each intersection within the traffic network. Simultaneously, the weight matrix is ​​used as prior knowledge to adjust the importance of different features during the inference process. Regarding environmental features, due to the uncertainty of unpredictable events such as sudden weather changes, the large model employs a dynamic encoding strategy. Structured environmental data is normalized and discretized, then incorporated into the model using conditional embedding to achieve a quantitative representation of external factors such as weather and holidays.

[0034] Then, a multi-head attention mechanism is used to perform deep interactive analysis on the vectorized basic multi-dimensional features. The multi-head attention mechanism divides the feature vector into multiple subspaces, each of which independently learns the correlation between features of different dimensions and focuses on feature combinations that are key to traffic flow prediction. For example, the model can use the attention mechanism to focus on the temporal features of traffic flow at intersections that are closely related to the upstream and downstream of the intersection, as well as environmental factors that have a significant impact on traffic flow in the current time period, thereby uncovering the complex spatiotemporal dependencies between multi-dimensional features.

[0035] Based on the prompt word engineering, the large model is set as the traffic data analyst. After the large model is inferred based on complex multidimensional spatiotemporal features, the traffic flow prediction results for each intersection in the current future time period are obtained.

[0036] In step S4, machine learning co-optimization is performed, such as... Figure 2As shown, after obtaining the spatiotemporal features of each intersection and obtaining preliminary traffic flow prediction results based on the large model, to further improve the accuracy of the results, an LSTM network based on the Attention mechanism is first used to process the temporal features, spatial features, weight matrices, environmental features, and preliminary traffic flow prediction results of each intersection. The LSTM network has the ability to process long-sequence data, and its unique gating mechanism can effectively capture the temporal correlations between preceding and following sequences in the temporal features. In the traffic flow prediction scenario, the changing trends of historical traffic flow data at each intersection in the time dimension, such as the periodic patterns of morning and evening peak hours and the differences in traffic flow between weekdays and weekends, can be deeply mined and modeled through the LSTM network layers. The Attention model can adaptively weight the input data, focusing on the key value information in the spatiotemporal features, environmental features, and the inference results of the large model. For example, when analyzing spatial features, the Attention model can identify surrounding intersections that are highly correlated with changes in traffic flow at the target intersection; for environmental features, it can accurately determine the importance of their impact on traffic flow, thereby enhancing the model's adaptability to complex traffic scenarios and thus obtaining more accurate traffic flow prediction results for each intersection in the future.

[0037] After completing the aforementioned feature processing and preliminary traffic flow analysis and prediction, the Extreme Gradient Boosting Tree (XGBoost) algorithm is used to fuse all features, the preliminary traffic flow prediction results, and the LSTM model traffic flow prediction results for final prediction. The existing features are: temporal features, spatial features, and weight matrices for each intersection are the basic data. Temporal features record the traffic flow variation over time, spatial features reflect the spatial relationships between intersections, and the weight matrix quantifies the tightness of these spatial relationships. Environmental features include external factors affecting traffic flow, such as weather and holidays. The preliminary traffic flow prediction results are based on preliminary traffic flow predictions obtained from a large model. The LSTM model traffic flow prediction results are predictions optimized by the LSTM network.

[0038] XGBoost, as a highly efficient tree model, relies on iteratively constructing multiple regression trees to fit data. During model building, each node split is based on the feature's gain against the objective function, leading to feature selection. The more times a feature is used for node splitting, the greater its contribution to reducing the loss function and improving model performance during prediction, thus indicating its importance. XGBoost evaluates feature importance by calculating the split gain of each feature. By continuously calculating the split gain of each feature, it selects the feature with the largest gain for node splitting, thereby progressively building the tree model.

[0039] Based on the feature selection feature of XGBoost, the basic features of each intersection, such as the mean traffic flow, traffic flow variance, headway, congestion index, weight matrix, weather factors of environmental features, weekend and holiday impact factors of environmental features, preliminary traffic flow prediction results, and traffic flow prediction results of LSTM model, are combined in pairs. All basic features and combined features are then fed into the XGBoost model for training.

[0040] During the XGBoost model training process, for each tree built, features are selected and nodes are split according to the aforementioned split gain formula. As multiple trees are continuously built, the model automatically records the number of times each feature (including basic features and combined features) is used for node splitting. Once the model is built, the features selected more frequently are those that are more important for traffic flow prediction.

[0041] The final feature set not only retains all the basic features but also incorporates the combined features that were selected most frequently and were of high importance during model training. This final feature set fully integrates the relationships between data from various dimensions. Through XGBoost processing and computation, it can output the final traffic flow prediction results for each intersection in future time periods. Leveraging the feature selection advantages of tree models, it effectively improves the accuracy and reliability of traffic flow prediction.

[0042] After processing and calculating the constructed features using XGBoost, the final traffic flow prediction results for each intersection in the future time period are obtained. The features finally constructed in this embodiment are as follows: temporal features, spatial features, weight matrix, environmental features, preliminary traffic flow prediction results, LSTM model traffic flow prediction results, temporal features × holiday factor, spatial features × holiday factor, and preliminary traffic flow prediction results × congestion index for each intersection.

[0043] The specific application process of this embodiment is as follows:

[0044] Taking a road network in the city center as an example, a grid-like area containing 10 intersections is selected. Vehicle-road cooperative sensors (such as millimeter-wave radar) are deployed at each intersection. Vehicle-side data is uploaded in real time through OBU (On-Board Unit) and accessed by the city transportation bureau's historical traffic database and road network map in the cloud.

[0045] Step 1: Multi-source data integration and preprocessing:

[0046] First, data collection is conducted, specifically including vehicle-side data: real-time vehicle speeds of all vehicles in the area during the morning rush hour from 7:00 to 9:00 on May 1, 2024 (sampling frequency 1Hz, obtained through OBU); roadside data: real-time traffic flow (counting frequency 1 second / time) and average vehicle speed (sampling frequency 10 seconds / time) of each approach lane are collected through millimeter-wave radar deployed at intersections; cloud data: historical traffic situation database of the area is obtained (containing minute-level traffic flow data of each intersection over the past year) and road network information (coordinates of each intersection, number of entrance and exit lanes, and turning rules).

[0047] Then, data alignment is performed, specifically including:

[0048] Low-frequency data interpolation: Linear interpolation is used for historical cloud data (minute-level) to increase its frequency to 1 second / time to match the time granularity of radar data. For example, if the cloud data for a certain intersection shows a traffic flow of 50 vehicles at t=0s and 60 vehicles at t=60s, then the interpolation value at t=30s is 55 vehicles.

[0049] High-frequency data aggregation: Radar traffic data (1 second / time) is aggregated using a 1-minute sliding window, and the cumulative traffic flow per minute is calculated as the time-series feature of traffic flow.

[0050] Next, missing values ​​are filled in the data: for vehicle speed data that is missing for no more than 5 minutes consecutively, cubic spline interpolation is used to fill in the missing values. For example, if a vehicle's speed data is missing between t=100s and 120s, a cubic spline curve is fitted with the vehicle speeds at the preceding and following times (t=90s: 40km / h, t=130s: 35km / h) to fill in the missing values.

[0051] Finally, the road network is constructed: an intersection entrance / exit association table is generated based on the road network information. For example, the east entrance of intersection A is connected to the west entrance of intersection B, forming an association (A, East, B, West), which is stored in the adjacency table.

[0052] Step 2: Spatiotemporal Feature Extraction:

[0053] The first step is to perform time-series feature calculations. For the traffic flow data at each intersection, the following statistics are calculated using a 1-minute sliding window:

[0054] mean ( M ): Average traffic flow within the window;

[0055] variance( V ): The degree of fluctuation in traffic flow within the window;

[0056] Headway ( D): Average headway within the window (calculated using radar data);

[0057] Congestion Index ( I ): Calculated based on the ratio of vehicle speed to free-flow vehicle speed (e.g., if the index is >0.8 when the vehicle speed is <20km / h, it is considered congested).

[0058] The second step involves constructing environmental features, specifically including:

[0059] Weather factors ( E ): Real-time acquisition of meteorological data, set to 1.0 for sunny days, 0.8 for rainy days, and 0.6 for snowy days (representing the traffic efficiency attenuation coefficient);

[0060] Holiday factors ( H ): Set weekdays to 0 and weekends and holidays to 1.

[0061] The third step is to construct the spatial feature and weight matrix:

[0062] Taking intersection A as an example, its adjacent intersections are: intersection C at the north entrance, intersection D at the west entrance, intersection B at the east entrance, and no adjacent intersection at the south entrance. A spatial weight matrix is ​​constructed: the initial empirical weight coefficients are set as follows: μ1, μ2, μ3, μ4, μ5, and μ6 are 0.3, 0.2, 0.1, 0.2, 0.1, and 0.1 respectively. Using an LSTM network (2 layers, 64 hidden units), based on the features and actual traffic flow results of the previous hour, the weight coefficients are iteratively optimized to μ1=0.25, μ2=0.22, μ3=0.12, μ4=0.23, μ5=0.11, and μ6=0.07.

[0063] Step 3: Spatiotemporal Feature Analysis of the Large Model:

[0064] First, define the role of the large model: Using the prompt word engineering, set the large model (e.g., Deepseek-R1-32B) as a "Traffic Data Analyst," and input the prompt word in the following format:

[0065] "Current intersection ID: {intersection ID}, temporal characteristics: { " M , V,D , I}, Environmental characteristics: { E , H Spatial weight matrix: { W Previous traffic: {Previous actual traffic}. Please analyze the spatiotemporal correlation and predict the traffic for the next 15 minutes.

[0066] The second step involves feature input and inference:

[0067] The combined features of each intersection (temporal, spatial, environmental, and previous results) are input into the large model in parallel. The large model then uses multi-dimensional feature inference to output the traffic flow prediction results for each intersection for the next 15 minutes.

[0068] Step 4: Machine Learning Collaborative Optimization

[0069] The first step is to process the data using an LSTM-Attention network: A two-layer LSTM network (128 hidden units) is constructed, and the following input is processed using the Attention mechanism: temporal features ( M , V , D , I ), spatial weight matrix ( W ), environmental characteristics ( E, H ), large model prediction results (result_Deepseek).

[0070] The weights of each feature are calculated through the Attention layer, for example, highlighting the congestion index ( I The impact of spatial weights on flow is analyzed, and preliminary optimization results (result_LSTM) are output.

[0071] The second step is to perform XGBoost feature fusion: Constructing a fused feature set:

[0072] Basic characteristics: temporal characteristics, spatial characteristics, and environmental characteristics;

[0073] Model results: result_Deepseek, result_LSTM;

[0074] Cross features: temporal features × H, spatial features × H, result_Deepseek × I.

[0075] The XGBoost algorithm (parameters: n_estimators=100, learning_rate=0.1, max_depth=3) is used for training, and the final prediction result (result_XGB) is output. For example, the final prediction value for intersection A is 59 vehicles / minute, which is an 8% improvement in accuracy compared to the single model.

[0076] The method described in this embodiment achieves a traffic flow prediction accuracy of 92.3% (RMSE = 4.5 vehicles / minute) in the test area, which is 15% higher than the traditional LSTM model, verifying the effectiveness of multi-source data fusion and large model collaboration.

[0077] Example 2: A traffic flow prediction method combining machine learning and large models, comprising the following steps:

[0078] S1. Collect multi-source data from vehicle-road-cloud and perform data preprocessing to construct the road network;

[0079] S2. Extract basic multidimensional features, including temporal features, spatial features, environmental features, and weight matrix; environmental features include weather factors and holiday factors.

[0080] S3. Utilize the inference model to vectorize and analyze the basic multidimensional features, and output preliminary traffic prediction results;

[0081] S4. Using a machine learning model, based on the preliminary traffic prediction results and basic multidimensional features, re-combine features and predict traffic, and optimize the weight matrix in S2 based on the actual traffic.

[0082] S5. Repeat steps S1-S4 for iterative training to improve the final prediction accuracy and output the final flow prediction result.

[0083] Step S1 involves multi-source data integration and preprocessing. First, multi-source data is acquired, including vehicle-side (vehicle speed), roadside (radar traffic flow, radar vehicle speed), and cloud-based (historical traffic situation database, road network information). Next, data alignment is performed. To address the issue of sensor sampling frequency differences, linear interpolation is used for low-frequency data (cloud-based), and time window aggregation is applied to high-frequency data (radar, etc.). Then, missing values ​​are filled using cubic spline interpolation. Finally, road network construction is performed, generating a relationship table for entrances and exits at each intersection based on rules.

[0084] In step S2, for the processed multi-source data, based on a 1-minute sliding window, the mean and variance of traffic flow, as well as statistics such as headway and congestion index, are calculated as temporal features. Weather factors and weekend / holiday impact factors are introduced as environmental features. Then, based on the generated correlation table of entrances and exits of each intersection, the temporal features of adjacent intersections of each intersection are obtained to construct spatial features, and combined with environmental features to construct an upstream and downstream spatial weight matrix. The weight matrix includes the spatial weights of the four intersections connecting the east, west, south, and north entrances of the target intersection. The spatial weights are obtained by multiplying the mean traffic flow, variance of traffic flow, headway, congestion index, weather factors, and holiday factors by their respective empirical weight coefficients and summing them. If there are no adjacent intersections, the weights are set to 0. The empirical weight coefficients of each parameter are calculated and optimized by the Long Short-Term Memory (LSTM) network based on the features and actual traffic flow results of the previous round. The weather factor is a traffic efficiency attenuation coefficient dynamically adjusted based on meteorological data.

[0085] In step S3, a large model is used for spatiotemporal feature analysis. After obtaining the temporal features, spatial features, weight matrices, and environmental features of each intersection, the large model can be used for inference and analysis.

[0086] The large model vectorizes the received basic multidimensional features, transforming the temporal, spatial, weight matrices, and environmental features of each intersection into numerical vectors that the model can understand. For temporal features, time series embedding is used to map traffic flow data and its derived features at different time points into a high-dimensional space, capturing the periodicity and trends of traffic flow over time. For spatial features, graph embedding is used to transform the relationships and distances between intersections into low-dimensional dense vectors to represent the spatial connections of each intersection within the traffic network. Simultaneously, the weight matrix is ​​used as prior knowledge to adjust the importance of different features during the inference process. Regarding environmental features, due to the uncertainty of unpredictable events such as sudden weather changes, the large model employs a dynamic encoding strategy. Structured environmental data is normalized and discretized, then incorporated into the model using conditional embedding to achieve a quantitative representation of external factors such as weather and holidays.

[0087] Then, a multi-head attention mechanism is used to perform deep interactive analysis on the vectorized basic multi-dimensional features. The multi-head attention mechanism divides the feature vector into multiple subspaces, each of which independently learns the correlation between features of different dimensions and focuses on feature combinations that are key to traffic flow prediction. For example, the model can use the attention mechanism to focus on the temporal features of traffic flow at intersections that are closely related to the upstream and downstream of the intersection, as well as environmental factors that have a significant impact on traffic flow in the current time period, thereby uncovering the complex spatiotemporal dependencies between multi-dimensional features.

[0088] Based on the prompt word engineering, the large model is set as the traffic data analyst. After the large model is inferred based on complex multidimensional spatiotemporal features, the traffic flow prediction results for each intersection in the current future time period are obtained.

[0089] In step S4, machine learning collaborative optimization is performed. After obtaining the spatiotemporal features of each intersection and obtaining preliminary traffic flow prediction results for each intersection based on the large model, to further improve the accuracy of the results, an LSTM network based on the Attention mechanism is first used to process the temporal features, spatial features, weight matrices, environmental features, and preliminary traffic flow prediction results of each intersection. The LSTM network has the ability to process long sequence data, and its unique gating mechanism can effectively capture the temporal correlations between preceding and following sequences in the temporal features. In the traffic flow prediction scenario, the changing trends of historical traffic flow data at each intersection in the time dimension, such as the periodic patterns of morning and evening peak hours and the differences in traffic flow between weekdays and weekends, can be deeply mined and modeled through the LSTM network layers. The Attention model can adaptively weight the input data, focusing on the key value information in the spatiotemporal features, environmental features, and the inference results of the large model. For example, when analyzing spatial features, the Attention model can identify surrounding intersections that are highly correlated with changes in traffic flow at the target intersection; for environmental features, it can accurately determine the importance of their impact on traffic flow, thereby enhancing the model's adaptability to complex traffic scenarios and thus obtaining more accurate traffic flow prediction results for each intersection in the future.

[0090] After completing the aforementioned feature processing and preliminary traffic flow analysis and prediction, the Extreme Gradient Boosting Tree (XGBoost) algorithm is used to fuse all features, the preliminary traffic flow prediction results, and the LSTM model traffic flow prediction results for final prediction. The existing features are: temporal features, spatial features, and weight matrices for each intersection are the basic data. Temporal features record the traffic flow variation over time, spatial features reflect the spatial relationships between intersections, and the weight matrix quantifies the tightness of these spatial relationships. Environmental features include external factors affecting traffic flow, such as weather and holidays. The preliminary traffic flow prediction results are based on preliminary traffic flow predictions obtained from a large model. The LSTM model traffic flow prediction results are predictions optimized by the LSTM network.

[0091] XGBoost, as a highly efficient tree model, relies on iteratively constructing multiple regression trees to fit data. During model building, each node split is based on the feature's gain against the objective function, leading to feature selection. The more times a feature is used for node splitting, the greater its contribution to reducing the loss function and improving model performance during prediction, thus indicating its importance. XGBoost evaluates feature importance by calculating the split gain of each feature. By continuously calculating the split gain of each feature, it selects the feature with the largest gain for node splitting, thereby progressively building the tree model.

[0092] Based on the feature selection feature of XGBoost, the basic features of each intersection, such as the mean traffic flow, traffic flow variance, headway, congestion index, weight matrix, weather factors of environmental features, weekend and holiday impact factors of environmental features, preliminary traffic flow prediction results, and traffic flow prediction results of LSTM model, are combined in pairs. All basic features and combined features are then fed into the XGBoost model for training.

[0093] During the XGBoost model training process, for each tree built, features are selected and nodes are split according to the aforementioned split gain formula. As multiple trees are continuously built, the model automatically records the number of times each feature (including basic features and combined features) is used for node splitting. Once the model is built, the features selected more frequently are those that are more important for traffic flow prediction.

[0094] The final feature set not only retains all the basic features but also incorporates the combined features that were selected most frequently and were of high importance during model training. This final feature set fully integrates the relationships between data from various dimensions. Through XGBoost processing and computation, it can output the final traffic flow prediction results for each intersection in future time periods. Leveraging the feature selection advantages of tree models, it effectively improves the accuracy and reliability of traffic flow prediction.

[0095] After processing and calculating the constructed features using XGBoost, the final traffic flow prediction results for each intersection in the future time period are obtained. The features finally constructed in this embodiment are as follows: temporal features, spatial features, weight matrix, environmental features, preliminary traffic flow prediction results, LSTM model traffic flow prediction results, temporal features × holiday factor, spatial features × holiday factor, and preliminary traffic flow prediction results × congestion index for each intersection.

[0096] The specific application process of this embodiment is as follows:

[0097] A pilot area was selected in a city’s CBD (containing 15 intersections, distributed in a grid pattern). The area has an average daily traffic flow of over 100,000 vehicles, and is quite congested during morning and evening rush hours. In addition, frequent commercial activities lead to complex and ever-changing traffic patterns.

[0098] Step 1: Multi-source data integration and preprocessing

[0099] 1.1 Data Acquisition:

[0100] 1.1.1 Vehicle-side data: Real-time vehicle speeds of all vehicles in the area during the morning peak hours of 7:00-9:00 on May 1, 2024 (sampling frequency 1Hz, obtained through OBU).

[0101] 1.1.2 Roadside data: Real-time traffic flow (counting frequency 1 second / time) and average vehicle speed (sampling frequency 10 seconds / time) of each approach lane are collected by millimeter-wave radar deployed at the intersection.

[0102] 1.1.3 Cloud Data: Obtain the historical traffic situation database of the area (including minute-level traffic flow data of each intersection over the past year) and road network information (coordinates of each intersection, number of entrance and exit lanes, and turning rules).

[0103] 1.2 Data Alignment:

[0104] 1.2.1 Low-frequency data interpolation: Linear interpolation is used for historical cloud data (minute-level) to increase its frequency to 1 second / time to match the time granularity of radar data. For example, if the cloud data for a certain intersection shows a traffic flow of 50 vehicles at t=0s and 60 vehicles at t=60s, then the interpolation value at t=30s is 55 vehicles.

[0105] 1.2.2 High-frequency data aggregation: Radar traffic data (1 second / time) is aggregated using a 1-minute sliding window, and the cumulative traffic flow per minute is calculated as the time-series feature of traffic flow.

[0106] 1.3 Missing value imputation:

[0107] For vehicle speed data segments that are missing for no more than 5 minutes consecutively, cubic spline interpolation is used to fill in the missing segments. For example, if a vehicle's speed data is missing between t=100s and 120s, a cubic spline curve is fitted with the vehicle speeds at the preceding and following times (t=90s: 40km / h, t=130s: 35km / h) to fill in the missing intermediate values.

[0108] 1.4 Road Network Construction

[0109] An intersection entrance / exit association table is generated based on road network information. For example, the east entrance of intersection A is connected to the west entrance of intersection B, forming an association (A, East, B, West), which is stored in an adjacency table.

[0110] Step 2: Spatiotemporal Feature Extraction

[0111] 2.1 Calculation of temporal features (taking intersection C as an example)

[0112] For the traffic flow data at each intersection, the following statistics are calculated using a 1-minute sliding window:

[0113] Average traffic volume ( M ): 15 vehicles / min (peak morning time reaches 32 vehicles / min)

[0114] Traffic flow variance ( V: 20 (vehicles / min) 2

[0115] Headway ( D ): 1.8 seconds (reduced to 1.2 seconds during congestion)

[0116] Congestion Index ( I ): Based on the free-flow vehicle speed (60km / h), when the measured vehicle speed is ≤20km / h, I=0.9 (severe congestion).

[0117] 2.2 Environmental Feature Construction

[0118] 2.2.1 Weather factors ( E ): Real-time acquisition of meteorological data, set to 1.0 for sunny days, 0.8 for rainy days, and 0.6 for snowy days (representing the traffic efficiency attenuation coefficient).

[0119] 2.2.2 Holiday Factor ( H ): Set weekdays to 0 and weekends and holidays to 1.

[0120] 2.3 Spatial Features and Weight Matrix Construction:

[0121] Adjacent intersections: The north entrance of intersection C connects to intersection D (200 meters away), and the west entrance connects to intersection E (150 meters away). There are no adjacent intersections in the east and south directions.

[0122] Spatial weight calculation: Weights of various empirical factors: mean traffic flow 0.25, variance of traffic flow 0.22, headway 0.12, congestion index 0.23, weather factor 0.11, holiday factor 0.07.

[0123] Taking intersection D (north entrance) as an example, the calculation during a certain morning rush hour is as follows:

[0124] Average traffic flow = 80, Traffic flow variance = 20, Headway = 1.5, Congestion index = 0.8, Weather factor = 1.0, Holiday factor = 0

[0125] Therefore, its spatial weight = 0.25×80 + 0.22×20 + 0.12×1.5 + 0.23×0.8 + 0.11×1.0 + 0.07×0 = 25.63

[0126] Step 3: Spatiotemporal Feature Analysis of Large Model

[0127] The current time-series features, spatial features, environmental features, and the results from the previous round are input into the large model. Through inference by the large model, the predicted flow rate for the next 15 minutes is 21 vehicles / min (confidence level 0.89).

[0128] Step 4: Machine Learning Collaborative Optimization

[0129] 4.1 Construction of LSTM-Attention Network:

[0130] Network structure: two-layer LSTM (256 hidden units) + single-layer Attention, deployed using the PyTorch framework;

[0131] Input features: Time series features ( M, V, D, I Spatial weight matrix W Environmental characteristics ( E, H ), large model prediction results (21 vehicles / min).

[0132] Attention weights: Post-training congestion index ( I The weight of the area is 0.32, and the weight of the space is 0.28, indicating that the model focuses on the correlation between the congestion status and the intersection on the north side.

[0133] Output results: The LSTM optimization predicts 19 vehicles / min, which is 4.1% higher than the single large model.

[0134] 4.2 XGBoost Feature Fusion: Constructing a fused feature set:

[0135] Including basic features: temporal features, spatial features, and environmental features;

[0136] Model results: Large model prediction results (21 vehicles / min), LSTM-Attention prediction results (19 vehicles / min);

[0137] Cross-feature generation (including but not limited to):

[0138] Average traffic volume × Holiday factor: 0 for weekdays, M×1 for weekends

[0139] Large model result × Congestion index: 98 × 0.7 = 68.6

[0140] North side weight × Weather factor: 25.63 × 1.0 = 25.63

[0141] XGBoost model parameters:

[0142] n_estimators=500, learning_rate=0.01, max_depth=10, subsample=0.8

[0143] XGBoost model feature importance results (including but not limited to):

[0144] LSTM model traffic prediction result: Importance score 0.28

[0145] Preliminary traffic forecast result: Importance score 0.25

[0146] Large model results × Congestion index: Importance score 0.23

[0147] Average traffic volume × Holiday factor: Importance score 0.3

[0148] Final prediction results: XGBoost output is 20 vehicles / min, and after 50 iterations, RMSE is 0.4 vehicles / min, which is an 8% improvement over the baseline model (single LSTM).

[0149] Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A traffic flow prediction method that combines machine learning with a large model, characterized in that, Includes the following steps: S1. Collect multi-source data from vehicle-road-cloud and perform data preprocessing to construct the road network; S2. Extract basic multidimensional features, including temporal features, spatial features, environmental features, and weight matrix. The weight matrix is ​​jointly constructed based on spatial features and environmental features. Environmental characteristics include weather factors and holiday factors; S3. Utilize the inference model to vectorize and analyze the basic multidimensional features, and output the preliminary flow prediction results for this round. S4. Use machine learning models to process basic multidimensional features and optimize the preliminary traffic prediction results. Then, perform feature fusion and final prediction on all basic multidimensional features, preliminary traffic prediction results and optimized preliminary traffic prediction results in S2. Use all basic multidimensional features and combined features to construct several regression trees through iterative methods to predict traffic. Optimize the weight matrix in S2 based on the actual traffic. S5. Repeat steps S1-S4 for iterative training to improve the final prediction accuracy and output the final flow prediction result.

2. The traffic flow prediction method based on machine learning and large model collaboration according to claim 1, characterized in that, The data preprocessing in step S1 includes data alignment for data with different sampling frequencies, linear interpolation for low-frequency data, and time window aggregation for high-frequency data; it also includes filling missing values ​​in the data by using cubic spline interpolation to fill in missing values; and generating a table of relationships between entrances and exits of each intersection when constructing the road network in S1.

3. The traffic flow prediction method based on machine learning and large model collaboration according to claim 1, characterized in that, S2 uses a fixed-time sliding window to calculate the mean and variance of traffic flow, as well as headway and congestion index, as time-series features. Spatial features are constructed by obtaining the temporal characteristics of adjacent intersections of each intersection based on the correlation table of entrances and exits of each intersection. The weight matrix is ​​constructed based on a combination of spatial and environmental features.

4. The traffic flow prediction method based on machine learning and large model collaboration according to claim 1 or 3, characterized in that, The weight matrix in S2 includes the spatial weights of the four intersections connecting the east, west, north, and south entrances of the target intersection. The spatial weights are obtained by multiplying the parameters of the temporal characteristics of each intersection and the parameters of the environmental characteristics by their respective empirical weight coefficients and then summing them up. The weather factor in the environmental characteristics is a traffic efficiency attenuation coefficient that is dynamically adjusted based on meteorological data.

5. The traffic flow prediction method based on machine learning and large model collaboration according to claim 4, characterized in that, In each iteration of training, the empirical weight coefficients of the spatial weights in S2 are calculated and optimized by the machine learning model in S4 based on the actual traffic during the previous iteration of training.

6. The traffic flow prediction method based on machine learning and large model collaboration according to claim 1, characterized in that, In S3, the large model vectorizes basic multidimensional features, including time series embedding for temporal features and graph embedding for spatial features. It also uses the weight matrix as prior knowledge to adjust the importance of different features in the inference process. For environmental features, it adopts a dynamic encoding strategy, which integrates structured environmental data into the model after normalization and discretization using conditional embedding.

7. The traffic flow prediction method based on machine learning and large model collaboration according to claim 1, characterized in that, In S4, an LSTM model based on the Attention mechanism is first used to process the basic multidimensional features of each intersection and optimize the preliminary traffic prediction results to obtain the LSTM model traffic prediction results. Then, the Extreme Gradient Boosting Tree (XGBoost) model is used to fuse all features with the preliminary traffic prediction results and make the final prediction.

8. The traffic flow prediction method based on machine learning and large model collaboration according to claim 7, characterized in that, The XGBoost model uses the parameters, weight matrix, weather factors, holiday factors, large model traffic inference results, and LSTM model traffic prediction results of the acquired time-series features of each intersection as basic features and combines them in pairs. Iteratively, it constructs several regression trees to fit the data by combining all basic features and combined features. By continuously calculating the split gain of each feature, it selects the feature with the largest gain to split the node, thereby gradually building a tree model.

9. The traffic flow prediction method based on machine learning and large model collaboration according to claim 8, characterized in that, During the XGBoost model's regression tree construction process, features are selected and nodes are split based on split gain for each tree built. The number of times each feature, including basic features and combined features, is used for node splitting is recorded during the model construction process. After the model is built, the features selected most frequently are taken as important features.

10. The traffic flow prediction method based on machine learning and large model collaboration according to claim 1 or 9, characterized in that, In S5, important features are processed and calculated using the XGBoost model to obtain the final traffic flow prediction results for each intersection in the future time period.

Citation Information

Patent Citations

  • Multi-modal traffic flow prediction system based on AI

    CN117437774A

  • Short-term traffic flow prediction method based on gradient boosting decision tree

    CN113096388A

  • Short-term traffic flow prediction model based on variational mode decomposition multi-stage optimization

    CN116721542A