Construction method of traffic flow prediction system and traffic flow prediction method
By constructing a traffic flow prediction system and utilizing iterative training and optimization of the temporal encoder and decoder, the problems of high model complexity and large computational cost in existing methods are solved, achieving efficient and accurate traffic flow prediction.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-22
- Publication Date
- 2026-03-17
AI Technical Summary
Existing traffic flow prediction methods have high model complexity and computational overhead, and their prediction performance deteriorates significantly when the number of monitored variables increases, making it difficult to meet the dual requirements of efficiency and accuracy in practical traffic applications.
A traffic flow prediction system is constructed, including a temporal encoder, a trend encoder, a hidden encoder, a hidden decoder, and a temporal decoder. The system parameters are optimized through multiple iterations of training. The trend encoder and the hidden encoder are discarded to reduce system redundancy and improve prediction accuracy.
While reducing system structural redundancy, it improves the accuracy of traffic flow prediction, adapts to the spatiotemporal dynamic changes in traffic flow, and enhances prediction efficiency.
Smart Images

Figure CN121682190A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of traffic analysis, specifically to traffic flow prediction technology in the field of traffic analysis, and more specifically, to a method for constructing a traffic flow prediction system and a traffic flow prediction method. Background Technology
[0002] Time series are time-stamped sequences of values of the same attribute arranged chronologically. They are widely found in various real-world fields, such as transportation, electricity, and the environment. Time series forecasting aims to infer future trends from historical data to support decision-making. Depending on whether the correlation between time series is considered, time series forecasting tasks can be divided into univariate time series forecasting and multivariate time series forecasting. Early research, limited by data acquisition capabilities, focused primarily on univariate time series forecasting. In recent years, with advancements in data acquisition capabilities and forecasting technologies, multivariate time series forecasting has become a research focus.
[0003] Multivariate time series forecasting is a short-term forecasting task with relatively short input and output sequences. Its core challenge is how to model the temporal and spatial dependencies within the time series in order to predict the future trends of multivariate time series to support decision-making.
[0004] Existing methods primarily rely on deep learning to build prediction models, capturing temporal dependencies and spatial correlations through the design of specific network structures. However, these methods have significant drawbacks in practical traffic flow prediction: high model complexity, large computational overhead, and a significant decrease in prediction performance as the number of monitored variables increases, making it difficult to meet the dual requirements of efficiency and accuracy in real-world traffic applications.
[0005] It should be noted that the background information presented here is only for illustrating relevant information about the present invention to aid in understanding the technical solutions of the present invention, and does not imply that the relevant information is necessarily prior art. In the absence of evidence indicating that the relevant information was disclosed before the filing date of this invention, the relevant information should not be considered prior art. Summary of the Invention
[0006] Therefore, the purpose of this invention is to overcome the shortcomings of the prior art and provide a method for constructing a traffic flow prediction system and a traffic flow prediction method.
[0007] The objective of this invention is achieved through the following technical solutions.
[0008] According to a first aspect of the present invention, a method for constructing a traffic flow prediction system is provided, the method comprising: step S1, acquiring multiple sample pairs, each sample pair including a historical traffic time series data and future traffic time series data within a preset future time corresponding to the historical traffic time series data, wherein the historical traffic time series data and the future traffic time series data in each sample pair each include multiple consecutive moments and each moment corresponds to multiple traffic features, and the historical traffic time series data in each sample pair also corresponds to multiple time features; step S2, constructing an initial traffic flow prediction system, the system comprising a time series encoder, a trend encoder, a hidden encoder, a hidden decoder, and a time series decoder, wherein the time series encoder is used to extract the time series features of the historical traffic time series data in each sample pair; the trend encoder is used to encode the future traffic time series data in each sample pair to obtain the historical traffic time series data in each sample pair. The data includes: a true trend encoding; a hidden encoder to generate latent variables for each sample pair based on the temporal features and true trend encoding of historical traffic time series data; a hidden decoder to generate predicted trend encoding of historical traffic time series data for each sample pair based on the temporal features and latent variables of historical traffic time series data for each sample pair; and a temporal decoder to generate predicted traffic time series data corresponding to historical traffic time series data for each sample pair based on the temporal features, predicted trend encoding, and corresponding multiple time features of historical traffic time series data for each sample pair. Step S3 involves iteratively training the initial traffic flow prediction system using multiple sample pairs until the system converges, and using the converged temporal encoder, hidden decoder, and temporal decoder as the final traffic flow prediction system. During each iterative training process, a preset loss function is used to update the system parameters.
[0009] According to some embodiments of the present invention, the initial traffic flow prediction system further includes a trend reconstruction module, wherein the trend reconstruction module is used to reconstruct the true trend value of the historical traffic time series data in each sample pair based on the predicted trend encoding of the historical traffic time series data in each sample pair, so as to obtain the reconstructed trend value of the historical traffic time series data in each sample pair, and the true trend value of the historical traffic time series data in each sample pair is the true value of each traffic feature corresponding to the last moment of the future traffic time series data in the sample pair.
[0010] According to some embodiments of the present invention, the traffic features corresponding to each moment in the historical traffic time series data and future traffic time series data of each sample pair include traffic flow, road occupancy and average vehicle speed.
[0011] According to some embodiments of the present invention, the time features corresponding to the historical traffic time series data in each sample pair include data collection time, data collection frequency, and total data collection time span.
[0012] According to some embodiments of the present invention, the timing encoder, trend encoder, hidden encoder, hidden decoder, timing decoder and trend reconstruction module are all multilayer perceptrons.
[0013] According to some embodiments of the present invention, the preset loss function is:
[0014]
[0015] in,
[0016]
[0017]
[0018]
[0019] in, Indicates the total loss. Indicates the mean absolute error loss. Indicates the reconstruction loss. Indicates divergence loss. Indicates the number of predicted time points. Indicates the number of sample pairs. This represents the total number of traffic features. Indicates the first The nth sample pair corresponds to the nth predicted traffic time series data. At the moment of the first Predicted values for each traffic characteristic Indicates the first In the future traffic time series data of the sample pair, the first... At the moment of the first The true value of each traffic feature Indicates the first The true trend value of historical traffic time series data in each sample pair. Indicates the first The reconstructed trend value of historical traffic time series data in each sample pair Indicates the dimension of the latent variable. Indicates the first The latent variables of the nth sample pair are in the nth... The variance of the dimension, Indicates the first The latent variables of the nth sample pair are in the nth... The mean of the dimension.
[0020] According to a second aspect of the present invention, a traffic flow prediction method is provided, the method comprising: step T1, acquiring historical traffic time series data and its corresponding multiple time features; step T2, processing the historical traffic time series data and its corresponding multiple time features acquired in step T1 using a traffic flow prediction system constructed as described in the first aspect of the present invention, to obtain predicted traffic time series data corresponding to the historical traffic time series data.
[0021] According to some embodiments of the present invention, in step T2, the traffic flow prediction system is configured to process historical traffic time-series data and its corresponding multiple time features in the following manner: the time encoder extracts the time-series features of the historical traffic time-series data; the hidden decoder performs trend encoding on the latent variables generated from the standard Gaussian distribution to obtain the prediction trend encoding of the historical traffic time-series data; the time decoder generates the prediction traffic time-series data corresponding to the historical traffic time-series data based on the time-series features of the historical traffic time-series data, the prediction trend encoding, and the corresponding multiple time features.
[0022] Compared with the prior art, the advantages of the present invention are as follows: a trend encoder, a hidden encoder, and a trend reconstruction module are set in the initial traffic flow prediction system, so that the initial traffic flow prediction system explicitly extracts and stores future spatiotemporal features during the training process. However, the trend encoder, hidden encoder, and trend reconstruction module are abandoned in the final traffic flow prediction system, so that the constructed traffic flow prediction system can predict future traffic time series data based on the learned future spatiotemporal features, thereby reducing the redundancy of the system structure and improving the prediction accuracy. Attached Figure Description
[0023] The embodiments of the present invention will be further described below with reference to the accompanying drawings, wherein:
[0024] Figure 1 This is a flowchart illustrating a method for constructing a traffic flow prediction system according to an embodiment of the present invention.
[0025] Figure 2 This is a schematic diagram of the training and inference process of a traffic flow prediction system according to an embodiment of the present invention. Detailed Implementation
[0026] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are merely illustrative and are not intended to limit the invention.
[0027] As mentioned in the background section, existing methods have significant drawbacks in traffic flow prediction practice: high model complexity, large computational overhead, and a significant decrease in prediction performance when the number of monitored variables increases, making it difficult to meet the dual requirements of efficiency and accuracy in practical traffic applications.
[0028] To address the aforementioned issues, the inventors analyzed existing deep learning-based multivariate time series forecasting methods and discovered that the root cause of their performance deficiencies lies in the overly complex unified network structures commonly used in the constructed forecasting models to capture complex spatiotemporal dependencies. Specifically, these models typically use a single, fixed, complex module (such as a coupled structure of deep graph neural networks and recurrent neural networks) to handle all types and all time-series spatiotemporal correlations. This "one-size-fits-all" design paradigm leads to severe structural redundancy: on the one hand, the model utilizes complex computational units even for simple, linear dependencies, resulting in a waste of computational resources; on the other hand, its static structure struggles to adapt to the dynamically changing dependency strengths in traffic flow over time and space. To capture occasional strong nonlinear relationships, the entire model must continuously maintain a high level of complexity. This ultimately leads to inefficient models and, in large-scale road networks, a tendency to overfit due to excessive parameters, resulting in decreased generalization performance.
[0029] Based on the above analysis, the inventors propose a novel method for constructing a traffic flow prediction system to predict traffic conditions. This method includes steps S1-S3, whereby, in step S1, multiple sample pairs are acquired, each sample pair including historical traffic time-series data and its corresponding future traffic time-series data; in step S2, an initial traffic flow prediction system is constructed, which includes a time-series encoder, a trend encoder, a hidden encoder, a hidden decoder, and a time-series decoder; in step S3, the initial traffic flow prediction system is iteratively trained multiple times using multiple sample pairs until the system converges, and the converged time-series encoder, hidden decoder, and time-series decoder are used as the final traffic flow prediction system.
[0030] In summary, such as Figure 1As shown, this invention provides a method for constructing a traffic flow prediction system. The method includes: Step S1, acquiring multiple sample pairs, each sample pair including historical traffic time-series data and future traffic time-series data within a preset future time corresponding to the historical traffic time-series data, wherein the historical traffic time-series data and future traffic time-series data in each sample pair include multiple consecutive moments and each moment corresponds to multiple traffic features, and the historical traffic time-series data in each sample pair also corresponds to multiple time features; Step S2, constructing an initial traffic flow prediction system, the system including a time-series encoder, a trend encoder, a hidden encoder, a hidden decoder, and a time-series decoder, wherein the time-series encoder is used to extract the time-series features of the historical traffic time-series data in each sample pair; the trend encoder is used to encode the future traffic time-series data in each sample pair to obtain the historical traffic time-series data in each sample pair. The system consists of three parts: a true trend encoding and a hidden encoder. The hidden encoder is used to generate latent variables for each sample pair based on the temporal features and true trend encoding of historical traffic time series data in each sample pair. The hidden decoder is used to generate predicted trend encoding of historical traffic time series data in each sample pair based on the temporal features, predicted trend encoding, and corresponding multiple time features of historical traffic time series data in each sample pair. Step S3: The initial traffic flow prediction system is trained iteratively multiple times using multiple sample pairs until the system converges. The converged temporal encoder, hidden decoder, and temporal decoder are used as the final traffic flow prediction system. In each iteration of training, the system parameters are updated using a preset loss function.
[0031] To better understand the present invention, each step will be described in detail below with reference to specific embodiments.
[0032] I. Step S1
[0033] In step S1, multiple sample pairs are obtained. Each sample pair includes a historical traffic time series data and a future traffic time series data within a preset future time corresponding to the historical traffic time series data. The historical traffic time series data and the future traffic time series data in each sample pair include multiple consecutive moments and each moment corresponds to multiple traffic features. The historical traffic time series data in each sample pair also corresponds to multiple time features.
[0034] Each sample pair can be constructed as follows: multiple traffic time series data are obtained from a known database. (No. Each traffic time series data point is divided into multiple segments of equal length using a fixed-length sliding window. (No. The first traffic time series data a fragment, , Indicates the length of time. (This represents the number of traffic features corresponding to each time point), and it also represents the pair of adjacent segments in each traffic time series data. , Each sample pair constructed based on this can be represented as: ,in, This represents the historical traffic time series data in this sample pair. express Vector representation at time t, express Vector representation at time t, express Vector representation at time t, This represents the future traffic time series data in this sample pair. express Vector representation at time t, express Vector representation at time t, express Vector representation at time t.
[0035] According to one embodiment of the present invention, the traffic features corresponding to each moment in the historical traffic time series data and future traffic time series data of each sample pair include traffic flow, road occupancy rate, and average vehicle speed. Specifically, traffic flow represents the total number of vehicles detected passing through a certain cross-section of the road within a specific time window ending at the corresponding moment; road occupancy rate represents the degree to which the road is occupied by vehicles within a specific time window ending at the corresponding moment (the value ranges from 0 to 1, where 0 indicates the road is completely empty and 1 indicates the road is completely occupied by vehicles); and average vehicle speed represents the average speed of all vehicles passing through the road within a specific time window ending at the corresponding moment. For example, suppose... The vector representation (sequence data) corresponding to each time step is: Based on this vector representation, it can be seen that in to At any given time, a total of 25 vehicles were detected, the road occupancy rate was 0.3, and the average speed of all detected vehicles was 60 miles per hour. Indicates the length of time.
[0036] According to one embodiment of the present invention, the time characteristics corresponding to the historical traffic time series data in each sample pair include data collection time, data collection frequency, and total data collection time span. Here, data collection time represents the collection date and time period corresponding to the historical traffic time series data; for example, a certain historical traffic time series data was collected between point x and point i on a certain date. The total data collection time span represents the total time span of the collected data; for example, if data is collected between 9:00 and 12:00, the total data collection time span is 3 hours.
[0037] It should be noted that in step S1, all sample pairs can correspond to the traffic flow status of a road at different time periods, or all sample pairs can correspond to the traffic flow status of different roads in a road network at different time periods; this invention does not impose any special limitations on this. It should also be noted that the traffic time series data is collected by traffic flow sensors deployed on the roads.
[0038] II. Step S2
[0039] In step S2, an initial traffic flow prediction system is constructed, which includes a time-series encoder, a trend encoder, a hidden encoder, a hidden decoder, a time-series decoder, and a trend reconstruction module.
[0040] According to one embodiment of the present invention, the timing encoder, trend encoder, hidden encoder, hidden decoder, timing decoder and trend reconstruction module are all multilayer perceptrons.
[0041] To better understand the initial traffic flow prediction system, the following section combines... Figure 2 Let's introduce each component separately.
[0042] 2.1 Timing Encoder
[0043] Depend on Figure 2 It can be seen that the time-series encoder extracts the temporal features of historical traffic time-series data in each sample pair. Specifically, the time-series encoder is a linear projection used to map the historical traffic time-series data in each sample pair to a latent space. For the historical traffic time-series data in a single sample pair... ( The encoding process is as follows: ,in, This represents the temporal characteristics of historical traffic time series data in the sample pair. It is a learnable weight matrix. It is a learnable bias vector. This represents the latent space dimension. Therefore, after encoder processing, the historical traffic time series data in each sample pair is transformed into a dimension of... The temporal characteristics are represented.
[0044] 2.2 Trend Encoder
[0045] Depend on Figure 2 It is understood that the trend encoder encodes the future traffic time-series data in each sample pair to obtain the true trend code of the historical traffic time-series data in each sample pair. Specifically, it maps the vector representation of the last moment of the future traffic time-series data in each sample pair to a high-dimensional vector as the true trend code of that sample pair. For example, suppose a sample pair is... The sample pair can be As the true trend value, it is mapped to a high-dimensional vector as the true trend encoding for that sample pair.
[0046] 2.3 Hidden Encoder
[0047] Depend on Figure 2 It can be seen that the hidden encoder generates the latent variables of each sample pair based on the temporal characteristics and true trend encoding of the historical traffic time series data in each sample pair.
[0048] Specifically, for a single sample pair, the hidden encoder first generates the normal distribution parameters (mean and variance) of the latent variables based on the temporal characteristics of the historical traffic time series data in the sample pair and the true trend encoding of the sample pair. The specific calculation process is as follows:
[0049]
[0050] in, Representing latent variables It follows a normal distribution. Indicates a hidden encoder. Representing latent variables The mean, Represents the variance of latent variables. Represents the identity matrix. This represents the temporal characteristics of historical traffic time series data in the sample pair. This represents the true trend encoding of the sample pair.
[0051] The latent variables are then obtained by sampling based on the parameters of the normal distribution they follow. Considering that the sampling process itself is not differentiable, a reparameterization technique is needed to generate the latent variables to overcome this problem. The specific generation process can be represented as follows:
[0052]
[0053] in, Represents latent variables. This represents noise sampled from a standard normal distribution. It should be noted that the sampling operation itself does not participate in gradient descent. Participate in gradient descent.
[0054] 2.4 Hidden Decoder
[0055] Depend on Figure 2 It is understood that the hidden decoder generates the predictive trend code of the historical traffic time series data in each sample pair based on the temporal features of the historical traffic time series data in each sample pair and the latent variables of each sample pair.
[0056] It should be noted that, ideally, the predicted trend code of the historical traffic time series data in each sample pair should closely approximate the true trend code of the corresponding historical traffic time series data in the sample pair. This allows the time series decoder to correctly predict the future traffic time series data corresponding to the historical traffic time series data based on the predicted trend code of the historical traffic time series data in each sample pair. Simultaneously, it enables the trend reconstruction module to reconstruct the true trend value of the historical traffic time series data in each sample pair based on the predicted trend code of the historical traffic time series data in each sample pair.
[0057] 2.5 Timing Decoder
[0058] Depend on Figure 2 As can be seen, the temporal decoder takes the temporal features of the historical traffic time-series data in each sample pair, the predicted trend encoding, and the feature data obtained by concatenating multiple corresponding time features as input to generate the predicted traffic time-series data corresponding to the historical traffic time-series data in each sample pair. For example, for a single sample pair... The time-series decoder generates the predicted traffic time-series data as follows: .
[0059] 2.6 Trend Reconstruction Module
[0060] Depend on Figure 2 It can be seen that the trend reconstruction module reconstructs the true trend value of the historical traffic time series data in each sample pair based on the predicted trend code of the historical traffic time series data in each sample pair, so as to obtain the reconstructed trend value of the historical traffic time series data in each sample pair. The true trend value of the historical traffic time series data in each sample pair is the true value of each traffic feature corresponding to the last moment of the future traffic time series data in that sample pair. By comparing the difference between the reconstructed trend value and the true trend value of the historical traffic time series data in each sample pair, the system can be effectively supervised to learn how to correctly generate the predicted trend code.
[0061] III. Step S3
[0062] In step S3, the initial traffic flow prediction system is trained iteratively multiple times using multiple sample pairs until the system converges. The converged temporal encoder, hidden decoder, and temporal decoder are used as the final traffic flow prediction system. In each iteration of training, the system parameters are updated using a preset loss function.
[0063] According to one embodiment of the present invention, the preset loss function is:
[0064]
[0065] in,
[0066]
[0067]
[0068]
[0069] in, Indicates the total loss. Indicates the mean absolute error loss. Indicates the reconstruction loss. Indicates divergence loss. Indicates the number of predicted time points. Indicates the number of sample pairs. This represents the total number of traffic features. Indicates the first The nth sample pair corresponds to the nth predicted traffic time series data. At the moment of the first Predicted values for each traffic characteristic Indicates the first In the future traffic time series data of the sample pair, the first... At the moment of the first The true value of each traffic feature Indicates the first The true trend value of historical traffic time series data in each sample pair. Indicates the first The reconstructed trend value of historical traffic time series data in each sample pair Indicates the dimension of the latent variable. Indicates the first The latent variables of the nth sample pair are in the nth... The variance of the dimension, Indicates the first The latent variables of the nth sample pair are in the nth... The mean of the dimension.
[0070] The mean absolute error loss measures the difference between the predicted future traffic time-series data and the actual future traffic time-series data to evaluate the predictive performance of the traffic flow prediction system. The reconstruction loss guides the trend reconstruction module to reconstruct the trend value of the historical traffic time-series data in each sample pair closer to the true trend value of the historical traffic time-series data in that sample pair. This ensures that the final traffic flow prediction system can accurately reconstruct the "true trend value to be inferred" from the latent variables, thereby guaranteeing that the trend features pre-extracted during system training contain effective information. The divergence loss constrains the distribution of the latent variables learned by the hidden encoder to approach a standard normal distribution, balancing the system's fitting ability and generalization ability.
[0071] To better understand this invention, the following is combined with... Figure 2 This will illustrate how to train the initial traffic flow prediction system. Among other things, Figure 2 The training process shown includes sections composed of both solid and dashed arrows.
[0072] Assuming to adopt The initial traffic flow prediction system is trained using sample pairs, where each sample pair can be represented as... , Indicates the first a sample pair Historical traffic time series data in China Indicates sample pairs middle Vector representation at time t, Indicates sample pairs middle Vector representation at time t, Indicates sample pairs middle Vector representation at time t, Indicates the first a sample pair Future traffic time series data in Indicates sample pairs middle Vector representation at time t, Indicates sample pairs middle Vector representation at time t, Indicates sample pairs middle Vector representation at time t.
[0073] During each iteration of training, the initial traffic flow prediction system processes each sample pair as follows: First, the temporal encoder extracts the temporal features of the historical traffic time series data in each sample pair. Simultaneously, the trend encoder encodes the future traffic time series data in each sample pair to obtain the true trend code of the historical traffic time series data in each sample pair. Then, the hidden encoder generates the latent variables of each sample pair based on the temporal features and true trend codes of the historical traffic time series data in each sample pair. The hidden decoder generates the predicted trend code of the historical traffic time series data in each sample pair based on the temporal features and latent variables of the historical traffic time series data in each sample pair. Finally, the temporal decoder generates the predicted traffic time series data corresponding to the historical traffic time series data in each sample pair based on the temporal features, predicted trend codes, and corresponding multiple time features of the historical traffic time series data in each sample pair. The trend reconstruction module reconstructs the true trend value of the historical traffic time series data in each sample pair based on the predicted trend code of the historical traffic time series data in each sample pair to obtain the reconstructed trend value of the historical traffic time series data in each sample pair. Each iteration of training is performed, and the total loss of this iteration is calculated using a preset loss function. The backpropagation gradient is then calculated based on the total loss to update all learnable parameters in the initial traffic flow prediction system.
[0074] The initial traffic flow prediction system is trained iteratively multiple times according to the above training process until the system converges, and the converged temporal encoder, hidden decoder and temporal decoder are used as the final traffic flow prediction system.
[0075] Furthermore, to better understand the present invention, the following description is provided in conjunction with... Figure 2 This will illustrate how to use the constructed traffic flow prediction system to perform traffic flow prediction tasks. Specifically, Figure 2 The task execution process shown in the image only includes the portion consisting of solid arrows.
[0076] Suppose we have historical traffic time series data The traffic flow prediction system generates predicted traffic time-series data based on historical traffic time-series data as follows: First, the time-series encoder extracts the time-series features of the historical traffic time-series data; then, the hidden decoder performs trend encoding on the latent variables sampled from the standard Gaussian distribution (sampling noise from the standard Gaussian distribution and generating latent variables based on the sampled noise using reparameterization techniques) to obtain the predicted trend encoding of the historical traffic time-series data; finally, the time-series decoder generates the predicted traffic time-series data corresponding to the historical traffic time-series data based on the time-series features of the historical traffic time-series data, the predicted trend encoding, and the corresponding multiple time features. .
[0077] Based on the aforementioned steps, in the construction method proposed by the inventors, the initial traffic flow prediction system is equipped with a trend encoder, a hidden encoder, and a trend reconstruction module, which allows the initial traffic flow prediction system to explicitly extract and store future spatiotemporal features during the training process. However, the final traffic flow prediction system abandons the trend encoder, hidden encoder, and trend reconstruction module, enabling the constructed traffic flow prediction system to predict future traffic time series data based on the learned future spatiotemporal features. This reduces the redundancy of the system structure while improving the prediction accuracy.
[0078] It should be noted that the construction method proposed in this invention can also be used to construct a weather forecasting system to predict the weather, or to construct a power forecasting system to predict power consumption.
[0079] To build a weather forecasting system, simply replace the historical and future traffic time-series data in each sample pair with historical weather time-series data and the corresponding future weather time-series data. Each sample pair's historical and future weather time-series data includes multiple consecutive moments, each corresponding to multiple weather characteristics. These characteristics include temperature, humidity, wind speed, wind direction, precipitation, precipitation type, air pressure, visibility, cloud cover, sunshine duration, evaporation, and dew point temperature. Each sample pair's historical weather time-series data also corresponds to multiple time characteristics (data collection time, data collection frequency, and total data collection time span).
[0080] Similarly, to build a power forecasting system, one only needs to replace the historical and future traffic time-series data in each sample pair with historical electricity time-series data and the corresponding future electricity time-series data. Each sample pair's historical and future electricity time-series data includes multiple consecutive time points, and each time point corresponds to multiple electricity characteristics. These characteristics include power consumption, average power, peak-to-valley difference, and peak power percentage. Each sample pair's historical electricity time-series data also corresponds to multiple time characteristics (data collection time, data collection frequency, and total data collection time span).
[0081] Based on the traffic flow prediction system construction method described in the foregoing embodiments, this invention also proposes a traffic flow prediction system construction device for constructing a traffic flow prediction system. The device includes: a data input module, a data processing module, a parameter setting module, a system storage module, a data storage module, a configuration file storage module, a system loading module, and a user operation module. The data input module receives historical traffic time-series data and future traffic time-series data. The data processing module normalizes the historical and future traffic time-series data. The parameter setting module sets system parameters such as learning rate, batch size, and network structure. The system storage module stores the constructed traffic flow prediction system. The data storage module stores historical and future traffic time-series data. The configuration file storage module stores configuration information (system parameters, data paths, etc.) associated with the traffic flow prediction system. The system loading module reads the traffic flow prediction system from the system storage module. The user operation module provides a visual processing interface, enabling users to predict traffic flow states based on the constructed traffic flow prediction system.
[0082] Based on the traffic flow prediction system construction method described in the foregoing embodiments, this invention also proposes a traffic flow prediction method, which includes: step T1, acquiring historical traffic time-series data and its corresponding multiple time features; step T2, using the traffic flow prediction system constructed as described in the foregoing embodiments to process the historical traffic time-series data and its corresponding multiple time features acquired in step T1, to obtain the predicted traffic time-series data corresponding to the historical traffic time-series data. By predicting traffic time-series data, it is possible to assist in adjusting traffic control strategies, realize adaptive intelligent signal control, dynamic variable lane management, publish real-time traffic information through guidance screens, and provide early warnings for potential congestion or accidents, achieving intelligent traffic management from passive response to active intervention.
[0083] According to an embodiment of the present invention, in step T2, the traffic flow prediction system is configured to process historical traffic time-series data and its corresponding multiple time features in the following manner: the time encoder extracts the time-series features of the historical traffic time-series data; the hidden decoder performs trend encoding on the latent variables generated from the standard Gaussian distribution to obtain the prediction trend encoding of the historical traffic time-series data; the time decoder generates the prediction traffic time-series data corresponding to the historical traffic time-series data based on the prediction trend encoding of the historical traffic time-series data and the multiple time features corresponding to the historical traffic time-series data.
[0084] The beneficial effects of this invention are as follows: a trend encoder, a hidden encoder, and a trend reconstruction module are set in the initial traffic flow prediction system, so that the initial traffic flow prediction system explicitly extracts and stores future spatiotemporal features during the training process. However, the trend encoder, hidden encoder, and trend reconstruction module are abandoned in the final traffic flow prediction system, so that the constructed traffic flow prediction system can predict future traffic time series data based on the learned future spatiotemporal features, thereby reducing the redundancy of the system structure and improving the prediction accuracy.
[0085] It should be noted that although the steps are described in a specific order above, it does not mean that the steps must be executed in the above specific order. In fact, some of these steps can be executed concurrently or even in a different order, as long as the required function can be achieved.
[0086] This invention can be a system, method, and / or computer program product. A computer program product may include a computer-readable storage medium having computer-readable program instructions loaded thereon for causing a processor to implement various aspects of the invention.
[0087] Computer-readable storage media can be tangible devices that hold and store instructions for use by an instruction execution device. Computer-readable storage media can include, for example, but not limited to, electrical storage devices, magnetic storage devices, optical storage devices, electromagnetic storage devices, semiconductor storage devices, or any suitable combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable compact disc read-only memory (CD-ROM), digital multifunction disc (DVD), memory sticks, floppy disks, mechanical encoding devices, such as punch cards or recessed protrusions storing instructions thereon, and any suitable combination thereof.
[0088] The various embodiments of the present invention have been described above. These descriptions are exemplary and not exhaustive, nor are they limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principles, practical application, or technical improvements to the embodiments in the market, or to enable others skilled in the art to understand the embodiments disclosed herein.
Claims
1. A method of constructing a traffic flow prediction system, characterized by, The method comprises: Step S1, obtaining a plurality of sample pairs, each sample pair comprising historical traffic time series data and future traffic time series data corresponding to the historical traffic time series data within a preset future time, wherein the historical traffic time series data and the future traffic time series data in each sample pair each comprise a plurality of continuous time points, and each time point corresponds to a plurality of traffic characteristics, and the historical traffic time series data in each sample pair further corresponds to a plurality of time characteristics; Step S2, constructing an initial traffic flow prediction system, the system comprising a time series encoder, a trend encoder, a hidden encoder, a hidden decoder and a time series decoder, wherein the time series encoder is used to extract the time series characteristics of the historical traffic time series data in each sample pair; the trend encoder is used to encode the future traffic time series data in each sample pair to obtain the true trend encoding of the historical traffic time series data in each sample pair; the hidden encoder is used to generate the hidden variable of each sample pair based on the time series characteristics of the historical traffic time series data in each sample pair and the true trend encoding; the hidden decoder is used to generate the predicted trend encoding of the historical traffic time series data in each sample pair based on the time series characteristics of the historical traffic time series data in each sample pair and the hidden variable of each sample pair; and the time series decoder is used to generate the predicted traffic time series data corresponding to the historical traffic time series data in each sample pair based on the time series characteristics of the historical traffic time series data in each sample pair, the predicted trend encoding and the corresponding plurality of time characteristics; Step S3, performing multiple iteration training on the initial traffic flow prediction system using the plurality of sample pairs until the system converges, and taking the converged time series encoder, hidden decoder and time series decoder as the final traffic flow prediction system, wherein in each iteration training process, the system parameters are updated using a preset loss function.
2. The method of claim 1, wherein, The initial traffic flow prediction system further comprises a trend reconstruction module, wherein the trend reconstruction module is used to reconstruct the true trend value of the historical traffic time series data in each sample pair based on the predicted trend encoding of the historical traffic time series data in each sample pair to obtain the reconstructed trend value of the historical traffic time series data in each sample pair, and the true trend value of the historical traffic time series data in each sample pair is the true value of each traffic characteristic corresponding to the last time point of the future traffic time series data in the sample pair.
3. The method of claim 2, wherein, The traffic characteristics corresponding to each time point in the historical traffic time series data and the future traffic time series data in each sample pair comprise vehicle flow, road occupancy and average vehicle speed.
4. The method of claim 3, wherein, The time characteristics corresponding to the historical traffic time series data in each sample pair comprise data collection time, data collection frequency and total data collection time span.
5. The method of claim 4, wherein, The time series encoder, the trend encoder, the hidden encoder, the hidden decoder, the time series decoder and the trend reconstruction module are all multilayer perceptrons.
6. The method of claim 5, wherein, The preset loss function is: wherein, wherein, denotes the total loss, denotes the mean absolute error loss, denotes the reconstruction loss, denotes the divergence loss, denotes the number of prediction time steps, denotes the number of sample pairs, denotes the total number of traffic features, denotes the predicted value of the th traffic feature at the th time step in the predicted traffic time series data for the th sample pair, denotes the true value of the th traffic feature at the th time step in the future traffic time series data for the th sample pair, denotes the true trend value of the historical traffic time series data for the th sample pair, denotes the reconstructed trend value of the historical traffic time series data for the th sample pair, denotes the dimension of the latent variable, denotes the variance of the latent variable in the th dimension for the th sample pair, denotes the mean of the latent variable in the th dimension for the th sample pair.
7. A traffic flow prediction method characterized by, The method comprises: Step T1, obtaining historical traffic time series data and a plurality of time characteristics corresponding thereto; Step T2, the traffic flow prediction system constructed by the method of any one of claims 1-6 processes the historical traffic time series data and the corresponding plurality of time features obtained in step T1 to obtain predicted traffic time series data corresponding to the historical traffic time series data.
8. The method of claim 7, wherein, In the step T2, the traffic flow prediction system processes the historical traffic time series data and the corresponding plurality of time features in the following manner: The time series encoder extracts the time series features of the historical traffic time series data; The latent decoder trend-encodes the latent variables generated by sampling from a standard Gaussian distribution to obtain predicted trend encoding of the historical traffic time series data; The time series decoder generates predicted traffic time series data corresponding to the historical traffic time series data based on the time series features of the historical traffic time series data, the predicted trend encoding, and the corresponding plurality of time features.
9. A computer-readable storage medium, characterized in that, A computer program is stored thereon, and the computer program is executable by a processor to implement the steps of the method of any one of claims 1-8.
10. An electronic device, comprising: Comprise: One or more processors, and a memory, wherein the memory is configured to store executable instructions; The one or more processors are configured to implement the steps of the method of any one of claims 1-8 by executing the executable instructions.