# Short-Term Travel Demand Prediction of Online Ride-Hailing Based on Multi-Factor GRU Model
## 3 Model Analysis
### Improved Model  
GRU model has good accuracy in the case of less training times or small data sample size, so the GRU model was adopted based on the sample size in this paper. As shown in Figure 5 below, the technical roadmap for the improved model proposed in this paper is as follows:  
Step 1: The data sets are built by time series. The GRU model is a time-series model, which requires the data set to have a stable time-series, otherwise the time-series model cannot be established. The data spans from the 1 May 2017 solstice to 1 June 2017, in which, travel data of a day is calculated according to the hourly travel demand. Step 2: The factor weights are set. In this paper, two influence factors of online ride-hailing are selected. One is the rainfall intensity, the other is the off-day factor. The weight of rainfall intensity factor is set according to millimeters of rainfall per hour. The weight of seven days a week is set according to the data analysis above. The weight of Monday to Friday at 2:00 p.m. is 0.2, and the weight of Friday at 2:00 p.m. to Sunday at 12:00 a.m. is 0.4, among which the weight of holidays is 0.6. Input the two factors and hourly travel demand data into the GRU model at the same time, and the formula is as follows:  
\[x_{t}=\left( \begin{array}{cc}D_{h}&W_{r}&W_{d}\end{array} \right) \tag{6}\]  
where \(x_{t}\) is the input, \(D_{h}\), \(W_{r}\), and \(W_{d}\), respectively, represent the hourly travel demand for online ride-hailing, hourly rainfall, and the weight of each hour of the day. The input dimension of this paper is \((744,2,4)\), which expresses the number of rows representing the input, which is 744, the number of columns, which is 4, and the number of GRU cells, which is 2. Step 3: The data sets are divided. The training set is the learning sample data set, which is mainly used to train the model. The verification set is to adjust the parameters  
Figure 5: Model training process. of the classifier on the learned model, such as selecting the number of hidden units in the neural network. Validation sets are also used to determine the network structure or parameters that control the complexity of the model. The test set is mainly to test the resolution (recognition rate, etc.) of the trained model. In this paper, the original data set was divided into training set and test set, and the ratio of training set and test set was 4:1. The data from 1 May 2017 to 1 June 2017 are sorted according to the time series. The first 80% of the data are the training set and the last 20% are the test set. In addition, The data of the validation set is the last 10% of the training set. Step 4: The data is normalized. The original data maintains its original distribution, and the data values are normalized to a range of 0 to 1. After data normalization, the original features of the data can be well retained, but the size of the data value is reduced, which is of great help to model training and prediction. In this paper, the min-max normalization method is selected to normalize the data. The calculation formula is as follows:  
\[x^{\prime}=\frac{x-\min(x)}{\max(x)-\min(x)} \tag{7}\]  
where \(x^{\prime}\) is the normalized data value and \(x\) is the real data value. Step 5: Input the training set into the model for training. According to the training results of the training set, the parameters of the model and the weight of the model input are adjusted constantly. In this paper, the K-fold cross-validation method is used [26; 27; 28], and K = 10 is taken without repeated sampling. The training set is randomly divided into 10 pieces. Each time, 1 piece is selected as the validation set, and the remaining 9 pieces are selected as the training set. The average value of the 10 test results was calculated as the estimation of the model accuracy and as the performance index of the model under the current K-fold cross-validation. The schematic diagram of K-fold cross-validation is shown in Figure 6 below.