Effective berth combination prediction method, terminal and storage medium based on neural network
By predicting effective berths in parking lots, using three data processing methods and combined prediction models, the problem of unsatisfactory prediction in the prior art is solved, and more accurate berth prediction and higher resource utilization are achieved.
Patent Information
- Application Number
- CN202111083406.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-15
- Publication Date
- 2025-02-11
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing effective parking lot berth prediction method based on BP neural network cannot fully reflect the information on the number of berths changes due to a single data processing method, resulting in unsatisfactory prediction results.
Three different data processing methods are adopted to process the prediction sample data through sliding windows, three independent neural network models are constructed, and a combination prediction model is constructed based on the three prediction results to improve prediction accuracy.
Through the combined prediction model, it is possible to more accurately predict the vacant berth information in the future period of the parking lot, improve the utilization rate of berth resources, reduce the invalid parking search time for parking users, and help alleviate regional traffic congestion problems.
Smart Images

Figure CN114048886B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of terminal applications, and in particular to an effective berth combination prediction method based on a neural network, a terminal and a storage medium. Background Art
[0002] At present, the problem of "difficult parking" is a common problem faced by urban development. In recent years, with the widespread rise and application of sharing economic models such as "Internet + sharing", parking space sharing has become a new way to alleviate the problem of "difficult parking". However, how to realize the sharing of effective parking spaces (that is, vacant parking spaces) in parking lots requires real-time and accurate prediction of parking space information, so as to maximize the use of parking space resources. Therefore, real-time and accurate prediction of the number of vacant parking spaces in parking lots at different time periods will help to effectively promote and implement parking space sharing strategies, and also help parking users to arrange their travel reasonably, realize parking induction, and reduce ineffective parking search time on the road. Moreover, traffic management departments can also conduct macro-control of road traffic near parking lots based on the prediction results, thereby helping to alleviate regional traffic congestion problems, with good economic and social benefits.
[0003] The change of effective parking spaces in a parking lot belongs to nonlinear time series change. Since BP neural network has a good effect on processing nonlinear time series prediction problems, especially for data prediction of complex systems with many influencing factors and difficult to quantify with mathematical formulas, BP neural network algorithm is often used for nonlinear time series prediction. At present, the existing prediction methods of effective parking spaces in parking lots based on BP neural network mostly adopt a single prediction method, such as using the number of effective parking spaces in the previous adjacent moments to predict the number of effective parking spaces in the future adjacent moments. However, due to the influence of multiple complex factors, the amount of information covered by a single data processing method is limited, and it is impossible to fully reflect the change information of the number of effective parking spaces, which often results in unsatisfactory prediction results.
[0004] Therefore, the prior art needs to be improved. Summary of the invention
[0005] The technical problem to be solved by the present invention is that, in view of the defects of the prior art, the present invention provides an effective berth combination prediction method, terminal and storage medium based on a neural network. Different from the single input layer and output layer data processing method in the traditional BP neural network prediction method, the present invention is based on the BP neural network and adopts three data processing methods, that is, three prediction methods. Finally, based on the three prediction results, a combined prediction model is further constructed to improve the prediction accuracy.
[0006] The technical solution adopted by the present invention to solve the technical problem is as follows:
[0007] In a first aspect, the present invention provides an effective berth combination prediction method based on a neural network, comprising the following steps:
[0008] Collect parking data of the target parking lot in real time, and pre-process the parking data to obtain prediction sample data;
[0009] Three prediction methods are adopted to process the prediction sample data in a sliding window manner to obtain three training samples and three test samples;
[0010] Constructing a neural network model, and inputting the three training samples into the neural network model for training respectively, to obtain three trained neural network models;
[0011] The three test samples are respectively input into the trained neural network model to predict the number of effective parking spaces in the target parking lot, and three prediction results are obtained;
[0012] Based on the three prediction results, a combined prediction model is constructed to obtain the prediction results of the combined prediction model;
[0013] The performance evaluation indicators of the four prediction results are calculated and compared, and a prediction simulation diagram is drawn and output according to the performance evaluation indicators, and the prediction result with the lowest prediction error is selected as the final effective berth prediction result.
[0014] In one implementation, the real-time acquisition of parking data of the target parking lot and preprocessing of the parking data to obtain prediction sample data include:
[0015] According to the effective berth prediction time period request, determine the time period range of the sample data to be collected;
[0016] Collect parking data of the target parking lot within the time period in real time, wherein the parking data is vehicle entry and exit time series data, including vehicle entry time and exit time;
[0017] Taking the preset time as the statistical period, the effective berth data of each interval period is counted;
[0018] The effective berth data is normalized and preprocessed to obtain the predicted sample data.
[0019] In one implementation, the three prediction methods are adopted, and the prediction sample data is processed in a sliding window manner to obtain three training samples and three test samples, including:
[0020] According to the different input methods of variable data in the input layer and output layer, three prediction methods are selected;
[0021] According to the three prediction methods, respectively, the prediction sample data is processed and counted by a sliding window method, and the training data and the test data are divided into the preset ratio to obtain the three training samples and the three test samples;
[0022] The three prediction methods are:
[0023] Based on the available berths at the current time and the four previous adjacent times, predict the available berths at the next adjacent time;
[0024] Based on the current time of the current weekday and the available berths at the same time on the previous four weekdays, predict the available berths at the same time on the next consecutive weekdays;
[0025] Based on the current time of the current working day of the current week and the valid berths on the same working day and the same time in the four adjacent weeks, the valid berths on the same working day and the same time in the future adjacent weeks are predicted.
[0026] In one implementation, the neural network model is constructed by respectively inputting the three training samples into the neural network model for training to obtain three trained neural network models, including:
[0027] Determine and initialize neural network parameters according to the predicted sample data;
[0028] Constructing the neural network model according to the neural network parameters;
[0029] The three training samples are respectively input into the neural network model for training, and the trained neural network parameters are saved according to the training results to obtain the three trained neural network models.
[0030] In one implementation, the inputting three training samples into the neural network model for training respectively, and saving the trained neural network parameters according to the training results, includes:
[0031] Input the three training samples into the neural network model for training respectively, and calculate the output value and error value of each layer of the neural network model;
[0032] Adjusting the connection weights and bias values of each layer of the neural network according to the error value;
[0033] Determine whether the error value of the neural network model reaches a set value, or determine whether the number of learning times of the neural network model reaches a set number;
[0034] If the error value of the neural network model reaches a set value, or the learning times of the neural network model reaches a set number, the training is terminated and the trained neural network parameters are saved.
[0035] In one implementation, the three test samples are respectively input into the trained neural network model to predict the number of effective parking spaces in the target parking lot, and three prediction results are obtained, including:
[0036] Inputting the three test samples into the trained neural network model respectively to predict the number of effective parking spaces in the target parking lot;
[0037] The output value and error value of the trained neural network model are calculated to obtain the three prediction results.
[0038] In one implementation, the combined prediction model is constructed based on the three prediction results to obtain the prediction result of the combined prediction model, including:
[0039] Constructing the combined prediction model, and determining the weight allocation method according to the principle of minimizing the sum of squared errors;
[0040] Calculate the optimal weights of the prediction results of the three prediction methods according to the weight allocation method;
[0041] The three prediction results are weighted and combined according to the assigned weights to obtain the prediction result of the combined prediction model.
[0042] In one implementation, the calculation and comparison of the performance evaluation indicators of the four prediction results, and the drawing and output of the prediction simulation diagram according to the performance evaluation indicators, and the selection of the prediction result with the lowest prediction error as the final effective berth prediction result, include:
[0043] Compare each prediction result with the actual sample data and calculate the performance evaluation index of each prediction result;
[0044] According to the performance evaluation index of each prediction result, the prediction result with the lowest prediction error is selected as the final effective berth prediction result, and the prediction simulation diagram is drawn and output according to the selected prediction result.
[0045] In a second aspect, the present invention provides a terminal, comprising: a processor and a memory, wherein the memory stores a neural network-based effective berth combination prediction program, and when the neural network-based effective berth combination prediction program is executed by the processor, it is used to implement the neural network-based effective berth combination prediction method as described in the first aspect.
[0046] In a third aspect, the present invention provides a storage medium storing a neural network-based effective berth combination prediction program, which, when executed by a processor, is used to implement the neural network-based effective berth combination prediction method as described in the first aspect.
[0047] The present invention adopts the above technical solution to achieve the following effects:
[0048] The present invention collects parking data of the target parking lot in real time, adopts a combined prediction model based on the BP neural network, and analyzes the parking data of the target parking lot. It can accurately predict the vacant parking space information of the parking lot in a certain period of time in the future in real time, which helps to maximize the exploitation of parking space resources and realize the shared use of vacant parking spaces in the parking lot, thereby improving the utilization rate of parking spaces. It also helps parking users to arrange their travel reasonably according to the prediction results of effective parking spaces and reduce ineffective parking search time on the road. Moreover, the traffic management department can also carry out macro-control of road traffic near the parking lot through the prediction results, thereby helping to alleviate regional traffic congestion problems, and has good economic and social benefits. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the structures shown in these drawings without paying creative work.
[0050] Figure 1 It is a flow chart of an effective berth combination prediction method based on a neural network in one implementation of the present invention.
[0051] Figure 2 It is a schematic diagram of the topological structure of the BP neural network in one implementation of the present invention.
[0052] Figure 3 It is a schematic diagram of an image of a Sigmoid function in one implementation of the present invention.
[0053] Figure 4 It is a graphical diagram of a Purelin linear function in one implementation of the present invention.
[0054] Figure 5 It is a schematic diagram of processing sample data by a sliding window in one implementation of the present invention.
[0055] Figure 6 It is a schematic diagram of the movement of the data input window of prediction method 1 in one implementation method of the present invention.
[0056] Figure 7 It is a schematic diagram comparing the prediction result and the actual value of prediction method 1 in one implementation of the present invention.
[0057] Figure 8 It is a schematic diagram of the error between the prediction result and the actual value of the prediction method 1 in one implementation of the present invention.
[0058] Fig. 9 It is a schematic diagram of the movement of the data input window of the second prediction method in one implementation method of the present invention.
[0059] Fig.10 It is a schematic diagram comparing the prediction result and the actual value of the prediction method 2 in one implementation of the present invention.
[0060] Fig.11 It is a schematic diagram of the error between the prediction result and the actual value of the prediction method 2 in one implementation of the present invention.
[0061] Fig.12 It is a schematic diagram of the movement of the data input window of prediction method three in one implementation method of the present invention.
[0062] Fig.13 It is a schematic diagram comparing the prediction result and the actual value of prediction method three in one implementation of the present invention.
[0063] Fig.14 It is a schematic diagram of the error between the prediction result and the actual value of the prediction method three in one implementation of the present invention.
[0064] Fig.15 It is a schematic diagram of the prediction process of the combined prediction model in one implementation of the present invention.
[0065] Fig.16 It is a schematic diagram of comparison between the prediction result and the actual value of the combined prediction model in one implementation of the present invention.
[0066] Fig.17 It is a schematic diagram of the error between the prediction result and the actual value of the combined prediction model in one implementation of the present invention.
[0067] Fig.18 It is a schematic diagram comparing the prediction results and actual values of four prediction methods in one implementation of the present invention.
[0068] Fig.19 It is a functional principle diagram of a terminal in one implementation of the present invention.
[0069] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0070] In order to make the purpose, technical solution and advantages of the present invention clearer and more specific, the present invention is further described in detail with reference to the accompanying drawings and examples. This example takes the Liyumen West Street parking lot in Qianhai, Shenzhen as the specific research object. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0071] Exemplary Methods
[0072] like Figure 1 As shown, the embodiment of the present invention provides an effective berth combination prediction method based on a neural network. Specifically, it includes the following steps:
[0073] Step S100: collecting parking data of a target parking lot in real time, and preprocessing the parking data to obtain prediction sample data.
[0074] This embodiment takes the prediction of the number of valid parking spaces in each interval period from 08:00 to 20:00 on September 24, 2020 in the Liyumen West Street Parking Lot in Qianhai, Shenzhen as an example, and obtains the vehicle entry and exit time series data of the Liyumen West Street Parking Lot for two months from August 2020 to September 2020 through the Shenzhen Qianhai Parking Management Cloud Platform. The preset time length is used as the statistical period, for example: 15 minutes is used as the statistical period, and the number of valid parking spaces in each time period is counted.
[0075] It is worth mentioning that the parking data collected in real time in this embodiment is historical parking data updated in real time at the target parking lot, including vehicle entry time and vehicle exit time.
[0076] Since a large effective berth statistical sample value input into the BP neural network may cause network paralysis, in order to avoid inputting too large network sample values, this embodiment uses the following formula to normalize and preprocess the sample data statistical value to obtain predicted sample data.
[0077]
[0078] Where: x i is the sample value before processing, x′ i is the sample value after processing, x max and x min are the maximum and minimum values in the original sample data respectively.
[0079] That is, in one implementation of this embodiment, step S100 specifically includes the following steps:
[0080] Step S110, determining the time period range of sample data to be collected according to the effective berth prediction time period request;
[0081] Step S120, collecting parking data of the target parking lot within the time period in real time, wherein the parking data is vehicle entry and exit time series data, including vehicle entry time and vehicle exit time;
[0082] Step S130, taking a preset time as a statistical period, counting the valid berth data of each interval time period within the time period of the collected sample data;
[0083] Step S140, performing normalization preprocessing on the effective berth data to obtain the predicted sample data.
[0084] This embodiment can count the number of valid parking spaces in each time period based on the vehicle entry and exit time series data of the target parking lot, and after normalization preprocessing, predictive sample data can be obtained.
[0085] like Figure 1 As shown, in one implementation of the embodiment of the present invention, the parking lot space prediction method based on a neural network further includes the following steps:
[0086] Step S200: adopt three prediction methods and process the prediction sample data in a sliding window manner to obtain three training samples and three test samples respectively.
[0087] In this embodiment, based on the neural network model, three prediction methods are used to process the prediction sample data according to the different input methods of the input layer and output layer variable data. In order to make the prediction results of each prediction method comparable, the input layer variables of each prediction method are set to 5, and the explanations of the three prediction methods are shown in the following table.
[0088]
[0089]
[0090] Note: k represents the current week, m represents the current weekday, and n represents the current time.
[0091] Specifically, this embodiment uses a sliding window method to process sample data, fixes the window size, and when new data is added, the window slides forward, constantly replacing old data with new data. Figure 5 As shown, Figure 5 Schematic diagram of a sliding window model with a window size of m.
[0092] Furthermore, according to the three prediction methods, the prediction sample data is processed and counted using a sliding window method, and the training data and the test data are divided into a preset ratio (for example, the preset ratio is 8:2) to obtain three training samples and three test samples.
[0093] Specifically, the division of training samples and test samples for the three prediction methods is as follows:
[0094] (1) Prediction method 1
[0095] Use the current time and the four previous times that are adjacent to it to predict the valid berths at the next adjacent time. Let the current time be T n , the number of available berths at the current moment is x n , then x n+1 Corresponding to T n The expected output value predicted at the time. Since the number of neurons in the input layer is 5 and the number of neurons in the output layer is 1, the fixed window size is 6, such as Figure 6 As shown, Figure 6 Respectively represent T n Moment and T n+1 The input sample value at time and the corresponding expected output value.
[0096] Since the prediction period is 08:00-20:00, and the statistical cycle is 15 minutes, the prediction period includes 48 sample data in total. The sample data in the prediction period is used as the test set sample data, so the test set sample data has 48. The training set and the test set are divided into 8:2 ratios, so the training set sample data has 192, and the total sample data is 240. Since the window size is 6, the window sliding method is used, and a total of 240*6 input and expected output matrices can be obtained, where {x i}(i=1,2,3,4,5) is the input sample, y is the expected output value, that is, the true value, and the specific data is shown in the following table. The 1st to 192nd rows in the following table are used as the training set sample matrix, and the 193rd to 240th rows are used as the test set sample matrix.
[0097]
[0098]
[0099] (2) Prediction method 2
[0100] Use the current time of the current weekday and the valid berths at the same time on the previous four weekdays to predict the valid berths at the same time on the next consecutive weekdays. n , the corresponding effective berth number is x mn , then x (m+1)n Corresponding to T n The expected output value predicted at the time. Same as prediction method 1, such as Fig. 9 As shown, Fig. 9 Respectively represent T n Moment and T n+1The input sample value at time and the corresponding expected output value.
[0101] Referring to prediction method 1, the ratio of 8:2 is used to divide the training data and the test data, and the total sample data is set to 240. Using the window sliding method, the sample data shown in the following table can be obtained, where rows 1 to 192 are used as the training set sample matrix, and rows 193 to 240 are used as the test set sample matrix.
[0102]
[0103] (3) Prediction method 3
[0104] Use the current time of the current weekday of the current week and the valid berths on the same weekday and the same time in the four adjacent weeks to predict the valid berths on the same weekday and the same time in the next adjacent weeks. Let the current time be T n , the corresponding effective berth number is x kmn , then x (k+1)mn Corresponding to T n The expected output value predicted at time . Fig.12 As shown, Fig.12 Respectively represent T n Moment and T n+1 The input sample value at time and the corresponding expected output value.
[0105] Similarly, referring to prediction method 1 and prediction method 2, the training data and test data are divided into 8:2 ratios, and the total sample data is set to 240. Using the window moving method, the sample data shown in the following table can be obtained, where rows 1 to 192 are used as the training set sample matrix, and rows 193 to 240 are used as the test set sample matrix.
[0106]
[0107] That is, in one implementation of this embodiment, step S200 specifically includes the following steps:
[0108] Step S210, selecting three prediction methods according to different input methods of variable data of the input layer and the output layer;
[0109] Step S220, according to the three prediction methods, respectively, the prediction sample data is processed and counted by a sliding window method, and the training data and the test data are divided into the preset ratio to obtain the three training samples and the three test samples respectively.
[0110] This embodiment uses a sliding window method to process and count the prediction sample data according to three prediction methods, and obtains three training samples and three test samples respectively. The training samples can then be used to train the neural network model, and the test samples can be used to predict the number of effective parking spaces in the target parking lot.
[0111] like Figure 1 As shown, in one implementation of the embodiment of the present invention, the effective berth combination prediction method based on a neural network further includes the following steps:
[0112] Step S300, constructing a neural network model, inputting the three training samples into the neural network model for training respectively, and obtaining three trained neural network models.
[0113] In this embodiment, after obtaining the training samples and the test samples, the neural network model is constructed.
[0114] First, determine and initialize the neural network parameters, which include: the number of neural network layers, the number of neurons in the input layer, the number of neurons in the output layer, the number of neurons in the hidden layer, the activation function of the hidden layer, the activation function of the output layer, the learning rate, the maximum number of training times, the minimum setting error, the connection weights of each layer of neurons, and the bias.
[0115] Preferably, since a single hidden layer BP neural network can be used to approximate any continuous function, the embodiment of the present invention selects a typical three-layer BP neural network, whose topology is as follows: Figure 2 As shown; the number of neurons in the input layer is selected as 5; the number of neurons in the output layer is 1; the number of neurons in the hidden layer is selected as 8; the hidden layer activation function is selected as the Sigmoid function (such as Figure 3 As shown); the output layer activation function uses the Purelin linear function (as shown Figure 4 As shown); the learning rate is selected as 0.01; the maximum number of training times is selected as 10000 times; the minimum setting error is selected as 0.0001; and the connection weights and biases of each layer are assigned a random value in the interval (-1, 1).
[0116] Furthermore, a neural network model is constructed according to the neural network parameters, and the three training samples are sequentially input into the neural network model for training and learning. After the training is completed, the trained neural network parameters are saved to obtain the three trained neural network models.
[0117] That is, in one implementation of this embodiment, step S300 specifically includes the following steps:
[0118] Step S310, determining and initializing neural network model parameters according to the predicted sample data;
[0119] Step S320, constructing a neural network model according to the neural network parameters;
[0120] Step S330, respectively inputting the three training samples into the neural network model for training, and saving the trained neural network parameters according to the training results to obtain the three trained neural network models.
[0121] In this embodiment, the training and learning process of the BP neural network is divided into four stages: the first stage is the information forward propagation process. Given the input value, the output value of each neuron is calculated layer by layer from the input layer through the hidden layer to the output layer; the second stage is the error back propagation process. If the expected output value cannot be obtained in the output layer, the error between the expected value and the output value is reversely calculated layer by layer from the output layer through the hidden layer to the input layer; the third stage is the network parameter adjustment process. Based on the minimum error target, the connection weights and biases of the neurons in each layer are modified; the fourth stage is to determine whether the training and learning process has reached the end condition. If the prediction error is less than the set value or the number of learning times reaches the set value, the training is terminated and the trained neural network parameters are saved. Otherwise, the information forward propagation process of the first stage is entered again, and this is repeated until the error is less than the set value or the number of learning times reaches the set value. The specific mathematical principles of each stage are as follows:
[0122] Phase 1: Forward information propagation process
[0123] (1) Calculate the output value of each neuron in the hidden layer
[0124]
[0125] (2) Calculate the output value of each neuron in the output layer
[0126]
[0127] Phase 2: Error back propagation process
[0128] (3) Calculate the global network error of each neuron in the output layer
[0129]
[0130] (4) Calculate the global network error of each neuron in the hidden layer
[0131]
[0132] (5) Calculate the global network error of each neuron in the input layer
[0133]
[0134] Phase 3: Network parameter adjustment process
[0135] (6) Update network connection weights and biases
[0136]
[0137]
[0138]
[0139]
[0140] In the above types: net hj Input value for hidden layer neurons; out hj Output value of hidden layer neurons; net ot Input value for the output layer neuron; out ot is the output value of the output layer neuron; w ji is the connection weight between the input layer and the hidden layer; v tj is the connection weight between the hidden layer and the output layer; b h is the bias of each neuron in the hidden layer; b o is the bias of each neuron in the output layer; E is the global prediction error; x i is the input value; t is the output value; n, p, q are the number of neurons in the input layer, hidden layer, and output layer respectively.
[0141] That is, in one implementation of this embodiment, step S330 specifically includes the following steps:
[0142] Step S331, inputting the three training samples into the neural network model for training respectively, and calculating the output value and error value of each layer of the neural network model;
[0143] Step S332, adjusting the connection weights and bias values of each layer of the neural network according to the error value;
[0144] Step S333, determining whether the error value of the neural network model reaches a set value, or determining whether the number of learning times of the neural network model reaches a set number;
[0145] Step S334: If the error value of the neural network model reaches a set value, or the learning times of the neural network model reaches a set number of times, the training is terminated and the trained neural network parameters are saved.
[0146] This embodiment determines BP neural network parameters according to the prediction sample data, and then constructs a BP neural network model. By inputting training samples into the BP neural network model for training, a trained BP neural network model can be obtained, and then effective berth prediction can be performed based on the trained BP neural network model.
[0147] like Figure 1 As shown, in one implementation of the embodiment of the present invention, the effective berth combination prediction method based on a neural network further includes the following steps:
[0148] Step S400: Input the three test samples into the trained neural network model respectively, predict the number of effective parking spaces in the target parking lot, and obtain three prediction results.
[0149] In this embodiment, after the trained neural network model is obtained, the three test samples mentioned above are respectively input into the trained neural network model to realize the prediction of the number of effective parking spaces in the target parking lot.
[0150] Furthermore, according to the input test sample, the output value and error value of the trained neural network model are calculated to obtain the corresponding prediction result.
[0151] Specifically, the prediction process and prediction results of the three prediction methods are as follows:
[0152] (1) Prediction method 1
[0153] The test sample data of prediction method 1 is input into the neural network model trained based on the training samples of prediction method 1, and finally the prediction results of the effective parking spaces in each interval period of Lei Yue Mun West Street Parking Lot from 08:00 to 20:00 on September 24, 2020 predicted by prediction method 1 are obtained, as shown in the figure below: Figure 7 The relative error between the prediction results of effective berths in each period and the actual sample data is shown in Figure 8 shown.
[0154] (2) Prediction method 2
[0155] The test sample data of prediction method 2 is input into the neural network model trained based on the training samples of prediction method 2, and finally the prediction results of the effective parking spaces in each interval period of Lei Yue Mun West Street Parking Lot from 08:00 to 20:00 on September 24, 2020 predicted by prediction method 2 are obtained, as shown in the figure below: Fig.10 The relative error between the prediction results of effective berths in each period and the actual sample data is shown in Fig.11 shown.
[0156] (3) Prediction method 3
[0157] The test sample data of prediction method three is input into the neural network model trained based on the training samples of prediction method three, and finally the prediction results of the effective parking spaces in each interval period of Lei Yue Mun West Street Parking Lot from 08:00 to 20:00 on September 24, 2020 predicted by prediction method three are obtained, as shown in the figure below: Fig.13 The relative error between the prediction results of effective berths in each period and the actual sample data is shown in Fig.14 shown.
[0158] That is, in one implementation of this embodiment, step S400 specifically includes the following steps:
[0159] Step S410, respectively inputting the three test samples into the trained neural network model to predict the number of effective parking spaces for the target parking lot;
[0160] Step S420, calculating the output value and error value of the trained neural network model to obtain the three prediction results.
[0161] This embodiment predicts the number of effective parking spaces in the target parking lot through three prediction methods, and obtains three different prediction results. Then, a combined prediction model can be constructed based on the three prediction results to improve the accuracy of the prediction.
[0162] like Figure 1 As shown, in one implementation of the embodiment of the present invention, the effective berth combination prediction method based on a neural network further includes the following steps:
[0163] Step S500, based on the three prediction results, a combined prediction model is constructed to obtain a prediction result of the combined prediction model.
[0164] In this embodiment, due to the influence of various complex factors, different prediction models will obtain prediction results of different accuracy for the same prediction problem. Even if it is the same prediction model, if the data processing method or assumption conditions are different, the prediction results will often be different. Since the amount of information covered by a single prediction model is limited, it often cannot fully reflect the data information, resulting in unsatisfactory prediction results. Based on this, a combined prediction model came into being. Its basic idea is to combine the prediction results of each single model through various effective methods to obtain a more accurate and reliable prediction result.
[0165] Specifically, multiple prediction methods are first used to construct multiple single prediction models, and then the weights of the prediction results of each single prediction model are determined based on the weight distribution method, and finally the final prediction result is obtained through weighted combination. The prediction flow chart is as follows: Fig.15 shown.
[0166] In general, the combined prediction method first selects two or more single models for prediction, and then establishes a model to combine the prediction results of each single model to construct a combined prediction model.
[0167] Suppose there are m single prediction models, let {x t}(t=1,2,...n) is the true value of the target object to be predicted, is the prediction result of the tth time predicted by the i-th single model, w i is the weight of the i-th single prediction model in the combined model, Z t is the final predicted value of the combined model at time t, e it is the prediction error of the i-th prediction model at the t-th moment, e t is the prediction error of the combined prediction model at the tth moment, then:
[0168]
[0169]
[0170]
[0171]
[0172] In this embodiment, the weight of each single prediction model is determined based on the principle of minimizing the sum of squared errors. Let Q be the sum of squared errors of the combined model predictions, and the following mathematical model can be established:
[0173]
[0174]
[0175] Among them, according to the knowledge of linear algebra, Q can be expressed in the following form:
[0176]
[0177]
[0178]
[0179]
[0180] Among them, W represents the weight matrix of the combined prediction model, and E represents the error information matrix of the combined prediction model. Then the optimal combined prediction model formula can be expressed in the following matrix form:
[0181] minQ=W T EW;
[0182]
[0183] According to the relevant theory of matrix operations, the optimal weight matrix can be obtained as:
[0184]
[0185] If the prediction error of a single prediction model is larger than that of other models, the weight allocation based on the above method may assign a negative weight to the model with a larger prediction error, which does not meet the conditions. If a negative weight occurs, the result needs to be corrected. This embodiment uses the following method for correction. First, the single prediction model assigned a negative weight, that is, the prediction model with a larger error, is removed from the combined model and does not participate in the combined prediction. Then, the remaining single prediction models are recombined and weighted using the above method, and this is repeated until the weights assigned to each single prediction model are non-negative.
[0186] In the above, under the BP neural network algorithm, three single prediction models were constructed by adopting three data processing methods, and three prediction results were obtained respectively, that is, m is 3. According to the prediction results of each prediction model, the error information matrix of the combined prediction model can be calculated:
[0187]
[0188] Substituting its inverse matrix into the optimal weight calculation formula, the optimal weight matrix W = (0.0773, 0.0891, 0.8336) can be obtained using Matlab software. T , substitute into the combined prediction model prediction result calculation formula have to:
[0189]
[0190] According to the above combined prediction model formula, the prediction results of the effective parking spaces in each interval period of Lei Yue Mun West Street Parking Lot from 08:00 to 20:00 on September 24, 2020 can be calculated, such as Fig.16 The relative error between the prediction results of effective berths in each period and the actual sample data is shown in Fig.17 shown.
[0191] That is, in an implementation of this embodiment, step S500 specifically includes the following steps:
[0192] Step S510, constructing the combined prediction model, and determining the weight distribution method according to the principle of minimizing the sum of squared errors;
[0193] Step S520, calculating the optimal weights of the prediction results of the three prediction methods according to the weight allocation method;
[0194] Step S530: performing weighted combination on the three prediction results according to the assigned weights to obtain the prediction result of the combined prediction model.
[0195] Based on the three prediction results, this embodiment obtains a combined prediction model and a prediction result of the combined prediction model by combining the predictions, thereby improving the prediction accuracy of the number of effective parking spaces in the target parking lot.
[0196] like Figure 1 As shown, in one implementation of the embodiment of the present invention, the parking lot space prediction method based on a neural network further includes the following steps:
[0197] Step S600, calculating and comparing the performance evaluation indicators of the four prediction results, and drawing and outputting the prediction simulation diagram according to the performance evaluation indicators, and selecting the prediction result with the lowest prediction error as the final effective berth prediction result.
[0198] In this embodiment, after obtaining four prediction results, the performance evaluation indicators of various prediction results are obtained by calculation, that is, each prediction result is compared with the actual sample data, and the performance evaluation indicators of each prediction result are calculated. In this embodiment, the mean absolute error (MAE), the mean absolute percentage error (MAPE), and the root mean square error (RMSE) are selected as the performance evaluation indicators. Then, according to the comparison results of the performance evaluation indicators of each prediction result, the prediction result with the lowest prediction error is selected as the final effective berth prediction result.
[0199] like Fig.18 As shown in the figure, by comparing and analyzing the prediction results of the three prediction methods and the combined prediction method, we can intuitively see the performance of the four prediction methods in predicting the number of effective parking spaces in the parking lot.
[0200] The following table shows the calculation and comparison results of various performance evaluation index values of the four prediction results.
[0201]
[0202] From the comparison results of the performance indicators of the above four prediction results, it can be seen that the combined prediction model established based on the principle of minimum sum of squared errors has improved the three performance evaluation indicators of mean absolute error, mean absolute percentage error and root mean square error to a certain extent, and the prediction error is the lowest, indicating that the combined prediction model can effectively combine the characteristics of each single prediction method and can more comprehensively reflect the data change information, so as to make a better judgment on the change trend of the effective parking spaces at the next moment. This also proves the effectiveness of the combined prediction model based on neural network finally established in this embodiment in predicting the effective parking spaces in the parking lot, which can provide data support for the shared use of vacant parking spaces in the parking lot and provide a reference basis for users' travel.
[0203] In the above comparison results, it can be determined that the combined prediction method is the prediction method with the lowest prediction error; at this time, the prediction result obtained by the combined prediction model can be used as output data to draw and output the prediction simulation graph in the terminal device, that is, draw and output the comparison graph between the prediction result of the combined model and the actual value; after the terminal device draws the prediction simulation graph, the prediction simulation graph can be sent to the cloud server through the terminal device to use the prediction simulation graph as prediction big data; or, the prediction simulation graph can be sent to the APP on the user's mobile terminal through the cloud server to provide a reference for the user's travel.
[0204] That is, in one implementation of this embodiment, step S600 specifically includes the following steps:
[0205] Step S610, comparing each prediction result with the actual sample data, and calculating the performance evaluation index of each prediction result;
[0206] Step S620, according to the performance evaluation index of each prediction result, the prediction result with the lowest prediction error is selected as the final effective berth prediction result, and the prediction simulation diagram is drawn and output according to the selected prediction result.
[0207] The present invention collects parking data of the target parking lot in real time, adopts a combined prediction model based on a neural network, and analyzes the parking data of the target parking lot. It can accurately predict the vacant parking space information of the parking lot in a certain period of time in the future in real time, which helps to maximize the exploitation of parking space resources and realize the shared use of vacant parking spaces in the parking lot, thereby improving the utilization rate of parking spaces. It also helps parking users to reasonably arrange their travel according to the prediction results of effective parking spaces, realize parking induction, and reduce ineffective parking search time on the road. Moreover, the traffic management department can also carry out macro-control of road traffic near the parking lot through the prediction results, thereby helping to alleviate regional traffic congestion problems, and has good economic and social benefits.
[0208] Exemplary Devices
[0209] Based on the above embodiment, the present invention further provides a terminal, whose principle block diagram can be as follows: Fig.19 The effective berth combination prediction method based on neural network is applied in a terminal, and the terminal includes but is not limited to: a computer and a mobile terminal.
[0210] The terminal includes: a processor, a memory, an interface, a display screen and a communication module connected via a system bus; wherein the processor of the terminal is used to provide computing and control capabilities; the memory of the terminal includes a storage medium and an internal memory; the storage medium stores an operating system and a computer program; the internal memory provides an environment for the operation of the operating system and the computer program in the storage medium; the interface is used to connect to external terminal devices, such as mobile terminals and computers; the display screen is used to display the corresponding target parking lot effective parking space prediction result information; the communication module is used to communicate with a cloud server or a mobile terminal.
[0211] When the computer program is executed by a processor, it is used to implement an effective berth combination prediction method based on a neural network.
[0212] It can be understood by those skilled in the art that Fig.19 The principle block diagram shown in the figure is only a block diagram of a partial structure related to the scheme of the present invention, and does not constitute a limitation on the terminal to which the scheme of the present invention is applied. The specific terminal may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0213] In one embodiment, a terminal is provided, which includes: a processor and a memory, wherein the memory stores a neural network-based effective berth combination prediction program, and the neural network-based effective berth combination prediction program is used to implement the above-mentioned neural network-based effective berth combination prediction method when executed by the processor.
[0214] In one embodiment, a storage medium is provided, wherein the storage medium stores a neural network-based effective berth combination prediction program, which, when executed by a processor, is used to implement the above-mentioned neural network-based effective berth combination prediction method.
[0215] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing related hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided by the present invention can include non-volatile and / or volatile memory.
[0216] In summary, the present invention discloses a method, terminal and storage medium for predicting effective berth combinations based on neural networks, wherein the method includes: real-time acquisition of parking data of a target parking lot, and preprocessing the data; processing the preprocessed data in three prediction methods to obtain three training samples and three test samples; constructing a neural network model, respectively inputting the three training samples into the neural network model for training, and obtaining three trained neural network models; respectively inputting the three test samples into the trained neural network model for effective berth prediction, and obtaining three prediction results; based on the three prediction results, constructing a combined prediction model, and obtaining the prediction results of the combined prediction model; calculating and comparing the performance evaluation indicators of each prediction result, and selecting the prediction result with the lowest prediction error as the final effective berth prediction result. The present invention can accurately and real-timely predict the vacant berth information of the parking lot in the future period through a combined prediction model based on a BP neural network, which is helpful for the application and implementation of operation modes such as parking guidance and berth sharing in actual scenarios.
[0217] It should be understood that the application of the present invention is not limited to the above examples. For ordinary technicians in this field, improvements or changes can be made based on the above description. All these improvements and changes should fall within the scope of protection of the claims attached to the present invention.
Claims
1. A method for predicting effective berth combinations based on neural networks, characterized in that: The effective berth combination prediction method based on neural network comprises the following steps: Collect parking data of the target parking lot in real time, and pre-process the parking data to obtain prediction sample data; Three prediction methods are adopted to process the prediction sample data in a sliding window manner to obtain three training samples and three test samples; Constructing a neural network model, and inputting the three training samples into the neural network model for training respectively, to obtain three trained neural network models; The three test samples are respectively input into the trained neural network model to predict the number of effective parking spaces in the target parking lot, and three prediction results are obtained; Based on the three prediction results, a combined prediction model is constructed to obtain the prediction results of the combined prediction model; Calculate and compare the performance evaluation indicators of the four prediction results, draw and output the prediction simulation diagram according to the performance evaluation indicators, and select the prediction result with the lowest prediction error as the final effective berth prediction result; The three prediction methods are adopted to process the prediction sample data in a sliding window manner to obtain three training samples and three test samples, including: According to the different input methods of variable data in the input layer and output layer, three prediction methods are selected; According to the three prediction methods, respectively, the prediction sample data is processed and counted by a sliding window method, and the training data and the test data are divided into the preset ratio to obtain the three training samples and the three test samples; The three prediction methods are: Based on the available berths at the current time and the four previous adjacent times, predict the available berths at the next adjacent time; Based on the current time of the current weekday and the available berths at the same time on the previous four weekdays, predict the available berths at the same time on the next consecutive weekdays; Based on the current time of the current working day of the current week and the valid berths on the same working day and at the same time in the four adjacent weeks, the valid berths on the same working day and at the same time in the future adjacent weeks are predicted.
2. The effective berth combination prediction method based on neural network according to claim 1 is characterized in that: The real-time collection of parking data of the target parking lot and preprocessing of the parking data to obtain predicted sample data include: According to the effective berth prediction time period request, determine the time period range of the sample data to be collected; Collect parking data of the target parking lot within the time period in real time, wherein the parking data is vehicle entry and exit time series data, including vehicle entry time and exit time; Taking the preset time as the statistical period, the effective berth data of each interval period is counted; The effective berth data is normalized and preprocessed to obtain the predicted sample data.
3. The effective berth combination prediction method based on neural network according to claim 1 is characterized in that: The neural network model is constructed by respectively inputting the three training samples into the neural network model for training to obtain three trained neural network models, including: Determine and initialize neural network parameters according to the predicted sample data; Constructing the neural network model according to the neural network parameters; The three training samples are respectively input into the neural network model for training, and the trained neural network parameters are saved according to the training results to obtain the three trained neural network models.
4. The effective berth combination prediction method based on neural network according to claim 3 is characterized in that: The three training samples are respectively input into the neural network model for training, and the trained neural network parameters are saved according to the training results, including: Input the three training samples into the neural network model for training respectively, and calculate the output value and error value of each layer of the neural network model; Adjusting the connection weights and bias values of each layer of the neural network according to the error value; Determine whether the error value of the neural network model reaches a set value, or determine whether the number of learning times of the neural network model reaches a set number; If the error value of the neural network model reaches a set value, or the learning times of the neural network model reaches a set number, the training is terminated and the trained neural network parameters are saved.
5. The effective berth combination prediction method based on neural network according to claim 1 is characterized in that: The three test samples are respectively input into the trained neural network model to predict the number of effective parking spaces in the target parking lot, and three prediction results are obtained, including: Inputting the three test samples into the trained neural network model respectively to predict the number of effective parking spaces in the target parking lot; The output value and error value of the trained neural network model are calculated to obtain the three prediction results.
6. The effective berth combination prediction method based on neural network according to claim 1 is characterized in that the combination prediction model is constructed based on the three prediction results to obtain the prediction results of the combination prediction model, including: Constructing the combined prediction model, and determining the weight allocation method according to the principle of minimizing the sum of squared errors; Calculate the optimal weights of the prediction results of the three prediction methods according to the weight allocation method; The three prediction results are weighted and combined according to the assigned weights to obtain the prediction result of the combined prediction model.
7. The effective berth combination prediction method based on neural network according to claim 1 is characterized in that: The calculation and comparison of the performance evaluation indicators of the four prediction results, and the drawing and output of the prediction simulation diagram according to the performance evaluation indicators, and the selection of the prediction result with the lowest prediction error as the final effective berth prediction result, include: Compare each prediction result with the actual sample data and calculate the performance evaluation index of each prediction result; According to the performance evaluation index of each prediction result, the prediction result with the lowest prediction error is selected as the final effective berth prediction result, and the prediction simulation diagram is drawn and output according to the selected prediction result.
8. A terminal, characterized in that: include: A processor and a memory, wherein the memory stores a neural network-based effective berth combination prediction program, and the neural network-based effective berth combination prediction program is used to implement the neural network-based effective berth combination prediction method according to any one of claims 1 to 7 when executed by the processor.
9. A storage medium, characterized in that: The storage medium stores a neural network-based effective berth combination prediction program, which, when executed by a processor, is used to implement a neural network-based effective berth combination prediction method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Effective parking space prediction method
CN109215380A