Online car-hailing demand prediction method based on time sequence decomposition and improved TSDf

Through the online ride-hailing demand prediction method based on timing decomposition and improving TSDf, the problem of difficult to take into account the accuracy and performance of the existing model is solved, and more efficient feature extraction and prediction accuracy is achieved, and the model design and calculation process is simplified.

CN119494678APending Publication Date: 2025-02-21CHANGZHOU UNIV

Patent Information

Application Number
CN202411539402.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-31
Publication Date
2025-02-21

AI Technical Summary

Technical Problem

The existing online ride-hailing demand prediction model has the problem that accuracy and performance cannot be taken into account at the same time. The model structure is complex, the parameter calculation is large, the training time is long, and it is difficult to capture the overall characteristics and distribution of the time series.

Method used

Using the online ride-hailing demand prediction method based on timing decomposition and improved TSDf, the input sequence is decomposed into seasonal terms and trend terms through the timing decomposition module, the encoder and decoder of the Transformer model are improved, and the frequency domain selection module and frequency domain attention are used. The force module extracts features and predicts trend terms through a linear neural network, and finally generates prediction results through inverse RevIN operation.

Benefits of technology

Effectively extract the overall characteristics and distribution in the data, reduce the impact of external factors on prediction accuracy, improve model performance and accuracy, simplify model design, and reduce calculation complexity and time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119494678A_ABST
    Figure CN119494678A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of online car-hailing demand prediction, in particular to an online car-hailing demand prediction method based on time sequence decomposition and improved TSDf, and the method comprises the steps: collecting the online car-hailing demand and control parameters; decomposing the input sequence after the RevIN operation into a season term and a trend term; the improved Encoder layer comprises the following steps of: inputting a position coding layer feature into a first frequency domain selection module, and then carrying out concat operation on the position coding layer feature and the position coding layer feature; inputting a first-layer normalization and coding feed-forward layer, and carrying out concat operation on the first-layer normalization and coding feed-forward layer and the features of the first-layer normalization; inputting a second layer of normalization; predicting a trend term by using a linear neural network; and adding the season item prediction features and the trend item prediction features, and performing inverse RevIN operation to generate a prediction result. The problem that precision and performance of an existing online car-hailing demand prediction model cannot be considered at the same time is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of online car-hailing demand prediction, and in particular to an online car-hailing demand prediction method based on time series decomposition and improved TSDf. Background Art

[0002] Online ride-hailing is a new mode of transportation in which travelers reserve taxi services through websites or apps; however, the carrying capacity of transportation infrastructure is limited, and the demand for online ride-hailing is affected by various factors, resulting in an imbalance in the temporal and spatial distribution of supply and demand of online ride-hailing.

[0003] The problem of predicting the demand for online ride-hailing vehicles is usually regarded as a time series analysis task. Currently, it is mainly solved through statistics, traditional machine learning, deep learning models and neural networks. The patent with publication number CN118154240A predicts the demand by combining the Transformer and GAN models. However, the model structure is very complex and the parameter calculation is large, which will increase the difficulty of model training and tuning and take longer to train the model. In addition, the original Transformer makes predictions in the time domain and often cannot capture the overall characteristics and distribution of the time series. At the same time, adversarial training involves a balance between the generator and the discriminator, and may require fine-tuning of hyperparameters to achieve the best results. The prediction performance is highly dependent on the quality and characteristics of the input data. When there is noise or information is missing, it has a greater impact on the accuracy of the model prediction.

[0004] The patent publication number is CN118313638A. It also has a complex structure when combining multiple models and requires a lot of computing resources and training time. In addition, although the model uses feature selection methods to reduce dimensions and improve efficiency, the feature selection process may ignore certain variables that affect the prediction, affecting the accuracy of the prediction. Summary of the invention

[0005] In view of the shortcomings of the existing methods, the present invention solves the problem that the accuracy and performance of the existing online car-hailing demand prediction model cannot be taken into account at the same time.

[0006] The technical solution adopted by the present invention is: a method for predicting the demand for online car-hailing vehicles based on time series decomposition and improved TSDf includes the following steps:

[0007] Step 1: Collect control parameter data sets corresponding to the demand for online ride-hailing vehicles and perform data preprocessing;

[0008] As a preferred embodiment of the present invention, the control parameters include: number of pick-up times, wind speed, traffic volume, temperature, dew point, sea level pressure, 1-hour liquid precipitation, 6-hour liquid precipitation, 24-hour liquid precipitation, snow depth and holidays.

[0009] Step 2: Use RevIN operation to normalize the preprocessed data;

[0010] Step 3: Use the time series decomposition module to decompose the input sequence after the RevIN operation into seasonal terms and trend terms;

[0011] Step 4: Improve the encoder of the Transformer model and use the improved encoder to extract features of the seasonal item; the improved Encoder layer includes: the position encoding layer features are input into the first frequency domain selection module and then concat-operated with the position encoding layer features; then input into the first layer normalization and encoding feedforward layer, and concat-operated with the first layer normalization features; then input into the second layer normalization;

[0012] As a preferred embodiment of the present invention, it also includes: improving the decoder of the Transformer model, using the improved decoder to extract features of seasonal items; the improved decoder inputs the position encoding layer features into the second frequency domain selection module and then performs a concat operation with the position encoding layer features; then inputs the third layer normalization, and inputs the features together with the encoder output features into the first frequency domain attention module; and performs a concat operation with the third layer normalization features; then inputs the fourth layer normalization and decoding feedforward layer; and performs a concat operation with the fourth layer normalization features and then inputs the fifth layer normalization to obtain seasonal item prediction features.

[0013] As a preferred implementation of the present invention, the frequency domain selection module includes:

[0014] First, the input sequence is decomposed into Fourier basis by discrete cosine transform in, L is the length of the input sequence;

[0015] Secondly, find the phase and amplitude of each Fourier basis;

[0016] As a preferred embodiment of the present invention, the formulas for the phase and amplitude of the Fourier basis are:

[0017]

[0018] Among them, X t-L:t is the input data of length L, Φ b,i ,A b,i is the phase and amplitude of the bth frequency in the i-th dimension.

[0019] Next, select β bases with the largest amplitudes;

[0020] As a preferred embodiment of the present invention, the formula of the basis of β maximum amplitudes is:

[0021]

[0022] Among them, Top-β returns the parameters of the first β amplitudes, and β is a hyperparameter.

[0023] Finally, the inverse discrete cosine transform is applied to obtain the seasonal term S in the time domain t-L:t .

[0024] Step 5: Use linear neural network to predict trend items;

[0025] As a preferred embodiment of the present invention, the formula of the linear neural network is:

[0026] X trend =Linear(X t )

[0027] Among them, Linear represents a linear neural network, X t is the trend term of time series decomposition.

[0028] Step 6: Add the seasonal item prediction features and the trend item prediction features, and perform the inverse RevIN operation to generate the prediction results;

[0029] As a preferred embodiment of the present invention, the formula for adding the seasonal item prediction feature and the trend item prediction feature is:

[0030]

[0031] Among them, RevIN -1 For the reverse RevIN operation, X trend is the trend item prediction feature, Predict features for the seasonal term.

[0032] Beneficial effects of the present invention:

[0033] 1. For online car-hailing scenarios, the overall characteristics and distribution of the data are effectively extracted through time series decomposition and improved TSDf model. The seasonal item characteristics in extreme cases are decomposed through the time series decomposition module for prediction, reducing the impact of external factors such as weather conditions and holidays on prediction accuracy;

[0034] 2. The present invention designs a frequency domain selection module to effectively eliminate redundant information, reduce computational complexity, and reduce the amount of calculation;

[0035] 3. The encoder output features after frequency domain selection are fused with the decoder frequency domain selection features, and the frequency domain analysis is used to enhance feature extraction. The attention mechanism is used to further optimize the utilization efficiency of features, capture and utilize the key frequency components in the input data, and improve the performance and accuracy of the model.

[0036] 4. The introduction of RevIN operation solves the problem of data distribution drift in time series prediction. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 This is a diagram showing the architecture of a method for predicting online car-hailing demand based on time series decomposition and improved TSDf according to the present invention;

[0038] Figure 2 Select the module flow chart for frequency domain;

[0039] Figure 3 This is the architecture diagram of the frequency domain attention module;

[0040] Figure 4 A comparison chart of the prediction results of the present invention and the baseline model in terms of MAE evaluation index;

[0041] Figure 5 A comparison chart of the prediction results of the present invention and the baseline model in the MSE evaluation index;

[0042] Figure 6 This is a comparison chart of the predicted results of the ablation experiment of the present invention. DETAILED DESCRIPTION

[0043] The present invention is further described below in conjunction with the accompanying drawings and embodiments. This figure is a simplified schematic diagram, which only illustrates the basic structure of the present invention in a schematic manner, and therefore it only shows the components related to the present invention.

[0044] like Figure 1 As shown in FIG. 1 , the online car-hailing demand forecasting method based on time series decomposition and improved TSDf includes the following steps:

[0045] Step 1: Collect a data set of control parameters corresponding to the demand for online ride-hailing services and pre-process the data set;

[0046] Among them, the control parameters include: the number of pick-ups during a period, wind speed, traffic volume, temperature, dew point, sea level pressure, 1-hour liquid precipitation, 6-hour liquid precipitation, 24-hour liquid precipitation, snow depth and whether it is a holiday.

[0047] Preprocessing the data set includes removing missing values ​​and outliers to prevent abnormal data from affecting the accuracy of the model.

[0048] Step 2: Use the RevIN operation to normalize the preprocessed data to solve the problem of data distribution drift in the time series prediction process.

[0049] The RevIN operation includes: setting the input control parameter value and the corresponding demand value n represents the number of sequences, D is the number of features, and L is the length of the input sequence;

[0050]

[0051] in d = 1, 2, ..., D is the learnable affine transformation parameter, t is the t-th row data, ∈ is a small positive number for numerical stability; the inverse RevIN operation is shown in formula (6):

[0052]

[0053] in, To get the trend term and seasonal term forecast results, add them together. Output value for the inverse RevIN operation.

[0054] Step 3: Decompose the input sequence after the RevIN operation into seasonal terms and trend terms through the time series decomposition module designed by the moving average decomposition principle;

[0055] Timing decomposition module operations include:

[0056] For an input sequence of length L and number of features D The process is:

[0057] X t =AvgPool(Padding(X′)) (5)

[0058] X s =X′-X t (6)

[0059] Among them, X′ is the input sequence after the RevIN operation, X t is the trend term, X s is the seasonal term, AvgPool is the sliding average function, and Padding is the padding operation to keep the sequence length unchanged.

[0060] Step 4: Construct an improved Transformer model (TSDformer for short) to predict seasonal terms. The encoder of the improved Transformer model includes: inputting seasonal terms into the position encoding layer to obtain features Input the output of the first frequency domain selection module and After the concat operation, the first layer is normalized to obtain the features After the input encoding feed-forward layer and After the concat operation, the second layer is normalized to obtain the features

[0061] The decoder of the improved Transformer model includes: inputting the seasonal term into the position encoding layer to obtain the feature Input the output of the second frequency domain selection module and After the concat operation, the third layer is normalized to obtain the features and After inputting the first frequency domain attention module Perform concat operation and then input the fourth layer normalization to obtain features After the input decoding feed-forward layer and Perform concat operation and then input the fifth layer normalization to obtain seasonal item prediction features

[0062] The traditional Transformer self-attention mechanism performs matrix calculations in the time domain, which is not only computationally intensive but also has low accuracy. The frequency domain attention module (FAB) combines the frequency domain with the attention mechanism, uses frequency domain analysis to enhance the feature extraction process, and further optimizes the utilization efficiency of features through the attention mechanism, which helps the model capture and utilize key frequency components in the input data. It can not only improve the performance and accuracy of the model, but also simplify the design of the model and improve computational efficiency to a certain extent.

[0063] like Figure 3 As shown, the frequency domain attention module uses the standard Transformer expression, with the input as query, key, and value, expressed as The formula is as follows:

[0064]

[0065] in, is the corresponding weight matrix, and x is the input data.

[0066] First, apply fast Fourier transform to q, k, v to get Q, K, V, and then apply the attention mechanism attention value. The formula is as follows:

[0067]

[0068] Among them, d q Indicates the dimension of the key.

[0069] Finally, the inverse Fourier transform is applied to obtain the output result Y, the formula is as follows:

[0070]

[0071] in, is the inverse Fourier transform.

[0072] like Figure 2 The figure shows the frequency domain selection module (FSB). Although the frequency domain representation can fully represent the data information, there will be a lot of redundant information. Keeping all the frequency components may introduce a lot of noise information. Therefore, frequency domain selection is required to select several Fourier bases with the largest amplitude and discard other Fourier bases, thereby effectively eliminating redundant information and greatly improving the calculation efficiency.

[0073] The frequency domain selection module uses discrete cosine transform to perform frequency domain selection; including:

[0074] For a time series X = [x1,...,x t ], first decompose the input sequence into Fourier basis by discrete cosine transform in, L is the length of the input sequence;

[0075] Then find the phase and amplitude of each Fourier basis, the formula is as follows:

[0076]

[0077]

[0078] Among them, X t-L:t is the input data of length L, Φ b,i ,A b,i is the phase and amplitude of the bth frequency in the i-th dimension.

[0079] Then select the β bases with the largest amplitude and discard the other Fourier bases. The formula is as follows:

[0080]

[0081] Among them, Top-β returns the parameters of the first β amplitudes, and β is a hyperparameter.

[0082] Finally, the inverse discrete cosine transform is applied to obtain the seasonal term S in the time domain t-L:t , the formula is as follows:

[0083]

[0084] Step 5: Linear neural network predicts the trend item, and the trend item prediction feature X trend The formula is:

[0085] X trend =Linear(X t )

[0086] Among them, Linear represents a linear neural network, X t is the trend term of time series decomposition.

[0087] Step 6: Add the seasonal item prediction features and trend item prediction features, and perform the reverse RevIN operation to generate the final prediction result X final ;

[0088] The formula is as follows:

[0089]

[0090] Among them, RevIN -1 It is the reverse RevIN operation;

[0091] Experimental process:

[0092] The data comes from Kaggle's dataset NYC UberPickups withWeather and Holidays, which contains Uber ride-hailing service data in seven boroughs of New York City from January 1, 2015 to June 30, 2015; the dataset contains more than 10 million observations of variables, which are aggregated by hour and borough, and then combined with other weather and holiday data, resulting in 29,101 observations of 11 variables.

[0093] Evaluation indicators:

[0094] The mean absolute error (MAE) and mean square error (MSE) evaluation indicators are used, and the calculation expressions are as follows:

[0095]

[0096] Among them, n represents the number of data. Represents the predicted value, y i is the true value. The lower the MSE and MAE values, the better the effect.

[0097] Parameter settings:

[0098] The loss function used in network training is MSE, the Adam optimizer is used, the learning rate is 1e-4, the batch-size is 32, and the hyperparameter B is 4; the data set is divided into training set, validation set and test set with a ratio of 7:2:1, the validation set is used for hyperparameter tuning, and the results are predicted on the test set.

[0099] Baseline settings:

[0100] In order to fully verify the effectiveness of the model of the present invention in predicting the demand for online ride-hailing services, three time series prediction models are selected as baselines: Autoformer, CNN, and LSTM. The prediction lengths in this example are set to 24, 48, 96, and 192 hours.

[0101] Result analysis:

[0102] Figure 4 and Figure 5 The prediction results of online car-hailing demand in four areas of Bronx, Brooklyn, Manhattan, and Queens in the NYC dataset are shown, and the prediction lengths are set to 24, 48, 96, and 192 hours. It can be seen from the figure that with the increase of the prediction time length, the prediction performance of various methods changes accordingly. The online car-hailing demand prediction method TSDformer based on time series decomposition and deep learning proposed in this scheme can obtain the best prediction results compared with other models. The MAE and MSE of the model of the present invention are improved by 23.7% and 11.7% respectively compared with the baseline model. This shows that the model of the present invention can better extract features such as weather and holidays, and further improve the prediction accuracy of online car-hailing demand.

[0103] Figure 6 This is the ablation experiment result diagram, which shows the impact of different modules on the model performance. TSDformer-FSB eliminates the frequency domain selection module, TSDformer-FAB eliminates the frequency domain attention module, TSDformer-FSB-FAB eliminates both the frequency domain selection module and the frequency domain attention module. Transformer is the baseline model, that is, all improved modules are eliminated. When the modules are deleted, the model filling accuracy will decrease, indicating that each module proposed in the filling model of the present invention contributes to the overall model performance.

[0104] Based on the above ideal embodiments of the present invention, the relevant staff can make various changes and modifications without departing from the technical concept of the present invention through the above description. The technical scope of the present invention is not limited to the contents of the specification, and its technical scope must be determined according to the scope of the claims.

Claims

1. A method for predicting online car-hailing demand based on time series decomposition and improved TSDf, characterized in that: The following steps are involved: Step 1: Collect control parameter data sets corresponding to the demand for online ride-hailing vehicles and perform data preprocessing; Step 2: Use RevIN operation to normalize the preprocessed data; Step 3: Use the time series decomposition module to decompose the input sequence after the RevIN operation into seasonal terms and trend terms; Step 4: Improve the encoder of the Transformer model and use the improved encoder to extract features of seasonal items; The improved Encoder layer includes: the position coding layer feature is input into the first frequency domain selection module and then concat operation is performed with the position coding layer feature; Then input the first layer of normalization and encoding feedforward layer, and perform concat operation with the first layer of normalized features; then input the second layer of normalization; Step 5: Use linear neural network to predict trend items; Step 6: Add the seasonal item prediction features and the trend item prediction features, and perform an inverse RevIN operation to generate the prediction results.

2. The method for predicting online car-hailing demand based on time series decomposition and improved TSDf according to claim 1 is characterized in that: Step four also includes: improving the decoder of the Transformer model, and using the improved decoder to extract features of seasonal items; the improved decoder inputs the position encoding layer features into the second frequency domain selection module and then performs a concat operation with the position encoding layer features; then inputs the third layer normalization, and inputs the encoder output features into the first frequency domain attention module together; and performs a concat operation with the third layer normalization features; then inputs the fourth layer normalization and decoding feedforward layer; and performs a concat operation with the fourth layer normalization features, and then inputs the fifth layer normalization to obtain seasonal item prediction features.

3. The method for predicting online car-hailing demand based on time series decomposition and improved TSDf according to claims 1 and 2 is characterized in that: The frequency domain selection module includes: First, the input sequence is decomposed into Fourier basis by discrete cosine transform in, L is the length of the input sequence; Secondly, find the phase and amplitude of each Fourier basis; Next, select β bases with the largest amplitudes; Finally, the inverse discrete cosine transform is applied to obtain the seasonal term S in the time domain t-L:t .

4. The method for predicting online car-hailing demand based on time series decomposition and improved TSDf according to claim 3 is characterized in that: The formulas for the phase and amplitude of the Fourier basis are: Among them, X t-L:t is the input data of length L, Φ b,i ,A b,i is the phase and amplitude of the bth frequency in the i-th dimension.

5. The method for predicting online car-hailing demand based on time series decomposition and improved TSDf according to claim 4 is characterized in that: The formula for the basis of the β largest amplitudes is: Among them, Top-β returns the parameters of the first β amplitudes, and β is a hyperparameter.

6. The method for predicting online car-hailing demand based on time series decomposition and improved TSDf according to claim 1 is characterized in that: The formula for a linear neural network is: X trend =Linear(X t ) Among them, Linear represents a linear neural network, X t is the trend term of time series decomposition.

7. The method for predicting online car-hailing demand based on time series decomposition and improved TSDf according to claim 1 is characterized in that: The formula for adding the seasonal item prediction features and the trend item prediction features is: Among them, RevIN -1 For the reverse RevIN operation, X trend is the trend item prediction feature, Predict features for the seasonal term.

8. The method for predicting online car-hailing demand based on time series decomposition and improved TSDf according to claim 1 is characterized in that: Control parameters include: number of pick-ups, wind speed, traffic volume, temperature, dew point, sea level pressure, 1-hour liquid precipitation, 6-hour liquid precipitation, 24-hour liquid precipitation, snow depth and holidays.

9. The online car-hailing demand forecasting system based on time series decomposition and improved TSDf is characterized by: include: a memory for storing instructions executable by a processor; A processor, used to execute instructions to implement the online car-hailing demand prediction method based on time series decomposition and improved TSDf as described in any one of claims 1-8.

10. A computer readable medium storing computer program code, characterized in that: When the computer program code is executed by a processor, it implements the method for predicting the demand for online car-hailing services based on time series decomposition and improved TSDf as described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Online car-hailing demand prediction method based on Transform and generative adversarial network

    CN118154240A

  • SRFE-BLP-Transform-based inter-city online car-hailing long-term travel demand prediction method, apparatus and device, and medium

    CN118313638A

Cited By

  • Urban water supply prediction method based on non-stationary perception Transform-BiLSTM model

    CN121543827A