CN114694379A - Traffic flow prediction method and system based on self-adaptive dynamic graph convolution - Google Patents
Traffic flow prediction method and system based on self-adaptive dynamic graph convolution Download PDFInfo
- Publication number
- CN114694379A CN114694379A CN202210318281.XA CN202210318281A CN114694379A CN 114694379 A CN114694379 A CN 114694379A CN 202210318281 A CN202210318281 A CN 202210318281A CN 114694379 A CN114694379 A CN 114694379A
- Authority
- CN
- China
- Prior art keywords
- adaptive dynamic
- traffic
- graph
- graph convolution
- prediction
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract 11
- 230000003044 adaptive effect Effects 0.000 claims abstract 31
- 230000003068 static effect Effects 0.000 claims abstract 8
- 238000007781 pre-processing Methods 0.000 claims abstract 5
- 239000011159 matrix material Substances 0.000 claims 4
- 125000004122 cyclic group Chemical group 0.000 claims 2
- 230000000306 recurrent effect Effects 0.000 claims 1
- 238000005070 sampling Methods 0.000 claims 1
- 238000001308 synthesis method Methods 0.000 claims 1
Images
Classifications
-
- G—PHYSICS
- G08—SIGNALLING
- G08G—TRAFFIC CONTROL SYSTEMS
- G08G1/00—Traffic control systems for road vehicles
- G08G1/01—Detecting movement of traffic to be counted or controlled
- G08G1/0104—Measuring and analyzing of parameters relative to traffic conditions
- G08G1/0125—Traffic data processing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2458—Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
- G06F16/2474—Sequence data queries, e.g. querying versioned data
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/28—Databases characterised by their database models, e.g. relational or object models
- G06F16/284—Relational databases
- G06F16/288—Entity relationship models
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/29—Geographical information databases
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/044—Recurrent networks, e.g. Hopfield networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/045—Combinations of networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Databases & Information Systems (AREA)
- Data Mining & Analysis (AREA)
- General Engineering & Computer Science (AREA)
- Mathematical Physics (AREA)
- Computational Linguistics (AREA)
- Software Systems (AREA)
- Biomedical Technology (AREA)
- Evolutionary Computation (AREA)
- Computing Systems (AREA)
- Molecular Biology (AREA)
- General Health & Medical Sciences (AREA)
- Health & Medical Sciences (AREA)
- Life Sciences & Earth Sciences (AREA)
- Artificial Intelligence (AREA)
- Biophysics (AREA)
- Chemical & Material Sciences (AREA)
- Fuzzy Systems (AREA)
- Analytical Chemistry (AREA)
- Remote Sensing (AREA)
- Probability & Statistics with Applications (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
本发明公开了一种基于自适应动态图卷积的交通流预测方法及系统,该方法包括:获取历史交通数据并对历史交通数据进行预处理;构建静态邻接关系图;构建自适应动态邻接关系图张量;构建自适应动态图卷积预测模型;基于预处理历史交通数据对自适应动态图卷积预测模型进行训练;将待测数据交通流数据输入至训练完成的预测模型,得到预测结果。该系统包括:预处理模块、第一构建模块、第二构建模块、模型构建模块、训练模块和预测模块。通过使用本发明,能够提高交通流预测的准确性。本发明作为一种基于自适应动态图卷积的交通流预测方法及系统,可广泛应用于交通预测领域。
The invention discloses a traffic flow prediction method and system based on self-adaptive dynamic graph convolution. The method includes: acquiring historical traffic data and preprocessing the historical traffic data; constructing a static adjacency relation graph; constructing an adaptive dynamic adjacency relation Graph tensor; construct an adaptive dynamic graph convolution prediction model; train the adaptive dynamic graph convolution prediction model based on preprocessed historical traffic data; input the traffic flow data of the data to be measured into the trained prediction model to obtain the prediction result . The system includes: a preprocessing module, a first building module, a second building module, a model building module, a training module and a prediction module. By using the present invention, the accuracy of traffic flow prediction can be improved. As a traffic flow prediction method and system based on adaptive dynamic graph convolution, the present invention can be widely used in the field of traffic prediction.
Description
技术领域technical field
本发明涉及交通预测领域,尤其涉及一种基于自适应动态图卷积的交通流预测方法及系统。The invention relates to the field of traffic prediction, in particular to a traffic flow prediction method and system based on adaptive dynamic graph convolution.
背景技术Background technique
交通流预测旨在基于历史交通观测对路网中未来的交通流状况(如交通速度、交通量等)进行预测。准确的交通预测是构建智能交通系统的重要基础,对交通时间估计、路线规划、交通灯管控等各类下游应用具有重要意义。由于城市交通网络具有高度的动态性及复杂的时空依赖性,进行准确的交通预测仍是一个挑战。Traffic flow prediction aims to predict the future traffic flow conditions (such as traffic speed, traffic volume, etc.) in the road network based on historical traffic observations. Accurate traffic prediction is an important foundation for building an intelligent transportation system, and is of great significance to various downstream applications such as traffic time estimation, route planning, and traffic light control. Accurate traffic forecasting remains a challenge due to the highly dynamic and complex spatiotemporal dependencies of urban transportation networks.
传统统计信号处理方法如ARIMA模型、支持向量回归(SVR)模型将交通预测用单变量时间信号回归的方式建模。它们依赖于信号平稳假设,且忽略交通节点间的相互关系,难以捕捉真实世界复杂的交通模式。随着深度学习技术的发展,卷积神经网络等模型涌现,但其仅能以欧式空间栅格化的方式处理空间信息,无法处理不规则的交通网络拓扑关系。Traditional statistical signal processing methods such as ARIMA model and Support Vector Regression (SVR) model model traffic forecasting with univariate time signal regression. They rely on the assumption of signal stationarity and ignore the interrelationships between traffic nodes, making it difficult to capture the complex traffic patterns in the real world. With the development of deep learning technology, models such as convolutional neural networks have emerged, but they can only process spatial information in the way of Euclidean spatial rasterization, and cannot deal with irregular traffic network topology.
发明内容SUMMARY OF THE INVENTION
为了解决上述技术问题,本发明的目的是提供一种基于自适应动态图卷积的交通流预测方法及系统,能够提高交通流预测的准确性。In order to solve the above technical problems, the purpose of the present invention is to provide a traffic flow prediction method and system based on adaptive dynamic graph convolution, which can improve the accuracy of traffic flow prediction.
本发明所采用的第一技术方案是:一种基于自适应动态图卷积的交通流预测方法,包括以下步骤:The first technical solution adopted by the present invention is: a traffic flow prediction method based on adaptive dynamic graph convolution, comprising the following steps:
获取历史交通数据并对历史交通数据进行预处理,得到预处理历史交通数据;Obtain historical traffic data and preprocess the historical traffic data to obtain preprocessed historical traffic data;
获取交通节点的地理空间距离并构建静态邻接关系图;Obtain the geospatial distances of traffic nodes and build a static adjacency graph;
对交通节点进行表征并构建自适应动态邻接关系图张量;Characterize traffic nodes and build adaptive dynamic adjacency graph tensors;
根据静态邻接关系图和自适应动态邻接关系图张量构建自适应动态图卷积预测模型;Build an adaptive dynamic graph convolution prediction model based on the static adjacency graph and the adaptive dynamic adjacency graph tensors;
基于预处理历史交通数据对自适应动态图卷积预测模型进行训练,得到训练完成的预测模型;The adaptive dynamic graph convolution prediction model is trained based on the preprocessed historical traffic data, and the trained prediction model is obtained;
将待测数据交通流数据输入至训练完成的预测模型,得到预测结果。Input the traffic flow data of the data to be tested into the trained prediction model to obtain the prediction result.
进一步,所述获取历史交通数据并对历史交通数据进行预处理,得到预处理历史交通数据这一步骤,其具体包括:Further, the step of obtaining historical traffic data and preprocessing the historical traffic data to obtain the preprocessing historical traffic data specifically includes:
设定时间步间隔、最大历史观测时间步数和最大预测时间步数;Set the time step interval, the maximum number of historical observation time steps and the maximum number of forecast time steps;
根据时间步间隔将一天划分等长时段,得到时段索引序列;Divide one day into equal-length periods according to the time step interval, and obtain the period index sequence;
根据时间步间隔、最大历史观测时间步数和最大预测时间步数对历史交通数据进行滑窗切片,得到交通流特征序列;According to the time step interval, the maximum number of historical observation time steps and the maximum number of predicted time steps, the historical traffic data is sliced by sliding window, and the traffic flow feature sequence is obtained;
根据交通流特征和时段索引序列构建特征索引对,得到预处理历史交通数据。The feature index pair is constructed according to the traffic flow feature and the time period index sequence, and the preprocessed historical traffic data is obtained.
进一步,所述静态邻接关系图的表达式如下:Further, the expression of the static adjacency graph is as follows:
上式中,静态邻接关系图,表示交通节点vi与vj的地理空间距离,σ表示各节点间距离的标准差。In the above formula, the static adjacency graph, represents the geographic spatial distance between traffic nodes v i and v j , and σ represents the standard deviation of the distance between each node.
进一步,所述对交通节点进行表征并构建自适应动态邻接关系图张量这一步骤,其具体包括:Further, the step of characterizing traffic nodes and constructing an adaptive dynamic adjacency graph tensor specifically includes:
设定交通节点和各时段的表征维度,并构造交通节点表征矩阵和时段表征矩阵;Set the representation dimensions of traffic nodes and time periods, and construct a traffic node representation matrix and a time period representation matrix;
基于张量合成方法,根据交通节点表征矩阵和时段表征矩阵计算张量;Based on the tensor synthesis method, the tensor is calculated according to the traffic node representation matrix and the time period representation matrix;
对张量进行非线性映射并作归一化处理,得到自适应动态邻接关系图张量。The tensors are nonlinearly mapped and normalized to obtain adaptive dynamic adjacency graph tensors.
进一步,所述根据静态邻接关系图和自适应动态邻接关系图张量构建自适应动态图卷积预测模型这一步骤,其具体包括:Further, the step of constructing an adaptive dynamic graph convolution prediction model according to the static adjacency graph and the adaptive dynamic adjacency graph tensor specifically includes:
根据自适应动态邻接关系图张量获取自适应动态邻接关系图;Obtain the adaptive dynamic adjacency graph according to the adaptive dynamic adjacency graph tensor;
构建自适应动态图卷积模块并采用静态邻接关系图与动态邻接关系图进行图卷积操作;Build an adaptive dynamic graph convolution module and use static adjacency graph and dynamic adjacency graph to perform graph convolution operations;
将自适应动态图卷积模块嵌入门控循环单元并替换全连接计算,得到含自适应动态图卷积的门控循环单元;Embed the adaptive dynamic graph convolution module into the gated cyclic unit and replace the full connection calculation to obtain the gated cyclic unit with adaptive dynamic graph convolution;
基于含自适应动态图卷积的门控循环单元构建组成编码器-解码器结构的模型,得到自适应动态图卷积预测模型。Based on the gated recurrent unit with adaptive dynamic graph convolution, a model constituting the encoder-decoder structure is constructed, and an adaptive dynamic graph convolution prediction model is obtained.
进一步,所述基于预处理历史交通数据对自适应动态图卷积预测模型进行训练,得到训练完成的预测模型这一步骤,其具体包括:Further, the step of training the adaptive dynamic graph convolution prediction model based on the preprocessing historical traffic data to obtain the trained prediction model specifically includes:
基于计划采样方式,以概率ε使用历史交通流特征真实值为输入,以1-ε的概率使用前一时间步的输出估计值作为输入,对自适应动态图卷积预测模型中的解码器进行训练,得到训练完成的预测模型。Based on the planned sampling method, the actual value of historical traffic flow features is used as input with probability ε, and the output estimated value of the previous time step is used as input with probability 1-ε. Train to get the trained prediction model.
本发明所采用的第二技术方案是:一种基于自适应动态图卷积的交通流预测系统,包括:The second technical solution adopted by the present invention is: a traffic flow prediction system based on adaptive dynamic graph convolution, comprising:
预处理模块,用于获取历史交通数据并对历史交通数据进行预处理,得到预处理历史交通数据;The preprocessing module is used to obtain the historical traffic data and preprocess the historical traffic data to obtain the preprocessed historical traffic data;
第一构建模块,用于获取交通节点的地理空间距离并构建静态邻接关系图;The first building module is used to obtain the geospatial distance of the traffic node and construct a static adjacency graph;
第二构建模块,用于对交通节点进行表征并构建自适应动态邻接关系图张量;The second building module is used to characterize the traffic nodes and construct an adaptive dynamic adjacency graph tensor;
模型构建模块,用于根据静态邻接关系图和自适应动态邻接关系图张量构建自适应动态图卷积预测模型;A model building module for constructing an adaptive dynamic graph convolution prediction model based on the static adjacency graph and the adaptive dynamic adjacency graph tensors;
训练模块,基于预处理历史交通数据对自适应动态图卷积预测模型进行训练,得到训练完成的预测模型;The training module trains the adaptive dynamic graph convolution prediction model based on the preprocessed historical traffic data, and obtains the trained prediction model;
预测模块,用于将待测数据交通流数据输入至训练完成的预测模型,得到预测结果。The prediction module is used to input the traffic flow data of the data to be measured into the trained prediction model to obtain the prediction result.
本发明方法及系统的有益效果是:本发明通过在不同时间点采用不同的自适应邻接图对交通节点表征进行动态的图卷积,挖掘交通网络复杂的动态模式,提高了交通流预测的准确性,另外,分别设置可训练的节点表征矩阵与时段表征矩阵,以张量合成的方式生成不同时段的节点动态邻接关系图,避免了在每一个时段分别定义一种节点表征,在交通节点数量巨大时有效降低了预测模型的参数量。The beneficial effects of the method and system of the present invention are as follows: the present invention uses different adaptive adjacency graphs at different time points to perform dynamic graph convolution on the representation of traffic nodes, so as to mine the complex dynamic patterns of the traffic network and improve the accuracy of traffic flow prediction. In addition, the trainable node representation matrix and the time period representation matrix are respectively set, and the dynamic adjacency graph of nodes in different time periods is generated by tensor synthesis, which avoids defining a node representation in each time period. When it is huge, it effectively reduces the number of parameters of the prediction model.
附图说明Description of drawings
图1是本发明一种基于自适应动态图卷积的交通流预测方法的步骤流程图;1 is a flow chart of the steps of a traffic flow prediction method based on adaptive dynamic graph convolution of the present invention;
图2是本发明一种基于自适应动态图卷积的交通流预测系统的结构框图;2 is a structural block diagram of a traffic flow prediction system based on adaptive dynamic graph convolution of the present invention;
图3是本发明具体实施自适应动态图卷积预测模型的示意图;3 is a schematic diagram of the present invention implementing an adaptive dynamic graph convolution prediction model;
图4是本发明方法和现有典型的基于图卷积的交通预测方法的预测性能比较图。FIG. 4 is a comparison chart of the prediction performance between the method of the present invention and the existing typical traffic prediction method based on graph convolution.
具体实施方式Detailed ways
下面结合附图和具体实施例对本发明做进一步的详细说明。对于以下实施例中的步骤编号,其仅为了便于阐述说明而设置,对步骤之间的顺序不做任何限定,实施例中的各步骤的执行顺序均可根据本领域技术人员的理解来进行适应性调整。The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. The numbers of the steps in the following embodiments are set only for the convenience of description, and the sequence between the steps is not limited in any way, and the execution sequence of each step in the embodiments can be adapted according to the understanding of those skilled in the art Sexual adjustment.
如图1所示,本发明提供了一种基于自适应动态图卷积的交通流预测方法,该方法包括以下步骤:As shown in Figure 1, the present invention provides a traffic flow prediction method based on adaptive dynamic graph convolution, the method comprising the following steps:
S1、获取历史交通数据并对历史交通数据进行预处理,得到预处理历史交通数据;S1. Obtain historical traffic data and preprocess the historical traffic data to obtain preprocessed historical traffic data;
S1.1、设定时间步间隔、最大历史观测时间步数和最大预测时间步数;S1.1. Set the time step interval, the maximum number of historical observation time steps and the maximum number of prediction time steps;
具体地,设定时间步间隔ΔT为5分钟,设定最大历史观测时间步数P=12(即1小时时长),最大预测时间步数Q=12(即1小时时长);Specifically, set the time step interval ΔT to 5 minutes, set the maximum number of historical observation time steps P=12 (that is, the duration of 1 hour), and the maximum number of predicted time steps Q=12 (that is, the duration of 1 hour);
S1.2、根据时间步间隔将一天划分等长时段,得到时段索引序列;S1.2. Divide one day into equal-length periods according to the time step interval, and obtain the period index sequence;
具体地,将一天内的按照ΔT为5分钟划分为L=288个等长的时段,各时段在一天中的索引l分别对应为0,1,…,287。Specifically, a day is divided into L=288 time periods of equal length according to ΔT of 5 minutes, and the indices l of each time period in the day correspond to 0, 1, . . . , 287 respectively.
S1.3、根据时间步间隔、最大历史观测时间步数和最大预测时间步数对历史交通数据进行滑窗切片,得到交通流特征序列;S1.3. Perform sliding window slicing on the historical traffic data according to the time step interval, the maximum number of historical observation time steps and the maximum number of predicted time steps to obtain a traffic flow feature sequence;
具体地,由所设定时间步间隔ΔT为5分钟、最大历史观测时间步数P=12,最大预测时间步数Q=12,对历史交通流特征数据进行滑窗切片,每个窗口切片为长度24的交通流特征序列Xt-11,…,Xt,Xt+1,…,Xt+12,其中每个时刻的207为交通节点数量,1为每个节点的特征数(即仅采用交通速度一种特征),对应时段在一天中的索引分别为lt-11,…,lt,lt+1,…,lt+12;Specifically, the set time step interval ΔT is 5 minutes, the maximum number of historical observation time steps P=12, and the maximum number of predicted time steps Q=12, the historical traffic flow characteristic data is sliced by sliding window, and each window slice is The traffic flow feature sequence X t-11 ,…,X t ,X t+1 ,…,X t+12 of length 24, in which the 207 is the number of traffic nodes, 1 is the number of features of each node (that is, only one feature of traffic speed is used), and the indices of the corresponding time periods in one day are l t-11 ,...,l t ,l t+1 ,... ,l t+12 ;
S1.4、根据交通流特征和时段索引序列构建特征索引对,得到预处理历史交通数据。S1.4, construct a feature index pair according to the traffic flow feature and the time period index sequence, and obtain the preprocessed historical traffic data.
具体地,组合交通流特征序列及对应的时段索引序列为“交通特征-时段索引对”序列,得到预处理的历史交通流数据样本。Specifically, the traffic flow feature sequence and the corresponding time period index sequence are combined into a "traffic feature-time period index pair" sequence to obtain preprocessed historical traffic flow data samples.
单个样本的形式为[(Xt-11,lt-11),…,(Xt,lt),(Xt+1,lt+1),…,(Xt+12,lt+12)]的长度为24的序列。A single sample has the form [(X t-11 ,l t-11 ),…,(X t ,l t ),(X t+1 ,l t+1 ),…,(X t+12 ,l t +12 )] is a sequence of length 24.
S2、获取交通节点的地理空间距离并构建静态邻接关系图;S2. Obtain the geospatial distance of traffic nodes and construct a static adjacency graph;
具体地,采用高斯核函数的形式计算交通节点邻近度得到静态邻接关系图,表达式如下:Specifically, a static adjacency graph is obtained by calculating the proximity of traffic nodes in the form of a Gaussian kernel function, and the expression is as follows:
上式中,表示交通节点vi与vj的地理空间距离,σ表示各节点间距离的标准差。In the above formula, represents the geographic spatial distance between traffic nodes v i and v j , and σ represents the standard deviation of the distance between each node.
S3、对交通节点进行表征并构建自适应动态邻接关系图张量;S3. Characterize the traffic nodes and construct an adaptive dynamic adjacency graph tensor;
S3.1、设定交通节点和各时段的表征维度,并构造交通节点表征矩阵和时段表征矩阵;S3.1. Set the representation dimensions of traffic nodes and time periods, and construct a traffic node representation matrix and a time period representation matrix;
具体地,设定交通节点表征及一天中各时段表征的维度d=30,依此构造源端交通节点表征矩阵终端交通节点表征矩阵一天中各时段表征矩阵 核张量Es,Et,Eo,C随机初始化;Specifically, set the dimension d=30 of the representation of traffic nodes and the representation of each time period in a day, and construct the representation matrix of source-end traffic nodes accordingly Terminal Traffic Node Characterization Matrix Time-of-day representation matrix kernel tensor E s , E t , E o , C are initialized randomly;
S3.2、基于张量合成方法,根据交通节点表征矩阵和时段表征矩阵计算张量;S3.2. Based on the tensor synthesis method, the tensor is calculated according to the traffic node representation matrix and the time period representation matrix;
具体地,根据Es,Et,Eo,C,采用张量合成的方式计算得张量计算表达式如下:Specifically, according to E s , E t , E o , C, the tensor is calculated by tensor synthesis The calculation expression is as follows:
Ad=C×1Et×2Es×3Ee A d = C × 1 E t × 2 E s × 3 E e
S3.3、对张量进行非线性映射并作归一化处理,得到自适应动态邻接关系图张量。S3.3. Perform nonlinear mapping and normalization on the tensor to obtain an adaptive dynamic adjacency graph tensor.
具体地,对Ad进行非线性映射并作归一化处理,得最终交通节点动态邻接关系图张量计算表达式如下:Specifically, perform nonlinear mapping on A d and normalize it to obtain the final traffic node dynamic adjacency graph tensor The calculation expression is as follows:
上式中,非线性映射采用leakyReLU函数,softmax函数对张量的最后一个维度进行归一化;In the above formula, the nonlinear mapping uses the leakyReLU function, and the softmax function normalizes the last dimension of the tensor;
S4、根据静态邻接关系图和自适应动态邻接关系图张量构建自适应动态图卷积预测模型;S4, constructing an adaptive dynamic graph convolution prediction model according to the static adjacency graph and the adaptive dynamic adjacency graph tensor;
S4.1、根据自适应动态邻接关系图张量获取自适应动态邻接关系图;S4.1. Obtain an adaptive dynamic adjacency graph according to the adaptive dynamic adjacency graph tensor;
具体地,节点动态邻接关系图张量在其第一个维度的第l个切片的含义为在一天中第l个时段的交通节点动态邻接关系图。Specifically, the node dynamic adjacency graph tensor the lth slice in its first dimension The meaning of is the dynamic adjacency graph of traffic nodes in the lth period of the day.
S4.2、构建自适应动态图卷积模块dgconv(·)并采用静态邻接关系图与动态邻接关系图几何进行图卷积操作,采用的图卷积阶数K=2;S4.2. Build an adaptive dynamic graph convolution module dgconv( ) and use static adjacency graph and dynamic adjacency graph geometry to perform graph convolution operations, and the graph convolution order used is K=2;
具体地,计算公式为:Specifically, the calculation formula is:
上式中,Hin,Hout分别为交通节点的输入表征及自适应图卷积模块的输出表征,K为图卷积阶数,Df为静态邻接关系图As的度矩阵,Db为As的转置矩阵的度矩阵,为一天中第l个时段对应的动态邻接关系图,W均为可训练权重矩阵。In the above formula, H in and H out are the input representation of the traffic node and the output representation of the adaptive graph convolution module, respectively, K is the graph convolution order, D f is the degree matrix of the static adjacency graph A s , and D b is the degree matrix of the transposed matrix of A s , is the dynamic adjacency graph corresponding to the l-th time period in a day, and W is a trainable weight matrix.
S4.3、将自适应动态图卷积模块嵌入门控循环单元并替换全连接计算,得到含自适应动态图卷积的门控循环单元;S4.3. Embed the adaptive dynamic graph convolution module into the gated cyclic unit and replace the fully connected calculation to obtain a gated cyclic unit with adaptive dynamic graph convolution;
具体地,将dgconv(·)嵌入门控循环单元GRU替换其中的全连接计算,得含自适应动态图卷积的GRU单元;即,对于时间步t的GRU单元,依照如下表达式进行计算:Specifically, the dgconv( ) is embedded in the gated cyclic unit GRU to replace the fully connected calculation, so as to obtain a GRU unit containing adaptive dynamic graph convolution; that is, for the GRU unit at time step t, it is calculated according to the following expression:
Ht=ut⊙Ht-1+(1-ut)⊙ct,H t =u t ⊙H t-1 +(1-u t )⊙c t ,
上式中,Xt、Ht分别为当前时间步t的输入交通流特征、输出隐藏状态,Ht-1为前一时间步的隐藏状态;lt为输入样本中与交通流特征Xt对应的一天中时段索引,为在其第一个维度的第lt个切片;σ(·)表示sigmoid函数,||代表矩阵拼接操作,⊙代表矩阵Hadamard积操作。In the above formula, X t and H t are the input traffic flow feature and output hidden state of the current time step t respectively, H t-1 is the hidden state of the previous time step; l t is the input sample and the traffic flow feature X t the index of the corresponding time of day, for The t -th slice in its first dimension; σ( ) represents the sigmoid function, || represents the matrix concatenation operation, and ⊙ represents the matrix Hadamard product operation.
S4.4、基于含自适应动态图卷积的门控循环单元构建组成编码器-解码器结构的模型,得到自适应动态图卷积预测模型。S4.4, constructing a model constituting an encoder-decoder structure based on a gated recurrent unit including an adaptive dynamic graph convolution, and obtaining an adaptive dynamic graph convolution prediction model.
具体地,采用GRU编码器长度与P相等为12,GRU解码器长度与Q相等为12,编码器-解码器结构层数为2,使用该含自适应动态图卷积的GRU单元构成GRU编码器-解码器预测模型,模型结构示意图参照图3。Specifically, the length of the GRU encoder is 12 equal to P, the length of the GRU decoder is 12 equal to Q, and the number of layers of the encoder-decoder structure is 2, and the GRU unit containing the adaptive dynamic graph convolution is used to form the GRU encoding The decoder-decoder prediction model is shown in Figure 3 for a schematic diagram of the model structure.
S5、基于预处理历史交通数据对自适应动态图卷积预测模型进行训练,得到训练完成的预测模型;S5. Train the adaptive dynamic graph convolution prediction model based on the preprocessed historical traffic data, and obtain the trained prediction model;
基于计划采样方式,以概率ε使用历史交通流特征真实值为输入,以1-ε的概率使用前一时间步的输出估计值作为输入,对自适应动态图卷积预测模型中的解码器进行训练,得到训练完成的预测模型。Based on the planned sampling method, the actual value of historical traffic flow features is used as input with probability ε, and the output estimated value of the previous time step is used as input with probability 1-ε. Train to get the trained prediction model.
具体地,训练模型时每个样本中序列的前12个“交通特征-时段索引对”输入到模型中的编码器,后12个“交通特征-时段索引对”输入到模型中的解码器;采用最小化平均绝对误差(MAE)准则;采用Adam优化器;学习率起始值为0.01,在训练第20、30、40、50回合时以0.1的比率衰减;训练过程中第i次迭代时模型中的GRU解码器的计划采样概率εi由以下函数计算得到:Specifically, when training the model, the first 12 "traffic feature-period index pairs" of the sequence in each sample are input to the encoder in the model, and the last 12 "traffic feature-period index pairs" are input to the decoder in the model; The minimum mean absolute error (MAE) criterion is adopted; the Adam optimizer is adopted; the learning rate starts at 0.01, and decays at a rate of 0.1 at the 20th, 30th, 40th, and 50th rounds of training; during the ith iteration of the training process The planned sampling probability εi of the GRU decoder in the model is calculated by the following function:
其中τ取2000;where τ is taken as 2000;
基于模型输出与真值误差进行训练。模型采用的是GRU编码器-解码器结构:(1)训练的时候,产生的输入序列其实对应于编码器与解码器的两段。(2)编码器输入固定用第一段的输入,编码器只在最后一步的隐藏向量会输入到编码器中作为编码器第一步的初始隐藏向量,但没有模型的输出,解码器才有输出。(3)训练的时候,解码器每一步输入依概率进行选择,要么输入(1)所述输入序列第二段中对应于当前时间步的值,要么输入的是解码器前一个时间步的输出预测/估计值。Train based on model output and ground truth error. The model adopts the GRU encoder-decoder structure: (1) During training, the generated input sequence actually corresponds to the two segments of the encoder and the decoder. (2) The input of the encoder is fixed with the input of the first segment. The hidden vector of the encoder only in the last step will be input to the encoder as the initial hidden vector of the first step of the encoder, but without the output of the model, the decoder can only output. (3) During training, the input of each step of the decoder is selected according to the probability, either the value corresponding to the current time step in the second segment of the input sequence (1) is input, or the output of the previous time step of the decoder is input. forecast/estimate value.
S6、将待测数据交通流数据输入至训练完成的预测模型,得到预测结果。S6. Input the traffic flow data of the data to be measured into the trained prediction model to obtain a prediction result.
下面结合图4对本发明的交通流预测性能作进一步描述:The traffic flow prediction performance of the present invention is further described below in conjunction with Fig. 4:
将本发明方法与现有典型的基于图卷积的交通预测方法的预测性能进行比较,所对比的方法包括:DCRNN(扩散卷积递归神经网络)模型、STGCN(时空图卷积网络)模型、Graph-WaveNet模型。其中,DCRNN模型采用固定的静态距离邻接关系图进行扩散图卷积,并结合编码器-解码器结构进行交通流预测;STGCN模型采用固定的静态距离邻接关系图以切比雪夫多项式的形式进行图卷积,并与1D-CNN时域卷积结合进行交通流预测;Graph-WaveNet模型在STGCN模型基础上,增加全时段共享的静态自适应邻接关系图进行图卷积,并结合多种尺度的空洞时域卷积进行交通流预测。附图4为预测性能对比图,展示了各方法对未来15分钟(3步)、30分钟(6步)、60分钟(12步)交通流预测的误差;其中MAE代表平均绝对误差,RMSE代表均方根误差,MAPE代表平均绝对百分比误差。可见本发明通过在不同时间点采用不同的自适应邻接图进行动态的图卷积,相比于基于固定静态邻接关系图与自适应静态邻接关系图的方法,获得了整体上更优的交通流预测准确性。The method of the present invention is compared with the prediction performance of the existing typical traffic prediction method based on graph convolution, and the compared methods include: DCRNN (diffusion convolutional recurrent neural network) model, STGCN (space-time graph convolutional network) model, Graph-WaveNet model. Among them, the DCRNN model uses a fixed static distance adjacency graph for diffusion graph convolution, and combines the encoder-decoder structure for traffic flow prediction; the STGCN model uses a fixed static distance adjacency graph in the form of Chebyshev polynomials. Convolution, and combined with 1D-CNN time domain convolution for traffic flow prediction; Graph-WaveNet model, based on STGCN model, adds a static adaptive adjacency graph shared at all times for graph convolution, and combines multiple scales of Atrous temporal convolution for traffic flow prediction. Figure 4 is a comparison chart of prediction performance, showing the error of each method for the traffic flow prediction in the next 15 minutes (3 steps), 30 minutes (6 steps) and 60 minutes (12 steps); where MAE stands for mean absolute error, RMSE stands for Root Mean Squared Error, MAPE stands for Mean Absolute Percentage Error. It can be seen that the present invention obtains an overall better traffic flow by using different adaptive adjacency graphs at different time points to perform dynamic graph convolution, compared with the methods based on fixed static adjacency graphs and adaptive static adjacency graphs prediction accuracy.
如图2所示,一种基于自适应动态图卷积的交通流预测系统,包括:As shown in Figure 2, a traffic flow prediction system based on adaptive dynamic graph convolution includes:
预处理模块,用于获取历史交通数据并对历史交通数据进行预处理,得到预处理历史交通数据;The preprocessing module is used to obtain the historical traffic data and preprocess the historical traffic data to obtain the preprocessed historical traffic data;
第一构建模块,用于获取交通节点的地理空间距离并构建静态邻接关系图;The first building module is used to obtain the geospatial distance of the traffic node and construct a static adjacency graph;
第二构建模块,用于对交通节点进行表征并构建自适应动态邻接关系图张量;The second building module is used to characterize the traffic nodes and construct an adaptive dynamic adjacency graph tensor;
模型构建模块,用于根据静态邻接关系图和自适应动态邻接关系图张量构建自适应动态图卷积预测模型;A model building module for constructing an adaptive dynamic graph convolution prediction model based on the static adjacency graph and the adaptive dynamic adjacency graph tensors;
训练模块,基于预处理历史交通数据对自适应动态图卷积预测模型进行训练,得到训练完成的预测模型;The training module trains the adaptive dynamic graph convolution prediction model based on the preprocessed historical traffic data, and obtains the trained prediction model;
预测模块,用于将待测数据交通流数据输入至训练完成的预测模型,得到预测结果。The prediction module is used to input the traffic flow data of the data to be measured into the trained prediction model to obtain the prediction result.
上述方法实施例中的内容均适用于本系统实施例中,本系统实施例所具体实现的功能与上述方法实施例相同,并且达到的有益效果与上述方法实施例所达到的有益效果也相同。The contents in the above method embodiments are all applicable to the present system embodiments, the specific functions implemented by the present system embodiments are the same as the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
一种基于自适应动态图卷积的交通流预测装置:A traffic flow prediction device based on adaptive dynamic graph convolution:
至少一个处理器;at least one processor;
至少一个存储器,用于存储至少一个程序;at least one memory for storing at least one program;
当所述至少一个程序被所述至少一个处理器执行,使得所述至少一个处理器实现如上所述一种基于自适应动态图卷积的交通流预测方法。When the at least one program is executed by the at least one processor, the at least one processor implements the above-mentioned traffic flow prediction method based on adaptive dynamic graph convolution.
上述方法实施例中的内容均适用于本装置实施例中,本装置实施例所具体实现的功能与上述方法实施例相同,并且达到的有益效果与上述方法实施例所达到的有益效果也相同。The contents in the above method embodiments are all applicable to the present device embodiments, the specific functions implemented by the present device embodiments are the same as the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
一种存储介质,其中存储有处理器可执行的指令,其特征在于:所述处理器可执行的指令在由处理器执行时用于实现如上所述一种基于自适应动态图卷积的交通流预测方法。A storage medium storing processor-executable instructions, wherein the processor-executable instructions, when executed by the processor, are used to implement the above-mentioned traffic based on adaptive dynamic graph convolution Flow prediction method.
上述方法实施例中的内容均适用于本存储介质实施例中,本存储介质实施例所具体实现的功能与上述方法实施例相同,并且达到的有益效果与上述方法实施例所达到的有益效果也相同。The contents in the above method embodiments are all applicable to the present storage medium embodiments, the specific functions implemented by the present storage medium embodiments are the same as the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments. same.
以上是对本发明的较佳实施进行了具体说明,但本发明创造并不限于所述实施例,熟悉本领域的技术人员在不违背本发明精神的前提下还可做作出种种的等同变形或替换,这些等同的变形或替换均包含在本申请权利要求所限定的范围内。The above is a specific description of the preferred implementation of the present invention, but the present invention is not limited to the described embodiments, and those skilled in the art can make various equivalent deformations or replacements without departing from the spirit of the present invention. , these equivalent modifications or substitutions are all included within the scope defined by the claims of the present application.
Claims (7)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210318281.XA CN114694379B (en) | 2022-03-29 | 2022-03-29 | Traffic flow prediction method and system based on self-adaptive dynamic graph convolution |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210318281.XA CN114694379B (en) | 2022-03-29 | 2022-03-29 | Traffic flow prediction method and system based on self-adaptive dynamic graph convolution |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114694379A true CN114694379A (en) | 2022-07-01 |
CN114694379B CN114694379B (en) | 2024-05-03 |
Family
ID=82140419
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210318281.XA Active CN114694379B (en) | 2022-03-29 | 2022-03-29 | Traffic flow prediction method and system based on self-adaptive dynamic graph convolution |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114694379B (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116245255A (en) * | 2023-03-30 | 2023-06-09 | 湖南大学 | An Online Spatiotemporal Traffic Flow Prediction Method |
CN117058886A (en) * | 2023-10-12 | 2023-11-14 | 安徽宇疆科技有限公司 | Beidou space-time data model based on third-order tensor and traffic flow analysis method |
CN118733852A (en) * | 2024-09-02 | 2024-10-01 | 威海润蓝水处理设备有限公司 | Visualization system and method for the whole production process of MVR scraper crystallizer |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111710154A (en) * | 2020-05-15 | 2020-09-25 | 湖州师范学院 | A method for predicting traffic flow on expressways |
CN111931905A (en) * | 2020-07-13 | 2020-11-13 | 江苏大学 | Graph convolution neural network model and vehicle track prediction method using same |
CN112766551A (en) * | 2021-01-08 | 2021-05-07 | 鹏城实验室 | Traffic prediction method, intelligent terminal and computer readable storage medium |
CN112801404A (en) * | 2021-02-14 | 2021-05-14 | 北京工业大学 | Traffic prediction method based on self-adaptive spatial self-attention-seeking convolution |
CN112863180A (en) * | 2021-01-11 | 2021-05-28 | 腾讯大地通途(北京)科技有限公司 | Traffic speed prediction method, device, electronic equipment and computer readable medium |
CN113362491A (en) * | 2021-05-31 | 2021-09-07 | 湖南大学 | Vehicle track prediction and driving behavior analysis method |
CN113487088A (en) * | 2021-07-06 | 2021-10-08 | 哈尔滨工业大学(深圳) | Traffic prediction method and device based on dynamic space-time diagram convolution attention model |
CN114220271A (en) * | 2021-12-21 | 2022-03-22 | 南京理工大学 | Traffic flow prediction method, equipment and storage medium based on dynamic spatiotemporal graph convolutional recurrent network |
-
2022
- 2022-03-29 CN CN202210318281.XA patent/CN114694379B/en active Active
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111710154A (en) * | 2020-05-15 | 2020-09-25 | 湖州师范学院 | A method for predicting traffic flow on expressways |
CN111931905A (en) * | 2020-07-13 | 2020-11-13 | 江苏大学 | Graph convolution neural network model and vehicle track prediction method using same |
CN112766551A (en) * | 2021-01-08 | 2021-05-07 | 鹏城实验室 | Traffic prediction method, intelligent terminal and computer readable storage medium |
CN112863180A (en) * | 2021-01-11 | 2021-05-28 | 腾讯大地通途(北京)科技有限公司 | Traffic speed prediction method, device, electronic equipment and computer readable medium |
CN112801404A (en) * | 2021-02-14 | 2021-05-14 | 北京工业大学 | Traffic prediction method based on self-adaptive spatial self-attention-seeking convolution |
CN113362491A (en) * | 2021-05-31 | 2021-09-07 | 湖南大学 | Vehicle track prediction and driving behavior analysis method |
CN113487088A (en) * | 2021-07-06 | 2021-10-08 | 哈尔滨工业大学(深圳) | Traffic prediction method and device based on dynamic space-time diagram convolution attention model |
CN114220271A (en) * | 2021-12-21 | 2022-03-22 | 南京理工大学 | Traffic flow prediction method, equipment and storage medium based on dynamic spatiotemporal graph convolutional recurrent network |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116245255A (en) * | 2023-03-30 | 2023-06-09 | 湖南大学 | An Online Spatiotemporal Traffic Flow Prediction Method |
CN117058886A (en) * | 2023-10-12 | 2023-11-14 | 安徽宇疆科技有限公司 | Beidou space-time data model based on third-order tensor and traffic flow analysis method |
CN118733852A (en) * | 2024-09-02 | 2024-10-01 | 威海润蓝水处理设备有限公司 | Visualization system and method for the whole production process of MVR scraper crystallizer |
CN118733852B (en) * | 2024-09-02 | 2024-12-13 | 威海润蓝水处理设备有限公司 | Visualization system and method for whole production process of MVR scraper crystallizer |
Also Published As
Publication number | Publication date |
---|---|
CN114694379B (en) | 2024-05-03 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111161535B (en) | Graph neural network traffic flow prediction method and system based on attention mechanism | |
CN111091233B (en) | Short-term wind power prediction modeling method for wind power plant | |
CN109583565B (en) | Flood prediction method based on attention model long-time and short-time memory network | |
CN114694379A (en) | Traffic flow prediction method and system based on self-adaptive dynamic graph convolution | |
CN111582551B (en) | Wind power plant short-term wind speed prediction method and system and electronic equipment | |
CN113610286A (en) | PM accounting for spatio-temporal correlations and meteorological factors2.5Concentration prediction method and device | |
CN113094357A (en) | Traffic missing data completion method based on space-time attention mechanism | |
CN111814956B (en) | A multi-task learning air quality prediction method based on multi-dimensional quadratic feature extraction | |
CN113411216B (en) | Network flow prediction method based on discrete wavelet transform and FA-ELM | |
CN113298131B (en) | Attention mechanism-based time sequence data missing value interpolation method | |
CN118132964B (en) | Soil space temperature and humidity prediction method, device, equipment, medium and program product | |
CN115343784A (en) | A local temperature prediction method based on seq2seq-attention model | |
CN118779582B (en) | Marine environment short-term prediction method and system based on condition countermeasure network | |
CN113112791A (en) | Traffic flow prediction method based on sliding window long-and-short term memory network | |
CN113627676B (en) | Traffic prediction method and system based on multi-attention causal relationship | |
CN114841072A (en) | Differential fusion Transformer-based time sequence prediction method | |
CN115759461A (en) | Internet of things-oriented multivariate time sequence prediction method and system | |
CN116170351B (en) | A Network Traffic Prediction Method Based on Spatio-Temporal Graph Attention Mechanism | |
CN117891007A (en) | A weather forecasting method based on time-varying graph neural network | |
CN118824409A (en) | A soft-sensing method for sewage effluent index BOD5 based on Transformer and long short-term memory network | |
CN118194139B (en) | Spatio-temporal data prediction method based on adaptive graph learning and nerve controlled differential equation | |
CN115879375A (en) | Water quality index prediction method based on hybrid bidirectional long-time and short-time memory neural network | |
CN113469331B (en) | Vehicle exhaust gas prediction method and system based on global and local spatiotemporal graph convolution | |
CN118399378A (en) | Method, apparatus, device, storage medium and program product for predicting generated power | |
CN117195958A (en) | Surface sea current prediction method based on attention mechanism TCN-LSTM model |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |