Shared bicycle origin-destination quantity prediction method based on empirical mode decomposition and attention mechanism

By using empirical mode decomposition and attention mechanisms, the dense and sparse features of shared bicycle station edges are identified, and a traffic splitting neural network is constructed. This solves the data sparsity and large-scale problems of traffic prediction at shared bicycle station edges, and achieves high-precision vehicle number prediction.

CN117152952BActive Publication Date: 2026-03-27UNIV OF SCI & TECH OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-29
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

The cycling data between the origin and destination stations of shared bicycles is sparse and large in scale. Existing methods are difficult to effectively predict the traffic between stations, and traditional methods face challenges in terms of data sparsity and large-scale prediction.

Method used

By employing empirical mode decomposition and attention mechanisms, the time-series features of shared bicycle station edges are decomposed to identify dense and sparse station edges. Attention mechanisms and fully connected networks are used to extract time-series information, and a split neural network is constructed for prediction.

Benefits of technology

It significantly improves the accuracy of predicting the number of shared bicycles at the station, reduces model complexity and computational cost, and outperforms traditional and advanced time series forecasting methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117152952B_ABST
    Figure CN117152952B_ABST
Patent Text Reader

Abstract

The application discloses a shared bicycle start-end point number prediction method based on empirical mode decomposition and attention mechanism, comprising the following steps: 1, obtaining the user riding record information of the shared bicycle, including the starting station, the ending station, the riding start time and the riding end time; 2, establishing an empirical mode decomposition and attention mechanism model; 3, constructing sample data, first, all sample data are expanded in time sequence dimension through an empirical mode decomposition function, and the decomposed data are input into a deep learning model for training; 4, using the trained model to realize prediction, so as to achieve the purpose of predicting the riding number of all shared bicycle station connection edges. The application uses an empirical mode decomposition function to decompose a time sequence, expands the characteristics of the time sequence, adopts a first-order difference method to identify z main connection edges, uses a simple model to greatly reduce the time and space complexity of the model, and improves the prediction accuracy of the number of shared bicycle system station edges.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the field of intelligent traffic vehicle origin-destination quantity prediction, and in particular to a shared bicycle origin-destination quantity prediction method based on empirical mode decomposition and attention mechanism. BACKGROUND

[0002] Shared bicycles, as a convenient and green mode of transportation, are widely popular around the world. The complementarity of shared bicycles and other public transportation can save social costs. At the same time, due to the convenience and individualization of shared bicycles, people gradually rely on this means of transportation. As of August 2022, there are 1880 shared bicycle systems deployed in more than 50 countries and regions around the world, with more than 8 million shared bicycles available for consumers. According to the marginal effect of the network, more shared bicycle stations will further improve user experience and increase enterprise revenue. Therefore, shared bicycle companies often set up a large number of stations. For example, as of May 2022, the New York Citi bicycle system has 1627 stations, and the Chicago Divvy bicycle system has 1111 stations. A large number of stations provide convenience for users, but the complex and dynamic relationship between a large number of stations makes it difficult for enterprises to manage operations.

[0003] Origin-destination prediction has been widely used in urban rail transit passenger flow prediction, inter-regional taxi demand prediction, and urban population flow prediction, but there is no prediction of shared bicycle station edge flow. The main difficulties are as follows:

[0004] 1. The scale of shared bicycle origin-destination station edges is very large, which is the square of the number of stations. If there are 200 stations, there may be 200*200 edges, and traditional methods are difficult to solve such a large scale of time series prediction;

[0005] 2. Unlike rail transit origin-destination quantity prediction, most shared bicycle origin-destination edge ride time series data is sparse. In the past, when applied to other problems such as inter-regional taxi demand prediction, the regional scale was expanded to alleviate data sparsity, but shared bicycle stations cannot be expanded, so extracting time series information from sparse data is a difficulty;

[0006] 3. The number of shared bicycle station edges follows a long-tail distribution, i.e. a small number of station edges have a large number of ride records, but a large number of station edges have fewer ride records, so it is necessary to identify important edges with a large number of ride records to extract key time series information. SUMMARY

[0007] The present application is to solve the above-mentioned deficiencies in the prior art, a shared bicycle start-end number prediction method based on empirical mode decomposition and attention mechanism is proposed, in order to expand the information dimension from sparse time series, capture time series information, and more accurately predict the number of rides on each station edge in the shared bicycle system, so as to help the shared bicycle operator to adjust the vehicle distribution strategy and the station power exchange strategy in time, so as to ensure the reasonable distribution of shared bicycles.

[0008] In order to achieve the above-mentioned application purposes, the technical scheme adopted by the present application is as follows:

[0009] The shared bicycle start-end number prediction method based on empirical mode decomposition and attention mechanism has the characteristics that it comprises the following steps:

[0010] Step 1, obtaining the user ride records of shared bicycles in a period of time and preprocessing:

[0011] Step 1.1, obtaining the user ride records of shared bicycles, and each user ride record contains: initial station, terminal station, start time, end time;

[0012] Define the edge composed of station a to station b as a station edge, if there are stations, then there are station edges;

[0013] Step 1.2, according to the user ride records, constructing the ride number sequence of the station edges between all stations in each time interval in a period of time , wherein, represents the ride number sequence of the i-th station edge in each time interval in a period of time, and i , wherein, represents the ride number of the i-th station edge in the t-th time interval; represents the total number of time intervals in a period of time; P represents the number of stations, N represents the number of station edges, ; R represents the real number set;

[0014] Step 1.3, using the empirical mode decomposition function to sequence decompose , to obtain the feature i of the i-th station edge after time sequence decomposition;

[0015] Step 1.4, according to the process of step 1.3, sequence decomposing all station edges , to obtain the time sequence of all station edges, wherein, ​​Indicates the first i Features after time series decomposition of each site, and , express L One basic mode function, one residual term, and one original time series;

[0016] Step 1.5, set the width of the sliding window to... T ,and , Indicates the length of the input training sequence. Indicates the length of the predicted time series;

[0017] According to the sliding window The samples are partitioned to obtain the sample set. ,in, The first one constructed within the sliding window e One sample data, and ,in, Indicates the first e training sample data, and , = ,in, Indicates the first e The time series data after edge decomposition of the i-th station in the training samples, and , Indicates the first e The c-th column vector in the temporal feature matrix after edge decomposition of the i-th site in the training samples. Indicates the first e The true results of each predicted sample, and ;

[0018] Step 2, construct the splitting neural network;

[0019] Step 2.1, the construction of the splitting neural network includes: an edge selection layer, a dense temporal information extraction layer, a sparse temporal information extraction layer, and an output layer;

[0020] Step 2.2, the edge selection layer pair Processing is performed to obtain the first... e The first training sample data Temporal feature matrix of dense site edges and the e The remaining training sample data Temporal feature matrix of sparse site edges ;

[0021] Step 2.3, the dense temporal information extraction layer... The processing yields the output variable. ;

[0022] Step 2.4, the sparse temporal information extraction layer... Process the data to obtain the output variable. ;

[0023] Step 2.5, processing of the output layer:

[0024] Step 2.5.1 The output layer uses equation (20) to obtain the first... e Update features of all site edges for each training sample :

[0025] (20)

[0026] In equation (20), Indicates a splicing operation;

[0027] Step 2.5.2 The output layer uses equation (21) to obtain the first... e Prediction results of all edges for each training sample :

[0028] (twenty one)

[0029] In equation (21), This represents the activation function. Represents a linear transformation operation;

[0030] Step 3: Based on the first e Prediction results of all sites for each training sample and the e The true results of the predicted samples The mean squared error (MSE) is constructed as the loss function of the deep neural network. With the goal of minimizing the loss function, the parameters in the split neural network are optimized and updated through the backpropagation algorithm until the loss function converges. The model parameters are then saved to obtain a trained split neural network model, which is used to predict the number of vehicles on all connected edges in the future.

[0031] The method for predicting the number of shared bicycle origin-destination points based on empirical mode decomposition and attention mechanism described in this invention is characterized in that step 1.3 includes:

[0032] Step 1.3.0 defines the current outer iteration number as... L Define the current inner iteration number as k ;

[0033] Step 1.3.1 Define two conditions:

[0034] Condition 1: No. LThe first outermost iteration k Intermediate function of the innermost iteration The number of extreme points and the number of zero-crossing points are equal or at most differ by one;

[0035] Condition 2: From the intermediate function The average of the upper and lower envelopes fitted by the maximum and minimum points is 0.

[0036] Step 1.3.2 Initialization L =1; and will As the first L New signals under the next outermost iteration ;

[0037] Step 1.3.3 Judgment If the function is monotonic, stop the iteration and proceed to step 1.3.11; otherwise, proceed to step 1.3.4.

[0038] Step 1.3.4 Initialize k=1; As the first L The intermediate function of the k-th inner iteration under the outer iteration is denoted as... ;

[0039] Step 1.3.5 Obtain All local maxima ), This represents the number of maxima, thus allowing fitting using the spline function shown in equation (1). The maximum envelope :

[0040] (1)

[0041] In equation (1), Indicates the first L The nth maximum value of the i-th site edge in the k-th inner iteration under the outer iteration. Indicates the first L The (n+1)th maximum value of the i-th site edge in the k-th inner iteration under the outer iteration. These are the four parameters to be learned; As the independent variable;

[0042] Step 1.3.6 Obtain All local minima ), This represents the number of local minima, thus allowing for fitting using the spline function shown in equation (2). Minimum envelope : (2)

[0043] in formula (2), denotes the kth inner iteration under the lth outer iteration, L denotes the (n+1)th minimum value in the ith station edge under the kth inner iteration under the lth outer iteration, denotes the kth inner iteration under the lth outer iteration, L denotes the (n+1)th minimum value in the ith station edge under the kth inner iteration under the lth outer iteration, are four parameters to be learned; is an independent variable;

[0044] Step 1.3.7 calculates the average of the maximum envelope and the minimum envelope of the kth inner iteration under the lth outer iteration using formula (3) L :

[0045] (3)

[0046] Step 1.3.8 obtains the intermediate function of the (k+1)th iteration under the lth outer iteration using formula (4) L :

[0047] (4)

[0048] Step 1.3.9 judges whether conditions one and two are both satisfied, if yes, takes as the lth eigenmode function of the ith station edge , and executes step 1.3.11; otherwise, executes step 1.3.10; L Step 1.3.10 assigns k+1 to k, and judges whether k>K is true, if true, takes as the lth eigenmode function of the ith station edge

[0049] ; and executes step 1.3.11; otherwise, returns to repeat step 1.3.5 sequentially; Step 1.3.11 if there is no lth eigenmode function of the ith station edge, takes as the residual term output, that is , and executes step 1.4; otherwise, obtains a new signal L+1 using formula (5)

[0050] , and assigns L+1 to L, and returns to step 1.3.3: i L

[0051] ​​​​​​​​​ (5).

[0052] The step 2.2 comprises:

[0053] Step 2.2.1 The edge selection layer obtains the first-order difference vector of the cth column in the time feature matrix of the ith station after edge decomposition in the first training sample by using formula (6) e , thereby obtaining the first-order difference time feature matrix of the ith station after edge decomposition in the first training sample , and further obtaining the first-order difference time feature matrix of all stations after edge decomposition in the first training sample e : e

[0054] (6)

[0055] In formula (6), denotes the (c+1)th column vector in the time feature matrix of the ith station after edge decomposition in the first training sample; e

[0056] Step 2.2.2 The edge selection layer obtains the sum value of the first-order difference time feature matrix of the ith station after edge decomposition in the first training sample by using formula (7) e , and further obtains the sum vector of the first-order difference time features of all stations after edge decomposition in the first training sample : e

[0057] (7)

[0058] In formula (7), denotes an absolute value operation;

[0059] Step 2.2.3 The edge selection layer firstly sorts the values in formula (8) from large to small, and obtains the sorted index station edge :

[0060] (8)

[0061] In formula (8), denotes a descending sorting operation, denotes a sorted index operation;

[0062] Step 2.2.4 The edge selection layer respectively obtains the first K index station edges in the first training sample by using formula (9) and formula (10) e : ​​​​​​​​a timing feature matrix of dense station edges and the e timing feature matrix of remaining sparse station edges in the i-th training sample :

[0063] (9)

[0064] (10)

[0065] In formula (9) and formula (10), denotes all station edge indexes from the 1st position to the z-th position, denotes all station edge indexes from the z-th position to the -th position.

[0066] The step 2.3 comprises:

[0067] Step 2.3.1, the dense timing information extraction layer first divides the timing feature of dense station edges in the i-th training sample into g groups, to obtain a grouping timing feature matrix of dense station edges in the i-th training sample e , wherein, denotes the timing feature matrix of dense station edges in the i-th training sample and the j-th group, and e , wherein, denotes the p-th column vector of the timing feature matrix of dense station edges in the i-th training sample and the j-th group , and e , l e denotes the p-th column vector of the timing feature matrix of dense station edges in the i-th training sample and the j-th group l , denotes the number of attention heads;

[0068] Step 2.3.2, the dense timing information extraction layer calculates the attention score between the p-th column vector and the p+1-th column vector of the i-th training sample by using formula (11) through the j-th attention head e , so as to obtain the attention matrix of the j-th attention head to q station edges in the i-th training sample l , e l , and further obtain the attention matrix of all attention heads in the i-th training sample e :

[0069] (11)​​​​​​​​​

[0070] in formula (11), denotes all vectors in the l group, denotes an activation function, is a parameter to be learned;

[0071] Step 2.3.3 The dense time sequence information extraction layer updates the time sequence feature of all dense station edges in the i-th training sample by using formula (12), thereby obtaining the attention feature of all dense station edges in the i-th training sample: e e

[0072] (12)

[0073] Step 2.3.4 The dense time sequence information extraction layer obtains the cycle feature of all dense station edges in the i-th training sample by using formula (13): e

[0074] (13)

[0075] In formula (13), denotes taking the mean value in the last dimension;

[0076] Step 2.3.5 The dense time sequence information extraction layer obtains the trend feature of the number of all dense station edges in the i-th training sample by using formula (14): e

[0077] (14)

[0078] Step 2.3.6 The dense time sequence information extraction layer obtains the output variable of the dense time sequence information extraction layer by using formula (15):

[0079] (15)

[0080] In formula (15), denotes a linear transformation operation, denotes summation.

[0081] The step 2.4 comprises:

[0082] Step 2.4.1 The sparse time sequence information extraction layer obtains the normalized feature matrix of the j-th sparse station edge after decomposition in the i-th training sample by using formula (16): e ​​​​​​​​​​Thus, the first e Normalized feature matrix of all sparse temporal edges of training samples :

[0083] (16)

[0084] In equation (16), Indicates the first e The last column vector of the edge of the j-th sparse site in the training samples;

[0085] Step 2.4.2 The sparse temporal information extraction layer uses equation (17) to obtain the first... e Periodic characteristics of the number of sparse site edges in a training sample ;

[0086] (17)

[0087] In equation (17), Take the mean over the last dimension. Represents learnable parameters;

[0088] Step 2.4.3 The sparse temporal information extraction layer uses equation (18) to obtain the first... e Trend characteristics of the number of all sparse site edges in a training sample :

[0089] (18)

[0090] Step 2.4.4 The sparse temporal information extraction layer uses equation (19) to obtain the output variable of the sparse temporal information extraction layer. :

[0091] (19)

[0092] Mode middle, This represents a linear transformation operation. It indicates addition.

[0093] The present invention provides an electronic device, including a memory and a processor, wherein the memory is used to store a program that supports the processor in executing the vehicle origin-to-destination number prediction method, and the processor is configured to execute the program stored in the memory.

[0094] The present invention discloses a computer-readable storage medium on which a computer program is stored, wherein the computer program, when executed by a processor, performs the steps of the vehicle origin-to-destination quantity prediction method.

[0095] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0096] 1. This invention uses the empirical mode decomposition method to decompose sparse time series, expand the time dimension features, solve the problem of sparsity of time series features, extract time series information more fully, and thus more accurately predict the number of vehicles at the starting station.

[0097] 2. This invention uses a first-order difference method to identify dense and sparse temporal edges. For edge locations with high traffic volume, the time series of these edges have more complex temporal features. The model in this invention uses an attention mechanism to identify the connections between these edge locations. For edge locations with low traffic volume, the traffic volume data of these edges changes little and the features are simple. This model performs mean processing on these edges. By distinguishing between these two different types of edge locations and processing them separately, the prediction accuracy is significantly improved.

[0098] 3. Unlike previous Transformer-based methods, Transformer-based methods have higher model complexity and a higher number of sites. The relationship is The computational complexity of the model in this invention is Furthermore, during training on the experimental dataset D830, the average number of parameters for the Transformer-based model was 20,000,000, while the model of this invention had 280,000 parameters. The method employed in this invention significantly outperforms other existing time series prediction methods, while greatly reducing model complexity and improving model speed. Attached Figure Description

[0099] Figure 1 This is a network structure diagram of the present invention;

[0100] Figure 2 This is a flowchart illustrating the overall data flow of the present invention. Detailed Implementation

[0101] In this embodiment, addressing the three current challenges, a method for predicting the number of shared bicycle origin-destination points based on empirical mode decomposition and an attention mechanism is proposed. This method includes: First, addressing the sparsity problem of shared bicycle station features, this invention uses empirical mode decomposition to decompose the time-series features of station edges, extracting multiple intrinsic mode feature functions and trend terms. Second, for predicting the number of shared bicycle station edges on a large scale, this invention first uses a first-order difference method to identify station edges with more riding records, defining these as dense edges, and defining the remaining edges with fewer riding records as sparse edges. Then, for dense edges, this invention first uses an attention mechanism to identify the connections between dense station edges, and then uses a fully connected network to extract time-series information; for sparse station edges, a sequence decomposition method is used to extract time-series information, and finally, a fully connected layer is used to output the prediction result. Specifically, as... Figure 1 As shown, the prediction steps are as follows:

[0102] Step 1: Obtain and preprocess user riding records of shared bicycles over a period of time:

[0103] Step 1.1: Obtain the user riding records of shared bicycles, and each user riding record includes: initial station, ending station, start time, and end time;

[0104] Define an edge connecting station a to station b as a station edge. If there exists For each site, there are Each site edge;

[0105] Step 1.2: Based on the user's cycling records, construct a sequence of cycling counts for all stations at various time intervals within a given period. ,in, This indicates the number of time intervals within a given time period. i The sequence of cycling numbers along the station, and , This represents the number of rides on the i-th station edge during the t-th time interval; P It represents the total number of time intervals within a given period; N Indicates the number of sites. Indicates the number of edges at the site. R represents the set of real numbers; the shared bicycle riding record data system used in this example comes from the riding record data of two shared electric bicycle operators of Wuhan Xiaoan Technology Co., Ltd. in 2022. Operator D830 is located in Kashgar, Xinjiang. N = 1 131 shared bicycle stations, totaling 17,161 lanes; operator D345 is located in Changsha County, Hunan Province, and the selection process is underway. N = 1There are 222 shared bicycle stations, with a total of 49,284 edges; the time interval is 1 hour.

[0106] Step 1.3, use the empirical mode decomposition function to... Perform sequence decomposition:

[0107] Step 1.3.0 defines the current outer iteration number as... L Define the current inner iteration number as k ;

[0108] Step 1.3.1 Define two conditions:

[0109] Condition 1: No. L The first outermost iteration k Intermediate function of the innermost iteration The number of extreme points and the number of zero-crossing points are equal or at most differ by one;

[0110] Condition 2: From the intermediate function The average of the upper and lower envelopes fitted to the maximum and minimum points is 0.

[0111] Step 1.3.2 Initialization L =1; and will As the first L New signals under the next outermost iteration ;

[0112] Step 1.3.3 Judgment If the function is monotonic, stop the iteration and proceed to step 1.3.11; otherwise, proceed to step 1.3.4.

[0113] Step 1.3.4 Initialize k=1; As the first L The intermediate function of the k-th inner iteration under the outer iteration is denoted as... .

[0114] Step 1.3.5 Obtain All local maxima ), This represents the number of maxima, thus allowing fitting using the spline function shown in equation (1). The maximum envelope :

[0115] (1)

[0116] In equation (1), Indicates the first Lthe n-th maximum value in the i-th station edge in the k-th inner layer iteration under the l-th outer layer iteration, denotes the i-th station edge, L the n+1-th maximum value in the i-th station edge in the k-th inner layer iteration under the l-th outer layer iteration, are four parameters to be learned; is an independent variable.

[0117] Step 1.3.6 obtains all minimum points of ), denotes the number of minimum points, thereby fitting the minimum envelope line of using a spline function shown in equation (2) :

[0118] (2)

[0119] In equation (2), denotes the n-th minimum value in the i-th station edge in the k-th inner layer iteration under the l-th outer layer iteration, L denotes the n+1-th minimum value in the i-th station edge in the k-th inner layer iteration under the l-th outer layer iteration, are four parameters to be learned; L is an independent variable. Step 1.3.7 calculates the mean value of the maximum envelope line and the minimum envelope line of the k-th inner layer iteration under the l-th outer layer iteration using equation (3) :

[0120] L (3)

[0121] (3)

[0122] Step 1.3.8 obtains the intermediate function of the k+1-th iteration under the l-th outer layer iteration using equation (4) L :

[0123] (4)

[0124] Step 1.3.9 judges whether satisfy condition one and condition two, if yes, takes as the i-th eigenmode function of the station edge, and executes step 1.3.11; otherwise, executes step 1.3.10. L

[0125] ​​​​​​Step 1.3.10 After k+1 is assigned to k, it is determined whether k>L is true. If true, the residual term is output as Step 1.3.10 After k+1 is assigned to k, it is determined whether k>L is true. If true, the residual term is output as Step 1.3.10 After k+1 is assigned to k, it is determined whether k>L is true. If true, the residual term is output as Step 1.3.10 After k+1 is assigned to k, it is determined whether k>L is true. If true, the residual term is output as

[0126] Step 1.3.11 If the Lth eigenmode function of the Lth site edge does not exist, the residual term is output as i Step 1.3.11 If the Lth eigenmode function of the Lth site edge does not exist, the residual term is output as L Step 1.3.11 If the Lth eigenmode function of the Lth site edge does not exist, the residual term is output as Step 1.3.11 If the Lth eigenmode function of the Lth site edge does not exist, the residual term is output as Step 1.3.11 If the Lth eigenmode function of the Lth site edge does not exist, the residual term is output as Step 1.3.11 If the Lth eigenmode function of the Lth site edge does not exist, the residual term is output as Step 1.3.11 If the Lth eigenmode function of the Lth site edge does not exist, the residual term is output as Step 1.3.11 If the Lth eigenmode function of the Lth site edge does not exist, the residual term is output as

[0127] (5)

[0128] Step 1.4 The sequence decomposition is performed on all site edges according to the process of step 1.3, thereby obtaining the time series of all site edges Step 1.4 The sequence decomposition is performed on all site edges according to the process of step 1.3, thereby obtaining the time series of all site edges Step 1.4 The sequence decomposition is performed on all site edges according to the process of step 1.3, thereby obtaining the time series of all site edges Step 1.4 The sequence decomposition is performed on all site edges according to the process of step 1.3, thereby obtaining the time series of all site edges i Step 1.4 The sequence decomposition is performed on all site edges according to the process of step 1.3, thereby obtaining the time series of all site edges Step 1.4 The sequence decomposition is performed on all site edges according to the process of step 1.3, thereby obtaining the time series of all site edges Step 1.4 The sequence decomposition is performed on all site edges according to the process of step 1.3, thereby obtaining the time series of all site edges L Step 1.4 The sequence decomposition is performed on all site edges according to the process of step 1.3, thereby obtaining the time series of all site edges

[0129] Step 1.5 The width of the sliding window is set as T Step 1.5 The width of the sliding window is set as Step 1.5 The width of the sliding window is set as Step 1.5 The width of the sliding window is set as Step 1.5 The width of the sliding window is set as

[0130] Step 1.5.1 The sample set Step 1.5.1 The sample set Step 1.5.1 The sample set Step 1.5.1 The sample set e Step 1.5.1 The sample set Step 1.5.1 The sample set Step 1.5.1 The sample set e Step 1.5.1 The sample set Step 1.5.1 The sample set Step 1.5.1 The sample set Step 1.5.1 The sample set Step 1.5.1 The sample set e Step 1.5.1 The sample set Step 1.5.1 The sample set Indicates the first e The c-th column vector in the temporal feature matrix after edge decomposition of the i-th site in the training samples. Indicates the first e The true results of each predicted sample, and In this embodiment, T=30 indicates the use of past... 24-hour forecast and future prediction Six hours. 70% of the dataset was used for training, 20% for validating the model, and 10% for testing the model.

[0131] Step 2, construct the splitting neural network;

[0132] Step 2.1: Construct a split neural network, including: an edge selection layer, a dense temporal information extraction layer, a sparse temporal information extraction layer, and an output layer;

[0133] Step 2.2, processing of edge selection layers;

[0134] Step 2.2.1, select the edge layer using formula (6) Perform difference processing to obtain the first... e The first-order difference vector in the c-th column of the time feature matrix after edge decomposition of the i-th site in the training samples. Thus, the first e The first-order difference time feature matrix after edge decomposition of the i-th site in the training samples And thus obtain the first e The first-order difference time feature matrix of all site edges decomposed from the training samples ={ }:

[0135] (6)

[0136] In equation (6), Indicates the first e The (c+1)th column vector of the time feature matrix after edge decomposition of the i-th site in the training samples.

[0137] Step 2.2.2 Select the edge layer using formula (7) After summing, we get the first... e The sum of the first-order difference time feature matrices of the i-th station after decomposition in the training samples. And thus obtain the first e The sum of the first-order difference temporal features of all site edges after decomposition in each training sample. :

[0138] (7)

[0139] In equation (7), This indicates the absolute value operation.

[0140] Step 2.2.3 Using formula (8), the edge selection layer is first... Sort the values ​​in the index from largest to smallest, and obtain the sorted index site edges. :

[0141] (8)

[0142] In equation (8), This indicates a descending sort operation. This indicates the operation of retrieving the sorted index;

[0143] Step 2.2.4: Select the edge layer using equations (9) and (10) to obtain the first... e The first of the training samples Temporal feature matrix of dense site edges and the e The remaining training samples Temporal feature matrix of sparse site edges In this embodiment, we select :

[0144] (9)

[0145] (10)

[0146] In equations (9) and (10), This represents the edge index of all stations from position 1 to position z. This represents the distance from the z-th position to the z-th position. All site edge indexes for each location.

[0147] Step 2.3 Processing of the dense temporal information extraction layer:

[0148] Step 2.3.1 Dense Temporal Information Extraction Layer First, the first... e Temporal features of dense site edges in training samples Divided into g groups, the first group is obtained. e Grouped temporal feature matrix of dense site edges in training samples ,in, Indicates the first e In the training samples, the th l The temporal feature matrix of the dense site edges of the group, and ,in, Indicates the first e In the training samples, the th l Temporal feature matrix of dense site edges of the group The p-th column vector, and , This indicates the number of attention points.

[0149] Step 2.3.2 Dense Temporal Information Extraction Layer: Calculate the first... e In the training samples, the th l Attention score between attention heads and the p-th column vector and the (p+1)-th column vector Thus, the first e In the training samples, the th l Attention matrix of 1 attention head to q site edges }, and thus obtain the first e Attention matrix of all attention heads in each training sample :

[0150] (11)

[0151] In equation (11), Indicates the first l All vectors in the group This represents the activation function. These are the parameters to be learned.

[0152] Step 2.3.3 The dense temporal information extraction layer updates the first layer using equation (12). e Temporal features of all dense site edges in a training sample Thus, the first e Attention features of all dense site edges in a training sample :

[0153] (12)

[0154] Step 2.3.4 Dense Temporal Information Extraction Layer: Using Equation (13) to extract the first... e Attention features of all dense site edges in a training sample Take the average to get the first e Periodic features of all dense site edges in a training sample ;

[0155] (13)

[0156] In equation (13), This means taking the mean over the last dimension.

[0157] Step 2.3.5 Dense Temporal Information Extraction Layer uses Equation (14) to obtain the first... eThe attention feature matrix of all dense station edges in the i-th training sample is subtracted from the periodic feature of all dense station edges to obtain the trend feature of all dense station edges in the i-th training sample e :

[0158] (14)

[0159] In step 2.3.6, the dense timing information extraction layer linearly transforms and sums the periodic feature and the trend feature of all dense station edges in the i-th training sample respectively by using formula (15) to obtain the output variable of the dense timing information extraction layer e : :

[0160] (15)

[0161] In formula (15), denotes a linear transformation operation, denotes a sum operation.

[0162] Step 2.4, processing of the sparse timing information extraction layer:

[0163] In step 2.4.1, the sparse timing information extraction layer differentiates the decomposed timing feature of the j-th sparse station edge in the i-th training sample by using formula (16) to obtain the decomposed normalized feature matrix of the j-th sparse station edge in the i-th training sample e : e , thereby obtaining the normalized feature matrix of all sparse timing edges in the i-th training sample e :

[0164] (16)

[0165] In formula (16), denotes the last column vector of the j-th sparse station edge in the i-th training sample. e

[0166] In step 2.4.2, the sparse timing information extraction layer takes the mean of the normalized features of all sparse station edges in the i-th training sample by using formula (17) to obtain the periodic feature of the number of all sparse station edges in the i-th training sample e : e

[0167] (17) ​​​​​​​​​

[0168] In formula (17), In the last dimension, taking the mean, represents a learnable parameter.

[0169] Step 2.4.3 The sparse temporal information extraction layer uses formula (18) to subtract the periodic feature of the normalized feature matrix of all sparse station edges in the i-th training sample from the number of all sparse station edges, to obtain the trend feature of the number of all sparse station edges in the i-th training sample e : e

[0170] (18)

[0171] Step 2.4.4 The sparse temporal information extraction layer uses formula (19) to linearly transform and sum the periodic feature and the trend feature of the number of all sparse station edges in the i-th training sample respectively, to obtain the output variable of the sparse temporal information extraction layer e :

[0172] (19)

[0173] In formula (19), represents a linear transformation operation, represents a sum.

[0174] Step 2.5 Processing of the output layer:

[0175] Step 2.5.1 The output layer uses formula (20) to splice the output variable of the dense temporal information extraction layer and the output variable of the sparse temporal information extraction layer, to obtain the updated feature of all station edges in the i-th training sample : e In order to ensure that the position of the shared bicycle edge does not change, it is necessary to rearrange the spliced time series to restore the original position.

[0176] (20)

[0177] In formula (20), represents a splicing operation.

[0178] Step 2.5.2 The output layer uses formula (21) to linearly transform the updated feature of all station edges in the i-th training sample, to obtain the output variable of the output layer e : e ​​​​​​​​Prediction results of all edges for each training sample :

[0179] (twenty one)

[0180] In equation (21), Indicates the activation function; This represents a linear transformation operation. Since the number of edges at each station is non-negative, therefore, we use... Ensure the output is non-negative; since it pertains to the future... The number of stations is predicted for each time interval, therefore a linear transformation is used to output the prediction results.

[0181] Step 3: Based on the first e Prediction results of all sites for each training sample and the e The true results of the predicted samples The mean squared error (MSE) is constructed as the loss function of the deep neural network. With the goal of minimizing the loss function, the parameters of the splitting neural network constructed in step 2 are optimized and updated using the time backpropagation algorithm until the loss function converges. The model parameters are then saved, resulting in a trained splitting neural network model used to predict the number of vehicles on all connected edges in the future. The training and testing process is as follows: Figure 2 As shown.

[0182] In this embodiment, an electronic device includes a memory and a processor. The memory stores a program that supports the processor in executing the above-described method, and the processor is configured to execute the program stored in the memory.

[0183] In this embodiment, a computer-readable storage medium stores a computer program, which is executed by a processor to perform the steps of the above method.

[0184] The method of this invention is tested on the real-time prediction platform of Xiaoan Technology's shared bicycle system by using data from operator D830 and operator D345, and the model performance is evaluated using six indicators: MSE, MAE, RSE, mMSE, mMAE, and mRSE. MSE, MAE, and RSE represent global indicators, while mMSE, mMAE, and mRSE represent the model's performance on non-zero data. The calculation method is shown in equations (22) to (27).

[0185] (twenty two)

[0186] (twenty three)

[0187] (twenty four)

[0188] (25)

[0189] (26)

[0190] (27)

[0191] In equations (22)-(27), Indicates the first e The true result of the number of edge connections at the i-th site in the predicted sample. No. e The predicted number of edge numbers at the i-th site in the predicted sample. Represents a set of non-zero elements. Indicates the number of non-zero elements.

[0192] Meanwhile, this invention compares nine models: the traditional statistical method Differential Integrated Moving Average Autoregressive Model (ARIMA), the traditional deep learning methods LSTM, GRU, and TCN, and the latest time series prediction methods Transformer (2017), Reformer (2020), Informer (2021), Autoformer (2021), and DLinear (2023). The experimental results are shown in Table 1.

[0193] Table 1: Comparison of Model Experiment Results

[0194]

[0195] In Table 1, Length represents the length of the input historical time series, the underlined number represents the best performing model among the comparison models, the bold number represents the best performing model among all models, and IMP represents the improvement ratio of the prediction results of this invention compared to the prediction results of the best performing model among the comparison models.

[0196] As can be seen from Table 1, the model proposed in this invention outperforms existing models in all six indicators of the 830 and 345 operating areas of enterprises. Overall, it demonstrates the effectiveness of the model in predicting the actual number of shared bicycles at the station.

Claims

1. A method for predicting the number of shared bicycle origin-destination points based on empirical mode decomposition and attention mechanism, characterized in that, Includes the following steps: Step 1: Obtain and preprocess user riding records of shared bicycles over a period of time: Step 1.1: Obtain the user riding records of shared bicycles, and each user riding record includes: initial station, ending station, start time, and end time; Define an edge connecting station a to station b as a station edge. If there exists For each site, there are Each site edge; Step 1.2: Based on the user's cycling records, construct a sequence of cycling counts for all stations at various time intervals within a given period. ,in, This indicates the number of time intervals within a given time period. i The sequence of cycling numbers along the station, and , This represents the number of rides on the i-th station edge during the t-th time interval; P It represents the total number of time intervals within a given period; N Indicates the number of sites. Indicates the number of edges at the site. R represents the set of real numbers; Step 1.3, use the empirical mode decomposition function to... Perform sequence decomposition to obtain the first... i Features after time series decomposition of each site ; Step 1.4 Follow the process in Step 1.3 to process all site edges. Perform sequence decomposition to obtain the time series of all site edges. ,in, Indicates the first i Features after time series decomposition of each site edge, and , express L One basic mode function, one residual term, and one original time series; Step 1.5, set the width of the sliding window to... T ,and , Indicates the length of the input training sequence. Indicates the length of the predicted time series; According to the sliding window The samples are partitioned to obtain the sample set. ,in, Represents the first [unit / type] constructed within the sliding window. e One sample data, and ,in, Indicates the first e One training sample data, and , = ,in, Indicates the first e The time series data after edge decomposition of the i-th station in the training samples, and , Indicates the first e The c-th column vector in the temporal feature matrix after edge decomposition of the i-th site in the training samples. Indicates the first e The true results of each predicted sample, and ; Step 2, construct the splitting neural network; Step 2.1, the construction of the splitting neural network includes: an edge selection layer, a dense temporal information extraction layer, a sparse temporal information extraction layer, and an output layer; Step 2.2, the edge selection layer pair Processing is performed to obtain the first... e The first training sample data Temporal feature matrix of dense site edges and the e The remaining training sample data Temporal feature matrix of sparse site edges ; Step 2.3, the dense temporal information extraction layer... The processing yields the output variable. ; Step 2.4, the sparse temporal information extraction layer... Process the data to obtain the output variables. ; Step 2.5, processing of the output layer: Step 2.5.1 The output layer uses equation (20) to obtain the first... e Update features of all site edges for each training sample : (20) Mode middle, Indicates a splicing operation; Step 2.5.2 The output layer uses equation (21) to obtain the first... e Prediction results of all edges for each training sample : (21) In equation (21), This represents the activation function. Represents a linear transformation operation; Step 3: Based on the first e Prediction results of all sites for each training sample and the e The true results of the predicted samples The mean squared error (MSE) is constructed as the loss function of the deep neural network. With the goal of minimizing the loss function, the parameters in the split neural network are optimized and updated through the backpropagation algorithm until the loss function converges. The model parameters are then saved to obtain a trained split neural network model, which is used to predict the number of shared bicycles on all connected edges in the future.

2. The method for predicting the number of shared bicycle origin-destination points based on empirical mode decomposition and attention mechanism according to claim 1, characterized in that, Step 1.3 includes: Step 1.3.0 defines the current outer iteration number as... L Define the current inner iteration number as k ; Step 1.3.1 Define two conditions: Condition 1: No. L The first outermost iteration k Intermediate function of the innermost iteration The number of extreme points and the number of zero-crossing points are equal or at most differ by one; Condition 2: From the intermediate function The average of the upper and lower envelopes fitted by the maximum and minimum points is 0. Step 1.3.2 Initialization L =1; and will As the first L New signals under the next outermost iteration ; Step 1.3.3 Judgment If the function is monotonic, stop the iteration and proceed to step 1.3.11; otherwise, proceed to step 1.3.

4. Step 1.3.4 Initialize k=1; As the first L The intermediate function of the k-th inner iteration under the outer iteration is denoted as... ; Step 1.3.5 Obtain All local maxima ), This represents the number of maxima, thus allowing fitting using the spline function shown in equation (1). The maximum envelope : (1) In equation (1), Indicates the first L The nth maximum value of the i-th site edge in the k-th inner iteration under the outer iteration. Indicates the first L The (n+1)th maximum value of the i-th site edge in the k-th inner iteration under the outer iteration. These are the four parameters to be learned; As the independent variable; Step 1.3.6 Obtain All local minima ), This represents the number of local minima, thus allowing for fitting using the spline function shown in equation (2). Minimum envelope : (2) In equation (2), Indicates the first L The nth minimum value of the i-th site edge in the k-th inner iteration under the outer iteration. Indicates the first L The (n+1)th minimum value of the i-th station edge in the k-th inner iteration under the outer iteration. These are the four parameters to be learned; As the independent variable; Step 1.3.7 Calculate the first step using equation (3). L The mean of the maximum and minimum envelopes of the k-th inner iteration under the second outer iteration. : (3) Step 1.3.8 Use equation (4) to obtain the first... L Intermediate function of the (k+1)th iteration under the outermost iteration : (4) Step 1.3.9 Judgment Do both conditions one and two are satisfied? If so, then... As the edge of the i-th station L Individual eigenmode functions If yes, proceed to step 1.3.11; otherwise, proceed to step 1.3.

10. Step 1.3.10: After assigning k+1 to k, check if k>K is true. If true, then... As the first Individual eigenmode functions ; and execute step 1.3.11; otherwise, return to repeat step 1.3.5 sequentially; Step 1.3.11 If the first one does not exist... i The first station side L Individual eigenmode functions Then As the output of the residual term, i.e. And execute step 1.4; otherwise, use equation (5) to obtain the first... +1 new signal After assigning L+1 to L, return to step 1.3.3: (5)。 3. The method for predicting the number of shared bicycle origin-destination points based on empirical mode decomposition and attention mechanism according to claim 2, characterized in that, Step 2.2 includes: Step 2.2.1 The edge selection layer uses equation (6) to obtain the first... e The first-order difference vector in the c-th column of the time feature matrix after edge decomposition of the i-th site in the training samples. Thus, the first e The first-order difference time feature matrix after edge decomposition of the i-th site in the training samples And thus obtain the first e The first-order difference time feature matrix of all site edges decomposed in the training samples ={ }: (6) In equation (6), Indicates the first e The (c+1)th column vector of the temporal feature matrix after edge decomposition of the i-th site in the training samples; Step 2.2.2 The edge selection layer uses equation (7) to obtain the first... e The sum of the first-order difference time feature matrices of the i-th station after decomposition in the training samples. And thus obtain the first e The sum of the first-order difference temporal features of all site edges after decomposition in each training sample. : (7) In equation (7), This indicates the absolute value operation; Step 2.2.3 The edge selection layer first uses formula (8) to... Sort the values ​​in the index from largest to smallest, and obtain the sorted index site edges. : (8) In equation (8), This indicates a descending sort operation. This indicates the operation of retrieving the sorted index; Step 2.2.4 The edge selection layer obtains the first edge selection layer using equations (9) and (10) respectively. e Among the training samples, the first Temporal feature matrix of dense site edges and the e The remaining training samples Temporal feature matrix of sparse site edges : (9) (10) In equations (9) and (10), This represents the edge index of all stations from position 1 to position z. This represents the distance from the z-th position to the z-th position. All site edge indexes for each location.

4. The method for predicting the number of shared bicycle origin-destination points based on empirical mode decomposition and attention mechanism according to claim 3, characterized in that, Step 2.3 includes: Step 2.3.1 The dense temporal information extraction layer first extracts the first... e Temporal features of dense site edges in training samples Divide into g groups to obtain the first group. e Grouped temporal feature matrix of dense site edges in training samples ,in, Indicates the first e In the training samples, the th l The temporal feature matrix of the dense site edges of the group, and ,in, Indicates the first e In the training samples, the th l Temporal feature matrix of dense site edges of the group The p-th column vector, and , Indicates the number of attention heads; Step 2.3.2 The dense temporal information extraction layer uses equation (11) to calculate the first... e In the training samples, the th l Attention score between attention heads and the p-th column vector and the (p+1)-th column vector Thus, the first e In the training samples, the th l Attention matrix of 1 attention head to q site edges }, and thus obtain the first e Attention matrix of all attention heads in each training sample : (11) In equation (11), Indicates the first l All vectors in the group This represents the activation function. These are the parameters to be learned; Step 2.3.3 The dense temporal information extraction layer updates the first layer using equation (12). e Temporal features of all dense site edges in a training sample Thus, the first e Attention features of all dense site edges in a training sample : (12) Step 2.3.4 The dense temporal information extraction layer uses equation (13) to obtain the first... e Periodic features of all dense site edges in a training sample ; (13) In equation (13), This means taking the mean over the last dimension; Step 2.3.5 The dense temporal information extraction layer uses equation (14) to obtain the first... e Trend characteristics of the number of dense site edges in a training sample ; (14) Step 2.3.6 The dense temporal information extraction layer uses equation (15) to obtain the output variables of the dense temporal information extraction layer. : (15) In equation (15), This represents a linear transformation operation. It indicates addition.

5. The method for predicting the number of shared bicycle origin-destination points based on empirical mode decomposition and attention mechanism according to claim 4, characterized in that, Step 2.4 includes: Step 2.4.1 The sparse temporal information extraction layer uses equation (16) to obtain the first... e The normalized feature matrix after decomposition of the j-th sparse site edge in the training samples. Thus, the first e Normalized feature matrix of all sparse temporal edges of training samples : (16) In equation (16), Indicates the first e The last column vector of the edge of the j-th sparse site in the training samples; Step 2.4.2 The sparse temporal information extraction layer uses equation (17) to obtain the first... e Periodic characteristics of the number of sparse site edges in a training sample ; (17) In equation (17), Take the mean over the last dimension. Represents learnable parameters; Step 2.4.3 The sparse temporal information extraction layer uses equation (18) to obtain the first... e Trend characteristics of the number of sparse site edges in a training sample : (18) Step 2.4.4 The sparse temporal information extraction layer uses equation (19) to obtain the output variable of the sparse temporal information extraction layer. : (19) In equation (19), This represents a linear transformation operation. It indicates addition.

6. An electronic device, comprising a memory and a processor, characterized in that, The memory is used to store a program that supports the processor in executing any of the shared bicycle origin-destination number prediction methods according to claims 1-5, and the processor is configured to execute the program stored in the memory.

7. A computer-readable storage medium storing a computer program thereon, characterized in that, When the computer program is run by the processor, it performs the steps of the shared bicycle origin-destination number prediction method according to any one of claims 1-5.

Citation Information

Patent Citations

  • Tourism demand prediction method based on STL and LSTM with attention mechanism

    CN114091768A

  • Urban rail transit passenger flow short-term prediction method based on improved BP neural network

    CN114925924A