Traffic flow prediction method based on cooperation of machine learning and large model

Through the method of machine learning and big models, combined with multi-source data of vehicle-road cloud, multi-dimensional features are extracted and iterative training is carried out, which solves the shortcomings of traditional traffic flow prediction methods in complex scenarios, and achieves higher accuracy and reliability traffic flow prediction.

CN120580862AActive Publication Date: 2025-09-02ZHEJIANG SUPCON INFORMATION TECH CO LTD

Patent Information

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

AI Technical Summary

Technical Problem

Traditional traffic flow prediction methods rely on a single data source, are difficult to cover the dynamic changes of complex traffic scenarios, are unable to adapt to emergencies, and are insufficient in collaborative analysis of multi-dimensional features.

Method used

Using the method of machine learning and big models to synergize multi-source data of vehicle-road cloud, time sequence, spatial and environmental features are extracted, inference large models are used for vector processing, and feature fusion and optimization are combined with the Attention mechanism and XGBoost algorithm, and iterative training is used to improve prediction accuracy.

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 CN120580862A_ABST
    Figure CN120580862A_ABST
Patent Text Reader

Abstract

The invention provides a traffic flow prediction method based on cooperation of machine learning and a large model, and the method comprises the steps: firstly collecting vehicle and road cloud data to construct a road network, extracting basic multi-dimensional features in the data, carrying out the preliminary prediction of flow through a reasoning large model, and carrying out the calculation of the flow through a machine learning model based on a preliminary flow prediction result and the basic multi-dimensional features. Feature combination and flow prediction are carried out again, the weights of the features are optimized, repeated iteration training is carried out, and the prediction accuracy is improved. Through vehicle and road cloud data fusion, the feature dimension and information integrity can be improved; and machine learning and staged cooperation of the large model can give consideration to both global law and local refined prediction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of traffic flow prediction, and in particular relates to a traffic flow prediction method that collaborates with machine learning and a large model. Background Art

[0002] With the acceleration of urban development, traffic congestion is becoming increasingly severe. Traditional traffic flow prediction methods, often based on a single data source (such as loop detectors or cameras), have numerous shortcomings. These methods rely on historical traffic statistics or local sensor data, making it difficult to capture the dynamic changes in complex traffic scenarios. Traffic flow is significantly influenced by spatiotemporal correlations (such as upstream and downstream intersection linkages and peak hour characteristics), and existing models are limited in their ability to collaboratively analyze multidimensional features. Furthermore, static models are unable to adapt to the real-time adjustments required by sudden traffic events (such as accidents and weather changes).

[0003] Prior art application publication number CN117437774A discloses an AI-based multimodal traffic flow prediction system, which includes 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 is used to collect multimodal traffic data, including vehicle flow, pedestrian flow, bus flow, traffic signal status, and weather conditions. The data preprocessing module receives raw data from the data collection module, cleans, standardizes, and integrates it, generates a data quality report, and passes 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 integrated vehicle-road-cloud technology provides a new data foundation for traffic flow forecasting. By integrating multi-source data from vehicle-to-everything (V2X), roadside radar, cameras, and cloud platforms, a wealth of information, including vehicle trajectories, speeds, traffic volume, and road network topology, can be obtained. While large inference models offer outstanding logical reasoning and analysis capabilities, they are well-suited to processing multi-source data in complex scenarios. However, they lack the ability to provide refined forecasts and analyze information correlations across long time series dependencies.

[0005] In order to solve the above technical problems, the present invention provides a technical solution: a traffic flow prediction method that combines machine learning with a large model, comprising the following steps: S1. Collect multi-source data from vehicles, roads and clouds, perform data preprocessing, and build a road network. S2. Extract basic multidimensional features, including temporal features, spatial features, environmental features, and weight matrix; environmental features include weather factors and holiday factors; S3. Use the inference model to vectorize and analyze the basic multi-dimensional features and output preliminary traffic prediction results; S4: Use the machine learning model to re-combine features and perform traffic prediction based on the preliminary traffic prediction results and basic multi-dimensional features, and optimize the weight matrix in S2 based on the actual traffic; S5. Repeat steps S1-S4 to iteratively train, improve the final prediction accuracy, and output the final traffic prediction result.

[0006] Specifically, 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; missing values ​​are also filled in the data using cubic spline interpolation; when constructing the road network in S1, a correlation relationship table of the entrances and exits of each intersection is generated.

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

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

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

[0010] Specifically, the large model in S3 vectorizes the basic multi-dimensional features, including using the time series embedding method for temporal features and the graph embedding method for spatial features. At the same time, the weight matrix is ​​used as the prior knowledge of the model to adjust the importance of different features in the reasoning process. For environmental features, a dynamic encoding strategy is adopted to integrate the structured environmental data into the model after normalization and discretization using the conditional embedding method.

[0011] Specifically, S4 first uses an LSTM model based on the Attention mechanism to process the basic multi-dimensional 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 Algorithm (XGBoost) model is used to fuse all features with the preliminary traffic prediction results and make the final prediction.

[0012] Specifically, the XGBoost model combines the parameters of the acquired time series features of each intersection, the weight matrix, weather factors, holiday factors, preliminary traffic prediction results, and LSTM model traffic prediction results as basic features, and iteratively constructs several regression trees using all basic features and combined features to fit the data. 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.

[0013] Specifically, when the XGBoost model builds a regression tree, each time a tree is built, features are selected and nodes are divided according to the split gain. During the model construction process, the number of times each feature, including basic features and combined features, is used for node division is recorded; when the model is built, the features that are selected the most times are regarded as important features.

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

[0015] The beneficial effects of the present invention are: improving feature dimensions and information integrity through vehicle-road-cloud data fusion; phased collaboration of machine learning and large models, taking into account both global rules and local refined predictions; introducing the Attention mechanism and external factors to enhance the model's adaptability to environmental changes. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 Flow chart of the method of the present invention.

[0017] Figure 2 This is a detailed flow chart of the machine learning part of the present invention. DETAILED DESCRIPTION

[0018] The present invention is described in detail below with reference to the accompanying drawings and embodiments.

[0019] Example 1: A traffic flow prediction method based on machine learning and large model collaboration, such as Figure 1 As shown, the following steps are included: S1. Collect multi-source data from vehicles, roads and clouds, perform data preprocessing, and build a road network. S2. Extract basic multidimensional features, including temporal features, spatial features, environmental features, and weight matrix; environmental features include weather factors and holiday factors; S3. Use the inference model to vectorize and analyze the basic multi-dimensional features and output preliminary traffic prediction results; S4: Use the machine learning model to re-combine features and perform traffic prediction based on the preliminary traffic prediction results and basic multi-dimensional features, and optimize the weight matrix in S2 based on the actual traffic; S5. Repeat steps S1-S4 to iteratively train, improve the final prediction accuracy, and output the final traffic prediction result.

[0020] In step S1, multi-source data integration and preprocessing are performed. First, multi-source data is acquired, including vehicle-side data (vehicle speed), roadside data (radar traffic volume, radar speed), and cloud-based data (historical traffic situation database, road network information). Next, data alignment is performed. To address differences in sensor sampling frequencies, linear interpolation is performed on low-frequency data (cloud-based data) and time window aggregation is used for high-frequency data (radar, etc.). Missing values ​​are then filled using cubic spline interpolation. Finally, the road network is constructed, generating a rule-based association table for each intersection's entrance and exit.

[0021] In step S2, the processed multi-source data is used to calculate the mean and variance of traffic flow, as well as statistics such as headway and congestion index, based on a 1-minute sliding window. Weather factors and weekend and holiday influencing factors are introduced as environmental features. Then, based on the generated association table of each intersection's entrances and exits, the temporal characteristics of each intersection's adjacent intersections are derived to construct spatial features. Combined with the environmental features, an upstream and downstream spatial weight matrix is ​​constructed. The weight matrix includes the spatial weights of the four intersections connecting the east, west, south, and north entrances of the target intersection. Spatial weights are calculated by multiplying the mean traffic flow, traffic flow variance, headway, congestion index, weather factors, and holiday factors by their respective empirical weight coefficients and summing them. If there are no adjacent intersections, the values ​​are set to zero. The empirical weight coefficients for each parameter are calculated and optimized by a long short-term memory (LSTM) network based on the previous round of features and actual traffic results. The weather factor is a traffic efficiency attenuation coefficient dynamically adjusted based on meteorological data.

[0022] In step S3, the large model is used to perform spatiotemporal feature analysis. After obtaining the temporal features, spatial features, weight matrix, and environmental features of each intersection, they can be submitted to the large model for reasoning and analysis.

[0023] The large-scale model vectorizes the received basic multidimensional features, converting the temporal, spatial, weight matrix, and environmental characteristics of each intersection into numerical vectors that the model can understand. For temporal features, a time series embedding (TSE) approach 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, a graph embedding approach is used to transform the associations and distances between intersections into low-dimensional dense vectors, representing the spatial connections between intersections in the traffic network. The weight matrix is ​​used as prior knowledge in the model to adjust the importance of different features during the inference process. Regarding environmental features, the large-scale model employs a dynamic encoding strategy due to the uncertainty inherent in occasional conditions such as sudden weather changes. After normalization and discretization, structured environmental data is integrated into the model using conditional embedding to quantitatively represent external factors such as weather and holidays.

[0024] Then, a multi-head attention mechanism is used to perform in-depth interactive analysis on the vectorized basic multidimensional features. This multi-head attention mechanism divides the feature vector into multiple subspaces, each of which independently learns the correlations between features of different dimensions and focuses on feature combinations that are critical to traffic flow prediction. For example, the model can use the attention mechanism to focus on the time series characteristics of intersection traffic flow that are closely related to upstream and downstream traffic at the intersection, as well as environmental factors that have a significant impact on traffic flow during the current period, thereby mining the complex spatiotemporal dependencies between multidimensional features.

[0025] Based on the prompt word project, the big model is set as the role of traffic data analyst. After the big model reasons based on complex multi-dimensional spatiotemporal features, the traffic flow forecast results for each intersection in the future period are obtained.

[0026] In step S4, machine learning collaborative optimization is performed, such as Figure 2As shown in the figure, after obtaining the spatiotemporal characteristics of each intersection and generating preliminary traffic flow predictions for each intersection based on the large model, an LSTM network based on the Attention mechanism is first used to process the temporal features, spatial features, weight matrix, environmental features, and preliminary traffic flow predictions of each intersection, in order to further improve the accuracy of the results. The LSTM network is capable of processing long sequences of data, and its unique gating mechanism effectively captures the temporal correlations within the temporal features. In the context of traffic flow prediction, the temporal trends of historical traffic flow data at each intersection, such as the periodic patterns of morning and evening rush hours and the differences in traffic flow between weekdays and weekends, can be deeply mined and modeled using the LSTM network layer. The Attention model adaptively weights the input data, focusing on key information from the spatiotemporal and 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 their importance in influencing traffic flow, thereby enhancing the model's adaptability to complex traffic scenarios and obtaining more accurate traffic flow predictions for each intersection in the future.

[0027] After completing the aforementioned feature processing and preliminary traffic analysis and prediction, the XGBoost algorithm (Extreme Gradient Boosting Tree) is used to fuse all features with the preliminary traffic forecast results and the LSTM model traffic forecast results to create the final forecast. The currently available features include: the temporal characteristics, spatial characteristics, and weight matrix of each intersection as the basic data. The temporal characteristics record the temporal changes in traffic flow, the spatial characteristics reflect the spatial connections between intersections, and the weight matrix quantifies the degree of spatial connection. Environmental characteristics include external factors that affect traffic flow, such as weather and holidays. The preliminary traffic forecast results are based on the initial traffic forecast values ​​obtained from the large model. The LSTM model traffic forecast results are the predicted values ​​after optimization of the LSTM network.

[0028] As an efficient tree model, XGBoost's core approach is to iteratively build multiple regression trees to fit data. During the model building process, each node split is selected based on the feature's gain on the objective function. The more often a feature is used for node splits, the greater its contribution to reducing the loss function and improving model performance during prediction, indicating its importance. XGBoost evaluates feature importance by calculating the split gain of each feature. By continuously calculating the split gain of each feature, the feature with the largest gain is selected for node splitting, gradually building a tree model.

[0029] Based on this feature selection feature of XGBoost, the basic features of the acquired time series characteristics of each intersection, such as the traffic flow mean, traffic flow variance, headway, congestion index, weight matrix, weather factors of environmental characteristics, weekend and holiday influencing factors of environmental characteristics, preliminary traffic flow prediction results, and LSTM model traffic flow prediction results, are combined in pairs, and all basic features and combined features are sent to the XGBoost model for training. During XGBoost model training, each tree is constructed, and features are selected and nodes are partitioned according to the aforementioned splitting gain formula. As multiple trees are constructed, the model automatically records the number of times each feature (including basic features and combined features) is selected for node partitioning. Once the model is complete, the number of times each feature is selected is counted, and features with the highest number of selections are considered more important for traffic flow prediction. The resulting feature set not only retains all basic features but also incorporates highly important and frequently selected features during model training. This final feature set fully integrates the relationships between data across all dimensions. Processed and calculated using XGBoost, it outputs final traffic flow predictions for each intersection in the future. Leveraging the tree model's feature selection advantages, it effectively improves the accuracy and reliability of traffic flow predictions.

[0030] After XGBoost processing and calculation of the constructed features, the final traffic flow prediction results for each intersection in the future period are obtained. In this embodiment, the final constructed features are as follows: the time series features, spatial features and weight matrix of each intersection, as well as environmental features, preliminary traffic flow prediction results, LSTM model traffic flow prediction results, time series features × holiday factor, spatial features × holiday factor, preliminary traffic flow prediction results × congestion index.

[0031] The specific application process of this embodiment is as follows: Taking the road network in a certain city center as an example, a grid area containing 10 intersections was selected, and vehicle-road cooperative sensors (such as millimeter-wave radar) were deployed at each intersection. Vehicle-side data was uploaded in real time through the OBU (on-board unit) and connected to the city transportation bureau's historical traffic database and road network map in the cloud.

[0032] Step 1: Multi-source data integration and preprocessing: Data collection is carried out first, including vehicle-side data: real-time speed 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: through the millimeter-wave radar deployed at the intersection, the real-time traffic flow of each entrance lane is collected (counting frequency 1 second / time) and the average speed (sampling frequency 10 seconds / time); cloud data: obtain the historical traffic situation database of the area (including minute-level traffic data of each intersection in the past year) and road network information (coordinates of each intersection, number of entrance and exit lanes, turning rules).

[0033] Then perform data alignment, including: Low-frequency data interpolation: Linear interpolation is used on 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 at a certain intersection shows a traffic flow of 50 vehicles at t=0s and 60 vehicles at t=60s, the interpolated value at t=30s is 55 vehicles. High-frequency data aggregation: A 1-minute sliding window is used to aggregate radar traffic data (1 second / time), and the cumulative traffic volume per minute is calculated as the traffic flow time series feature.

[0034] Next, missing values ​​are filled in the data: For consecutive segments of vehicle-side speed data that are missing for no more than 5 minutes, cubic spline interpolation is used to fill in the missing values. For example, if a vehicle's speed data is missing from t = 100s to 120s, a cubic spline curve is fitted to the speeds before and after (t = 90s: 40km / h, t = 130s: 35km / h) to fill in the intermediate values.

[0035] Finally, the road network is constructed: Based on the road network information, a table of intersection entrances and exits is generated. For example, the east entrance of intersection A is connected to the west entrance of intersection B, forming an association relationship (A, East, B, West), which is stored in the adjacency table.

[0036] Step 2: Spatiotemporal feature extraction: The first step is to calculate the time series features. For the traffic flow data at each intersection, a 1-minute sliding window is used to calculate the following statistics: Mean ( M ): Average traffic flow within the window; variance( V ): Traffic flow fluctuation degree within the window; Headway ( D ): Average headway within the window (calculated using radar data); Congestion Index ( I): Calculated based on the ratio of vehicle speed to free-flow speed (e.g., when the vehicle speed is <20km / h and the index is >0.8, it is considered congested).

[0037] The second step is to construct environmental features, which includes: Weather factors ( E ): Get meteorological data in real time, set it to 1.0 for sunny days, 0.8 for rainy days, and 0.6 for snowy days (indicating the traffic efficiency attenuation coefficient); Holiday Factor ( H ): Set to 0 for weekdays and 1 for weekends and holidays.

[0038] The third step is to construct spatial features and weight matrix: Taking intersection A as an example, its adjacent intersections are: north entrance connecting to intersection C, west entrance connecting to intersection D, east entrance connecting to intersection B, and south entrance having no adjacent intersections. Constructing a spatial weight matrix: Initial empirical weight coefficients are set to: μ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 previous hour's features and actual traffic flow results, 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.

[0039] Step 3: Analysis of spatiotemporal characteristics of large models: First, set the role of the large model: set the large model (such as Deepseek-R1-32B) to "Traffic Data Analyst" through the prompt word project. Enter the prompt word format as follows: "Current intersection ID: {intersection ID}, time series features: { M , V,D , I}, Environmental characteristics: { E , H}, spatial weight matrix: { W}, last round of traffic: {actual traffic in the last round}. Please analyze the spatiotemporal correlation and predict the traffic in the next 15 minutes."

[0040] The second step is feature input and reasoning: The combined features of each intersection (time series + space + environment + previous round results) are input into the large model in parallel. The large model uses multi-dimensional feature reasoning to output the traffic forecast results for each intersection in the next 15 minutes.

[0041] Step 4: Machine Learning Co-Optimization The first step is to perform LSTM-Attention network processing: build a two-layer LSTM network (hidden unit 128), and combine the Attention mechanism to process the following inputs: time series features ( M , V , D , I ), spatial weight matrix ( W ), environmental characteristics ( E, H ), large model prediction results (result_Deepseek).

[0042] The weight of each feature is calculated through the Attention layer, such as highlighting the congestion index ( I ) and the impact of spatial weights on traffic, and output preliminary optimization results (result_LSTM).

[0043] The second step is to perform XGBoost feature fusion: build a fusion feature set: Basic features: temporal features, spatial features, and environmental features; Model results: result_Deepseek, result_LSTM; Cross-features: temporal features × H, spatial features × H, result_Deepseek × I.

[0044] The XGBoost algorithm (parameters: n_estimators=100, learning_rate=0.1, max_depth=3) is used for training and outputs the final prediction result (result_XGB). For example, the final prediction value for intersection A is 59 vehicles / minute, which is 8% more accurate than the single model.

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

[0046] Example 2: A traffic flow prediction method using machine learning and a large model, comprising the following steps: S1. Collect multi-source data from vehicles, roads and clouds, perform data preprocessing, and build a road network. S2. Extract basic multidimensional features, including temporal features, spatial features, environmental features, and weight matrix; environmental features include weather factors and holiday factors; S3. Use the inference model to vectorize and analyze the basic multi-dimensional features and output preliminary traffic prediction results; S4: Use the machine learning model to re-combine features and perform traffic prediction based on the preliminary traffic prediction results and basic multi-dimensional features, and optimize the weight matrix in S2 based on the actual traffic; S5. Repeat steps S1-S4 to iteratively train, improve the final prediction accuracy, and output the final traffic prediction result.

[0047] In step S1, multi-source data integration and preprocessing are performed. First, multi-source data is acquired, including vehicle-side data (vehicle speed), roadside data (radar traffic volume, radar speed), and cloud-based data (historical traffic situation database, road network information). Next, data alignment is performed. To address differences in sensor sampling frequencies, linear interpolation is performed on low-frequency data (cloud-based data) and time window aggregation is used for high-frequency data (radar, etc.). Missing values ​​are then filled using cubic spline interpolation. Finally, the road network is constructed, generating a rule-based association table for each intersection's entrance and exit.

[0048] In step S2, the processed multi-source data is used to calculate the mean and variance of traffic flow, as well as statistics such as headway and congestion index, based on a 1-minute sliding window. Weather factors and weekend and holiday influencing factors are introduced as environmental features. Then, based on the generated association table of each intersection's entrances and exits, the temporal characteristics of each intersection's adjacent intersections are derived to construct spatial features. Combined with the environmental features, an upstream and downstream spatial weight matrix is ​​constructed. The weight matrix includes the spatial weights of the four intersections connecting the east, west, south, and north entrances of the target intersection. Spatial weights are calculated by multiplying the mean traffic flow, traffic flow variance, headway, congestion index, weather factors, and holiday factors by their respective empirical weight coefficients and summing them. If there are no adjacent intersections, the values ​​are set to zero. The empirical weight coefficients for each parameter are calculated and optimized by a long short-term memory (LSTM) network based on the previous round of features and actual traffic results. The weather factor is a traffic efficiency attenuation coefficient dynamically adjusted based on meteorological data.

[0049] In step S3, the large model is used to perform spatiotemporal feature analysis. After obtaining the temporal features, spatial features, weight matrix, and environmental features of each intersection, they can be submitted to the large model for reasoning and analysis.

[0050] The large-scale model vectorizes the received basic multidimensional features, converting the temporal, spatial, weight matrix, and environmental characteristics of each intersection into numerical vectors that the model can understand. For temporal features, a time series embedding (TSE) approach 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, a graph embedding approach is used to transform the associations and distances between intersections into low-dimensional dense vectors, representing the spatial connections between intersections in the traffic network. The weight matrix is ​​used as prior knowledge in the model to adjust the importance of different features during the inference process. Regarding environmental features, the large-scale model employs a dynamic encoding strategy due to the uncertainty inherent in occasional conditions such as sudden weather changes. After normalization and discretization, structured environmental data is integrated into the model using conditional embedding to quantitatively represent external factors such as weather and holidays.

[0051] Then, a multi-head attention mechanism is used to perform in-depth interactive analysis on the vectorized basic multidimensional features. This multi-head attention mechanism divides the feature vector into multiple subspaces, each of which independently learns the correlations between features of different dimensions and focuses on feature combinations that are critical to traffic flow prediction. For example, the model can use the attention mechanism to focus on the time series characteristics of intersection traffic flow that are closely related to upstream and downstream traffic at the intersection, as well as environmental factors that have a significant impact on traffic flow during the current period, thereby mining the complex spatiotemporal dependencies between multidimensional features.

[0052] Based on the prompt word project, the big model is set as the role of traffic data analyst. After the big model reasons based on complex multi-dimensional spatiotemporal features, the traffic flow forecast results for each intersection in the future period are obtained.

[0053] In step S4, machine learning collaborative optimization is performed. After obtaining the spatiotemporal characteristics of each intersection and generating preliminary traffic flow predictions 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 characteristics, spatial characteristics, weight matrix, environmental characteristics, and preliminary traffic flow prediction results of each intersection. The LSTM network is capable of processing long sequences of data, and its unique gating mechanism effectively captures the temporal correlations within temporal features. In the context of traffic flow prediction, the temporal trends of historical traffic flow data at each intersection, such as the cyclical patterns of morning and evening rush hours and the differences in traffic flow between weekdays and weekends, can be deeply mined and modeled using the LSTM network layer. The Attention model adaptively weights the input data, focusing on key information from the spatiotemporal and environmental characteristics 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 their importance in influencing traffic flow, thereby enhancing the model's adaptability to complex traffic scenarios and obtaining more accurate traffic flow predictions for each intersection in the future.

[0054] After completing the aforementioned feature processing and preliminary traffic analysis and prediction, the XGBoost algorithm (Extreme Gradient Boosting Tree) is used to fuse all features with the preliminary traffic forecast results and the LSTM model traffic forecast results to create the final forecast. The currently available features include: the temporal characteristics, spatial characteristics, and weight matrix of each intersection as the basic data. The temporal characteristics record the temporal changes in traffic flow, the spatial characteristics reflect the spatial connections between intersections, and the weight matrix quantifies the degree of spatial connection. Environmental characteristics include external factors that affect traffic flow, such as weather and holidays. The preliminary traffic forecast results are based on the initial traffic forecast values ​​obtained from the large model. The LSTM model traffic forecast results are the predicted values ​​after optimization of the LSTM network.

[0055] As an efficient tree model, XGBoost's core approach is to iteratively build multiple regression trees to fit data. During the model building process, each node split is selected based on the feature's gain on the objective function. The more often a feature is used for node splits, the greater its contribution to reducing the loss function and improving model performance during prediction, indicating its importance. XGBoost evaluates feature importance by calculating the split gain of each feature. By continuously calculating the split gain of each feature, the feature with the largest gain is selected for node splitting, gradually building a tree model.

[0056] Based on this feature selection feature of XGBoost, the basic features of the acquired time series characteristics of each intersection, such as the traffic flow mean, traffic flow variance, headway, congestion index, weight matrix, weather factors of environmental characteristics, weekend and holiday influencing factors of environmental characteristics, preliminary traffic flow prediction results, and LSTM model traffic flow prediction results, are combined in pairs, and all basic features and combined features are sent to the XGBoost model for training. During XGBoost model training, each tree is constructed, and features are selected and nodes are partitioned according to the aforementioned splitting gain formula. As multiple trees are constructed, the model automatically records the number of times each feature (including basic features and combined features) is selected for node partitioning. Once the model is complete, the number of times each feature is selected is counted, and features with the highest number of selections are considered more important for traffic flow prediction. The resulting feature set not only retains all basic features but also incorporates highly important and frequently selected features during model training. This final feature set fully integrates the relationships between data across all dimensions. Processed and calculated using XGBoost, it outputs final traffic flow predictions for each intersection in the future. Leveraging the tree model's feature selection advantages, it effectively improves the accuracy and reliability of traffic flow predictions.

[0057] After XGBoost processing and calculation of the constructed features, the final traffic flow prediction results for each intersection in the future period are obtained. In this embodiment, the final constructed features are as follows: the time series features, spatial features and weight matrix of each intersection, as well as environmental features, preliminary traffic flow prediction results, LSTM model traffic flow prediction results, time series features × holiday factor, spatial features × holiday factor, preliminary traffic flow prediction results × congestion index.

[0058] The specific application process of this embodiment is as follows: A certain city's CBD area (including 15 intersections distributed in a grid pattern) was selected as a pilot. The average daily traffic volume in this area exceeds 100,000 vehicles, and the morning and evening rush hours are relatively congested. Frequent commercial activities also lead to complex and changeable traffic patterns.

[0059] Step 1: Multi-source data integration and preprocessing 1.1 Data Collection: 1.1.1 Vehicle-side data: Collect the real-time speed 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).

[0060] 1.1.2 Roadside data: Millimeter-wave radars deployed at intersections collect real-time traffic flow (counting frequency 1 second / time) and average vehicle speed (sampling frequency 10 seconds / time) at each entrance.

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

[0062] 1.2 Data alignment: 1.2.1 Low-Frequency Data Interpolation: Linear interpolation is used on historical cloud data (minute-level), increasing its frequency to 1 second per second 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, the interpolated value at t=30s is 55 vehicles.

[0063] 1.2.2 High-frequency data aggregation: A 1-minute sliding window is used to aggregate radar traffic data (1 second / time), and the cumulative traffic volume per minute is calculated as the traffic flow time series feature.

[0064] 1.3 Missing value filling: For consecutive segments of vehicle-side speed data that are missing for no more than 5 minutes, cubic spline interpolation is used to fill in the gaps. For example, if a vehicle's speed data is missing from t = 100s to 120s, a cubic spline curve is fitted using the speeds before and after (t = 90s: 40km / h, t = 130s: 35km / h) to fill in the intermediate values.

[0065] 1.4 Road Network Construction Generate an intersection import and export association table based on the road network information. For example, the east import of intersection A is connected to the west import of intersection B, forming an association relationship (A, East, B, West) and storing it in the adjacency table.

[0066] Step 2: Spatiotemporal feature extraction 2.1 Calculation of Time Series Features (Take Intersection C as an Example) For the traffic flow data at each intersection, the following statistics are calculated using a 1-minute sliding window: Average traffic volume ( M ): 15 vehicles / min (peak in the morning rush hour is 32 vehicles / min) Traffic flow variance ( V ):20 (vehicles / min) 2 Headway ( D ): 1.8 seconds (reduced to 1.2 seconds in congestion) Congestion Index (I ): Calculated based on the free-flow speed (60km / h), when the measured speed is ≤20km / h, I=0.9 (severe congestion).

[0067] 2.2 Environmental feature construction 2.2.1 Weather factors ( E ): Real-time meteorological data is obtained, with sunny days set to 1.0, rainy days set to 0.8, and snowy days set to 0.6 (indicating the traffic efficiency attenuation coefficient).

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

[0069] 2.3 Spatial features and weight matrix construction: 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.

[0070] Spatial weight calculation: The weights of each empirical weight are: traffic flow mean 0.25, traffic flow variance 0.22, headway 0.12, congestion index 0.23, weather factor 0.11, and holiday factor 0.07.

[0071] Taking intersection D (north entrance) as an example, during a morning rush hour, the calculation results are: Traffic flow mean = 80, traffic flow variance = 20, headway = 1.5, congestion index = 0.8, weather factor = 1.0, holiday factor = 0 Then 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 Step 3: Large model spatiotemporal feature analysis The currently calculated temporal features, spatial features, environmental features, and the results of the previous round are input into the large model. After inference by the large model, the predicted result is that the traffic volume in the next 15 minutes will be 21 vehicles / min (confidence level 0.89).

[0072] Step 4: Machine Learning Co-Optimization 4.1 LSTM-Attention network construction: Network structure: two-layer LSTM (256 hidden units) + single-layer Attention, deployed using the PyTorch framework; Input features: time series features ( M, V, D, I ), spatial weight matrix W 、Environmental characteristics( E, H), large model prediction results (21 vehicles / min).

[0073] Attention weight: congestion index after training ( I ) weight is 0.32, and the spatial weight is 0.28, indicating that the model focuses on the association between congestion status and the north-side intersection.

[0074] Output result: The predicted value after LSTM optimization is 19 vehicles / min, which is 4.1% higher than that of the single large model.

[0075] 4.2 XGBoost feature fusion: Constructing fusion feature set: Including basic features: temporal features, spatial features, and environmental features; Model results: Large model prediction results (21 vehicles / min), LSTM-Attention prediction results (19 vehicles / min); Cross-feature generation (including but not limited to): Mean traffic volume × holiday factor: 0 on weekdays and M × 1 on weekends Large model result × congestion index: 98 × 0.7 = 68.6 North weight × weather factor: 25.63 × 1.0 = 25.63 XGBoost model parameters: n_estimators=500, learning_rate=0.01, max_depth=10, subsample=0.8 XGBoost model feature importance results (including but not limited to): LSTM model traffic prediction results: importance score 0.28 Preliminary traffic forecast results: Importance score 0.25 Large model results × Congestion Index: Importance score 0.23 Average traffic volume × holiday factor: importance score 0.3 Final prediction results: XGBoost output is 20 vehicles / min, and after 50 iterations, RMSE = 0.4 vehicles / min, an 8% improvement over the baseline model (single LSTM).

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

Claims

1. A traffic flow prediction method based on the collaboration of machine learning and large models, characterized in that: The following steps are involved: S1. Collect multi-source data from vehicles, roads and clouds, perform data preprocessing, and build a road network. S2, extract basic multidimensional features, including temporal features, spatial features, environmental features and weight matrix; Environmental characteristics include weather factors and holiday factors; S3. Use the inference model to vectorize and analyze the basic multi-dimensional features and output preliminary traffic prediction results; S4: Use the machine learning model to re-combine features and perform traffic prediction based on the preliminary traffic prediction results and basic multi-dimensional features, and optimize the weight matrix in S2 based on the actual traffic; S5. Repeat steps S1-S4 to iteratively train, improve the final prediction accuracy, and output the final traffic prediction result.

2. The traffic flow prediction method based on machine learning and large model collaboration according to claim 1 is 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; missing values ​​are also filled in the data using cubic spline interpolation; when constructing the road network in S1, a correlation table of the entrances and exits of each intersection is generated.

3. The traffic flow prediction method based on the collaboration of machine learning and large models according to claim 1 is characterized in that: In S2, based on a fixed time sliding window, the mean and variance of traffic flow, as well as headway and congestion index are calculated as time series features; Based on the correlation table of the entrances and exits of each intersection, the temporal characteristics of the adjacent intersections of each intersection are obtained to construct the spatial characteristics; The weight matrix is ​​constructed based on the joint construction of spatial features and environmental features.

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

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

6. The traffic flow prediction method based on machine learning and large model collaboration according to claim 1 is characterized in that: The large model in S3 vectorizes the basic multi-dimensional features, including using the time series embedding method for temporal features and the graph embedding method for spatial features. At the same time, the weight matrix is ​​used as the prior knowledge of the model to adjust the importance of different features in the reasoning process. For environmental features, a dynamic encoding strategy is adopted to integrate the structured environmental data into the model after normalization and discretization using the conditional embedding method.

7. The traffic flow prediction method based on the collaboration of machine learning and large models 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. The XGBoost model of the Extreme Gradient Boosting Tree algorithm is then used to fuse all features with the preliminary traffic prediction results and make the final prediction.

8. The traffic flow prediction method based on the collaboration of machine learning and large models according to claim 7 is characterized in that: The XGBoost model combines the parameters of the acquired time series features of each intersection, the weight matrix, weather factors, holiday factors, large model traffic inference results, and LSTM model traffic prediction results as basic features, and iteratively constructs several regression trees with all the basic features and combined features to fit the data; 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.

9. The traffic flow prediction method based on machine learning and large model collaboration according to claim 8 is characterized in that: During the process of building a regression tree with the XGBoost model, each time a tree is built, features are selected and nodes are divided according to the split gain. During the model building process, the number of times each feature, including basic features and combined features, is used for node division is recorded; when the model is built, the features that are selected the most times are regarded as important features.

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

Citation Information

Patent Citations

  • 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

  • Road port traffic flow prediction method, device, equipment and program product

    CN120260299A

  • A method and system for predicting passenger flow in a transportation system

    EP4557188A1

  • Urban-region road network vehicle-passage flow prediction method and system based on hybrid deep learning model

    US20240220686A1

Cited By

  • Intelligent energy prediction and optimization method and system based on big data analysis

    CN121457714A