Available parking space prediction method based on improved SRU model
Through the improved SRU model, combined with weather data and feedforward neural network, the problem of insufficient parking space prediction accuracy and time step length in the prior art is solved, more accurate parking space prediction is achieved, and the effectiveness of the prediction results is improved.
Patent Information
- Application Number
- CN202210125473.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-10
- Publication Date
- 2024-12-20
- Estimated Expiration
- 2042-02-10
AI Technical Summary
The existing available parking space prediction methods have insufficient accuracy and time steps, and it is especially impossible to predict future parking space changes in advance, resulting in car owners being unable to reach their destination in time.
Using the improved SRU model, by obtaining historical parking space data and time-by-time weather data, input doors, weather doors and forget doors are built, tanh activation function and pipe peephole connection are added, and the feedforward neural network is combined to predict future parking behaviors and through Adagead optimizer adjusts hyperparameters.
The accuracy of parking space prediction and the accuracy of time step length are improved, making the prediction results more effective for car owners.
Smart Images

Figure CN114444810B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of parking demand prediction, and more specifically to an available parking space prediction method based on an improved SRU model. Background Art
[0002] There are two methods for parking space prediction available at present: one is the traditional prediction method, including: statistical model (Markov model), time series prediction method (ARIMA), chaotic time series prediction and Kalman filter theory. The advantages of these algorithms are fast calculation speed and simple calculation. However, the accuracy of prediction for nonlinear data, especially time series, cannot meet the requirements. The other is machine learning algorithm, mainly including algorithms based on neural network, such as long short-term memory (LSTM) and decision tree.
[0003] Currently, improvements to deep learning are achieved by designing more complex network structures suitable for this scenario to achieve the required accuracy. However, complex networks involve more parameters, so the training time will also increase, and the final prediction accuracy needs to be further improved. For the time step of the prediction, most of them are concentrated in the time granularity of 5-30 minutes. Although such predictions can improve the accuracy, they cannot predict the changes in the available parking spaces in the future for a period of time in advance, which will cause the car owner to be unable to arrive at the set destination in a short period of time, making the prediction result invalid for the car owner. Summary of the invention
[0004] The embodiment of the present invention provides an available parking space prediction method based on an improved SRU model, comprising:
[0005] Obtain historical parking space data and its corresponding hourly weather data;
[0006] Construct an improved SRU model, where:
[0007] Input gate h o From the hidden state h weekend 、h workday 、h week 、h month Same as the previous hidden layer output h t-1 , by adding tanh activation function integration; weather gate e t The acquired weather data is controlled by the sigmoid activation function to update the weather data; the forget gate f t From the input vector x t , input gate h o 、Weather Gate t , the candidate state vector C of the previous unit t-1 Get, used to control whether to retain the previous unit candidate state vector Ct-1 weather data and historical parking data, in the forgotten gate t A peephole connection is added to make the previous unit candidate state vector C t-1 The information is provided to the forget gate to control the information flow to obtain more information from the information flow;
[0008] By placing the reset gate r t =σ(W rx x t +W ro h o +W re e t +b r ) and the input vector x t and the internal state C t Adaptive combination h t =r t ⊙g(C t )+(1-r t )⊙x t , get the output state;
[0009] In the improved SRU model, historical parking space data and its corresponding hourly weather data are input to predict parking behavior at future moments.
[0010] Furthermore, the method further includes processing the historical parking space data and the corresponding hourly weather data, which includes:
[0011] Clean the hourly weather data and replace invalid data with mean data;
[0012] Clean the historical parking space data and remove the historical data less than 5 minutes in the parking records as invalid data;
[0013] Further, the input gate h o The calculation formula includes:
[0014] h o =σ(W wend h weekend +W wd h workday +W wk h week +W mon h month +W t-1 h t-1 )
[0015] Among them, h workday represents the hidden state of the working days from Monday to Friday, h weekend represents the hidden state on Saturday and Sunday, h weekrepresents the hidden state of a week, that is, from Monday to Sunday, h month represents the hidden state of one month, h t-1 Represents the hidden layer state and serves as the output at time t-1, and σ represents the sigmoid activation function.
[0016] Further, weather gate t The calculation formula includes:
[0017] e t =σ(W e w t +b e )
[0018] Among them, w t represents the weather input, b e represents the bias of weather input, W e represents the weather input matrix, and σ represents the sigmoid activation function.
[0019] Further, select the state vector C t-1 , through the current observation With the forget gate f t and adaptively average the previous state C t To determine, such as:
[0020]
[0021] Among them, the current observation value By h o With the input vector x t Accumulate and obtain through nonlinear transformation of tanh function, as shown in the formula:
[0022]
[0023] Among them, C t-1 represents the state vector, f t Indicates that the forget gate is used to control the candidate state vector C of the previous unit t-1 , g represents the tanh activation function, x t represents historical parking data, W xx Represents the matrix parameters of historical parking data, W xe Represents the input matrix parameter.
[0024] Furthermore, the forget gate f t By f t =σ(W fx x t +W fo h o +W fe e t +W fcC t-1 +b f ) is obtained, where x t Represents historical parking data, h o represents the input gate, e t Indicates weather gate, C t-1 represents the candidate state vector of the previous unit, b f Represents the bias of the forget gate, and different W represents different matrix parameters.
[0025] Furthermore, in order to predict the parking behavior at future moments, the recent state is predicted through an iterative method, and the predicted recent state is input into the improved SRU model to predict the future state.
[0026] Furthermore, a feed-forward neural network was added to the improved SRU model network layer to predict the number of remaining parking spaces when the vehicle leaves.
[0027] The hyperparameters of the improved SRU model are set as:
[0028] Iterations: 300; Learning rate: 0.01; Optimizer: Adagead.
[0029] The embodiment of the present invention provides an available parking space prediction method based on an improved SRU model. Compared with the prior art, the method has the following beneficial effects:
[0030] The present invention utilizes the influence of weather data on people's parking behavior to make disordered time series regular. A peephole structure based on SRU is proposed to enable the algorithm to predict prominent data more accurately, and the nonlinear fitting performance of the network is improved by adding a tanh activation function to the input gate, thereby improving the accuracy of the remaining parking space prediction. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 An improved SRU model for the available parking space prediction method provided by an embodiment of the present invention;
[0032] Figure 2 A flowchart of available parking space prediction based on an improved SRU model provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0033] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0034] See also Figure 1-2The embodiment of the present invention provides an available parking space prediction method based on an improved SRU model, the steps comprising:
[0035] (1) Obtain historical parking space data and its corresponding hourly weather data;
[0036] (2) Construct an improved SRU model, where:
[0037] Input gate h o From the hidden state h weekend 、h workday 、h week 、h month Same as the previous hidden layer output h t-1 , by adding tanh activation function integration; weather gate e t The acquired weather data is controlled by the sigmoid activation function to update the weather data; the forget gate f t From the input vector x t , input gate h o 、Weather Gate t , the candidate state vector C of the previous unit t-1 Get, forget gate f t Used to control whether to retain the previous unit candidate state vector C t-1 weather data and historical parking data, in the forgotten gate t A peephole connection is added to make the previous unit candidate state vector C t-1 The information is provided to the forget gate to control the information flow to obtain more information from the information flow; by resetting the gate r t =σ(W rx x t +W ro h o +W re e t +b r ) and the input vector x t and the internal state C t Adaptive combination h t =r t ⊙g(C t )+(1-r t )⊙x t Get the output status;
[0038] (3) In the improved SRU model, historical parking space data and its corresponding hourly weather data are input to predict parking behavior at future moments.
[0039] The embodiment comprises the following 7 steps:
[0040] Step 1: Crawl the China Weather Network to obtain hourly weather data corresponding to the historical parking space data, including precipitation, temperature, wind speed, and humidity, and store these data in csv format as training values.
[0041] Step 2: Clean the crawled weather data and replace invalid data with mean data. Clean the historical data of parking spaces and remove historical data less than 5 minutes in parking records as invalid data.
[0042] Step 3: Predict available parking spaces using historical data of available parking spaces. The specific form is as follows: S = {S t-1 ,S t-2 ,S t-3 ,…S t-n}. Where t represents the total step length with 1 hour as the time step length, n represents the number of time series to be predicted, and t and n are natural numbers.
[0043] Step 4: SRU model as Figure 1 As shown in the figure. The SRU simple recurrent unit transmits information flow through the reset gate and the forget gate, and improves the training accuracy through model improvement. This model passes the hidden state h weekend (Sunday), h workday (working days are from Monday to Friday), h week 、h month Same as the previous hidden layer output h t-1 Integrated design to obtain input gate h o , where the hidden state h is designed weekend (Sunday) and h workday (working days are from Monday to Friday) is to strengthen the model's learning of working days and non-working days. The specific formula is as follows: o =σ(W wend h weekend +W wd h workday +W wk h week +W mon h month +W t-1 h t-1 ), where h workday Indicates that the working days are from Monday to Friday. weekend represents the hidden state of Saturday and Sunday, h week represents the hidden state of a week, that is, from Monday to Sunday, h month represents the hidden state of one month, h t-1Represents the hidden layer state and is used as the output at time t-1. σ represents the sigmoid activation function. Different W in the above formula represent different matrix parameters. By continuously updating and iterating the weights of the parameters, more accurate results can be obtained. The weather data is controlled by the sigmoid activation function to obtain the weather gate e t , e t =σ(W e w t +b e ) Among them, w t represents the weather input, b e represents the bias of weather input, W e represents the weather input matrix, σ represents the sigmoid activation function. Then h o With the input vector x t Accumulate the current observation value by performing nonlinear transformation through the tanh function The formula is: Among them, g represents the tanh activation function, x t represents historical parking data, W xx Represents the matrix parameters of historical parking data, W xe Represents the input matrix parameter.
[0044] Here is further explanation:
[0045] 1) Forget gate: Forget gate f t Used to control information flow, when f t When it is 1, the previous unit candidate state C is retained. t-1 Weather data and historical parking data, when f t When it is 0, the previous unit candidate state C is forgotten. t-1 By adding a peephole connection, the previous unit candidate state C t-1 The information is provided to the forget gate to control the information flow to obtain more information from the information flow. The formula is: t =σ(W fx x t +W fo h o +W fe e t +W fc C t-1 +b f ), where x t Represents historical parking data, h o represents the input gate, e t Indicates weather gate, C t-1 represents the candidate state vector of the previous unit, b f Represents the bias of the forget gate, and different W represents different matrix parameters.
[0046] 2) Internal state vector: through the current observation value With the forget gate f t and adaptively average the previous state C t To determine the state vector C t-1 , such as C t-1 represents the state vector, f t Indicates that the forget gate is used to control the candidate state vector C of the previous unit t-1 ,.
[0047] 3) Output state: In order to facilitate network training, the reset gate r is designed t Such as:
[0048] r t =σ(W rx x t +W ro h o +W re e t +b r ), and then with the input x t and the internal state C t Perform adaptive combination, such as formula h t =r t ⊙g(C t )+(1-r t )⊙x t . Where g represents the tanh activation function, (1-r t )⊙x t is the input x t Select the information in the
[0049] 4) Prediction: To predict the parking behavior in the future time step t+k (k is a positive integer), the recent state is recursively predicted and the predicted state is input into the model to predict the future state. The change of the periodic pattern can also be applied to future prediction.
[0050] Step 5: The input layer receives input data for preprocessing. In this model, the processing granularity is one hour, so the historical data and input weather data (including temperature T, humidity H, rainfall P, and wind speed) are cleaned into data with a time granularity of one hour, and the data is normalized to [0,1]. For example, for temperature, the corresponding order of the past k time steps is T = {T t-k ,…T t-2 ,T t-1}, where T i Represents the temperature in the past i hours. The normalization method uses maximum and minimum normalization: Among them, x represents the data in the sample, xnorm Represents the normalized result value, x max 、x min Represent the maximum and minimum values of training or testing respectively.
[0051] Output layer: The final output predicted by the model is the number of remaining parking spaces when the vehicle leaves, so a feedforward neural network is added to the SRU network layer.
[0052] Hyperparameters: After multiple experiments, the hyperparameters are set to: 300 iterations, 0.01 learning rate, and Adagead optimizer. Compared with other optimizers such as Adam, ASGD, and Adadelat, Adagead optimizer can maximize accuracy.
[0053] Step 6: Divide the normalized historical available parking space data and weather data time series in step 5 into a 70% training set and a 30% test set, input the training data into the first layer SRU network to obtain the optimization parameters of the first layer SRU network model, continue to input the optimized training data into the second layer SRU network model to obtain the model optimization parameters, and input the obtained first test set data into the first layer SRU network layer with optimized parameters to obtain the prediction result R of the first layer, R = {R1, R2, R3, ... R n}, where R t The second test set data is input into the SRU network layer of the second layer optimization parameter to obtain the second layer prediction result Z, Z = {Z1, Z2, Z3, ... Z n}, where Z n Represents the prediction result of the nth step, where n represents a natural number. The output of the first layer of SRU network blocks in the test set is the input of the next layer of SRU network blocks.
[0054] Step 7: Set the evaluation indicators for the above model, including accuracy, mean absolute error (MAE), and root mean square error (RMSE), as shown in equations (1), (2), and (3), respectively. The higher the accuracy, the higher the accuracy. The smaller the MAE and RMSE, the higher the prediction accuracy.
[0055]
[0056]
[0057]
[0058] In the above formula, n represents the length of the data to be predicted, yt represents the actual remaining available parking quantity in the test data, y p Represents the predicted remaining available parking space.
[0059] Disclosed above are only a few specific embodiments of the present invention. Those skilled in the art may make various changes and modifications to the embodiments of the present invention without departing from the spirit and scope of the present invention. However, the embodiments of the present invention are not limited thereto. Any changes that can be conceived by those skilled in the art should fall within the scope of protection of the present invention.
Claims
1. The available parking space prediction method based on the improved SRU model is characterized by: include: Obtain historical parking space data and its corresponding hourly weather data; Construct an improved SRU model, where: Input gate h o The hidden layer state h weekend 、h workday 、h week 、h month Same as the previous hidden layer output h t-1 , integrated through sigmoid activation function; weather gate e t The acquired weather data is controlled by the sigmoid activation function to update the weather data; the forget gate f t From the input vector x t , input gate h o 、Weather Gate t , the candidate state vector C of the previous unit t-1 Get, used to control whether to retain the previous unit candidate state vector C t-1 weather data and historical parking data; by adding a peephole connection, the previous unit candidate state vector C t-1 The information is provided to the forget gate to control the information flow to obtain more information from the information flow; By placing the reset gate r t =σ(W rx x t +W ro h o +W re e t +b r ) and the input vector x t and the internal state C t Adaptive combination h t =r t ⊙g(C t )+(1-r t )⊙x t Get the output status; In the improved SRU model, historical parking space data and its corresponding hourly weather data are input to predict parking behavior at future moments; The input gate h o The calculation formula includes: h o =σ(W wend h weekend +W wd h workday +W wk h week +W mon h month +W t-1 h t-1 ) Among them, h workday Indicates that the working days are from Monday to Friday. weekend represents the hidden state of Saturday and Sunday, h week represents the hidden state of a week, that is, from Monday to Sunday, h month represents the hidden state of one month, h t-1 represents the hidden layer state and is used as the output at time t-1, σ represents the sigmoid activation function, and different W in the above formula represent different matrix parameters; The weather door t The calculation formula includes: e t =σ(W e w t +b e ) Among them, w t represents the weather input, b e represents the bias of weather input, W e represents the weather input matrix, σ represents the sigmod activation function; State vector C t-1 is the current observed value With the forget gate f t and adaptively average the previous state C t To determine, such as: Among them, the previous observation value By h o With the input vector x t Accumulate and obtain through tanh function, such as: Among them, C t-1 represents the state vector, f t Indicates that the forget gate is used to control the C of the previous state t-1 , g represents the tanh activation function, x t represents historical parking data, W xx Represents the matrix parameters of historical parking data, W xe Represents the input matrix parameters; The forget gate f t By f t =σ(W fx x t +W fo h o +W fe e t +W fc C t-1 +b f ) is obtained, where x t Represents historical parking data, h o represents the input gate, e t Indicates weather gate, C t-1 represents the candidate state vector of the previous unit, b f Represents the bias of the forget gate, and different W represents different matrix parameters.
2. The method for predicting available parking spaces based on the improved SRU model according to claim 1, characterized in that: It also includes the processing of historical parking space data and its corresponding hourly weather data, which includes: Clean the hourly weather data and replace invalid data with mean data; The historical parking space data is cleaned and the historical data less than 5 minutes in the parking records are removed and regarded as invalid data.
3. The method for predicting available parking spaces based on the improved SRU model according to claim 1, characterized in that: In order to predict the parking behavior at the future moment, the recent state is predicted by an iterative method, and the predicted recent state is input into the improved SRU model to predict the future state, wherein the change of the periodic pattern is also applied to the future prediction.
4. The method for predicting available parking spaces based on the improved SRU model according to claim 1, characterized in that: The improved SRU model network layer adds a feedforward neural network to predict the number of remaining available parking spaces when the vehicle leaves.
5. The method for predicting available parking spaces based on the improved SRU model according to claim 1, characterized in that: The hyperparameters of the improved SRU model are set as: Iterations: 300; Learning rate: 0.01; Optimizer: Adagead.
Citation Information
Patent Citations
Method and device for predicting short-term load
CN113158572A
Method for preloading application, terminal device, and medium
EP3486768A1
