Method and device for obtaining graph neural network for performing traffic prediction service

By obtaining the traffic data sequence of nodes in the graph structure, the constraints are determined and the time and space diagram neural network is trained, and the problem of insufficient traffic forecasts in the existing technology has been solved, and more accurate traffic forecasts are achieved.

CN113988264BActive Publication Date: 2025-01-24ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111271139.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-29
Publication Date
2025-01-24
Estimated Expiration
2041-10-29

AI Technical Summary

Technical Problem

The prior art is difficult to achieve more accurate predictions in traffic prediction services, especially when processing node traffic correlations in graph structures.

Method used

By obtaining the traffic data sequence of n nodes in the graph structure, the constraints of node traffic are determined, the loss function is determined based on these constraint conditions, and the first time and empty diagram neural network is used for training to achieve more accurate traffic forecasts.

Benefits of technology

Based on the correlation of node traffic, the trained space -time map neural network can more accurately predict the traffic of n nodes in one or more periods in the future.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113988264B_ABST
    Figure CN113988264B_ABST
Patent Text Reader

Abstract

The embodiments of this specification provide a method and device for obtaining a graph neural network for performing traffic prediction services. The method includes: obtaining a traffic data sequence of N nodes in a graph structure, the traffic data sequence includes T traffic data sets corresponding to T time periods, and a single traffic data set contains the node traffic of each of the N nodes in the corresponding time period; determining the constraints satisfied by the node traffic of each of the N nodes; determining a loss function based on the constraints; and training a first spatiotemporal graph neural network for performing traffic prediction services based on the traffic data sequence and the loss function.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] One or more embodiments of the present specification relate to the field of computers, and in particular, to methods and devices for obtaining graph neural networks for performing traffic prediction services. Background Art

[0002] With the development of artificial intelligence (AI) technology and the accumulation of big data, spatiotemporal graph neural networks used to perform traffic forecasting business have gradually been more widely used in business scenarios related to traffic forecasting, such as network traffic forecasting and traffic flow forecasting.

[0003] It is hoped that a new technical solution will be developed to facilitate more accurate completion of traffic forecasting services. Summary of the invention

[0004] One or more embodiments of the present specification provide a method for obtaining a graph neural network for performing traffic prediction services.

[0005] In a first aspect, a method for obtaining a spatiotemporal graph neural network for performing traffic prediction services is provided, comprising: obtaining a traffic data sequence of N nodes in a graph structure, the traffic data sequence comprising T traffic data sets corresponding to T time periods, a single traffic data set containing the node traffic of each of the N nodes in the corresponding time period; determining constraints satisfied by the node traffic of each of the N nodes; determining a loss function based on the constraints; training a first spatiotemporal graph neural network based on the traffic data sequence and the loss function, wherein the trained first spatiotemporal graph neural network is used to perform the traffic prediction service.

[0006] In a possible implementation, determining the constraint conditions satisfied by the node flows of each of the N nodes includes: determining W constraint nodes from the N nodes, where W is greater than 1; and determining the constraint conditions based on the node flows of each of the W constraint nodes in the same time period.

[0007] In one possible implementation, W constraint nodes are determined from N nodes, including: for any i-th node among the N nodes, the node traffic of N-1 nodes other than the i-th node in any current time period is used as input data, and the node traffic of the i-th node in the current time period is used as label data to train a first constraint network corresponding to the i-th node; the node traffic of the N-1 nodes in the current time period is input into the trained first constraint network to output a first predicted traffic of the i-th node in the current time period; and whether the i-th node is a constraint node is determined based on the node traffic of the i-th node in each time period and the first predicted traffic.

[0008] In a possible implementation, the constraint condition is determined based on the node flow of each of the W constraint nodes in the same time period, including: for any j-th node among the W constraint nodes, the node flow of W-1 constraint nodes other than the j-th constraint node in any current time period is used as input data, and the node flow of the j-th constraint node in the current time period is used as label data, and a second constraint network corresponding to the j-th node is trained; and the constraint condition is determined based on the trained second constraint network.

[0009] In a possible implementation, the constraint condition is determined based on the trained second constraint network, specifically including: determining the constraint sub-function corresponding to the j-th constraint node based on the trained second constraint network, the W variables in the constraint sub-function representing the W node flows of the W constraint nodes in the same time period; merging the constraint sub-functions corresponding to the W constraint nodes respectively to obtain a constraint function as the constraint condition.

[0010] In a possible implementation manner, the constraint condition is a constraint function with a function value of 0, and the W variables in the constraint function represent W node flows of W constraint nodes in the same time period.

[0011] In a possible implementation, the first spatiotemporal graph neural network includes a first hidden layer. When the traffic data sequence is input into the first spatiotemporal graph neural network, the first hidden layer outputs an N-dimensional feature vector for characterizing the node traffic of N nodes for any current time period traffic data set. The loss function includes a first loss term, which is used to indicate the degree of matching between the W-dimensional feature vector and the constraint function, and the W-dimensional feature vector is obtained from the N-dimensional feature vector and corresponds to the W constraint nodes.

[0012] In a possible implementation manner, the constraint function is a linear function. The first loss term is calculated by multiplying a target matrix determined based on the constraint function by the W-dimensional feature vector of each time period.

[0013] In a possible implementation, the constraint function is a nonlinear function. The first loss term is calculated based on a mean vector of the first hidden layer, and the mean vector is calculated based on the W-dimensional feature vectors of each time period.

[0014] In a possible implementation, the method further includes: generating a corresponding disturbance data sequence according to the constraint condition and the traffic data sequence. The training of the first spatiotemporal graph neural network according to the traffic data sequence and the loss function specifically includes: training the first spatiotemporal graph neural network according to the traffic data sequence, the disturbance data sequence and the loss function.

[0015] In one possible implementation, the loss function includes a second loss term, which is used to indicate the degree of matching between the third predicted traffic of N nodes in the T+1th time period output by the first space-time graph neural network and the constraint condition when the perturbation data sequence is input into the first space-time graph neural network.

[0016] In a possible implementation, the method further includes: constructing a conversion layer based on the constraints, the conversion layer being used to improve the degree of matching between the predicted traffic of N nodes in a target time period of the first spatiotemporal graph neural network and the constraints; connecting the conversion layer on the basis of the first spatiotemporal graph neural network to obtain a second spatiotemporal graph neural network, the second spatiotemporal graph neural network being used to perform the traffic prediction service.

[0017] In one possible implementation, the conversion layer is configured to obtain the fourth predicted flow of each of the N nodes output by the first spatiotemporal graph neural network in the target time period, process it and output the fifth predicted flow of the N nodes, wherein the degree of matching between the fourth predicted flow of the N nodes and the constraint condition is less than the degree of matching between the fifth predicted flow of the N nodes and the constraint condition.

[0018] In a possible implementation, N nodes correspond to N web pages or N network devices, and the node traffic is the number of visits to the web pages or network devices. Alternatively, N nodes correspond to N stations, and the node traffic is the number of vehicles passing through the stations.

[0019] In a second aspect, a device for obtaining a graph neural network for performing a traffic prediction service is provided, including:

[0020] A data acquisition unit is configured to acquire a flow data sequence of N nodes in a graph structure, wherein the flow data sequence includes T flow data sets corresponding to T time periods, and a single flow data set includes node flows of each of the N nodes in a corresponding time period;

[0021] A condition determination unit configured to determine a constraint condition satisfied by the node flow of each of the N nodes;

[0022] a loss determination unit, configured to determine a loss function according to the constraint condition;

[0023] A training processing unit is configured to train a first spatiotemporal graph neural network based on the traffic data sequence and the loss function, wherein the trained first spatiotemporal graph neural network is used to perform the traffic prediction service.

[0024] In a third aspect, a computer-readable storage medium is provided, on which a computer program / instruction is stored. When the computer program / instruction is executed in a computing device, the computing device executes the method as described in any one of the first aspects.

[0025] In a fourth aspect, a computing device is provided, comprising a memory and a processor, wherein the memory stores a computer program / instructions, and when the processor executes the computer program / instructions, the method as described in any one of the first aspects is implemented.

[0026] In the process of obtaining a spatiotemporal graph neural network for performing traffic prediction services through the methods and devices provided in one or more embodiments of the present specification, the correlation between the node traffic of N nodes in the graph structure involved in the traffic prediction service is fully considered. When the traffic prediction service is performed based on the trained spatiotemporal graph neural network, the trained spatiotemporal graph neural network can combine the correlation between the node traffic of N nodes in the same time period to more accurately predict the traffic of N nodes in one or more time periods in the future. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] In order to more clearly illustrate the technical solutions of the embodiments of this specification, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0028] Figure 1 A schematic diagram of a graph structure involved in a flow prediction service provided as an example;

[0029] Figure 2 A flowchart of a method for obtaining a graph neural network for performing traffic prediction services;

[0030] Figure 3 A schematic diagram for determining whether a node in a graph structure is a constraint node;

[0031] Figure 4 A flowchart of another method for obtaining a graph neural network for performing traffic prediction services;

[0032] Figure 5 A schematic diagram of a device for obtaining a graph neural network for performing traffic prediction services. DETAILED DESCRIPTION

[0033] Each non-limiting embodiment provided in this specification is described in detail below in conjunction with the accompanying drawings.

[0034] Figure 1The following is a schematic diagram of a graph structure involved in an exemplary traffic prediction service. Figure 1 As shown, the graph structure involved in the traffic prediction business may include, for example, Figure 1 Nodes 1 to 7 with the connection relationship shown in the figure may have node traffic that changes over time in different time periods. Usually, the node traffic of nodes 1 to 7 in the same time periods in the past can be used to form a traffic data set, and multiple traffic data sets corresponding to multiple time periods in the past can be used to form a traffic data sequence; then, the graph neural network for performing traffic prediction services is trained using the several traffic data sequences obtained in the aforementioned manner, for example, the trained graph neural network is used to predict the node traffic of nodes 1 to 7 in a single or multiple time periods in the future. The method of obtaining the graph neural network for performing traffic prediction services may affect whether it can accurately perform traffic prediction services in the inference mode.

[0035] A method and device for obtaining a graph neural network for performing traffic prediction services is provided in the embodiments of this specification. In the process of obtaining a graph neural network for performing traffic prediction services, the correlation between the node traffic of N nodes in the graph structure involved in the traffic prediction service is fully considered. When the traffic prediction service is performed based on the trained graph neural network, the trained graph neural network can combine the correlation between the node traffic of N nodes in the same time period to more accurately predict the traffic of N nodes in one or more time periods in the future.

[0036] Combine the following Figure 1 The method for obtaining a graph neural network for performing traffic prediction service provided in the embodiments of this specification is described in detail. Figure 2 As shown, the method may at least include the following steps 201 to 207.

[0037] First, in step 201, the flow data sequence of N nodes in the graph structure is obtained, wherein the flow data sequence includes T flow data sets corresponding to T time periods, and a single flow data set includes the node flow of each of the N nodes in the corresponding time period.

[0038] The N nodes in the graph structure can correspond to N web pages or N network devices, and the node traffic is the number of visits to the web page or network device. Alternatively, the N nodes in the graph structure can correspond to N stations, and the node traffic is the traffic volume passing through the station. The N nodes can also correspond to entities in other business scenarios, and the node traffic can be other forms of traffic data, such as the water flow at a specified observation location in a waterway network, etc.

[0039] Specifically, one or more traffic data sequences can be obtained based on actual business scenarios. Figure 1The graph structure shown in FIG. 1 shows that for the "Huabei" service provided by the application "Alipay", 7 web pages with relatively high visits involved in the service can be selected based on experience or statistical historical data, and the 7 web pages correspond to 7 nodes in the graph structure involved in the traffic prediction service. Then the observation time can be set to M days, and each day can be divided into T time periods according to the preset step size in the time dimension, and the T visits of each of the 7 web pages in the T time periods are collected continuously within M days. For any t-th time period in any m-th day, the visits of any i-th web page in the t-th time period collected from the 7 web pages can be expressed as the node traffic of the i-th web page in the t-th time period. Then, the node traffic of the 7 web pages in the t-th time period on the m-th day can be used to form the t-th traffic data set belonging to the m-th day, and then the T traffic data sets belonging to the m-th day are arranged in chronological order to form the traffic data sequence corresponding to the m-th day. By performing the above processing on the visits observed within M days, M traffic data sequences can be obtained to be used for training the spatiotemporal graph neural network.

[0040] Step 203: determine the constraints satisfied by the node flows of the N nodes.

[0041] In a possible implementation, the user may directly provide the constraint conditions satisfied by the node traffic of each of the N nodes in the same time period based on experience, that is, the constraint conditions set by the user may be directly obtained in step 203 .

[0042] In a possible implementation, W constraint nodes not less than 1 may be first determined from the N nodes, and then the aforementioned constraint conditions may be determined according to the node traffic of each of the W constraint nodes in the same time period.

[0043] The user may identify W constraint nodes among N nodes based on experience, that is, the W constraint nodes may be determined from N nodes directly according to the configuration performed by the user based on his experience. Figure 3 The following method steps are shown to achieve the determination of whether each node in the N nodes is a constraint node, thereby achieving the determination of W constraint nodes that are not less than 1 from the N nodes.

[0044] Step 301, for any i-th node among N nodes, the node flow of each of N-1 nodes except the i-th node in any current time period is used as input data, and the node flow of the i-th node in the t-th time period is used as label data to train the first constraint network corresponding to the i-th node.

[0045] Step 303: Input the node flows of N-1 nodes except the ith node in the tth period into the trained first constraint network, so that it outputs the first predicted flow of the ith node in the tth period.

[0046] Step 305 : Determine whether the ith node is a constraint node according to the node flow of the ith node in the same time period and the first predicted flow.

[0047] The loss function used when training the first constraint network corresponding to the i-th node may include but is not limited to the loss function shown in the following formula 1.

[0048]

[0049] L pred(i) Represents the loss of the first constraint network corresponding to any i-th node among N nodes, represents the vector consisting of the traffic of T nodes in T time periods corresponding to the i-th node in the m-th traffic data sequence, x m Represents a vector consisting of the T first predicted flows of the ith node in the T time periods corresponding to the mth flow data sequence.

[0050] Based on the node traffic of the aforementioned N-1 nodes in the tth period, the accuracy of the first predicted traffic of the i-th node in the tth period is pred(i) Negatively correlated. Correspondingly, L pred(i) The smaller the value, the smaller the correlation between the node traffic of the i-th node and the aforementioned N-1 nodes in the same period in spatial maintenance. Therefore, in step 305, L can be calculated based on the node traffic of the N nodes in each period and the first predicted traffic, as well as the aforementioned formula 1. pred(i) , and then based on L pred(i) The size of determines whether the i-th node is a constraint node.

[0051] In one example, the L pred(i) When it is less than a preset threshold, the i-th node is determined as a constraint node.

[0052] In one example, the L pred(i)When it is less than a preset threshold, the i-th node is determined as a candidate node. Then, for each determined candidate node, the average partial derivatives of the partial derivatives corresponding to the first predicted flow of the candidate node in different time periods are calculated according to the trained first constraint network corresponding to the candidate node and each flow data set used to train the first constraint network, and then based on the average partial derivative corresponding to the candidate node, it is determined whether the candidate node is a constraint node. For example, a candidate node whose average partial derivative is greater than a preset threshold is determined as a constraint node, or W candidate nodes with relatively large average partial derivatives are selected in order from large to small as W constraint nodes.

[0053] After determining W constraint nodes from N nodes through the process of the above example, specifically for any j-th node among the W constraint nodes, the node traffic of W-1 constraint nodes other than the j-th constraint node in any current time period can be used as input data, and the node traffic of the j-th constraint node in the current time period can be used as label data to train the second constraint network corresponding to the j-th node, and then the constraint condition can be determined based on the trained second constraint network.

[0054] In one example, the constraint sub-function corresponding to the j-th constraint node can be first determined based on the trained second constraint network, and the W variables in the constraint sub-function represent the W node flows of the W constraint nodes in the same period of time; then the constraint sub-functions corresponding to the W constraint nodes are merged to obtain the constraint function as the constraint condition.

[0055] More specifically, when the node flows of the remaining W-1 constraint nodes except the jth constraint node in the tth period are input into the trained second constraint network corresponding to the jth constraint node, the second constraint network outputs the second predicted flow of the jth constraint node in the tth period, which is equal to or approximate to the node flow of the jth constraint node in the tth period. Therefore, the second constraint network corresponding to the jth node obtains and outputs the second predicted flow x′ of the jth node in the tth period t,j The process can be expressed as x′ t,j =g(x t,1 , ..., x t,w ), where x t,1 represents the node flow of the first constraint node among W constraint nodes in the tth period, x t,w Represents the node flow of the Wth constraint node in the tth time period. Correspondingly, the weight matrix of the trained second constraint network corresponding to the jth constraint node can be transformed to obtain the deformation matrix A j And ensure that A j x' t = 0, where x′t is x′ t,j The W-dimensional vector composed of the node traffic of the remaining W-1 nodes in the tth period. It should be noted here that due to x' t,j Equal to or similar to the node traffic x of the jth node in the tth period t,j , so x′ t It can be used to represent the W-dimensional vector composed of the W node traffic of W constraint nodes in the tth time period, that is, it can be considered that the jth constraint node needs to satisfy the functional relationship A j x t =0, where x t The W-dimensional vector representing the W node traffic of the W constraint nodes in the tth period is thus j x t =0 is determined as the constraint sub-function corresponding to / satisfied by the jth constraint node.

[0056] It should be noted that the constraint function as a constraint condition may also be obtained by other means. For example, in some business scenarios, the constraint sub-function A corresponding to / satisfied by a single constraint node may be obtained by other means. j x t =0 is directly used as the constraint function.

[0057] The constraint function may be a linear function or a nonlinear function. For example, when the constraint sub-functions corresponding to / satisfied by W constraint nodes are merged, the constraint function Ax may be obtained. t = 0, where A is the target matrix formed when the merging process is performed; or, when it is impossible to merge the constraint sub-functions corresponding to / satisfied by the W constraint nodes, directly use the constraint sub-functions corresponding to / satisfied by the W constraint nodes to form a nonlinear constraint function f(x t )=0.

[0058] Back to Figure 2 In step 205, a loss function for training the first spatiotemporal graph neural network is determined based on the constraints.

[0059] In step 207, a first spatiotemporal graph neural network is trained based on the traffic data sequence and the loss function.

[0060] The first spatiotemporal graph neural network may include but is not limited to a spatiotemporal graph convolutional network or a dynamic graph convolutional recurrent network. The first spatiotemporal graph neural network may include an input layer, a plurality of hidden layers, and an output layer. During the training of the first spatiotemporal graph neural network, when the mth traffic data sequence is input into the first spatiotemporal graph neural network, for the tth traffic data set in the mth traffic data sequence, any of the plurality of hidden layers and the first hidden layer having C processing channels can output C N-dimensional feature vectors for the tth traffic data set; the i-th element in a single N-dimensional feature vector corresponds to the i-th node among the N nodes, and is used to characterize the node traffic of the i-th node in the t-th time period.

[0061] The loss function for training the first spatiotemporal graph neural network may include the first loss term L corresponding to the hidden layer R , the first loss term is used to indicate the degree of matching between the W-dimensional feature vector and the constraint function, the W-dimensional feature vector is obtained from the N-dimensional feature vector output by the hidden layer and corresponds to the W constraint nodes. More specifically, the first loss term includes multiple variables for characterizing multiple W-dimensional feature vectors, wherein the multiple W-dimensional feature vectors correspond one-to-one to all the N-dimensional feature vectors cumulatively output by each hidden layer; the j-th element in a single W-dimensional feature vector is the element obtained from its corresponding N-dimensional feature vector and corresponding to the j-th constraint node among the W constraint nodes.

[0062] When the constraint function is a linear function, the first loss term can be calculated by multiplying the target matrix determined based on the constraint function and the W-dimensional feature vector of each time period. Exemplarily, the number of hidden layers contained in the first spatiotemporal graph neural network is recorded as P, the number of channels contained in a single hidden layer is recorded as C, and the total amount of the acquired traffic data sequence is recorded as M. When the constraint function is a linear function, the first loss term L determined based on the constraint function is R As shown in the following formula 2.

[0063]

[0064] Where A is the target matrix in the constraint function mentioned above, Z m,c,t,p When the m-th traffic data sequence among M traffic data sequences is input into the first spatiotemporal graph neural network, the W-dimensional feature vector corresponding to the N-dimensional feature vector output by the c-th processing channel in the p-th hidden layer for the t-th traffic data set in the m-th traffic data sequence.

[0065] When the constraint function is a nonlinear function, the first loss term can be calculated by a number of mean vectors corresponding to a number of hidden layers, wherein the mean vector corresponding to the pth hidden layer is calculated based on the W-dimensional feature vectors corresponding to each N-dimensional feature vector output by the pth hidden layer. Exemplarily, when the constraint function is a nonlinear function, the first loss term L determined based on the constraint function is R As shown in the following formula 3.

[0066]

[0067] Where Z p Characterizes the mean vector corresponding to the pth hidden layer, and the corresponding rule f is the aforementioned constraint function f(x t ) in the corresponding law f.

[0068] It should be noted that the first loss term L R The larger the value of , the smaller the matching degree between the W-dimensional feature vector and the constraint function. Conversely, the smaller the matching degree between the W-dimensional feature vector and the constraint function. By minimizing L in the process of training the first spatiotemporal graph neural network R , it can be achieved that the elements used to characterize the node flow of each node in the N-dimensional feature vector output by the hidden layer can more accurately characterize the node flow of the corresponding constraint node on the basis of satisfying the constraint conditions, which is conducive to accurately predicting the node flow of each node in a certain target period in the future.

[0069] The number of traffic data sequences directly obtained for training the first spatiotemporal graph neural network may be relatively small. Figure 4 As shown, the method may further include step 401, generating a corresponding disturbance data sequence according to the constraint condition and the flow data sequence. In other words, it is necessary to ensure that in the disturbance data sequence generated based on the flow data sequence, the N node flows in a single flow data set have a high degree of matching with the aforementioned constraint condition, for example, a high degree of matching with the aforementioned constraint function. More specifically, for a single flow data set in the disturbance data sequence, the vector x composed of the node flows of the W constraint nodes in the flow data set is t Substituted into the above constraint function f(x t ), the calculated f(x t ) should be equal to or close to 0, for example, smaller than a preset threshold.

[0070] Correspondingly, the aforementioned step 207 may specifically include step 2071, training the first spatiotemporal graph neural network according to the traffic data sequence, the disturbance data sequence and the loss function.

[0071] In a possible implementation, based on Figure 4 In the illustrated embodiment, the loss function for training the first spatiotemporal graph neural network may include a second loss term, which is used to indicate: when the perturbation data sequence is input into the first spatiotemporal graph neural network, the degree to which the third predicted flow of each of the N nodes output by the first spatiotemporal graph neural network in the T+1th time period matches the constraint condition. Exemplarily, the second loss term L determined based on the constraint condition A As shown in the following formula (4).

[0072]

[0073] where y′ q,t When any qth disturbance data sequence among the Q disturbance data sequences is input into the first space-time graph neural network, the first space-time graph neural network outputs a corresponding prediction result, which includes the third predicted traffic of N nodes in the T+1th time period, and the corresponding relationship f is the corresponding relationship in the aforementioned constraint function.

[0074] It should be noted that the first loss term L A The larger the value of y′ is, the q,t The smaller the match with the constraint function, the smaller the match with the constraint function. q,t The greater the match with the constraint function. By minimizing L in the process of training the first spatiotemporal graph neural network A , which ensures that y′ q,t It can more accurately characterize the node flow of the corresponding constraint node in the T+1th time period, which is conducive to accurately predicting the node flow of each node in a certain target time period in the future.

[0075] It should be noted that the loss function used to train the first spatiotemporal graph neural network can include the aforementioned first loss term L R and / or the second loss term L A In addition, a third loss term L can also be included B The third loss term L B It can be calculated according to specified calculation rules based on the label data corresponding to each flow data sequence and / or disturbance data sequence, and the prediction results output by the first spatiotemporal graph neural network for each flow data sequence and / or disturbance data sequence.

[0076] After completing the training of the first spatiotemporal graph neural network through the methods provided in the aforementioned embodiments, a conversion layer can also be constructed based on the constraints, wherein the conversion layer is used to improve the matching degree between the predicted traffic of the first spatiotemporal graph neural network for N nodes in the target time period and the constraints; then the conversion layer is connected on the basis of the first spatiotemporal graph neural network to obtain a second spatiotemporal graph neural network for performing traffic prediction services. In this way, the second spatiotemporal graph neural network can more accurately predict the node traffic of N nodes in the target time period compared to the trained first spatiotemporal graph neural network.

[0077] Specifically, the conversion layer can be configured to obtain the fourth predicted flow of N nodes in the target time period output by the trained first spatiotemporal graph neural network, process it and output the fifth predicted flow of N nodes, wherein the degree of matching between the fourth predicted flow of the N nodes and the constraints is less than the degree of matching between the fifth predicted flow of the N nodes and the constraints.

[0078] For example, the prediction result output by the first spatiotemporal graph neural network after training in inference mode is expressed as The fourth predicted flow of N nodes output by the first spatiotemporal graph neural network in a certain target period is recorded as The real traffic data set of N nodes in a certain target period is recorded as T+1 ; Target the conversion layer to The fifth predicted flow of N nodes obtained by processing is recorded as We expect that the matching degree between the fourth predicted flow of N nodes and the constraint condition is less than the matching degree between the fifth predicted flow of N nodes and the constraint condition. Satisfy the conditions

[0079] When the constraint function is a linear function Ax t = 0, the conversion layer can Directly project onto the hyperplane that satisfies the constraints to obtain In other words, the conversion layer can be calculated by the following formula (5):

[0080]

[0081] When the constraint function is a nonlinear function f(x t )=0, The process of directly projecting onto a hyperplane that satisfies the constraints has no closed-form solution. So suppose f(y T+1 )=0 and is the Jacobian matrix, about The first-order Taylor expansion of can be written as When the aforementioned Taylor expansion is set to 0, we can obtain The conversion layer can obtain the conditions that meet the conditions by repeatedly performing the above processing process. of

[0082] The inventors conducted tests on the data sets of the "Huabei" business and the "Jiebei" business. The data set of the "Huabei" business is marked as Flow Dataset 1, and Flow Dataset 1 involves 23 relatively high-visited web pages related to the "Huabei" business; in the time dimension, we collected 24 days of data and divided the data into 5-minute periods every day, splitting 18 days of data for training, 3 days of data for verification, and 3 days of data for testing. The data set of the "Jiebei" business is marked as FlowDataset 2, and Flow Dataset 2 involves 30 relatively high-visited web pages related to the "Jiebei" business; in the time dimension, we collected 21 days of data and divided the data into 5-minute periods every day, splitting 15 days of data for training, 3 days of data for verification, and 3 days of data for testing.

[0083] The inventors specifically tested six baseline models, such as "historical average (HA)", "support vector regression (SVR)", "feedforward neural network (FNN)", "fully connected-long short-term memory network (FC-LSTM)", "space-time graph convolutional network (STGCN)" and "dynamic convolutional recurrent network (AGCRN)". At the same time, the second space-time graph neural network obtained by the method provided in the embodiments of this specification was tested, specifically taking the second space-time graph neural network including the space-time graph convolutional network (CSTGCN) with added constraints and the dynamic convolutional recurrent network (CAGCRN) with added constraints as an example.

[0084] The performance in terms of mean absolute error (MAE) and root mean square error (RMSE) is shown in Table 1.

[0085]

[0086] Table 1

[0087] It can be seen from the test results of the examples in Table 1 above that the CSTGCN and CAGCRN obtained by the method provided in the embodiments of this specification take into account the constraints satisfied by the node traffic of different network pages in the same period, and their performance in MAE and RMSE is significantly better than the other 6 baseline models.

[0088] Based on the same concept as the aforementioned method embodiment, the present specification also provides a device for obtaining a graph neural network for performing traffic prediction services. Figure 5As shown, the device may include: a data acquisition unit 501, configured to acquire a traffic data sequence of N nodes in a graph structure, the traffic data sequence including T traffic data sets corresponding to T time periods, and a single traffic data set containing the node traffic of each of the N nodes in the corresponding time period; a condition determination unit 503, configured to determine the constraints satisfied by the node traffic of each of the N nodes; a loss determination unit 505, configured to determine a loss function based on the constraints; a training processing unit 507, configured to train a first spatiotemporal graph neural network based on the traffic data sequence and the loss function, wherein the trained first spatiotemporal graph neural network is used to perform the traffic prediction service.

[0089] In a possible implementation, the condition determination unit 503 is configured to determine W constraint nodes from N nodes, where W is greater than 1; and determine the constraint condition according to the node traffic of each of the W constraint nodes in the same time period.

[0090] In a possible implementation, the condition determination unit 503 is configured as follows: for any i-th node among N nodes, the node flow of N-1 nodes other than the i-th node in any current time period is used as input data, and the node flow of the i-th node in the current time period is used as label data to train the first constraint network corresponding to the i-th node; the node flow of the N-1 nodes in the current time period is input into the trained first constraint network to output the first predicted flow of the i-th node in the current time period; and whether the i-th node is a constraint node is determined based on the node flow of the i-th node in each time period and the first predicted flow.

[0091] In one possible implementation, the condition determination unit is configured as follows: for any j-th node among the W constraint nodes, the node traffic of W-1 constraint nodes other than the j-th constraint node in any current time period is used as input data, and the node traffic of the j-th constraint node in the current time period is used as label data, and a second constraint network corresponding to the j-th node is trained; and the constraint condition is determined based on the trained second constraint network.

[0092] In a possible implementation, the condition determination unit 503 is specifically configured as follows: determining the constraint sub-function corresponding to the j-th constraint node based on the trained second constraint network, the W variables in the constraint sub-function representing the W node flows of the W constraint nodes in the same time period; merging the constraint sub-functions corresponding to the W constraint nodes respectively to obtain the constraint function serving as the constraint condition.

[0093] In a possible implementation manner, the constraint condition is a constraint function with a function value of 0, and the W variables in the constraint function represent W node flows of W constraint nodes in the same time period.

[0094] In a possible implementation, the first spatiotemporal graph neural network includes a first hidden layer. When the traffic data sequence is input into the first spatiotemporal graph neural network, the first hidden layer outputs an N-dimensional feature vector for characterizing the node traffic of N nodes for any current time period traffic data set. The loss function includes a first loss term, which is used to indicate the degree of matching between the W-dimensional feature vector and the constraint function, and the W-dimensional feature vector is obtained from the N-dimensional feature vector and corresponds to the W constraint nodes.

[0095] In a possible implementation manner, the constraint function is a linear function. The first loss term is calculated by multiplying a target matrix determined based on the constraint function by the W-dimensional feature vector of each time period.

[0096] In a possible implementation, the constraint function is a nonlinear function. The first loss term is calculated based on a mean vector of the first hidden layer, and the mean vector is calculated based on the W-dimensional feature vectors of each time period.

[0097] In a possible implementation, the device further includes: a disturbance processing unit configured to generate a corresponding disturbance data sequence according to the constraint condition and the flow data sequence. The training processing unit 507 is specifically configured to train a first spatiotemporal graph neural network according to the flow data sequence, the disturbance data sequence and the loss function.

[0098] In one possible implementation, the loss function includes a second loss term, which is used to indicate the degree of matching between the third predicted traffic of N nodes in the T+1th time period output by the first space-time graph neural network and the constraint condition when the perturbation data sequence is input into the first space-time graph neural network.

[0099] In a possible implementation, the device further includes a configuration processing unit for constructing a conversion layer based on the constraint conditions, wherein the conversion layer is used to improve the degree of matching between the predicted traffic of N nodes in a target time period of the first spatiotemporal graph neural network and the constraint conditions; the conversion layer is connected on the basis of the first spatiotemporal graph neural network to obtain a second spatiotemporal graph neural network, and the second spatiotemporal graph neural network is used to execute the traffic prediction service.

[0100] In one possible implementation, the conversion layer is configured to obtain the fourth predicted flow of each of the N nodes output by the first spatiotemporal graph neural network in the target time period, process it and output the fifth predicted flow of the N nodes, wherein the degree of matching between the fourth predicted flow of the N nodes and the constraint condition is less than the degree of matching between the fifth predicted flow of the N nodes and the constraint condition.

[0101] In a possible implementation, N nodes correspond to N web pages or N network devices, and the node traffic is the number of visits to the web pages or network devices. Alternatively, N nodes correspond to N stations, and the node traffic is the number of vehicles passing through the stations.

[0102] Those skilled in the art should be aware that in one or more of the above examples, the functions described in this specification can be implemented by hardware, software, firmware, or any combination thereof. When implemented by software, the computer programs corresponding to these functions can be stored in a computer-readable medium or transmitted as one or more instructions / codes on a computer-readable medium, so that when the computer programs corresponding to these functions are executed by a computer, the method described in any embodiment of this specification is implemented by the computer.

[0103] A computer-readable storage medium is also provided in an embodiment of the present specification, on which a computer program / instruction is stored. When the computer program / instruction is executed in a computing device, the computing device executes the method for obtaining a spatiotemporal graph neural network for performing traffic prediction services provided in any embodiment of the present specification.

[0104] A computing device is also provided in an embodiment of the present specification, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, a flowchart method of a method for obtaining a spatiotemporal graph neural network for performing traffic prediction services provided in any embodiment of the present specification is implemented.

[0105] Each embodiment in this specification is described in a progressive manner, and the same or similar parts of each embodiment can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0106] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0107] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made on the basis of the technical solution of the present invention should be included in the scope of protection of the present invention.

Claims

1. A method for obtaining a graph neural network for performing a traffic prediction service, comprising: Obtaining a flow data sequence of N nodes that are connected in a graph structure, wherein the flow data sequence includes T flow data sets corresponding to T time periods, and a single flow data set includes the node flow of each of the N nodes in the corresponding time period, wherein the N nodes correspond to N network pages or network devices, and the node flow is the number of visits to the network page or network device; Determine a constraint condition satisfied by the node flow of each of the N nodes, wherein the constraint condition is a constraint function with a function value of 0, and W variables in the constraint function represent W node flows of the W constraint nodes determined from the N nodes in the same time period; Determining a loss function according to the constraint conditions; A first spatiotemporal graph neural network is trained according to the traffic data sequence and the loss function, wherein the trained first spatiotemporal graph neural network is used to perform the traffic prediction service.

2. The method according to claim 1, wherein: Determine the constraints that the node traffic of each of the N nodes meets, including: Determine W constraint nodes from N nodes, where W is greater than 1; The constraint condition is determined according to the node flow of each of the W constraint nodes in the same time period.

3. The method according to claim 2, wherein: Determine W constraint nodes from N nodes, including: For any i-th node among the N nodes, the node traffic of N-1 nodes other than the i-th node in any current period is used as input data, and the node traffic of the i-th node in the current period is used as label data to train the first constraint network corresponding to the i-th node; Input the node flows of the N-1 nodes in the current period into the first trained constraint network, so that it outputs the first predicted flow of the i-th node in the current period; Whether the i-th node is a constraint node is determined according to the node flow of the i-th node in each time period and the first predicted flow.

4. The method according to claim 2, wherein: The constraint condition is determined according to the node traffic of each of the W constraint nodes in the same period, including: For any j-th node among the W constraint nodes, the node traffic of W-1 constraint nodes other than the j-th constraint node in any current period is used as input data, and the node traffic of the j-th constraint node in the current period is used as label data to train the second constraint network corresponding to the j-th node; The constraint condition is determined based on the trained second constraint network.

5. The method according to claim 4, wherein: Determining the constraint condition based on the trained second constraint network specifically includes: Determine a constraint sub-function corresponding to the j-th constraint node based on the trained second constraint network, wherein the W variables in the constraint sub-function represent the W node flows of the W constraint nodes in the same period; The constraint sub-functions corresponding to the W constraint nodes are merged to obtain a constraint function serving as the constraint condition.

6. The method according to claim 2, wherein: The constraint condition is a constraint function with a function value of 0, and the W variables in the constraint function represent the W node flows of the W constraint nodes in the same time period.

7. The method according to claim 6, wherein: The first spatiotemporal graph neural network includes a first hidden layer; when the traffic data sequence is input into the first spatiotemporal graph neural network, the first hidden layer outputs an N-dimensional feature vector for characterizing the node traffic of N nodes for any current time period traffic data set; The loss function includes a first loss term, which is used to indicate the matching degree between a W-dimensional feature vector and the constraint function. The W-dimensional feature vector is obtained from the N-dimensional feature vector and corresponds to the W constraint nodes.

8. The method according to claim 7, wherein: The constraint function is a linear function; the first loss term is calculated by multiplying the target matrix determined based on the constraint function and the W-dimensional feature vector of each time period.

9. The method according to claim 7, wherein: The constraint function is a nonlinear function; the first loss term is calculated based on the mean vector corresponding to the first hidden layer, and the mean vector is calculated based on the W-dimensional feature vector of each time period.

10. The method according to any one of claims 1 to 9, wherein: The method further comprises: Generate a corresponding disturbance data sequence according to the constraint condition and the flow data sequence; Training a first spatiotemporal graph neural network according to the traffic data sequence and the loss function includes: training a first spatiotemporal graph neural network according to the traffic data sequence, the disturbance data sequence and the loss function.

11. The method according to claim 10, wherein: The loss function includes a second loss term, which is used to indicate the degree of matching between the third predicted traffic of N nodes in the T+1th time period output by the first space-time graph neural network and the constraint condition when the perturbation data sequence is input into the first space-time graph neural network.

12. The method according to any one of claims 1 to 9, further comprising: Constructing a conversion layer based on the constraint conditions, the conversion layer is used to improve the matching degree between the predicted traffic of the N nodes in the target time period and the constraint conditions of the first spatiotemporal graph neural network; The conversion layer is connected on the basis of the first spatiotemporal graph neural network to obtain a second spatiotemporal graph neural network, and the second spatiotemporal graph neural network is used to perform the traffic prediction service.

13. The method according to claim 12, wherein: The conversion layer is configured to obtain the fourth predicted flow of each of the N nodes output by the first spatiotemporal graph neural network in the target time period, process it and output the fifth predicted flow of the N nodes, wherein the degree of matching between the fourth predicted flow of the N nodes and the constraint condition is less than the degree of matching between the fifth predicted flow of the N nodes and the constraint condition.

14. A device for obtaining a graph neural network for performing a traffic prediction service, comprising: A data acquisition unit is configured to acquire a flow data sequence of N nodes having a connection relationship in a graph structure, wherein the flow data sequence includes T flow data sets corresponding to T time periods, and a single flow data set includes node flows of each of the N nodes in a corresponding time period, wherein the N nodes correspond to N network pages or network devices, and the node flows are visits to the network pages or network devices; A condition determination unit, configured to determine a constraint condition satisfied by each node flow of the N nodes, wherein the constraint condition is a constraint function with a function value of 0, and W variables in the constraint function represent W node flows of the W constraint nodes determined from the N nodes in the same time period; a loss determination unit, configured to determine a loss function according to the constraint condition; A training processing unit is configured to train a first spatiotemporal graph neural network based on the traffic data sequence and the loss function, wherein the trained first spatiotemporal graph neural network is used to perform the traffic prediction service.

15. A computer-readable storage medium having a computer program / instruction stored thereon, wherein when the computer program / instruction is executed in a computing device, the computing device executes the method according to any one of claims 1 to 13.

16. A computing device, comprising a memory and a processor, wherein the memory stores a computer program / instruction, and when the processor executes the computer program / instruction, the method according to any one of claims 1 to 13 is implemented.

Citation Information

Patent Citations

  • A dynamic heterogeneous network traffic prediction method based on a deep space-time neural network

    CN109862585A

  • Demand prediction method and system based on deep space-time neural network, and computer readable storage medium

    CN111882157A