Traffic prediction model training method, traffic prediction method and related equipment
By constructing a hypergraph structure in the traffic prediction model and using the graph message delivery layer for feature aggregation, the problem that traditional traffic prediction methods are difficult to capture complex traffic relationships is solved, and a higher node-level traffic prediction accuracy is achieved.
Patent Information
- Application Number
- CN202411920734.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-25
- Publication Date
- 2025-04-22
- Estimated Expiration
- 2044-12-25
AI Technical Summary
When traditional traffic prediction methods deal with large-scale, high-dimensional, and complex urban-level traffic data at space and time, it is difficult to capture complex relationships and dynamic changes in the traffic network, resulting in low traffic prediction accuracy at the node level.
By building a hypergraph structure in the traffic prediction model, using the graph message delivery layer for feature aggregation, avoiding the smoothing phenomenon caused by frequency domain graph convolution operations, thereby improving prediction accuracy.
It effectively improves the traffic prediction accuracy at the node level, can better capture complex relationships and dynamic changes in the traffic network, and improves the model's expression ability and computing efficiency.
Smart Images

Figure CN119479307B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the technical field of traffic prediction, and in particular to a training method for a traffic prediction model, a traffic prediction method, and related equipment. Background Art
[0002] Traditional traffic forecasting methods mainly rely on statistical models and machine learning models, such as time series analysis and support vector machines. However, the frequency domain graph convolution operation based on graph Laplacian eigendecomposition commonly used in current model methods easily causes node features to be over-smoothed, resulting in the model being unable to distinguish nodes and making the prediction results converge. As a result, current model methods have limitations in processing large-scale, high-dimensional, and spatiotemporally complex urban-level traffic data. It is difficult to capture the complex relationships and dynamic changes in the traffic network, and it is impossible to effectively perform node-level traffic forecasting. Summary of the invention
[0003] An embodiment of the present application provides a training method for a traffic prediction model, which can avoid the smoothing phenomenon caused by the frequency domain graph convolution operation by performing graph message feature aggregation based on a hypergraph structure in the model, thereby effectively improving the prediction accuracy of the node-level traffic prediction performed by the present application.
[0004] To achieve the above-mentioned purpose, the first aspect of an embodiment of the present application provides a method for training a traffic prediction model, comprising: constructing an initial model to be trained, the initial model comprising an input layer, a time series feature extraction layer, a graph message passing layer, and a fully connected output layer; preprocessing preset sample traffic data based on the input layer to obtain a time series traffic volume sequence and an adjacency matrix of multiple traffic nodes, and constructing a hypergraph structure corresponding to each of the traffic nodes according to the corresponding adjacency matrix; for the time series traffic volume sequence of each of the traffic nodes, performing a one-dimensional dilated convolution process through the time series feature extraction layer to obtain a corresponding first convolution feature and a second convolution feature, and according to the first convolution feature The second convolution feature is adjusted according to the nonlinear conversion value domain to obtain the time series feature corresponding to each of the traffic nodes; based on the graph message passing layer, the intra-edge neighborhood passing messages and the inter-edge neighborhood passing messages corresponding to each of the hypergraph structures are respectively aggregated to obtain the intra-edge aggregation feature and the inter-edge aggregation feature, and the intra-edge aggregation feature and the inter-edge aggregation feature are weighted to obtain the spatial feature corresponding to each of the traffic nodes; based on the fully connected output layer, a traffic prediction result is obtained according to the time series feature and the spatial feature, and a model loss is calculated according to the traffic prediction result, so as to update the model parameters of the initial model according to the model loss to obtain a trained traffic prediction model.
[0005] In some embodiments, the pre-processing of preset sample traffic data based on the input layer to obtain time-series traffic volume sequences and adjacency matrices of multiple traffic nodes includes: pre-processing of preset sample traffic data based on the input layer to extract time-series traffic data and spatial traffic data corresponding to multiple traffic nodes from the sample traffic data; obtaining time-series traffic volume sequences of multiple traffic nodes based on multiple time-series traffic data; obtaining adjacency matrices of multiple traffic nodes based on multiple spatial traffic data; wherein the spatial traffic data includes traffic connectivity relationships or geographical location relationships between multiple traffic nodes.
[0006] In some embodiments, constructing a hypergraph structure corresponding to each of the traffic nodes according to the corresponding adjacency matrix includes: constructing an initial graph structure corresponding to the traffic node; generating multiple structure points in the initial graph structure according to the multiple traffic nodes in the adjacency matrix, and calculating the association weights between the multiple structure points; generating multiple structure edges in the initial graph structure according to the relationship information between the multiple traffic nodes in the adjacency matrix, and determining multiple hyperedges formed by the multiple structure edges according to the relationship information; and obtaining the hypergraph structure corresponding to the traffic node according to the multiple structure points, the structure edges, the association weights and the hyperedges.
[0007] In some embodiments, the calculation of the association weights between the multiple structural points includes: obtaining interest point information corresponding to the multiple structural points based on the sample traffic data, the interest point information representing the node attributes of the structural points at the corresponding geographical locations; calculating the similarity coefficients between the multiple structural points based on the multiple interest point information, and obtaining the corresponding association weights based on the similarity coefficients.
[0008] In some embodiments, the temporal feature extraction layer includes multiple temporal gated linear units, each of which is used to independently process the temporal traffic volume sequence of a traffic node, and the temporal traffic volume sequence of each traffic node is subjected to one-dimensional dilated convolution processing through the temporal feature extraction layer to obtain corresponding first convolution features and second convolution features, including: respectively assigning the temporal traffic volume sequence of each traffic node to a temporal gated linear unit in the temporal feature extraction layer; determining the time mode of each traffic node based on the temporal traffic volume sequence of the corresponding traffic node through each temporal gated linear unit; and performing one-dimensional dilated convolution processing on the temporal traffic volume sequence of each traffic node based on the time mode of each traffic node to obtain the first convolution features and second convolution features corresponding to each traffic node.
[0009] In some embodiments, the second convolution feature is adjusted according to the nonlinear conversion value range of the first convolution feature to obtain the timing feature corresponding to each of the traffic nodes, including: performing a nonlinear transformation on the first convolution feature according to a preset activation function to obtain the corresponding nonlinear conversion value range; performing element-by-element multiplication of the nonlinear conversion value range and the second convolution feature to achieve suppression adjustment of the second convolution feature to obtain the timing feature corresponding to each of the traffic nodes.
[0010] In some embodiments, the graph message passing layer performs feature aggregation on the intra-edge neighborhood transmission messages and the inter-edge neighborhood transmission messages corresponding to each of the hypergraph structures respectively to obtain intra-edge aggregation features and inter-edge aggregation features, including: determining multiple hyperedges corresponding to the traffic node from the hypergraph structure based on the graph message passing layer; determining the intra-edge neighborhood node range and the inter-edge neighborhood node range corresponding to the traffic node according to the multiple hyperedges, and obtaining the intra-edge neighborhood transmission messages corresponding to each node within the intra-edge neighborhood node range, and obtaining the inter-edge neighborhood transmission messages corresponding to each node within the inter-edge neighborhood node range; compressing the intra-edge neighborhood transmission messages according to the number of nodes within the intra-edge neighborhood node range to obtain intra-edge aggregation features; compressing the inter-edge neighborhood transmission messages according to the number of hyperedges of the multiple hyperedges to obtain inter-edge aggregation features.
[0011] In some embodiments, the weighted calculation of the intra-edge aggregation features and the inter-edge aggregation features is performed to obtain the spatial features corresponding to each of the traffic nodes, including: obtaining the original node features corresponding to the traffic node according to the hypergraph structure; and weighted calculation of the original node features, the intra-edge aggregation features and the inter-edge aggregation features based on a preset adaptive weight coefficient method to obtain the spatial features corresponding to the traffic node.
[0012] In some embodiments, calculating the model loss based on the traffic prediction result includes: calculating the precision loss corresponding to the traffic prediction result based on a mean square error loss function; calculating the smoothing loss corresponding to the traffic prediction result based on a graph relationship reconstruction loss function; and obtaining the model loss based on the precision loss and the smoothing loss.
[0013] To achieve the above-mentioned purpose, the second aspect of an embodiment of the present application provides a traffic prediction method, comprising: obtaining historical traffic data of a target traffic scene; inputting the historical traffic data into a traffic prediction model to obtain a traffic prediction result of the target traffic scene; wherein the traffic prediction model is trained according to the training method of the traffic prediction model described in any one of the embodiments of the first aspect.
[0014] To achieve the above-mentioned purpose, the third aspect of an embodiment of the present application provides an electronic device, comprising: at least one processor; at least one memory for storing at least one program; when at least one of the programs is executed by at least one of the processors, a training method for a traffic prediction model as described in any one of the first aspects is implemented.
[0015] To achieve the above-mentioned purpose, the fourth aspect of an embodiment of the present application provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are used to execute the training method of the traffic prediction model as described in any one of the first aspects or the traffic prediction method as described in any one of the second aspects.
[0016] The embodiment of the present application provides a training method for a traffic prediction model, a traffic prediction method and related equipment. The initial model to be trained can be constructed, and the initial model includes an input layer, a time series feature extraction layer, a graph message passing layer and a fully connected output layer. Based on the input layer, the preset sample traffic data is normalized, denoised and other processes are performed to extract the time series traffic volume sequence of each traffic node, and the time series traffic volume sequence and adjacency matrix of multiple traffic nodes are obtained. A hypergraph structure corresponding to each traffic node is constructed according to the corresponding adjacency matrix, and the hypergraph structure represents the control relationship between the nodes; further, for the time series traffic volume sequence of each of the traffic nodes, a one-dimensional dilated convolution process is performed through the time series feature extraction layer to obtain a corresponding first convolution feature and a second convolution feature, and the second convolution feature is adjusted according to the nonlinear conversion value range of the first convolution feature to obtain the time series feature corresponding to each of the traffic nodes; further, based on the graph message passing layer, feature aggregation is performed on the intra-edge neighborhood transmission message and the inter-edge neighborhood transmission message corresponding to each hypergraph structure to obtain the intra-edge aggregation feature and the inter-edge aggregation feature, and the intra-edge aggregation feature and the inter-edge aggregation feature are respectively aggregated. The features are weighted to obtain the spatial features corresponding to each of the traffic nodes; further, based on the fully connected output layer, the time series features and the spatial features are fused to generate traffic prediction results, and the model loss is calculated through the mean square error loss function and the graph relationship reconstruction loss function, and then the model parameters are updated through the back propagation algorithm according to the model loss to optimize the model performance; it can be understood that the graph message passing layer in the embodiment of the present application can avoid the characteristic decomposition and frequency domain convolution operation of the graph Laplacian matrix through the graph message passing mechanism, thereby improving the computational efficiency, and in the case of having a multi-layer graph message passing layer, it can gradually aggregate neighborhood information at different levels to construct a multi-scale feature representation to better capture the relationship between nodes; the intra-edge neighborhood message passing is to pass messages between nodes in the same hyperedge to capture local relationships, and the inter-edge neighborhood message passing is to pass messages between nodes in different hyperedges to capture global relationships. Through the above-mentioned message passing, multi-layer feature aggregation can be achieved to form a multi-level feature representation, improve the expression ability of the model, and then avoid the smoothing phenomenon caused by the frequency domain graph convolution operation, and effectively improve the prediction accuracy of the node-level traffic prediction performed by the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 A method flow chart of a method for training a traffic prediction model provided in one embodiment of the present application;
[0018] Figure 2 A flow chart of a method for preprocessing in a training method for a traffic prediction model provided in an embodiment of the present application;
[0019] Figure 3A flow chart of a method for obtaining a hypergraph structure in a training method for a traffic prediction model provided in an embodiment of the present application;
[0020] Figure 4 A flow chart of a method for calculating association weights in a training method for a traffic prediction model provided in an embodiment of the present application;
[0021] Figure 5 A flow chart of a method for obtaining a first convolution feature and a second convolution feature in a training method for a traffic prediction model provided in an embodiment of the present application;
[0022] Figure 6 A flow chart of a method for adjusting the second convolution feature in a training method for a traffic prediction model provided in an embodiment of the present application;
[0023] Figure 7 A flow chart of a method for performing feature aggregation in a method for training a traffic prediction model provided in an embodiment of the present application;
[0024] Figure 8 A flow chart of a method for performing weighted calculation in a training method for a traffic prediction model provided in an embodiment of the present application;
[0025] Fig. 9 A flow chart of a method for calculating model loss in a method for training a traffic prediction model provided in an embodiment of the present application;
[0026] Fig.10 A schematic diagram of the structure of an electronic device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0027] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0028] In some embodiments, although the functional modules are divided in the system schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the system or the order in the flowchart. The terms first, second, etc. in the specification, claims and the above drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.
[0029] In addition, unless otherwise clearly specified and limited, the term "connected" should be understood in a broad sense. For example, it can be a fixed connection or a movable connection, a detachable connection or a non-detachable connection, or an integral connection; it can be a mechanical connection, an electrical connection, or the two can communicate with each other; it can be a direct connection or an indirect connection through an intermediate medium.
[0030] In the description of the embodiments of the present application, the description of reference terms "one embodiment / implementation", "another embodiment / implementation" or "certain embodiments / implementations", "in the above embodiments / implementations", etc. means that the specific features, structures, materials or characteristics described in combination with the implementation or example are included in at least two embodiments or implementations disclosed in the present application. In the disclosure of this application, the schematic representation of the above terms does not necessarily refer to the same embodiment or implementation. It should be noted that although the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in an order different from that in the flowchart.
[0031] At present, traditional traffic prediction methods mainly rely on statistical models and machine learning models, such as time series analysis and support vector machines. However, the frequency domain graph convolution operation based on graph Laplacian eigendecomposition commonly used in current model methods can easily cause node features to be over-smoothed, resulting in the model being unable to distinguish nodes and making the prediction results converge. As a result, the current model method has limitations in processing large-scale, high-dimensional, and spatiotemporally complex urban-level traffic data. It is difficult to capture the complex relationships and dynamic changes in the traffic network, and it is impossible to effectively perform node-level traffic prediction.
[0032] Based on this, an embodiment of the present application provides a training method for a traffic prediction model, which can avoid the smoothing phenomenon caused by the frequency domain graph convolution operation by performing graph message feature aggregation based on a hypergraph structure in the model, thereby effectively improving the prediction accuracy of the node-level traffic prediction performed by the present application.
[0033] The present application scheme is described below with reference to the accompanying drawings.
[0034] refer to Figure 1 , Figure 1 A method flow chart of a method for training a traffic prediction model provided in an embodiment of the present application; a first aspect of an embodiment of the present application provides a method for training a traffic prediction model, including but not limited to the following steps:
[0035] Step S110, constructing an initial model to be trained, the initial model including an input layer, a temporal feature extraction layer, a graph message passing layer, and a fully connected output layer;
[0036] Step S120, preprocessing the preset sample traffic data based on the input layer to obtain the time series traffic volume sequences and adjacency matrices of multiple traffic nodes, and constructing a hypergraph structure corresponding to each traffic node according to the corresponding adjacency matrix;
[0037] Step S130: for the time series traffic volume sequence of each traffic node, a one-dimensional dilated convolution process is performed through the time series feature extraction layer to obtain the corresponding first convolution feature and second convolution feature, and the second convolution feature is adjusted according to the nonlinear conversion value range of the first convolution feature to obtain the time series feature corresponding to each traffic node;
[0038] Step S140, based on the graph message passing layer, feature aggregation is performed on the intra-edge neighborhood transmission messages and the inter-edge neighborhood transmission messages corresponding to each hypergraph structure to obtain intra-edge aggregation features and inter-edge aggregation features, and the intra-edge aggregation features and the inter-edge aggregation features are weighted to obtain the spatial features corresponding to each traffic node;
[0039] Step S150, based on the fully connected output layer, a traffic prediction result is obtained according to the temporal characteristics and the spatial characteristics, and the model loss is calculated according to the traffic prediction result, so as to update the model parameters of the initial model according to the model loss to obtain a trained traffic prediction model.
[0040] Among them, the initial model refers to the untrained model framework built before the training starts. It includes an input layer, a time series feature extraction layer, a graph message passing layer, and a fully connected output layer. This model framework is designed to process traffic data and perform traffic prediction.
[0041] In some embodiments, the input layer in the present application is used to pass the preprocessed multivariate time-series traffic volume sequence data and the constructed adjacency matrix to the model, so as to construct a hypergraph according to the adjacency matrix through the model. It can be understood that the input layer can read the historical traffic data of multiple traffic nodes from a database or file, and preprocess the multivariate time-series traffic volume sequence data; obtain or construct the adjacency matrix based on geographic information, and determine the pre-definition of graph structure information based on hyperedges according to the adjacency matrix to determine the nodes and edges of the graph structure, and calculate the node weights according to the similarity calculation formula to obtain the hypergraph (graph structure information).
[0042] In some embodiments, the timing feature extraction layer in the present application is used to extract timing features by applying two sets of different weights and biases to the input sequence to perform a one-dimensional dilated convolution operation to obtain two convolution outputs, and applying a Sigmoid activation function to one of the convolution outputs to obtain a gating signal. The gating signal is multiplied by the other convolution output to obtain the timing features of multiple nodes.
[0043] In some embodiments, the graph message transmission layer in the present application is used to extract spatial features using the hypergraph structure, and aggregate the transmission messages within the hyperedge to which each node belongs and the transmission messages outside the hyperedge, respectively, to obtain the intra-hyperedge aggregation features and the inter-hyperedge aggregation features, and then adjust the adaptive weights of the intra-hyperedge aggregation features and the inter-hyperedge aggregation features according to the residual to obtain the spatial feature information of the corresponding node.
[0044] In some embodiments, the fully connected output layer in the present application is used to pass the extracted spatiotemporal features to the fully connected output layer, obtain the traffic volume prediction results for each node at the future time, and reversely update the model parameters used in the above process according to the prediction results based on the loss function. When the preset training rounds are reached or the loss converges, the model training is completed, and data prediction can be performed based on the trained model.
[0045] In some embodiments, the present application can construct an initial model to be trained, the initial model includes an input layer, a time series feature extraction layer, a graph message passing layer and a fully connected output layer, and based on the input layer, normalize, denoise and other processing are performed on the preset sample traffic data to extract the time series traffic volume sequence of each traffic node, obtain the time series traffic volume sequence and adjacency matrix of multiple traffic nodes, and construct a hypergraph structure corresponding to each traffic node according to the corresponding adjacency matrix, and the hypergraph structure represents the control relationship between the nodes; further, for the time series traffic volume sequence of each traffic node, a one-dimensional dilated convolution is performed through the time series feature extraction layer to obtain the corresponding first convolution feature and second convolution feature, and the second convolution feature is adjusted according to the nonlinear conversion value range of the first convolution feature to obtain the time series feature corresponding to each traffic node; further, based on the graph message passing layer, feature aggregation is performed on the intra-edge neighborhood transmission message and the inter-edge neighborhood transmission message corresponding to each hypergraph structure to obtain the intra-edge aggregation feature and the inter-edge aggregation feature, and the intra-edge aggregation feature and the inter-edge aggregation feature are weighted to obtain the space corresponding to each traffic node. Features; further, based on the fully connected output layer, the time series features and spatial features are integrated to generate traffic prediction results, and the model loss is calculated through the mean square error loss function and the graph relationship reconstruction loss function, and then the model parameters are updated through the back propagation algorithm according to the model loss to optimize the model performance; Among them, it can be understood that the graph message passing layer in the embodiment of the present application can avoid the characteristic decomposition and frequency domain convolution operation of the graph Laplacian matrix through the graph message passing mechanism, thereby improving the computational efficiency, and in the case of having a multi-layer graph message passing layer, it is possible to gradually aggregate neighborhood information at different levels and construct a multi-scale feature representation to better capture the relationship between nodes; the intra-edge neighborhood message passing is to pass messages between nodes in the same hyperedge to capture local relationships, and the inter-edge neighborhood message passing is to pass messages between nodes in different hyperedges to capture global relationships. Through the above-mentioned message passing, multi-layer feature aggregation can be achieved to form a multi-level feature representation, improve the expression ability of the model, and then avoid the smoothing phenomenon caused by the frequency domain graph convolution operation, and effectively improve the prediction accuracy of the node-level traffic prediction performed by the present application.
[0046] In some embodiments, the process of adjusting the second convolution feature according to the nonlinear conversion value domain of the first convolution feature can be understood as multiplying the elements in the nonlinear conversion value domain with the elements of the second convolution feature element by element to obtain the timing characteristics corresponding to each traffic node.
[0047] It is worth noting that the graph network method in the traditional scheme realizes the feature extraction of graph structure data through the frequency domain graph convolution operation, but due to the high computational complexity of the graph Laplacian matrix during feature decomposition, the scale of the input graph of the traditional scheme method is limited; in addition, the graph convolution operation is equivalent to a low-pass filter, which easily causes the node features to be over-smoothed, resulting in the model being unable to distinguish the nodes and making the prediction results converge; in response to the above problems, the present method avoids the feature decomposition and frequency domain convolution operation of the graph Laplacian matrix through the graph message passing mechanism of the graph message passing layer, and performs feature aggregation on the intra-edge neighborhood transmission messages and inter-edge neighborhood transmission messages corresponding to each hypergraph structure based on the graph message passing layer, thereby constructing a multi-scale feature representation based on multi-order neighborhood information. At the same time, step S130 can be based on channel independent modeling, and step S150 can maintain the node-level data features based on the loss function guided by the graph structure, so that the present application can more accurately and effectively realize node-level traffic prediction.
[0048] refer to Figure 2 , Figure 2 A flow chart of a method for preprocessing in a training method for a traffic prediction model provided in an embodiment of the present application; in some embodiments, preprocessing the preset sample traffic data based on the input layer to obtain a time series traffic volume sequence and an adjacency matrix of multiple traffic nodes includes but is not limited to the following steps:
[0049] Step S210, preprocessing the preset sample traffic data based on the input layer to extract time series traffic data and spatial traffic data corresponding to multiple traffic nodes from the sample traffic data;
[0050] Step S220, obtaining a time series traffic volume sequence of a plurality of traffic nodes according to a plurality of time series traffic data;
[0051] Step S230, obtaining an adjacency matrix of multiple transportation nodes according to multiple spatial transportation data; wherein the spatial transportation data includes transportation connectivity relationships or geographical location relationships between multiple transportation nodes.
[0052] Among them, the preset sample traffic data refers to the historical traffic data used to train the model, usually including the historical traffic volume records of multiple traffic nodes; the time series traffic volume sequence refers to the traffic volume data sequence of a specific traffic node that changes over time, such as the vehicle flow every 5 minutes at a certain intersection; the adjacency matrix is used to represent the connection relationship between nodes in the graph structure, that is, which nodes are directly connected. In the traffic prediction scenario, it can indicate which traffic nodes have direct road connections; hypergraph structure: Compared with ordinary graphs (each edge only connects two nodes), hypergraphs allow one edge to connect multiple nodes. In traffic prediction, hypergraphs can be used to more flexibly represent complex traffic network structures.
[0053] In some embodiments, step S210 first pre-processes the input sample traffic data during the training process of the traffic prediction model. The sample traffic data usually contains historical traffic volume information of multiple traffic nodes. The purpose of pre-processing is to convert the original data into a form that can be processed by the model, extract the traffic volume sequence of each traffic node that changes over time from the sample traffic data, and extract the spatial association relationship between each traffic node from the sample traffic data, which may include traffic connectivity or geographical location, that is, extract the time series traffic data and spatial traffic data of each traffic node. Pre-processing can include cleaning and formatting these data to ensure the integrity and consistency of the data.
[0054] In some embodiments, step S220 may arrange the historical traffic volume data of each traffic node in chronological order to form a time series sequence and may perform standardization processing on the time series data, such as normalization, to eliminate the influence of the dimension and improve the generalization ability of the model. For example, by chronologically sorting the historical traffic volume data of each traffic node, if there are missing values in the data, interpolation or other filling methods need to be performed.
[0055] In some embodiments, step S230 can generate a matrix representing the connection relationship between nodes based on the traffic connectivity relationship or geographical location relationship between the traffic nodes. In the adjacency matrix, the weight is used to represent the strength of the association between two nodes, that is, the degree of mutual influence between the two nodes. The larger the weight value, the closer the connection between the two nodes. When constructing the adjacency matrix, if there is a direct road connection between two traffic nodes, an edge can be set between the two nodes, and a weight can be assigned according to the nature of the connection (such as road type, distance, etc.). Alternatively, if there is a geographical location between two traffic nodes, an edge can be set between the two nodes, and a weight can be assigned according to factors such as distance.
[0056] In some embodiments, specifically, the multivariate time-series traffic volume data composed of the time-series traffic data corresponding to multiple traffic nodes can be expressed as , that is, at time t, the input sequence of N nodes has a total of C feature channels. When obtaining data at the input layer, if there is no adjacency matrix input, it is necessary to construct an adjacency matrix based on the actual traffic connectivity or geographical location relationship between the nodes.
[0057] Through the above steps, the model of this application can effectively extract temporal and spatial features from the original traffic data to ensure that the quality and format of the input data meet the requirements of the model, thereby improving the prediction performance of the model.
[0058] refer to Figure 3 , Figure 3A method flow chart of obtaining a hypergraph structure in a training method of a traffic prediction model provided in an embodiment of the present application; in some embodiments, a hypergraph structure corresponding to each traffic node is constructed according to a corresponding adjacency matrix, including but not limited to the following steps:
[0059] Step S310, constructing an initial graph structure corresponding to the traffic node;
[0060] Step S320, generating multiple structural points in the initial graph structure according to the multiple traffic nodes in the adjacency matrix, and calculating the association weights between the multiple structural points;
[0061] Step S330, generating multiple structural edges in the initial graph structure according to the relationship information between the multiple traffic nodes in the adjacency matrix, and determining multiple hyperedges formed by the multiple structural edges according to the relationship information;
[0062] Step S340, obtaining a hypergraph structure corresponding to the traffic node according to a plurality of structural points, structural edges, associated weights and hyperedges.
[0063] In some embodiments, steps S310 to S340 can be understood as that before constructing a hypergraph structure, the present application first needs to construct a basic graph structure, which includes all traffic nodes and their preliminary connection relationships, and then can generate multiple structural points in the initial graph structure according to the multiple traffic nodes in the adjacency matrix, and calculate the association weights between the multiple structural points, add specific nodes to the initial graph structure, and calculate the association weights between these nodes, so as to subsequently construct a more complex hypergraph structure; wherein, the present application can take each traffic node as a structural point in the graph, and calculate the association weight between each structural point according to the information in the adjacency matrix, and further generate structural edges on the basis of the initial graph structure, and determine the hyperedge according to the relationship information between the nodes, the hyperedge can connect multiple nodes to form a hypergraph structure, and then obtain the hypergraph structure corresponding to the traffic node according to the multiple structural points, structural edges, association weights and hyperedges for subsequent traffic prediction model training.
[0064] It can be understood that the hypergraph structure is a data structure that extends the traditional graph structure. It allows edges (called hyperedges) to connect more than two nodes. Compared with the traditional graph structure, the hypergraph structure can more flexibly represent the complex relationships between multiple nodes and is suitable for dealing with some complex problems in the real world, such as social networks, biological networks, and traffic networks. In this application, the hypergraph structure includes attributes such as nodes, edges, hyperedges, and weights. The traffic flow on a road may be affected by multiple adjacent roads. Hyperedges can connect these adjacent road nodes to represent this multi-node influence relationship, and the traffic conditions of multiple traffic nodes in an area may be similar. Hyperedges can connect these nodes to represent the traffic characteristics in the area. Specifically, the hypergraph is constructed through the spatial association relationship represented by the adjacency matrix. , including nodes ,side And weight , where the traffic volume data collection points are nodes in the graph , when there is a geographical connection between two nodes in the graph, there is an edge between the two nodes , weight It is used to represent the association relationship between two nodes, that is, the greater the mutual influence between the two nodes, the greater the weight value.
[0065] refer to Figure 4 , Figure 4 A flow chart of a method for calculating association weights in a training method for a traffic prediction model provided in an embodiment of the present application; in some embodiments, calculating association weights between multiple structural points includes but is not limited to the following steps:
[0066] Step S410, obtaining information of points of interest corresponding to a plurality of structure points according to the sample traffic data, where the information of the points of interest represents node attributes of the structure points at corresponding geographical locations;
[0067] Step S420, calculating similarity coefficients between multiple structure points according to the information of multiple interest points, and obtaining corresponding association weights according to the similarity coefficients.
[0068] In some embodiments, step S410 can be understood as that the present application obtains interest point information corresponding to multiple structural points based on sample traffic data, and the interest point information represents the node attributes of the structural point at the corresponding geographical location, that is, by analyzing the sample traffic data, the interest point information of each structural point is extracted, and this information reflects the geographical location and attributes of the node; specifically, the location, type, traffic flow and other information of each node can be extracted from the sample traffic data, and this information is organized into a structured form, namely the interest point information, which is convenient for subsequent processing. The interest point information is used to represent the attributes of the node and provide a basis for subsequent similarity calculations.
[0069] Among them, the above-mentioned point of interest information (POI) refers to the relevant information of a specific geographical location, which can help understand and analyze the characteristics and importance of the location. POI information may include but is not limited to the following aspects: the name of the place, the specific address of the place, the geographical coordinates of the place, the category of the place, and other additional information such as opening hours, contact information, ratings, comments, etc., and thus in the traffic prediction task of this application, POI information can provide rich contextual information to help the model better understand and predict changes in traffic flow.
[0070] In some embodiments, step S420 can be understood as determining the association weight between the structural points by calculating the similarity coefficient between them, so as to better reflect the relationship between the nodes. For example, a preset similarity measurement method is used to calculate the similarity coefficient between each structural point, and the association weight is determined according to the similarity coefficient. The higher the similarity coefficient, the greater the association weight. Specifically, in the process of constructing a hypergraph through the spatial association relationship represented by the adjacency matrix, the present application mainly considers the geographical proximity of traffic nodes and POI information. In terms of geographical relationship, the invention jointly regards the upstream and downstream nodes of the same road as hyperedges to predefine the graph structure information. The correlation, that is, the weight between nodes, is calculated through POI information. The following is the similarity calculation formula for obtaining the weight:
[0071]
[0072] in, and For Node and nodes No. The number of POIs of this type.
[0073] refer to Figure 5 , Figure 5 In the training method of the traffic prediction model provided in one embodiment of the present application, a method flow chart of obtaining the first convolution feature and the second convolution feature; in some embodiments, the time series feature extraction layer includes multiple time series gated linear units, each time series gated linear unit is used to independently process the time series traffic volume sequence of a traffic node, and for the time series traffic volume sequence of each traffic node, a one-dimensional dilated convolution process is performed through the time series feature extraction layer to obtain the corresponding first convolution feature and the second convolution feature, including but not limited to the following steps:
[0074] Step S510, respectively assigning the time series traffic volume sequence of each traffic node to a time series gated linear unit in the time series feature extraction layer;
[0075] Step S520, determining the time pattern of each traffic node based on the time-series traffic volume sequence of the corresponding traffic node through each time-series gated linear unit;
[0076] Step S530, based on the time pattern of each traffic node, a one-dimensional dilation convolution process is performed on the time series traffic volume sequence of each traffic node to obtain a first convolution feature and a second convolution feature corresponding to each traffic node.
[0077] Among them, the time series feature extraction layer is responsible for extracting useful time series features from the time series traffic volume sequence to facilitate subsequent prediction work; the one-dimensional dilated convolution processing can be understood as inserting holes in the convolution kernel during convolution, thereby expanding the receptive field of the convolution and capturing information over a longer time span without adding additional parameters; the first convolution feature and the second convolution feature are obtained from the same input sequence through different convolution operations, and one of the features (the first convolution feature) is used to adjust the other feature (the second convolution feature) after nonlinear transformation. This adjustment method helps to improve the model's modeling ability for time series data; the nonlinear transformation value range here specifically refers to the use of the Sigmoid function to convert the first convolution feature to a value range between 0 and 1, which can be used as a gating signal to adjust other features.
[0078] In some embodiments, based on steps S510 to S530, the temporal feature extraction layer in the present application includes multiple temporal gated linear units, each of which independently processes the temporal traffic volume sequence of a traffic node. This can avoid mutual interference between the temporal patterns of different nodes, thereby better capturing the specific temporal characteristics of each node.
[0079] It can be understood that the time-series traffic volume sequence of each node is processed by an independent time-series gated linear unit to ensure that the feature extraction process of each node is carried out independently. Each time-series gated linear unit has a corresponding weight parameter to avoid mutual interference between features of different nodes, thereby better retaining the specific time pattern of each node; then, each time-series gated linear unit determines the time pattern of each traffic node based on the time-series traffic volume sequence of the corresponding traffic node, and then performs a one-dimensional dilated convolution operation to extract the time-series features, and controls the feature extraction process through a gating mechanism. The one-dimensional dilated convolution expands the convolution's perception field of view by inserting holes in the convolution kernel, thereby being able to capture features of a longer time span, and then the feature extraction process can be controlled through a gating mechanism to avoid over-smoothing.
[0080] In some embodiments, the time pattern is determined based on the time-series traffic volume sequence of each traffic node. The time pattern can be understood as referring to the traffic flow change pattern of each traffic node in different time periods. Because the pattern of each traffic node is different, the convolution weights and biases to be set for each node are different, so it is necessary to set different convolution weights and biases according to the time pattern to perform one-dimensional dilated convolution on the time-series traffic volume sequence; the time-series gated linear unit can be a processing unit of a multi-threaded channel divided in advance, which can be understood as assigning units of different channels to each traffic node for separate processing.
[0081] It is understandable that, considering the large differences in the time patterns of different nodes, using the same timing feature extraction module is likely to lead to over-smoothing of node features. In order to avoid losing the node-specific time patterns and fully model the impact of node differences on timing feature extraction, the invention adopts a channel-independent approach to construct the timing feature extraction module, that is, each node is individually assigned a corresponding timing gated linear unit, so that model parameters are not shared between nodes.
[0082] refer to Figure 6 , Figure 6 A flow chart of a method for adjusting the second convolution feature in a training method for a traffic prediction model provided in an embodiment of the present application; in some embodiments, the second convolution feature is adjusted according to the nonlinear conversion value range of the first convolution feature to obtain the time series feature corresponding to each traffic node, including but not limited to the following steps:
[0083] Step S610, performing nonlinear transformation on the first convolution feature according to a preset activation function to obtain a corresponding nonlinear transformation value range;
[0084] Step S620, performing element-by-element multiplication on the nonlinear conversion value domain and the second convolution feature to achieve suppression adjustment of the second convolution feature, and obtain the time series feature corresponding to each traffic node.
[0085] In some embodiments, the present application may convert the first convolution feature into a specific value range, usually (0, 1), through a nonlinear activation function (such as a Sigmoid function) to generate a gating signal for adjusting the second convolution feature.
[0086] It can be understood that the nonlinear transformation is to convert the first convolution feature to the value range of (0,1) through the Sigmoid function to obtain the gating signal. Furthermore, the gating signal is multiplied element by element with the second convolution feature to achieve the inhibition and regulation of the second convolution feature. The above gating mechanism helps the model better capture the nonlinear relationship in the time series data and avoid the gradient disappearance problem.
[0087] In some embodiments, the first convolution feature is nonlinearly transformed according to a preset activation function to obtain a corresponding nonlinear transformation range step, and the elements in the nonlinear transformation range are multiplied element by element with the elements of the second convolution feature to achieve suppression adjustment of the second convolution feature. The process of obtaining the time series feature corresponding to each traffic node can be expressed as:
[0088]
[0089] in, and Representation Node The two different temporal convolution kernels correspond to the first convolution feature and the second convolution feature respectively. Representation Node The temporal convolution operation, For Node Time series input. is the Hadama product, corresponding to the element-by-element multiplication operation, is the Sigmoid activation function.
[0090] It is understandable that the traffic prediction model in the above steps can better capture the nonlinear relationship in the time series data and avoid the gradient vanishing problem by adjusting the second convolution feature. Specifically, the nonlinear transformation value range is used as a gating signal, and the second convolution feature is multiplied element by element, thereby realizing the dynamic adjustment of the second convolution feature, thereby effectively enhancing the model's time series feature extraction capability.
[0091] refer to Figure 7 , Figure 7 A flow chart of a method for performing feature aggregation in a training method for a traffic prediction model provided in an embodiment of the present application; in some embodiments, feature aggregation is performed on the intra-edge neighborhood transmission messages and the inter-edge neighborhood transmission messages corresponding to each hypergraph structure based on the graph message transmission layer to obtain intra-edge aggregation features and inter-edge aggregation features, including but not limited to the following steps:
[0092] Step S710, determining multiple hyperedges corresponding to the traffic nodes from the hypergraph structure based on the graph message passing layer;
[0093] Step S720, determining the intra-edge neighborhood node range and the inter-edge neighborhood node range corresponding to the traffic node according to the multiple hyperedges, and obtaining the intra-edge neighborhood transfer message corresponding to each node in the intra-edge neighborhood node range, and obtaining the inter-edge neighborhood transfer message corresponding to each node in the inter-edge neighborhood node range;
[0094] Step S730, compressing the intra-edge neighborhood transmission message according to the number of nodes within the intra-edge neighborhood node range to obtain the intra-edge aggregation feature;
[0095] Step S740 , compressing the inter-edge neighborhood transmission message according to the number of hyperedges of the multiple hyperedges to obtain the inter-edge aggregation feature.
[0096] Among them, the graph message passing layer aggregates node features through the message passing mechanism and uses the spatial association between nodes to achieve feature updates, thereby replacing the traditional graph convolution operation based on graph Laplacian eigendecomposition; the graph message passing layer can aggregate node features through the message passing mechanism in the graph structure, thereby realizing the extraction of spatial features of the transportation network; the intra-edge neighborhood passing message and the inter-edge neighborhood passing message refer to the fact that in the graph structure, not only the information transmission between directly connected nodes (intra-edge) but also the information transmission between indirectly connected nodes (inter-edge) are considered. These two ways of passing messages help the model better understand the complex relationships in the transportation network; the intra-edge aggregation features and the inter-edge aggregation features are the features obtained by aggregating the messages transmitted within and between edges, respectively, and they together constitute the spatial features of each node; it can be understood that the present application gives different weights to the intra-edge aggregation features and the inter-edge aggregation features to more accurately reflect their importance in the spatial features.
[0097] In some embodiments, corresponding to step S710 to step S740, in the hypergraph structure, each traffic node can be connected to multiple hyperedges, and these hyperedges represent the complex relationship between nodes. First, it is necessary to determine the multiple hyperedges corresponding to each traffic node in order to perform subsequent message transmission and feature aggregation. The present application identifies the hyperedges to which each traffic node belongs, and these hyperedges will be used for subsequent message transmission and feature aggregation; further, in the process of graph message transmission, the neighborhood of each node can be divided into intra-edge neighborhood and inter-edge neighborhood. Intra-edge neighborhood refers to other nodes within the same hyperedge, and inter-edge neighborhood refers to nodes within different hyperedges. By processing the message transmission of these two types of neighborhoods separately, the relationship between nodes can be captured more comprehensively; further, in order to aggregate the messages transmitted in the intra-edge neighborhood into a feature vector, these messages need to be compressed. The compression operation can be implemented through aggregation functions. Commonly used aggregation functions include summation and average value. The compressed message can be understood as aggregating the messages transmitted by the intra-edge neighborhood into a feature vector as the intra-edge aggregation feature. Furthermore, similar to the compression of the messages in the intra-edge neighborhood, the messages in the inter-edge neighborhood also need to be compressed through the aggregation function to be aggregated into a feature vector. The inter-edge aggregation feature reflects the relationship between nodes in different hyperedges.
[0098] In some embodiments, based on steps S710 to S740, the present application can also make the aggregation function FFF invariant to the arrangement of nodes and hyperedges in the neighborhood to ensure that the final message propagation to the node does not depend on the order of selecting its neighbors, and determine that the aggregation function is injective, that is, different input sets are mapped to different output features to avoid excessive smoothing of information; further, in the process of message transmission, the original information of the node can be combined with the aggregated features by introducing residual connections to avoid the loss of unique information of the node.
[0099] In some embodiments, corresponding to step S710 to step S740, the specific calculation process of the intra-edge aggregation feature and the inter-edge aggregation feature is as follows: The message passing aggregation function for a single node can be expressed as:
[0100]
[0101] The above two equations represent the intra-edge and inter-edge aggregation functions respectively, where v represents a node, e represents a hyperedge, and F is the aggregation function. Represents the feature set of neighbor nodes in the edge region, represents the aggregated feature set within the edge domain of the hyperedge to which it belongs, X represents the feature of the previous node. Furthermore, residual connections can be introduced to avoid the loss of unique information of the node, that is, the original node features corresponding to the traffic node are obtained according to the hypergraph structure, and the messages transmitted within the edge neighborhood are compressed according to the original node features and the number of nodes within the range of the edge neighborhood nodes to obtain the edge aggregation features; the messages transmitted between the edges are compressed according to the original node features and the number of hyperedges of multiple hyperedges to obtain the edge aggregation features. The specific aggregation function corresponding to the above process can be defined as:
[0102]
[0103] in, is the original node feature of the current node, N is the number of node neighbors, E is the number of hyperedges shown, and w is a scaling term used to balance the weighted bias introduced in the edge aggregation due to the cardinality change across hyperedges. The computational complexity of traditional frequency domain graph convolution is , where n is the number of nodes. The computational complexity of graph message passing is , where m is the number of edges in the graph. The computational cost of graph message passing is much lower than that of frequency domain graph convolution. Therefore, the model of this application can accommodate a larger input graph scale to avoid the smoothing phenomenon caused by the frequency domain graph convolution operation, thereby effectively improving the prediction accuracy of node-level traffic prediction.
[0104] refer to Figure 8 , Figure 8A flow chart of a method for weighted calculation in a training method for a traffic prediction model provided in an embodiment of the present application; in some embodiments, weighted calculation is performed on intra-edge aggregation features and inter-edge aggregation features to obtain spatial features corresponding to each traffic node, including but not limited to the following steps:
[0105] Step S810, obtaining original node features corresponding to traffic nodes according to the hypergraph structure;
[0106] Step S820, weighted calculation is performed on the original node features, the intra-edge aggregation features, and the inter-edge aggregation features based on a preset adaptive weight coefficient method to obtain the spatial features corresponding to the traffic node.
[0107] Among them, the fully connected output layer can receive features from the time series feature extraction layer and the graph message passing layer, and finally output the traffic prediction result through a series of fully connected operations; the traffic prediction result is the model predicting the traffic volume of each traffic node in a certain time period in the future based on the input time series and spatial features; the model loss refers to the difference measure between the prediction result and the true value. The goal of model training is to minimize this loss. According to the calculated loss value, the internal parameters of the model are adjusted through the back propagation algorithm, in order to reduce the loss in the next iteration and improve the prediction accuracy.
[0108] In some embodiments, corresponding to steps S810 to S820, before performing feature aggregation, it is necessary to obtain the original node features of each traffic node. These original features can be the initial input features of the node, or the features after feature extraction in the previous layer. Then, the original node features, intra-edge aggregation features, and inter-edge aggregation features can be weighted calculated through an adaptive weight coefficient method, which can better integrate different types of features. The adaptive weight coefficient method can dynamically adjust the weight according to the importance of the feature, thereby improving the accuracy and robustness of the feature representation.
[0109] In some embodiments, corresponding to step S810 to step S820, specifically, since deep graph convolution operations are prone to cause smoothing loss of information, the present application can use multi-order neighborhood information to construct a multi-scale feature representation, that is, simultaneously consider the outputs of graph convolution layers of different depths and perform reasonable weighted output of the final result.
[0110]
[0111] in, are the adaptive weights for residual connections, intra-edge aggregation, and inter-edge aggregation, is the final output of the graph convolution layer. By considering the combination of graph convolution layer outputs of different scales and functions, the feature over-smoothing loss caused by the deep structure can be avoided.
[0112] In some embodiments, the traffic prediction model in the present application may include multiple layers of time series feature extraction layers or graph message passing layers, that is, in the traffic prediction model, multiple layers of feature aggregation can be further realized through multiple layers of time series feature extraction layers and graph message passing layers to form a multi-level feature representation, and in the feature extraction or aggregation process of each layer, the features of the previous layer are combined with the features of the current layer through the processing operation of introducing residual connections in the above embodiments, which can avoid information loss, so that this multi-level feature representation can more deeply capture the temporal and spatial characteristics in the traffic data, thereby improving the prediction performance of the model.
[0113] refer to Fig. 9 , Fig. 9 A flow chart of a method for calculating model loss in a method for training a traffic prediction model provided in an embodiment of the present application; in some embodiments, calculating model loss according to traffic prediction results includes but is not limited to the following steps:
[0114] Step S910, calculating the accuracy loss corresponding to the traffic prediction result according to the mean square error loss function;
[0115] Step S920, calculating the smoothing loss corresponding to the traffic prediction result according to the graph relationship reconstruction loss function;
[0116] Step S930, obtaining the model loss according to the precision loss and the smoothness loss.
[0117] In some embodiments, corresponding to steps S910 to S930, the mean square error loss function is used to measure the difference between the model prediction value and the true value. By minimizing the mean square error, the prediction result of the model can be closer to the true value and the prediction accuracy can be improved; the graph relationship reconstruction loss function is used to measure the smoothness of the model prediction result in the graph structure. By minimizing the smoothing loss, the prediction result of the model can be made smoother in space to avoid overfitting and unstable predictions; further, by combining the precision loss and smoothing loss, the overall loss of the model can be obtained, which helps the model to maintain the spatial smoothness of the prediction results while improving the prediction accuracy; through the above steps, the present application can effectively calculate the precision loss and smoothing loss of the traffic prediction model, and combine these losses to obtain the total loss of the model, thereby improving the overall performance and robustness of the model.
[0118] In some embodiments, the present application can design multiple layers of temporal gated linear unit layers and graph message passing layers, and after repeatedly extracting temporal features and spatial features, obtain prediction results through linear activation. At the same time, the model relies on two loss functions for optimization. For example, the accuracy loss corresponding to the traffic prediction result is calculated according to the mean square error loss function (L2 loss function), and the over-smoothing of node features caused by graph convolution operations is avoided through the reconstruction loss function of the graph relationship. It can be understood that the purpose of constructing the graph relationship loss function is to alleviate the problem of loss of unique node features caused by graph convolution operations and avoid the convergence of node-level prediction results. Since the road structure will not change significantly in a short period of time, it can be considered that the correlation between road nodes is stable. Therefore, the present application aligns the node-level correlation of the input data and the predicted data to ensure that the node-level features will not be over-smoothed, and can retain the unique properties of each node prediction while predicting a wide range of traffic node data.
[0119] In some embodiments, the graph relation loss function can be expressed as:
[0120]
[0121] in, For input data, To predict the results, It is a predefined road network hypergraph structure.
[0122] To achieve the above-mentioned purpose, the second aspect of an embodiment of the present application provides a traffic prediction method, including: obtaining historical traffic data of a target traffic scene; inputting the historical traffic data into a traffic prediction model to obtain a traffic prediction result for the target traffic scene; wherein the traffic prediction model is trained according to the training method of the traffic prediction model of any one of the embodiments in the first aspect.
[0123] refer to Fig.10 , Fig.10 The electronic device provided in one embodiment of the present application includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the training method of the traffic prediction model or the traffic prediction method of any of the above embodiments is implemented. For example, the above described Figure 1 Steps S110 to S150 of the method described above are performed Figure 2 Steps S210 to S230 of the method, Figure 3 Steps S310 to S340 of the method, Figure 4 Steps S410 to S420 of the method, Figure 5 Steps S510 to S530 of the method described above are performed. Figure 6 Steps S610 to S620 of the method, Figure 7 Steps S710 to S740 of the method, Figure 8 Steps S810 to S820 of the method, Fig. 9 Method steps S910 to S930.
[0124] The electronic device 1000 of the embodiment of the present application includes one or more processors 1010 and a memory 1020. Fig.10 In the figure, a processor 1010 and a memory 1020 are taken as an example.
[0125] The processor 1010 and the memory 1020 may be connected via a bus or other means. Fig.10 The example of connecting through bus is taken in the following.
[0126] The memory 1020, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer executable programs. In addition, the memory 1020 may include a high-speed random access memory, and may also include a non-transitory memory, such as at least one disk storage device, a flash memory device, or other non-transitory solid-state storage device. In some embodiments, the memory 1020 may optionally include a memory 1020 remotely disposed relative to the processor 1010, and these remote memories may be connected to the electronic device 1000 via a network. At the same time, examples of the above-mentioned network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.
[0127] In some embodiments, when the processor executes the computer program, the training method of the traffic prediction model of any of the above embodiments is performed at preset intervals.
[0128] Those skilled in the art will understand that Fig.10 The device structure shown in the figure does not constitute a limitation on the electronic device 1000, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0129] exist Fig.10 In the electronic device 1000 shown, the processor 1010 can be used to call the training method of the traffic prediction model stored in the memory 1020, so as to implement the training method of the traffic prediction model.
[0130] Based on the hardware structure of the above-mentioned electronic device 1000, various embodiments of the training device for the traffic prediction model of the present application are proposed. At the same time, the non-transient software program and instructions required to implement the training method for the traffic prediction model of the above-mentioned embodiment are stored in the memory. When executed by the processor, the training method for the traffic prediction model of the above-mentioned embodiment is executed.
[0131] The present application also provides a computer-readable storage medium storing computer-executable instructions for executing the above-mentioned method for training a traffic prediction model, which enables the above-mentioned one or more processors to execute the method for training a traffic prediction model or the traffic prediction method of any one of the above-mentioned embodiments, for example, to execute the above-mentioned method for training a traffic prediction model or the traffic prediction method. Figure 1 Steps S110 to S150 of the method described above are performed Figure 2 Steps S210 to S230 of the method, Figure 3 Steps S310 to S340 of the method, Figure 4 Steps S410 to S420 of the method, Figure 5 Steps S510 to S530 of the method described above are performed. Figure 6 Steps S610 to S620 of the method, Figure 7 Steps S710 to S740 of the method, Figure 8 Steps S810 to S820 of the method, Fig. 9 Method steps S910 to S930.
[0132] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network nodes. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0133] It will be appreciated by those skilled in the art that all or some of the steps and systems in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer-readable storage medium (or non-transitory medium) and a communication medium (or transient medium). As known to those skilled in the art, the term computer-readable storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer-readable storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD to ROM, digital versatile disk (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and can be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically embodies computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0134] The above is a specific description of the preferred implementation of the present application, but the present application is not limited to the above implementation mode. Technical personnel familiar with the field can also make various equivalent modifications or substitutions without violating the spirit of the present application. These equivalent modifications or substitutions are all included in the scope defined by the claims of the present application.
Claims
1. A method for training a traffic prediction model, characterized in that: include: Constructing an initial model to be trained, wherein the initial model includes an input layer, a temporal feature extraction layer, a graph message passing layer, and a fully connected output layer; Preprocessing the preset sample traffic data based on the input layer to obtain the time series traffic volume sequence and adjacency matrix of multiple traffic nodes, and constructing a hypergraph structure corresponding to each traffic node according to the corresponding adjacency matrix; For each of the time series traffic volume sequences of the traffic nodes, a one-dimensional dilated convolution process is performed through the time series feature extraction layer to obtain a corresponding first convolution feature and a second convolution feature, and the second convolution feature is adjusted according to the nonlinear conversion value range of the first convolution feature to obtain the time series feature corresponding to each of the traffic nodes; Based on the graph message passing layer, feature aggregation is performed on the intra-edge neighborhood passing messages and the inter-edge neighborhood passing messages corresponding to each of the hypergraph structures to obtain intra-edge aggregation features and inter-edge aggregation features, and the intra-edge aggregation features and the inter-edge aggregation features are weighted to obtain the spatial features corresponding to each of the traffic nodes; Obtaining a traffic prediction result based on the fully connected output layer according to the temporal features and the spatial features, calculating a model loss according to the traffic prediction result, and updating a model parameter of the initial model according to the model loss to obtain a trained traffic prediction model; Among them, the temporal feature extraction layer includes multiple temporal gated linear units, each temporal gated linear unit is used to independently process the temporal traffic volume sequence of a traffic node, and the temporal traffic volume sequence of each traffic node is subjected to one-dimensional dilated convolution processing through the temporal feature extraction layer to obtain the corresponding first convolution feature and second convolution feature, including: respectively assigning the temporal traffic volume sequence of each traffic node to a temporal gated linear unit in the temporal feature extraction layer; determining the time mode of each traffic node based on the temporal traffic volume sequence of the corresponding traffic node through each temporal gated linear unit; based on the time mode of each traffic node, performing one-dimensional dilated convolution processing on the temporal traffic volume sequence of each traffic node to obtain the first convolution feature and second convolution feature corresponding to each traffic node.
2. The method for training a traffic prediction model according to claim 1, characterized in that: The preprocessing of the preset sample traffic data based on the input layer to obtain the time series traffic volume sequence and adjacency matrix of multiple traffic nodes includes: Preprocessing the preset sample traffic data based on the input layer to extract time series traffic data and spatial traffic data corresponding to a plurality of traffic nodes from the sample traffic data; Obtaining time-series traffic volume sequences of a plurality of traffic nodes according to a plurality of time-series traffic data; Obtaining an adjacency matrix of a plurality of the traffic nodes according to a plurality of the spatial traffic data; Among them, the spatial traffic data includes the traffic connectivity relationship or geographical location relationship between multiple traffic nodes.
3. The method for training a traffic prediction model according to claim 1, characterized in that: The step of constructing a hypergraph structure corresponding to each of the traffic nodes according to the corresponding adjacency matrix includes: Constructing an initial graph structure corresponding to the traffic node; Generating a plurality of structural points in the initial graph structure according to the plurality of traffic nodes in the adjacency matrix, and calculating association weights between the plurality of structural points; Generate multiple structural edges in the initial graph structure according to the relationship information between the multiple traffic nodes in the adjacency matrix, and determine multiple hyperedges formed by the multiple structural edges according to the relationship information; A hypergraph structure corresponding to the traffic node is obtained according to the plurality of the structural points, the structural edges, the associated weights and the hyperedges.
4. The method for training a traffic prediction model according to claim 3, characterized in that: The calculating the association weights between the plurality of structure points comprises: Obtaining interest point information corresponding to the plurality of structure points according to the sample traffic data, wherein the interest point information represents node attributes of the structure points at corresponding geographical locations; The similarity coefficients between the plurality of structure points are calculated according to the plurality of interest point information, and the corresponding association weights are obtained according to the similarity coefficients.
5. The method for training a traffic prediction model according to claim 1, characterized in that: The step of adjusting the second convolution feature according to the nonlinear conversion value range of the first convolution feature to obtain the time series feature corresponding to each of the traffic nodes includes: Performing a nonlinear transformation on the first convolution feature according to a preset activation function to obtain a corresponding nonlinear transformation value range; The nonlinear conversion value domain and the second convolution feature are element-by-element multiplied to achieve suppression adjustment of the second convolution feature, and obtain the time series feature corresponding to each of the traffic nodes.
6. The method for training a traffic prediction model according to claim 1, characterized in that: The step of performing feature aggregation on the intra-edge neighborhood transmission messages and inter-edge neighborhood transmission messages corresponding to each of the hypergraph structures based on the graph message transmission layer to obtain intra-edge aggregation features and inter-edge aggregation features includes: Determining a plurality of hyperedges corresponding to the traffic nodes from the hypergraph structure based on the graph message passing layer; Determine the intra-edge neighborhood node range and the inter-edge neighborhood node range corresponding to the traffic node according to the multiple hyperedges, and obtain the intra-edge neighborhood transfer message corresponding to each node in the intra-edge neighborhood node range, and obtain the inter-edge neighborhood transfer message corresponding to each node in the inter-edge neighborhood node range; Compressing the intra-edge neighborhood transmission message according to the number of nodes within the intra-edge neighborhood node range to obtain an intra-edge aggregation feature; The inter-edge neighborhood transmission message is compressed according to the number of hyperedges of the multiple hyperedges to obtain an inter-edge aggregation feature.
7. The method for training a traffic prediction model according to claim 1, characterized in that: The weighted calculation of the intra-edge aggregation features and the inter-edge aggregation features to obtain the spatial features corresponding to each of the traffic nodes includes: Acquire original node features corresponding to the traffic node according to the hypergraph structure; The original node features, the intra-edge aggregation features, and the inter-edge aggregation features are weightedly calculated based on a preset adaptive weight coefficient method to obtain the spatial features corresponding to the traffic node.
8. The method for training a traffic prediction model according to claim 1, characterized in that: The calculating the model loss according to the traffic prediction result includes: Calculate the accuracy loss corresponding to the traffic prediction result according to the mean square error loss function; Calculate the smoothing loss corresponding to the traffic prediction result according to the graph relationship reconstruction loss function; A model loss is obtained according to the precision loss and the smoothness loss.
9. A traffic prediction method, characterized in that: include: Obtain historical traffic data of the target traffic scenario; Inputting the historical traffic data into a traffic prediction model to obtain a traffic prediction result for the target traffic scenario; The traffic prediction model is trained according to the traffic prediction model training method according to any one of claims 1 to 8.
10. An electronic device, characterized in that: include: at least one processor; at least one memory for storing at least one program; When at least one of the programs is executed by at least one of the processors, the training method of the traffic prediction model according to any one of claims 1 to 8 or the traffic prediction method according to claim 9 is implemented.
11. A computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are used to execute the training method of the traffic prediction model according to any one of claims 1 to 8 or the traffic prediction method according to claim 9.
Citation Information
Patent Citations
Traffic flow prediction method based on space-time hypergraph neural network
CN114944053A
Traffic flow prediction method based on dynamic graph convolution and time sequence convolution network
CN115376317A