[go: up one dir, main page]

CN110599236A - Short-time parking demand prediction method based on GRU model - Google Patents

Short-time parking demand prediction method based on GRU model Download PDF

Info

Publication number
CN110599236A
CN110599236A CN201910751621.6A CN201910751621A CN110599236A CN 110599236 A CN110599236 A CN 110599236A CN 201910751621 A CN201910751621 A CN 201910751621A CN 110599236 A CN110599236 A CN 110599236A
Authority
CN
China
Prior art keywords
model
parking
gru
data
layer
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.)
Pending
Application number
CN201910751621.6A
Other languages
Chinese (zh)
Inventor
李林波
李杨
王文璇
何思远
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tongji University
Original Assignee
Tongji University
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Tongji University filed Critical Tongji University
Priority to CN201910751621.6A priority Critical patent/CN110599236A/en
Publication of CN110599236A publication Critical patent/CN110599236A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/084Backpropagation, e.g. using gradient descent
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q30/00Commerce
    • G06Q30/02Marketing; Price estimation or determination; Fundraising
    • G06Q30/0201Market modelling; Market analysis; Collecting market data
    • G06Q30/0202Market predictions or forecasting for commercial activities
    • GPHYSICS
    • G08SIGNALLING
    • G08GTRAFFIC CONTROL SYSTEMS
    • G08G1/00Traffic control systems for road vehicles
    • G08G1/01Detecting movement of traffic to be counted or controlled
    • G08G1/0104Measuring and analyzing of parameters relative to traffic conditions
    • G08G1/0125Traffic data processing
    • G08G1/0129Traffic data processing for creating historical data or processing based on historical data

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Accounting & Taxation (AREA)
  • Data Mining & Analysis (AREA)
  • Development Economics (AREA)
  • Finance (AREA)
  • Strategic Management (AREA)
  • Computing Systems (AREA)
  • Evolutionary Computation (AREA)
  • Software Systems (AREA)
  • Mathematical Physics (AREA)
  • General Engineering & Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Computational Linguistics (AREA)
  • Entrepreneurship & Innovation (AREA)
  • General Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Marketing (AREA)
  • Game Theory and Decision Science (AREA)
  • Economics (AREA)
  • General Business, Economics & Management (AREA)
  • Chemical & Material Sciences (AREA)
  • Analytical Chemistry (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)
  • Traffic Control Systems (AREA)

Abstract

本发明公开了一种基于GRU模型的短时停车需求预测方法,包括以下步骤:1)获得停车场设施的历史数据,对历史数据进行处理,得到各时间点上的泊位占有率数据。2)利用深度学习Keras框架包,设定GRU神经网络结构,利用Keras包中GridSearch函数获得模型最优参数。3)利用训练集数据训练GRU模型,保存该模型并预测下一个步长的泊位占有率。与现有技术相比,本发明在获取连续停车数据的背景下利用大数据处理技术以及应用深度学习最新的算法,提出了更先进以及更精确的停车信息诱导发布方法,其不仅可以考虑停车需求在时间维度上的关联性,同时其细胞模块有着更简介的控制门结构,能够很大程度上提高训练效率,从而提高停车设施的利用率,提升有泊车需求用户的满意度,同时避免用户的不必要交通,减轻道路的交通压力,还利于交通管理部门在车流高峰时期进行有效的交通管控。

The invention discloses a short-term parking demand prediction method based on a GRU model, comprising the following steps: 1) obtaining historical data of parking lot facilities, processing the historical data, and obtaining berth occupancy data at each time point. 2) Use the deep learning Keras framework package, set the GRU neural network structure, and use the GridSearch function in the Keras package to obtain the optimal parameters of the model. 3) Use the training set data to train the GRU model, save the model and predict the berth occupancy rate of the next step. Compared with the prior art, the present invention uses big data processing technology and the latest algorithm of deep learning under the background of obtaining continuous parking data, and proposes a more advanced and accurate parking information induction release method, which can not only consider the parking demand The correlation in the time dimension, and its cell module has a simpler control gate structure, which can greatly improve the training efficiency, thereby improving the utilization rate of parking facilities, improving the satisfaction of users with parking needs, and avoiding users unnecessary traffic, reduce the traffic pressure on the road, and also help the traffic management department to carry out effective traffic control during the peak period of traffic flow.

Description

一种基于GRU模型的短时停车需求预测方法A Short-term Parking Demand Prediction Method Based on GRU Model

技术领域technical field

本发明涉及一种停车需求预测方法,尤其是涉及一种基于GRU模型的短时停车需求预测方法。The invention relates to a parking demand forecasting method, in particular to a short-term parking demand forecasting method based on a GRU model.

背景技术Background technique

汽车产业的快速发展与城市空间资源的有限构成严重冲突,供需矛盾日益尖锐,停车难问题成为了各大城市的挑战。停车诱导系统(PGS)是缓解交通拥堵的有效办法,但停车需求短时精准预测作为空余车位发布的关键技术并没有得到有效解决。现有的诱导信息在使用过程中会出现诱导信息显示不准确的问题,驾驶人看到诱导信息显示还有车位,但当到达停车场时却显示已经没有停车位,尤其是在高峰时期,空余车位的变化很大。为了避免司机无效绕行,因此对诱导信息的精确度提出了更高的要求。如何能够利用停车需求短时预测技术在诱导信息屏上显示更准确的空余车位数信息。传统的停车需求预测方法与技术主要体现在规划层面,停车精细化管理作为有效提升停车效能的关键路径,对于停车需求短时预测技术也提出了高标准要求。The rapid development of the automobile industry is in serious conflict with the limited urban space resources, the contradiction between supply and demand is becoming increasingly acute, and the problem of difficult parking has become a challenge for major cities. Parking Guidance System (PGS) is an effective way to alleviate traffic congestion, but the short-term accurate prediction of parking demand as a key technology for the release of vacant parking spaces has not been effectively resolved. During the use of the existing guidance information, there will be a problem that the guidance information display is inaccurate. When the driver sees the guidance information, it shows that there are still parking spaces, but when they arrive at the parking lot, it shows that there are no parking spaces, especially during peak hours. Parking spaces vary greatly. In order to avoid invalid detours for drivers, higher requirements are put forward for the accuracy of guidance information. How to use the parking demand short-term prediction technology to display more accurate vacant parking information on the guidance information screen. Traditional parking demand forecasting methods and technologies are mainly reflected in the planning level. As the key path to effectively improve parking efficiency, refined parking management also puts forward high standards for short-term parking demand forecasting technology.

在停车需求短时预测方面的研究,预测方法主要分为以下几种:一是传统的时间序列预测方法,其主要包括ARIMA(Autoregressive Integrated Moving Average Model)、考虑时空相关性的多元自回归预测模型、马尔科夫模型、卡尔曼滤波模型。二是机器学习中的算法,大多数研究采用较多的是较为简单的BP神经网络。由于采用单一的预测模型难以提高泊位占有率的预测精度,不少学者提出了组合预测模型的方法来提高预测精度,例如模糊神经网络预测方法、结合小波分析以及马尔科夫链有效泊位占有率短时预测方法、基于混沌和BP神经网络的复合预测方法、基于小波变换的神经网络改进方法等。根据以往的研究,这些方法的精度不能满足停车场精细化管理对于停车需求预测的要求,因此,需要探究一种准确率更高的机器学习算法。GRU模型即Gated Recurrent Unit,该模型是由Cho、van Merrienboer、 Bahdanau和Bengio在2014年提出,GRU模型是LSTM模型的一个变体,与LSTM 相比,少一个门控,保持了LSTM的效果同时又使结构更加简单。Research on short-term forecasting of parking demand, the forecasting methods are mainly divided into the following categories: one is the traditional time series forecasting method, which mainly includes ARIMA (Autoregressive Integrated Moving Average Model), multivariate autoregressive forecasting model considering spatio-temporal correlation , Markov model, Kalman filter model. The second is the algorithm in machine learning. Most studies use more simple BP neural network. Because it is difficult to improve the prediction accuracy of berth occupancy by using a single prediction model, many scholars have proposed a method of combining prediction models to improve prediction accuracy, such as fuzzy neural network prediction method, combined with wavelet analysis and Markov chain effective berth occupancy rate is short Time prediction method, compound prediction method based on chaos and BP neural network, improved neural network method based on wavelet transform, etc. According to previous studies, the accuracy of these methods cannot meet the requirements of refined management of parking lots for parking demand prediction. Therefore, it is necessary to explore a machine learning algorithm with higher accuracy. The GRU model is the Gated Recurrent Unit. This model was proposed by Cho, van Merrienboer, Bahdanau and Bengio in 2014. The GRU model is a variant of the LSTM model. Compared with LSTM, there is one less gate, which maintains the effect of LSTM while It also makes the structure simpler.

更新门(z_t)用于控制前一时刻的状态信息被带入到当前状态中的程度,更新门的值越大说明前一时刻的状态信息带入越多。The update gate (z_t) is used to control the degree to which the state information of the previous moment is brought into the current state. The larger the value of the update gate, the more state information of the previous moment is brought in.

重置门(r_t)用于控制前一状态有多少信息被写入到当前的候选集h_t上,重置门的值越小说明前一状态的信息被写入的越少。The reset gate (r_t) is used to control how much information in the previous state is written into the current candidate set h ~ _t. The smaller the value of the reset gate, the less information in the previous state is written.

GRU前向传播公式如下:The GRU forward propagation formula is as follows:

rt=σ(Wr·[ht-1,xt])r t =σ(W r ·[h t-1 ,x t ])

zt=σ(Wz·[ht-1,xt])z t =σ(W z ·[h t-1 ,x t ])

yt=σ(Wo·ht)y t = σ(W o h t )

其中,[]表示两个向量相连,*表示矩阵的乘积。Among them, [] indicates that two vectors are connected, and * indicates the product of matrices.

GRU训练公式如下:The GRU training formula is as follows:

需要学习的参数包括:Wr、WzWo,前三个参数都是拼接的,在学习时需要分割出来:The parameters to be learned include: W r , W z , W o , the first three parameters are concatenated and need to be separated during learning:

Wr=Wrx+Wrh W r =W rx +W rh

Wz=Wzx+Wzh W z = W z x +W zh

输出层的输入: Input to the output layer:

输出层的输出: The output of the output layer:

在得到最终的输出后,就可以写出网络传递的损失,单个样本某时刻的损失为:After the final output is obtained, the loss transmitted by the network can be written. The loss of a single sample at a certain moment is:

则单个样本的在所有时刻的损失为:Then the loss of a single sample at all times is:

采用后向误差传播算法来学习网络,损失函数对各参数的偏导公式如下,在获得各参数的偏导后,可以不断更新参数。The backward error propagation algorithm is used to learn the network. The partial derivative formula of the loss function for each parameter is as follows. After obtaining the partial derivative of each parameter, the parameters can be continuously updated.

中间参数: Intermediate parameters:

δt=δh,t·zt·φ′δ t = δ h,t z t φ′

发明内容Contents of the invention

本发明的目的就是为了克服上述现有技术存在的缺陷而提供一种基于GRU模型的短时停车需求预测方法。The object of the present invention is to provide a short-term parking demand prediction method based on the GRU model in order to overcome the above-mentioned defects in the prior art.

本发明的目的可以通过以下技术方案来实现:The purpose of the present invention can be achieved through the following technical solutions:

一种基于分区的停车场精细化管理方法,主要包括以下步骤:A partition-based fine-grained parking lot management method mainly includes the following steps:

1.一种基于GRU模型的短时停车需求预测方法,其特征在于,包括以下步骤:1. a short-term parking demand prediction method based on GRU model, is characterized in that, comprises the following steps:

1)获得停车设施的历史数据,对历史数据进行处理,得到各时间点上的泊位占有率数据。1) Obtain historical data of parking facilities, process the historical data, and obtain berth occupancy data at each time point.

2)利用深度学习Keras框架包,设定GRU神经网络结构,利用Keras包中GridSearch函数获得最优参数。2) Use the deep learning Keras framework package to set the GRU neural network structure, and use the GridSearch function in the Keras package to obtain the optimal parameters.

3)利用训练集数据训练GRU模型,保存该模型并预测下一个步长的泊位占有率。3) Use the training set data to train the GRU model, save the model and predict the berth occupancy rate of the next step.

所述的步骤1)具体为:Described step 1) is specifically:

S1.1,根据历史数据的原始字段信息(一辆车进入以及离去停车设施的具体时间点),通过Python中Panads包中的Resample函数获得各时间点上进入以及离去停车设施的车辆数,通过调整Resample函数中采样频率(60分或者30分或15 分钟或5分钟或1分钟等),可以获得不同时间尺度上驶入驶离车辆数。S1.1, according to the original field information of historical data (the specific time point when a vehicle enters and leaves the parking facility), the number of vehicles entering and leaving the parking facility at each time point is obtained through the Resample function in the Panads package in Python , by adjusting the sampling frequency in the Resample function (60 minutes or 30 minutes or 15 minutes or 5 minutes or 1 minute, etc.), the number of vehicles entering and leaving on different time scales can be obtained.

S1.2,利用所述Panads包中的Concat函数将驶入以及驶离的Series按照索引进行合并,得到DataFrame形式的数据。计算出起始时刻在场车辆数,则后一时刻的在场车辆数=上一时刻在场车辆数+驶入车辆数-驶离车辆数。在DataFrame中新建两列,通过循环遍历,一列为各时间尺度上的在场车辆数,一列为各时间尺度上的泊位占有率。S1.2, using the Concat function in the Panads package to merge the incoming and outgoing Series according to the index to obtain data in the form of DataFrame. Calculate the number of vehicles on the scene at the initial moment, then the number of vehicles on the scene at the next moment = the number of vehicles on the scene at the previous moment + the number of vehicles entering - the number of vehicles leaving. Create two new columns in the DataFrame, and through loop traversal, one column is the number of vehicles present on each time scale, and the other column is the berth occupancy rate on each time scale.

所述的步骤2)具体为:Described step 2) is specifically:

S2.1,为了防止模型产生过拟合以及欠拟合,将获取得到的历史数据集划分为训练集、验证集合测试集,验证集可以用于调整模型的超参数和用于对模型的能力进行初步评估。S2.1, in order to prevent the model from overfitting and underfitting, the obtained historical data set is divided into a training set and a verification set test set. The verification set can be used to adjust the hyperparameters of the model and the ability of the model Make an initial assessment.

S2.2,设定GRU神经网络的结构:第一层为GRU层,第二层为Bidirectional— GRU,第三层为全连接层、第四层为输出层。S2.2, set the structure of the GRU neural network: the first layer is the GRU layer, the second layer is the Bidirectional-GRU, the third layer is the fully connected layer, and the fourth layer is the output layer.

S2.3,为了评估模型预测精度,将Root Mean Square Error(RMSE)作为优化目标函数;优化器选取为RMSprop;采用激活函数relu;拟合训练集时,将shuffling 设置为false。S2.3, in order to evaluate the prediction accuracy of the model, Root Mean Square Error (RMSE) is used as the optimization objective function; the optimizer is selected as RMSprop; the activation function relu is used; when fitting the training set, shuffling is set to false.

S2.4,通过GridSearch网格搜索,在所有候选的参数选择中,通过循环遍历,尝试每一种可能性,表现最好的参数就是最终的结果。需要进行搜索的参数有 Lookback、各层神经元个数、学习率等。S2.4, through GridSearch grid search, in all candidate parameter selections, through loop traversal, try every possibility, the parameter with the best performance is the final result. The parameters that need to be searched include Lookback, the number of neurons in each layer, and the learning rate.

所述的步骤3)具体为:Described step 3) specifically is:

S3.1,在训练好模型之后,利用keras包中的model.save()方法将模型训练的结构保持在本地,文件类型为.h5。S3.1, after training the model, use the model.save() method in the keras package to keep the structure of the model training locally, and the file type is .h5.

S3.2,在实际的停车诱导系统中,要获得下一时刻的预测泊位占有率时,只需要采用model.load()方法读取训练好的模型。S3.2, in the actual parking guidance system, to obtain the predicted berth occupancy rate at the next moment, only need to use the model.load() method to read the trained model.

S3.3,当采集了新的一周或者一个月的历史数据,可重新训练GRU模型,保存最新的模型训练结果。S3.3, when a new week or month of historical data is collected, the GRU model can be retrained to save the latest model training results.

与现有技术相比,本发明在现有技术的基础上,与现有技术相比,本发明在现有技术的基础上,从精细化停车管理的角度出发,针对停车场诱导信息的发布提出基于GRU模型的短时停车需求预测方法。本发明在充分获取停车数据的背景下利用大数据和机器学习的方法,提出更精确的信息诱导发布方法,提高为停车用户的服务水平,提升用户的满意度,同时避免用户的不必要交通,减轻道路的交通压力。Compared with the prior art, the present invention is based on the prior art, and from the perspective of refined parking management, it aims at the release of parking lot induction information A short-term parking demand prediction method based on the GRU model is proposed. The present invention uses big data and machine learning methods under the background of fully obtaining parking data to propose a more accurate information induction release method, improve the service level for parking users, improve user satisfaction, and avoid unnecessary traffic for users at the same time. Reduce traffic pressure on the road.

本发明具有以下优点:The present invention has the following advantages:

1)GRU模型具有在时间维度上学习时间序列数据的能力,从而能考虑输入样本在时间维度上的相关性,从而能提高预测精度。1) The GRU model has the ability to learn time series data in the time dimension, so that it can consider the correlation of input samples in the time dimension, thereby improving the prediction accuracy.

2)GRU模型不仅能提供较高预测精度,同时其细胞模块有着更简介的控制门结构,从而能更容易进行训练,能够很大程度上提高训练效率。2) The GRU model can not only provide higher prediction accuracy, but also its cell module has a simpler control gate structure, which makes it easier to train and greatly improves the training efficiency.

附图说明Description of drawings

图1为本发明基于GRU模型的短时停车需求预测方法逻辑图;Fig. 1 is the logic diagram of the short-term parking demand prediction method based on the GRU model of the present invention;

图2为本发明中GRU细胞结构;Fig. 2 is GRU cell structure among the present invention;

图3为本发明在一个实施例中工作日停车需求日变图;Fig. 3 is a daily change chart of parking demand on weekdays in one embodiment of the present invention;

图4为本发明在一个实施例中训练模型的迭代损失曲线;Fig. 4 is the iterative loss curve of training model in one embodiment of the present invention;

图5为本发明在一个实施例中进行预测效果图。Fig. 5 is a prediction effect diagram in an embodiment of the present invention.

具体实施方式Detailed ways

下面结合附图和具体实施例对本发明进行详细说明。本实施例以本发明技术方案为前提进行实施,给出了详细的实施方式和具体的操作过程,但本发明的保护范围不限于下述的实施例。The present invention will be described in detail below in conjunction with the accompanying drawings and specific embodiments. This embodiment is carried out on the premise of the technical solution of the present invention, and detailed implementation and specific operation process are given, but the protection scope of the present invention is not limited to the following embodiments.

实施例Example

如图1所示,一种基于GRU模型的短时停车需求预测方法包括以下流程:首先获得停车场设施的历史数据,对历史数据进行处理,得到各时间点上的泊位占有率数据;其次,利用深度学习Keras框架包,设定GRU神经网络结构,利用Keras 包中GridSearch函数获得最优参数;最后,利用训练集数据训练GRU模型,保存该模型并预测下一个步长的泊位占有率。实施例中GRU细胞结构如图2所示。细胞结构的输入分别为上一时刻细胞的输出值ht-1以及这一时刻的观测泊位占有率值 xt,图中的zt与rt分别表示更新门以及重置门,更新门用于控制前一时刻的状态信息被带入到当前状态中的程度,更新门的值越大说明前一时刻的状态信息带入越多。重置门控制前一状态有多少信息被写入到当前的候选集上,重置门越小,前一状态的信息被写入的越少。As shown in Figure 1, a short-term parking demand forecasting method based on the GRU model includes the following process: First, obtain the historical data of the parking lot facility, process the historical data, and obtain the berth occupancy data at each time point; secondly, Using the deep learning Keras framework package, set the GRU neural network structure, and use the GridSearch function in the Keras package to obtain the optimal parameters; finally, use the training set data to train the GRU model, save the model and predict the berth occupancy rate of the next step. The GRU cell structure in the embodiment is shown in FIG. 2 . The input of the cell structure is the output value h t-1 of the cell at the previous moment and the observed berth occupancy value x t at this moment. The z t and r t in the figure represent the update gate and the reset gate respectively. The update gate uses It controls the extent to which the state information at the previous moment is brought into the current state. The larger the value of the update gate, the more state information at the previous moment is brought in. The reset gate controls how much information from the previous state is written to the current candidate set On the other hand, the smaller the reset gate is, the less information from the previous state is written.

本实施例具体方法如下:The concrete method of this embodiment is as follows:

(1)数据预处理(1) Data preprocessing

具体包括以下步骤:Specifically include the following steps:

步骤一:根据历史数据的原始字段信息,统计每辆车进入以及离去停车设施的具体时间点,通过Python中Panads包中的Resample函数获得各时间点上进入以及离去停车设施的车辆数,将Resample函数中的采样频率设置为10分钟,以10 分钟的时间尺度上统计驶入驶离车辆数。本发明选取某商业停车设施为实施例,车位数量为420个,获取的停车数据日期为2018.11.1-2018.11.30,具体停车数据包含的信息如表1所示。Step 1: According to the original field information of historical data, count the specific time points when each vehicle enters and leaves the parking facility, and obtain the number of vehicles entering and leaving the parking facility at each time point through the Resample function in the Panads package in Python. Set the sampling frequency in the Resample function to 10 minutes, and count the number of vehicles entering and leaving on a time scale of 10 minutes. The present invention selects a commercial parking facility as an example, the number of parking spaces is 420, and the date of the acquired parking data is 2018.11.1-2018.11.30. The information contained in the specific parking data is shown in Table 1.

表1 停车场数据字段信息Table 1 Parking lot data field information

步骤二:利用Panads包中的Concat函数将驶入以及驶离的Series按照索引进行合并,得到DataFrame形式的数据。计算出起始时刻在场车辆数,则后一时刻的在场车辆数=上一时刻在场车辆数+驶入车辆数-驶离车辆数。在DataFrame中新建两列,通过循环遍历,一列为各时间尺度上的在场车辆数,一列为各时间尺度上的泊位占有量。Step 2: Use the Concat function in the Panads package to merge the incoming and outgoing Series according to the index to obtain data in the form of DataFrame. Calculate the number of vehicles on the scene at the initial moment, then the number of vehicles on the scene at the next moment = the number of vehicles on the scene at the previous moment + the number of vehicles entering - the number of vehicles leaving. Create two new columns in the DataFrame, through loop traversal, one column is the number of vehicles present on each time scale, and the other column is the number of berth occupancy on each time scale.

步骤三:实施例中场车辆数的数据选取时间段为6:00-22:00,一天共97个数据点,保留工作日以及非工作日的数据,其数据样式如表2所示,工作日停车需求日变图如图3所示。Step 3: The data selection time period of the number of vehicles in the middle field of the embodiment is 6:00-22:00, a total of 97 data points in one day, and the data of working days and non-working days are reserved. The data format is as shown in Table 2. Working The daily variation of parking demand is shown in Figure 3.

表2 泊位占有量表格Table 2 Berth occupancy table

(2)GRU神经网络搭建(2) GRU neural network construction

具体包括以下步骤:Specifically include the following steps:

步骤一:为了防止模型产生过拟合以及欠拟合,将获取得到的历史数据集划分为训练集、验证集合测试集,验证集可以用于调整模型的超参数和用于对模型的能力进行初步评估。以2018年11月1日至2018年11月25日的历史数据为训练集,以2018年11月25日至2018年11月27日为验证集,以2018年11月28日至 2018年11月30日为测试集。Step 1: In order to prevent the model from overfitting and underfitting, the obtained historical data set is divided into a training set and a verification set test set. The verification set can be used to adjust the hyperparameters of the model and to test the ability of the model. Preliminary assessment. Take the historical data from November 1, 2018 to November 25, 2018 as the training set, take the data from November 25, 2018 to November 27, 2018 as the verification set, and use the historical data from November 28, 2018 to November 2018 30th is the test set.

步骤二:为了提高预测精度,将原始泊位占有量数据标准化,利用Sklearn包中的StandardScaler()函数将数据标准化到-1至1区间内,以及利用inverse_transform方法还原数据。Step 2: In order to improve the prediction accuracy, standardize the original berth occupancy data, use the StandardScaler() function in the Sklearn package to standardize the data to the interval from -1 to 1, and use the inverse_transform method to restore the data.

步骤三:设定GRU神经网络的结构:第一层为GRU层,第二层为 Bidirectional—GRU,第三层为全连接层、第四层为输出层。Step 3: Set the structure of the GRU neural network: the first layer is the GRU layer, the second layer is Bidirectional-GRU, the third layer is the fully connected layer, and the fourth layer is the output layer.

步骤四:为了评估模型预测精度,将Root Mean Square Error(RMSE)作为优化目标函数;优化器选取为RMSprop;采用激活函数Relu;拟合训练集时,将Shuffling 设置为false。Step 4: In order to evaluate the prediction accuracy of the model, Root Mean Square Error (RMSE) is used as the optimization objective function; the optimizer is selected as RMSprop; the activation function Relu is used; when fitting the training set, Shuffling is set to false.

步骤五:通过GridSearch网格搜索,在所有候选的参数选择中,通过循环遍历,尝试每一种可能性,表现最好的参数就是最终的结果,需要进行搜索的参数有 Lookback、各层神经元个数、学习率等。Step 5: Through GridSearch grid search, among all candidate parameter selections, through loop traversal, try every possibility, the parameter with the best performance is the final result, the parameters that need to be searched include Lookback, each layer of neurons number, learning rate, etc.

步骤六:最终得到模型的最优参数:Lookback=40,第一层GRU细胞数为60,第二层Bidirectional—GRU细胞数为60,第三层全连接层细胞数为60,第四层输入层细胞数为1,学习率为0.01迭代20次,batchsize为10。实施例中训练模型的迭代损失曲线如图4所示。Step 6: Finally, the optimal parameters of the model are obtained: Lookback=40, the number of GRU cells in the first layer is 60, the number of Bidirectional-GRU cells in the second layer is 60, the number of cells in the third layer of fully connected layer is 60, and the number of cells in the fourth layer is input The number of cells in the layer is 1, the learning rate is 0.01 and iterated 20 times, and the batchsize is 10. The iterative loss curve of the training model in the embodiment is shown in FIG. 4 .

(3)模型保存及预测(3) Model preservation and prediction

步骤一:在训练好模型之后,利用keras包中的model.save()方法将模型训练的结构保持在本地,文件命名为为ziyangli.h5。在实际的停车诱导系统中,只需要采用model.load()方法读取训练好的模型,然后进行实时预测即可。Step 1: After training the model, use the model.save() method in the keras package to keep the structure of the model training locally, and the file is named ziyangli.h5. In the actual parking guidance system, you only need to use the model.load() method to read the trained model, and then perform real-time prediction.

步骤二:当采集了新的一周或者一个月的历史数据,可重新训练GRU模型,,按照上述步骤,保存模型最终的训练结果,进行预测。Step 2: When a new week or month of historical data is collected, the GRU model can be retrained. Follow the above steps to save the final training results of the model for prediction.

(6)预测结果(6) Forecast results

以2018.11.30的预测结果为例,从表3可以看出预测结果与真实值的对比。Taking the prediction result of 2018.11.30 as an example, the comparison between the prediction result and the real value can be seen from Table 3.

表3 2018.11.30预测值与真实值对比Table 3 2018.11.30 Comparison of predicted value and real value

序号serial number 真实值actual value 预测值Predictive value 序号serial number 真实值actual value 预测值Predictive value 序号serial number 真实值actual value 预测值Predictive value 00 272272 270270 3333 281281 280280 6666 260260 263263 11 270270 272272 3434 283283 280280 6767 257257 258258 22 269269 269269 3535 287287 283283 6868 256256 255255 33 262262 267267 3636 292292 289289 6969 248248 255255 44 262262 259259 3737 292292 294294 7070 242242 246246 55 262262 261261 3838 295295 292292 7171 239239 240240 66 256256 262262 3939 296296 295295 7272 239239 239239 77 249249 254254 4040 296296 296296 7373 232232 240240 88 247247 246246 4141 299299 295295 7474 230230 231231 99 248248 246246 4242 300300 300300 7575 232232 230230 1010 247247 249249 4343 303303 301301 7676 229229 234234 1111 245245 247247 4444 300300 304304 7777 228228 230230 1212 247247 244244 4545 303303 299299 7878 222222 229229 1313 246246 248248 4646 297297 303303 7979 223223 222222 1414 245245 246246 4747 297297 295295 8080 219219 225225 1515 243243 244244 4848 294294 295295 8181 217217 220220 1616 245245 242242 4949 288288 293293 8282 207207 218218 1717 259259 246246 5050 288288 285285 8383 207207 204204 1818 262262 265265 5151 285285 286286 8484 205205 212212 1919 266266 265265 5252 286286 284284 8585 204204 205205 2020 261261 265265 5353 288288 285285 8686 198198 208208 21twenty one 261261 259259 5454 285285 289289 8787 196196 195195 22twenty two 259259 260260 5555 285285 284284 8888 192192 201201 23twenty three 256256 258258 5656 284284 283283 8989 188188 189189 24twenty four 260260 254254 5757 283283 283283 9090 186186 189189 2525 263263 261261 5858 280280 282282 9191 182182 186186 2626 263263 265265 5959 273273 278278 9292 179179 180180 2727 272272 26232623 6060 268268 269269 9393 175175 179179 2828 274274 277277 6161 267267 265265 9494 171171 173173 2929 275275 276276 6262 264264 266266 9595 165165 170170 3030 277277 273273 6363 265265 263263 9696 162162 161161 3131 279279 277277 6464 264264 264264 9797 160160 161161 3232 280280 280280 6565 264264 263263 102102 154154 152 152

实施例中2018.11.28-2018.11.30的预测结果如图5所示。可以看出,在对停车需求进行短期预测时,GRU神经网络能提供较高的预测精度,其MAE仅为3.40, MAPE仅为1.32%。The prediction results of 2018.11.28-2018.11.30 in the embodiment are shown in Figure 5. It can be seen that in the short-term prediction of parking demand, GRU neural network can provide higher prediction accuracy, its MAE is only 3.40, and MAPE is only 1.32%.

Claims (4)

1. A short-time parking demand prediction method based on a GRU model is characterized by comprising the following steps:
1) and obtaining historical data of the parking facility, and processing the historical data to obtain parking space occupancy data at each time point.
2) And setting a GRU neural network structure by using a deep learning Keras framework package, and obtaining optimal parameters by using a GridSearch function in the Keras package.
3) And training the GRU model by using the training set data, storing the GRU model and predicting the occupancy of the berthage of the next step length.
2. The method for predicting the demand for short-term parking based on the GRU model as claimed in claim 1, wherein the step 1) is specifically as follows:
s1.1, obtaining the number of vehicles entering and leaving the parking facility at each time point through a repeat function in a Panads package in Python according to original field information (specific time points of a vehicle entering and leaving the parking facility) of historical data, and obtaining the number of vehicles entering and leaving the parking facility at different time scales by adjusting sampling frequency (60 minutes, 30 minutes, 15 minutes, 5 minutes, 1 minute and the like) in the repeat function.
S1.2, merging the entering and leaving Series according to the index by using the Concat function in the Panads package to obtain data in a DataFrame form. And calculating the number of the vehicles present at the initial moment, wherein the number of the vehicles present at the later moment is equal to the number of the vehicles present at the last moment, the number of the vehicles entering the train and the number of the vehicles leaving the train. And newly building two columns in the DataFrame, wherein one column is the number of the vehicles in the field on each time scale through cyclic traversal, and the other column is the occupancy rate of the berth on each time scale.
S1.3, in order to improve the prediction accuracy, the original berthage-occupying capacity data is standardized, and the data is standardized to a range from-1 to 1 by using a StandardScaler () function in a Sklearn packet. And finally restoring the data by using an inverse _ transform method.
3. The method for predicting the demand for short-term parking based on the GRU model as claimed in claim 1, wherein the step 2) is specifically as follows:
s2.1, in order to prevent the model from generating overfitting and under-fitting, dividing the acquired historical data set into a training set, a verification set and a test set, wherein the verification set can be used for adjusting the hyper-parameters of the model and primarily evaluating the capability of the model, and the test set finally judges the prediction accuracy of the model.
S2.2, setting the structure of the GRU neural network: the first layer is a GRU layer, the second layer is a Bidirectional-GRU layer, the third layer is a full connection layer, and the fourth layer is an output layer.
S2.3, in order to evaluate the prediction accuracy of the model, using Root Mean Square Error (RMSE) as an optimization objective function; the optimizer selects RMSprop; adopting an activation function Relu; when fitting the training set, Shuffling is set to false.
S2.4, through GridSearch grid search, in all candidate parameter selections, each possibility is tried through loop traversal, the parameter which shows the best performance is the final result, and the well-trained GRU model is obtained.
The hyper-parameters needing to be searched mainly include a Lookback, the number of neurons in each layer, a learning rate and the like.
4. The method for predicting the demand for short-term parking based on the GRU model as claimed in claim 1, wherein the step 3) is specifically as follows:
s3.1, after the GRU model is trained, a model save () method in a keras package is used for keeping the model training structure in the local, and the file type is h5 (an efficient file storage format).
And S3.2, in an actual parking guidance system, when the predicted parking space occupancy at the next moment is to be obtained, only a model () method is adopted to read the trained model, and then prediction is carried out.
And S3.3, when new historical data of a week or a month is collected, the data can be imported again, the GRU model can be retrained again, and the latest model training result is stored.
CN201910751621.6A 2019-08-14 2019-08-14 Short-time parking demand prediction method based on GRU model Pending CN110599236A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910751621.6A CN110599236A (en) 2019-08-14 2019-08-14 Short-time parking demand prediction method based on GRU model

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910751621.6A CN110599236A (en) 2019-08-14 2019-08-14 Short-time parking demand prediction method based on GRU model

Publications (1)

Publication Number Publication Date
CN110599236A true CN110599236A (en) 2019-12-20

Family

ID=68854245

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910751621.6A Pending CN110599236A (en) 2019-08-14 2019-08-14 Short-time parking demand prediction method based on GRU model

Country Status (1)

Country Link
CN (1) CN110599236A (en)

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111210656A (en) * 2020-01-23 2020-05-29 北京百度网讯科技有限公司 Method and device for predicting free parking space of parking lot, electronic equipment and storage medium
CN111222704A (en) * 2020-01-10 2020-06-02 中国人民解放军国防科技大学 A Vehicle Position Prediction Method Based on Bi-GRU
CN111325382A (en) * 2020-01-23 2020-06-23 北京百度网讯科技有限公司 Method, device, electronic device and storage medium for predicting vacant parking space in parking lot
CN112101664A (en) * 2020-09-16 2020-12-18 哈尔滨工业大学 Multi-parameter atmospheric environment data generation method based on stacked LSTM-GRU
CN112309167A (en) * 2020-11-13 2021-02-02 河南观潮智能科技有限公司 Intelligent parking management system and parking method
CN112419711A (en) * 2020-10-22 2021-02-26 桂林电子科技大学 Prediction method of parking demand in closed parking lot based on improved GMDH algorithm
CN112529284A (en) * 2020-12-08 2021-03-19 湖南大学 Private car residence time prediction method, device and medium based on neural network
CN113052527A (en) * 2021-03-17 2021-06-29 渤海大学 Dynamic aquatic product decay monitoring and early warning method in cold chain transportation
CN113449780A (en) * 2021-06-15 2021-09-28 南京静态交通产业技术研究院 In-road berth occupancy prediction method based on random forest and LSTM neural network
CN113570866A (en) * 2021-09-24 2021-10-29 成都宜泊信息科技有限公司 Parking lot management method and system, storage medium and electronic equipment
CN113821547A (en) * 2021-08-26 2021-12-21 中山大学 Rapid and efficient short-term parking lot occupancy prediction method and system and storage medium
CN118824043A (en) * 2024-08-15 2024-10-22 深圳市德高智能系统有限公司 Intelligent parking guidance method, system and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107577662A (en) * 2017-08-08 2018-01-12 上海交通大学 Towards the semantic understanding system and method for Chinese text
CN109492817A (en) * 2018-11-16 2019-03-19 杭州电子科技大学 Following berth quantity required Forecasting Approach for Short-term in a kind of closed area
CN109822399A (en) * 2019-04-08 2019-05-31 浙江大学 Cutting tool for CNC machine state of wear prediction technique based on parallel deep neural network
CN109886459A (en) * 2019-01-16 2019-06-14 同济大学 A neural network-based parking demand forecasting method for public parking lots
CN109978228A (en) * 2019-01-31 2019-07-05 中南大学 A kind of PM2.5 concentration prediction method, apparatus and medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107577662A (en) * 2017-08-08 2018-01-12 上海交通大学 Towards the semantic understanding system and method for Chinese text
CN109492817A (en) * 2018-11-16 2019-03-19 杭州电子科技大学 Following berth quantity required Forecasting Approach for Short-term in a kind of closed area
CN109886459A (en) * 2019-01-16 2019-06-14 同济大学 A neural network-based parking demand forecasting method for public parking lots
CN109978228A (en) * 2019-01-31 2019-07-05 中南大学 A kind of PM2.5 concentration prediction method, apparatus and medium
CN109822399A (en) * 2019-04-08 2019-05-31 浙江大学 Cutting tool for CNC machine state of wear prediction technique based on parallel deep neural network

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
卢旭旺: "基于遗传算法与集成学习的停车位预测算法研究", 《中国优秀硕士学位论文全文数据库工程科技Ⅱ辑》 *
张国豪等: "采用CNN和Bidirectional GRU的时间序列分类研究", 《计算机科学与探索》 *
曹明: "Keras模型使用GridSearchCV自动调参", 《博客园 HTTPS://WWW.CNBLOGS.COM/THINK90/ARTICLES/13218544.HTML 》 *

Cited By (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111222704A (en) * 2020-01-10 2020-06-02 中国人民解放军国防科技大学 A Vehicle Position Prediction Method Based on Bi-GRU
CN111210656B (en) * 2020-01-23 2021-12-24 北京百度网讯科技有限公司 Method and device for predicting free parking space of parking lot, electronic equipment and storage medium
CN111325382A (en) * 2020-01-23 2020-06-23 北京百度网讯科技有限公司 Method, device, electronic device and storage medium for predicting vacant parking space in parking lot
CN111210656A (en) * 2020-01-23 2020-05-29 北京百度网讯科技有限公司 Method and device for predicting free parking space of parking lot, electronic equipment and storage medium
US11574259B2 (en) 2020-01-23 2023-02-07 Beijing Baidu Netcom Science And Technology Co., Ltd. Parking lot free parking space predicting method, apparatus, electronic device and storage medium
CN111325382B (en) * 2020-01-23 2022-06-28 北京百度网讯科技有限公司 Method, device, electronic device and storage medium for predicting vacant parking space in parking lot
CN112101664A (en) * 2020-09-16 2020-12-18 哈尔滨工业大学 Multi-parameter atmospheric environment data generation method based on stacked LSTM-GRU
CN112101664B (en) * 2020-09-16 2022-07-12 哈尔滨工业大学 Multi-parameter atmospheric environment data generation method based on stacked LSTM-GRU
CN112419711A (en) * 2020-10-22 2021-02-26 桂林电子科技大学 Prediction method of parking demand in closed parking lot based on improved GMDH algorithm
CN112309167A (en) * 2020-11-13 2021-02-02 河南观潮智能科技有限公司 Intelligent parking management system and parking method
CN112529284A (en) * 2020-12-08 2021-03-19 湖南大学 Private car residence time prediction method, device and medium based on neural network
CN113052527A (en) * 2021-03-17 2021-06-29 渤海大学 Dynamic aquatic product decay monitoring and early warning method in cold chain transportation
CN113449780A (en) * 2021-06-15 2021-09-28 南京静态交通产业技术研究院 In-road berth occupancy prediction method based on random forest and LSTM neural network
CN113449780B (en) * 2021-06-15 2023-09-22 南京静态交通产业技术研究院 On-street parking occupancy prediction method based on random forest and LSTM neural network
CN113821547A (en) * 2021-08-26 2021-12-21 中山大学 Rapid and efficient short-term parking lot occupancy prediction method and system and storage medium
CN113570866A (en) * 2021-09-24 2021-10-29 成都宜泊信息科技有限公司 Parking lot management method and system, storage medium and electronic equipment
CN118824043A (en) * 2024-08-15 2024-10-22 深圳市德高智能系统有限公司 Intelligent parking guidance method, system and storage medium

Similar Documents

Publication Publication Date Title
CN110599236A (en) Short-time parking demand prediction method based on GRU model
He et al. Learning heterogeneous traffic patterns for travel time prediction of bus journeys
CN110555990B (en) Effective parking space-time resource prediction method based on LSTM neural network
CN112330215B (en) A method, equipment and storage medium for predicting urban vehicle demand
CN111653088A (en) A method for constructing a vehicle trip volume prediction model and a prediction method and system
CN104778508B (en) A kind of public bicycles based on multisource data fusion lease Forecasting Methodology
CN111696355A (en) Dynamic graph convolution traffic speed prediction method
CN110390349A (en) Bus passenger flow volume based on XGBoost model predicts modeling method
CN111915059A (en) Seq2seq berth occupancy prediction method based on attention mechanism
Li et al. Deep learning based parking prediction on cloud platform
CN114418606A (en) Prediction method of online car-hailing order demand based on spatiotemporal convolutional network
CN115565369A (en) Hypergraph-based time-space hypergraph convolution traffic flow prediction method and system
CN106951976A (en) A kind of bus passenger flow Forecasting Methodology based on pattern classification
CN110503104A (en) A short-term prediction method for the number of remaining parking spaces based on convolutional neural network
Liu et al. Short-term passenger flow prediction based on wavelet transform and kernel extreme learning machine
CN111985731B (en) Prediction method and system for the number of people at urban public transport stations
CN111242395B (en) Method and device for constructing prediction model for OD (origin-destination) data
CN113362637B (en) A method and system for predicting vacant parking spaces at multiple sites in a region
CN111899511A (en) Bus arrival time prediction method for AVL data of collinear line
CN119047618A (en) Traffic prediction method based on dynamic causal analysis and space-time self-adaptive fusion map learning
CN115456238B (en) A method for urban travel demand prediction based on dynamic multi-view coupled graph convolution
CN112669595A (en) Online taxi booking flow prediction method based on deep learning
CN112613630A (en) Short-term traffic demand prediction method integrating multi-scale space-time statistical information
CN115619038A (en) Data-driven highway network congestion prediction and cause analysis method and system
Pan et al. Traffic speed prediction based on time classification in combination with spatial graph convolutional network

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20191220

RJ01 Rejection of invention patent application after publication