Rail transit passenger flow OD prediction method and system
By using the OD prediction method based on the iTransformer model in rail transit, combining the variable embedding layer and the time domain convolution network layer, the spatial and temporal characteristics of passenger flow are extracted, and the problem of low OD prediction accuracy in the existing technology is solved, and the more Accurate passenger flow forecast and operational optimization.
Patent Information
- Application Number
- CN202411256460.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-09
- Publication Date
- 2024-12-24
- Estimated Expiration
- 2044-09-09
AI Technical Summary
The existing OD prediction method for passenger flow in rail transit is based on a linear model of statistical theory, and it is difficult to accurately capture the temporal variability and spatial correlation of passenger flow. The neural network method is prone to gradient disappearance and explosion problems, and the prediction accuracy is low.
Using the OD prediction method of rail transit passenger flow based on the iTransformer model, the spatial and temporal relationship characteristics are extracted to predict passenger flow by constructing an OD matrix, combining variable embedding layer, multivariate attention mechanism layer, time domain convolution network layer and full connection layer. .
It improves the accuracy of OD passenger flow prediction in rail transit, improves the understanding and prediction ability of passenger flow laws, helps the transportation department to better arrange transportation capacity and avoid operational bottlenecks.
Smart Images

Figure CN119180372A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of rail transit control technology, and in particular to a rail transit passenger flow OD prediction method and system thereof. Background Art
[0002] As a mode of transportation in cities, urban rail transit has the characteristics of large passenger volume, safety, punctuality and sustainability, and plays an important role in urban development. However, with the acceleration of urbanization, the rail transit network is under great pressure from passenger transportation, and there are problems such as low punctuality and train departure times that cannot effectively meet the morning and evening peaks. The root cause is the lack of accurate analysis of passenger travel patterns, which leads to unbalanced resource allocation of the rail transit network and the problem that the supply of the rail network cannot meet the transportation demand. In summary, how to accurately predict passenger flow has become an urgent problem to be solved.
[0003] In the early days, various classic linear prediction models based on statistical theory were mainly used to accurately predict OD passenger flow. For example, the autoregressive integrated moving average (ARMIA) model, the Kalman filter model, and the non-parametric model. An important assumption of this model is that the passenger flow has linear and stable characteristics. The linear prediction model based on statistical theory is simple to calculate and efficient. It is a static prediction method that is greatly affected by large and abnormal passenger flows and has low prediction accuracy. In fact, the OD volume is greatly affected by its own internal temporal variability and spatial correlation. With the development of big data technology, related research has gradually transitioned to the use of neural networks and other methods. Through a large amount of OD data training, it attempts to dig out the spatiotemporal relationship from it, and then accurately grasp the passenger flow rules. However, this method is prone to gradient disappearance and explosion problems, and training is not easy. Summary of the invention
[0004] In order to overcome the above technical defects and improve the accuracy of OD passenger flow prediction in urban rail transit, the embodiment of the present application provides a rail transit passenger flow OD prediction method and system thereof, and the specific scheme is as follows:
[0005] In the first aspect, in an embodiment of the present invention, a rail transit passenger flow OD prediction method is characterized in that it includes the following steps: S1, constructing an OD passenger flow data set: matching the cleaned passenger flow data with the entry and exit information to form an OD passenger flow data set of a certain time step, wherein the passenger flow data is extracted from an automatic ticket vending and checking AFC system; S2, generating an OD matrix: for each station in the rail transit system, taking the station as the starting station and other stations as different destination stations, taking out the corresponding passenger flow from the OD passenger flow data set to generate a corresponding OD matrix; wherein the OD matrix includes spatial relationships and temporal relationships, and in the OD matrix corresponding to each station, the spatial relationships corresponding to the time series from the same starting station to different destination stations are The time variables represent their spatial relationship, and the time variables corresponding to the same timestamp from the same starting station to different destination stations in the OD matrix corresponding to each station represent their temporal relationship; S3, OD passenger flow prediction: the OD matrix is input into the trained OD prediction model to predict the OD passenger flow prediction result; wherein the OD prediction model is improved based on the iTransformer model, including a variable embedding layer, a multivariate attention mechanism layer, a time domain convolutional network layer, a feature fusion layer and a fully connected layer. The self-attention mechanism in the multivariate attention mechanism layer is used to extract features of the spatial relationship in the OD matrix. The time domain convolutional network layer includes causal convolution and dilated convolution, which are used to extract features of the temporal relationship in the OD matrix.
[0006] Optionally, in an implementation of the embodiment of the present invention, the specific steps of data cleaning include deleting duplicate values and correcting abnormal values using a smoothing correction method;
[0007] The OD passenger flow dataset is denoted as D T=t ; Its expression is:
[0008]
[0009] Where, T = t represents different time, n = 1, 2, ..., n,, ..., n, D T=t is the OD data set at different times, d 12 (t), …d 1n (t) represents the passenger flow from the 2nd to the nth starting stations to the 1st station, where the passenger flow from the 1st station to the 1st station is zero, that is, the value of the first row and the first column in the formula; d 21 (t)…d n1 (t) represents the passenger flow from the 1st starting station to the 2nd to nth stations; the elements on the diagonal in the formula represent the passenger flow from the nth station to the nth station and are all 0.
[0010] Optionally, in an implementation of the embodiment of the present invention, in a rail transit system, the daily operation period of the rail transit system is divided into b time periods, Represents the number of passengers from origin i to destination j in the Dth (1≤D≤s) day interval p. For n destinations with origin i, the number of passengers on n OD pairs forms an n-dimensional OD vector It is expressed as:
[0011]
[0012] At this time, the OD matrix is recorded as Its expression is:
[0013]
[0014] In the formula, the spatial variable is The vector corresponding to each column in is denoted as Mc, and the time variable is The vector corresponding to each row in is denoted as M k .
[0015] Optionally, in an implementation of the embodiment of the present invention, the specific steps of OD passenger flow prediction include:
[0016] S3.1. OD matrix After entering the OD prediction model, its spatial variable Mc is input into the variable embedding layer, and its temporal variable M k Input to the time domain convolutional network layer;
[0017] S3.2, the variable embedding layer embeds the vector, and then inputs it into the multivariate attention mechanism layer, in which the self-attention mechanism is used to extract the features in the spatial variable Mc, and the extracted results are sequentially subjected to residual connection and layer normalization to obtain the spatial variable features, which are recorded as H c , and output to the feature fusion layer;
[0018] S3.3. In the time domain convolutional network layer, first convert the time variable M k After transposition, the time domain convolution network composed of causal convolution and dilated convolution is used to extract features and obtain the time variable feature, which is recorded as H M , and output to the feature fusion layer;
[0019] S3.4. In the feature fusion layer, the spatial variable feature H c and time variable characteristic H M Feature fusion is performed to obtain feature W, and its feature fusion expression is: Output to the fully connected layer;
[0020] S3.5, extract the input feature W in the fully connected layer and output the OD passenger flow prediction result;
[0021] The fully connected layer has 3 hidden layers, 1 input layer, and 1 output layer. The number of neurons is set to 256, the activation function is the softmax function, the input layer receives the feature W, and the output layer is denormalized.
[0022] Optionally, in an implementation of the embodiment of the present invention, the time-domain convolutional network composed of causal convolution and dilated convolution is used to extract features to obtain time variable features, which are recorded as H M The specific steps include:
[0023] S3.3.1. Use the following calculation formula to calculate the time variable M k The calculation result is obtained by calculation, and the calculation formula is:
[0024]
[0025] Where d is the dilation coefficient, g is the convolution kernel size, and f(e) is the e-th element in the convolution kernel;
[0026] S3.3.2, the calculation result is first passed through the ReLU activation function, then the layer normalization processing, and finally the residual connection output is used. The output F(M) is expressed as:
[0027] F(M)=F(t)+M k ;
[0028] S3.3.3. The output result of the residual connection is normalized again to obtain the time variable feature H M .
[0029] Optionally, in one implementation of the present invention, cross-validation is used to perform parameter update optimization during the training of the OD prediction model. The loss function of the OD prediction model is MSE, and minimizing MAPE and RMSE is used as evaluation indicators to complete model training.
[0030] In a second aspect, an embodiment of the present invention provides a rail transit passenger flow OD prediction system, including:
[0031] Data collection unit, data processing unit, training unit and prediction unit;
[0032] The data collection unit is used to construct an OD passenger flow data set, specifically including: matching the cleaned passenger flow data with the entry and exit information to form an OD passenger flow data set of a certain time step, wherein the passenger flow data is extracted from the automatic ticket vending and checking AFC system;
[0033] The data processing unit is used to generate an OD matrix, specifically including: for each station in the rail transit system, the station is taken as the starting station and other stations are taken as different destination stations to extract the corresponding passenger flow from the OD passenger flow data set to generate a corresponding OD matrix; wherein the OD matrix includes spatial relationship and time relationship, and in the OD matrix corresponding to each station, the spatial variables corresponding to the time series from the same starting station to different destination stations represent their spatial relationship, and in the OD matrix corresponding to each station, the time variables corresponding to the same timestamp from the same starting station to different destination stations represent their time relationship;
[0034] The training unit is used to: use cross-validation to update and optimize parameters during the training of the OD prediction model. The loss function of the OD prediction model is MSE, and minimizing MAPE and RMSE is used as evaluation indicators to complete model training;
[0035] The prediction unit is used for OD passenger flow prediction, specifically including: inputting the OD matrix into the trained OD prediction model to obtain the OD passenger flow prediction result; wherein the OD prediction model is improved based on the iTransformer model, including a variable embedding layer, a multivariate attention mechanism layer, a time domain convolutional network layer, a feature fusion layer and a fully connected layer. The self-attention mechanism in the multivariate attention mechanism layer is used to extract features of the spatial relationship in the OD matrix. The time domain convolutional network layer includes causal convolution and dilated convolution, which are used to extract features of the temporal relationship in the OD matrix.
[0036] The embodiments of the present application adopt the above technical solution to achieve the following technical effects:
[0037] This solution uses the time series variable embedding and self-attention mechanism in iTransformer to obtain the spatial distribution of rail OD passenger flow. At the same time, the time domain convolutional network is used to extract features for temporal relationship mining, and the spatial relationship features and temporal relationship features are fused. The fully connected layer performs further internal feature learning and makes predictions. Denormalization is used to obtain easy-to-understand expressions, thereby improving the accuracy of OD passenger flow prediction in urban rail transit. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] The accompanying drawings exemplarily illustrate the embodiments and constitute a part of the specification, and together with the text description of the specification, are used to explain the exemplary implementation of the embodiments. The embodiments shown are for illustrative purposes only and do not limit the scope of the claims. In all drawings, the same reference numerals refer to similar but not necessarily identical elements.
[0039] Figure 1 A schematic diagram of a flow chart of a rail transit passenger flow OD prediction method in an embodiment of the present invention;
[0040] Figure 2 Schematic diagram of time variables and space variables in an embodiment of the present invention;
[0041] Figure 3 A flowchart of specific steps of OD passenger flow prediction in an embodiment of the present invention;
[0042] Figure 4 Schematic diagram of the model structure of the OD prediction model in an embodiment of the present invention;
[0043] Figure 5 Schematic diagram of calculation of the self-attention mechanism in an embodiment of the present invention;
[0044] Figure 6 Schematic diagram of the workflow of a time domain convolutional network in an embodiment of the present invention;
[0045] Figure 7 A schematic diagram of a process of using a time domain convolutional network to perform feature extraction in an embodiment of the present invention;
[0046] Figure 8 It is a schematic diagram of the system structure of the rail transit passenger flow OD prediction system in an embodiment of the present invention. DETAILED DESCRIPTION
[0047] In order to make the purpose, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
[0048] It should be noted that the descriptions involving "first", "second", etc. in the embodiments of the present application are only for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.
[0049] In the description of the present application, it should be understood that the numerical labels before the steps do not indicate the order in which the steps are executed, but are only used to facilitate the description of the present application and to distinguish each step, and therefore should not be understood as a limitation on the present application.
[0050] In order to facilitate understanding of the technical solution of the embodiment of the present application, the technical solution will be described in detail below with reference to the accompanying drawings, as follows:
[0051] Embodiment 1
[0052] See also Figure 1 , the rail transit passenger flow OD prediction method in an embodiment of the present invention is described in detail, which specifically includes the following steps:
[0053] S1. Construct OD passenger flow data set: Match the cleaned passenger flow data with the entry and exit information to form an OD passenger flow data set of a certain time step.
[0054] Specifically, the passenger flow data is extracted from the automatic ticket vending and checking AFC system.
[0055] When constructing the key basic data structure of the OD passenger flow data set, data preprocessing is required - this is one of the very important steps. It requires the cleaning of the original AFC (automatic ticket collection) system data first to ensure that only high-quality and valid data will be retained for subsequent analysis; next, according to each passenger's specific entry and exit records, they are integrated and matched, and based on this, a series of data sets reflecting the actual passenger flow between different departure locations and target destinations within a fixed period are constructed. For example, in the process of constructing the OD passenger flow data of a specific time span of the Beijing subway network, the following data may be obtained by summarizing the statistics within the hour from 7:30 to 8:30 in the morning: 2,000 people took the train from A to B.
[0056] S2. Generate OD matrix: For each station in the rail transit system, take the station as the starting station and other stations as different destination stations to extract the corresponding passenger flow from the OD passenger flow data set to generate the corresponding OD matrix.
[0057] Specifically, the OD matrix includes spatial relationships and temporal relationships. In the OD matrix corresponding to each station, the spatial variables corresponding to the time series from the same starting station to different destination stations represent their spatial relationships. In the OD matrix corresponding to each station, the temporal variables corresponding to the same timestamp from the same starting station to different destination stations represent their temporal relationships.
[0058] In S2, the OD matrix can reflect the data representation of the closeness of the connection and the frequency of flow between different transportation network nodes. In this process, it is necessary to convert the information extracted from the above-mentioned OD passenger flow data set into a form that is easy for machine learning models to analyze and interpret, so as to clearly show the distribution characteristics of travel demand from each starting and ending station combination in the entire transportation network. The specific method is to use the station numbers as the horizontal axis coordinates in a given order, and arrange the vertical axis index formed by the station arrangement in each line in the same way. With the support of the prerequisites for completing the above preparations, this information can be used to construct a rectangular digital array reflecting the total number of passengers from a certain starting point to other target locations in a certain period of time. This table not only reflects the actual passenger volume distribution from a certain departure station to all possible destination stations at a specific time, but also reflects the seasonal effect and intraday imbalance of the overall travel law as the time changes in the cross-sectional direction; that is, in this matrix, it can be seen that for example, during the evening rush hour after get off work on Friday, passengers usually choose to go from A to B to enjoy the night life, which leads to fluctuations in the passenger flow level higher than the same point on weekends.
[0059] S3. OD passenger flow prediction: Input the OD matrix into the trained OD prediction model to obtain the OD passenger flow prediction result.
[0060] In order to more accurately predict the OD amount at the next moment, it is necessary to consider the relationship between time variables and spatial variables. Therefore, the preset OD prediction model is used for description. The preset OD prediction model is obtained by improving the iTransformer model. Its structure is as follows: Figure 3 Specifically, the OD prediction model is improved based on the iTransformer model, including a variable embedding layer, a multivariate attention mechanism layer, a time domain convolutional network layer, a feature fusion layer, and a fully connected layer. The self-attention mechanism in the multivariate attention mechanism layer is used to extract features from the spatial relationship in the OD matrix. The time domain convolutional network layer includes causal convolution and dilated convolution, which are used to extract features from the temporal relationship in the OD matrix.
[0061] S3 is the last step to make an accurate forecast of future travel flow. It uses the previously processed passenger flow information from the source to the destination as part of the input content received by the machine prediction system. In this process, an enhanced version of the iTransformer architecture is used to perform relevant operations. Its design combines several different levels of deep understanding components in order to achieve better results. For example, when predicting passenger flow before the Spring Festival, due to the huge number of people returning home during the Spring Festival, the historical data analysis and prediction established according to the above steps can find that the number of passengers leaving the major subway stations will increase by about 40% in the month before the festival. This prediction can help the transportation department better arrange transportation capacity to cope with the upcoming large passenger flow and avoid operational bottlenecks. Through the application of such steps and methods, we have successfully improved the accuracy of the advance judgment of the number of passengers arriving at any other destination station from any point in the entire subway network, and provided a strong theoretical basis and reference standard value for the scientific planning and optimization of operation plans of relevant units, thereby improving the quality of public services and passenger experience, realizing a more efficient and intelligent urban infrastructure operation mode, achieving the goal of alleviating congestion and improving service levels, and ultimately achieving the role of optimizing the public transportation environment and promoting the comprehensive development of the economy and society.
[0062] In addition, in the above method, cross-validation is used to perform parameter update optimization during the training process of OD model prediction. The loss function of the OD prediction model is MSE, and minimizing MAPE and RMSE is used as evaluation indicators to complete model training.
[0063] Specifically, cross validation is a commonly used model evaluation method, which evaluates the performance of the model by dividing the data set into multiple parts, using part of the data for training and the other part of the data for verification or testing. This method can help the present invention understand the performance of the model on unseen data, so as to better adjust the parameters and structure of the model to improve the accuracy and stability of the model. The loss function of the model is MSE, and minimizing MAPE and RMSE is used as evaluation indicators. The formulas of each evaluation indicator are as follows:
[0064]
[0065] Where l represents the number of data, Represents the predicted value, y i Indicates actual value.
[0066] In the technical solution of the embodiment of the present invention, for each station in the rail transit system, the station is taken as the starting station and other stations are taken as different destination stations to extract the corresponding passenger flow from the OD passenger flow data set to generate a corresponding OD matrix. In the OD matrix corresponding to each station, the spatial variables corresponding to the time series from the same starting station to different destination stations represent their spatial relationship, and in the OD matrix corresponding to each station, the time variables corresponding to the same timestamp from the same starting station to different destination stations represent their temporal relationship, so that the OD matrix can comprehensively cover the relatively complete passenger flow information in the urban rail transit. The iTransformer model is further improved by using the self-attention mechanism, causal convolution and dilated convolution to obtain a new OD prediction model that can accurately extract the spatial relationship and temporal relationship in the OD matrix, thereby effectively improving the accuracy of OD passenger flow prediction in urban rail transit.
[0067] Embodiment 2
[0068] Next, the data cleaning method of the embodiment of the present invention is described:
[0069] Optionally, in S1, the specific steps of the above data cleaning include deleting duplicate values and correcting abnormal values using a smoothing correction method;
[0070] The OD passenger flow dataset is denoted as D T=t ; Its expression is:
[0071]
[0072] Where, T = t represents different time, n = 1, 2, ..., n,, ..., n, D T=t is the OD data set at different times, d 12 (t), …d 1n (t) represents the passenger flow from the 2nd to the nth starting stations to the 1st station, where the passenger flow from the 1st station to the 1st station is zero, that is, the value of the first row and the first column in the formula; d 21 (t)…d n1 (t) represents the passenger flow from the 1st starting station to the 2nd to nth stations; the elements on the diagonal in the formula represent the passenger flow from the nth station to the nth station and are all 0.
[0073] Before starting data cleaning, the OD dataset is defined. This is a dataset that contains the passenger flow of all origin-destination combinations in different time periods. Assuming there is a transportation network consisting of 128 lines, and collecting passenger data according to 15-minute time slices, there will be different OD (Origin-Destination) pairs of data. If a certain time is the tth moment, it is a statistical summary of all OD passengers in the entire public transportation system during that period.
[0074] The first step is to delete any duplicates that appear in the data set. Duplicate records may cause duplicate storage of input data due to a variety of reasons. In this step, the algorithm is used to identify and eliminate these redundant information to avoid bias in subsequent analysis.
[0075] After the data is deduplicated, the next step is to use smoothing correction technology to correct outliers. Outliers are usually unreasonable numerical records, such as unreasonable large values or negative data caused by system errors, equipment problems or operational errors. Smoothing methods usually use the average of adjacent values to replace these extreme values, thereby reducing their adverse effects on the model, making subsequent trend predictions based on the cleaned data more accurate and reliable.
[0076] As an example, suppose there are three stations A, B, and C in a given time period. In the time interval T1 to T3, the actual passenger flow recorded from station A to the other two stations B and C, or from any other station to any other target station is: T1(A, B) = 30, T1(A, C) = 40; T2(A, B) = 50T2(B, C) = 70. However, the data T3(A, A) = -10 in a certain period of time, which is obviously wrong data. It is corrected by smoothing means, for example, using the average flow between the same starting point and end point in the first two time slices T1 and T2 as a substitute value to replace the original value, and deleting repeated records such as (A, C, T1) that may be entered more than once due to misoperation. This process ensures the accuracy and rationality of the basic data used for passenger flow trend and flow distribution calculation. Please note that the data used as an example here are only fictitious data values for illustrative purposes.
[0077] Embodiment 3
[0078] Next, see Figure 2 The spatial and temporal relationships of the OD matrix are explained. For the convenience of explanation, the following is used: Figure 2 Represent it and give relevant definitions:
[0079] Definition 1: Spatial variable: Each column in the OD matrix is a time series from the starting station to the same destination station. The column is regarded as a variable in a spatial relationship. The relationship between variables can be reflected as the spatial dependence between the two stations.
[0080] Definition 2: Time variable: Each row in the OD matrix is the same timestamp from the same starting station to different destination stations. The row is regarded as a time variable in a time relationship. The relationship between time variables can be reflected as the time dependency between different timestamps.
[0081] Specifically, in the rail transit system, the daily operation period of the rail transit system is divided into b time periods: Represents the number of passengers from origin i to destination j in the Dth (1≤D≤s) day interval p. For n destinations with origin i, the number of passengers on n OD pairs forms an n-dimensional OD vector It is expressed as:
[0082]
[0083] At this time, the OD matrix is recorded as Its expression is:
[0084]
[0085] In the formula, the spatial variable is The vector corresponding to each column in is denoted as Mc, and the time variable is The vector corresponding to each row in is denoted as M k .
[0086] First, in the rail transit system analysis process, the daily operating hours are divided into m small time periods (for example: morning peak, evening peak, and off-peak period), which allows more detailed management and control of passenger flow in each specific period; for example, rail transit can be divided into three time periods: morning and evening peak and off-peak for operation scheduling and data analysis.
[0087] Then, use F i (p,D) It represents the number of passengers from a specific starting station to another fixed station in the jth period of a specific day. Then define a set of combinations of different destination stations (OD pairs) with a single source as the starting and ending points. This set of data constitutes an n-dimensional passenger flow or traffic behavior model. For example, during the morning commuting rush hour, the number of passengers departing from a fixed starting subway station to different locations can form a vector.
[0088] At the same time, a complete OD (origin-destination pair) matrix M is created to comprehensively display the passenger flow distribution under all possible travel modes within any day. Its structure is constructed by combining multiple such vectors; the matrix captures all potential connections between origins and destinations. Taking the morning rush hour as an example, the OD matrix will record the total number of passengers from each origin station to each destination station, such as M = [m11,m 12 ,...,m kn ].
[0089] The set of vertically arranged entries of the matrix is then defined as Mc (spatial factor or travel volume between source and destination). In the above example, the column vector of the matrix will be the integrated representation of all travel data for a certain station, such as or at different time periods throughout the day.
[0090] Then we define the row element cluster in the M matrix as T variable (or time series), that is, M k , which indicates the total number of rides between all start-end pairs for each specified time interval of the day; for example, between 7:30 and 9:30 in the morning, the matrix rows represent the number of passengers arriving at any other location from any starting point.
[0091] Embodiment 4
[0092] Next, see Figure 3 , 4 , 5 and 6 illustrate the specific scheme of the above OD passenger flow prediction. The specific steps of the above OD passenger flow prediction include:
[0093] S3.1、OD matrix MF i (*,D) After entering the OD prediction model, its spatial variable Mc is input into the variable embedding layer, and its temporal variable M k Input to the time domain convolutional network layer.
[0094] First, the OD matrix is input into the OD prediction model. The spatial variable here is marked as Mc and will be sent to the so-called variable embedding layer for subsequent processing. At the same time, the model will also process the time domain information related to Mc. These time variables will be sent to the time domain convolutional network layer to analyze its internal sequence dependency patterns and characteristic changes. For example, in the process of predicting the boarding and alighting of subway lines, we regard the number of passengers boarding and alighting between stations at different time points in a day as our spatial variable, and different time points in a day can be used as corresponding time variables. The two are entered through data to build the initial prediction basis.
[0095] S3.2, the variable embedding layer embeds the vector, and then inputs it into the multivariate attention mechanism layer, in which the self-attention mechanism is used to extract the features in the spatial variable Mc, and the extracted results are sequentially subjected to residual connection and layer normalization to obtain the spatial variable features, which are recorded as H c , and output to the feature fusion layer.
[0096] For the previously obtained spatial variable Mc, a mechanism called variable embedding layer is used to extract and map features, that is, to form an embedded vector representation. This vector representation will be further sent to a layer called multivariate attention mechanism. At this stage, the model uses the self-attention mechanism to refine the feature details in the above vector, and performs a series of operations (such as residual connection and normalization) on the information obtained after processing. In our case, the system captures the temporal patterns and behavioral preferences of subway passengers through the above steps, and outputs the processed spatial features for subsequent processing.
[0097] S3.3. In the time domain convolutional network layer, first convert the time variable M k After transposition, the time domain convolution network composed of causal convolution and dilated convolution is used to extract features and obtain the time variable feature, which is recorded as H M , and output to the feature fusion layer.
[0098] In S3.3, we focus on the stage of processing time dimension variables. The previous time variables are preprocessed by denoising and other preprocessing before entering the time domain convolutional network (TCN). The characteristic of this convolutional network is that it can capture time sequence information well. After the operation of TCN (including causal convolution, and dilation or expansion convolution), the characteristic features closely related to the time factor are finally obtained. For example, the time element in the subway line passenger flow data is transposed and then obtained through a specific convolution process. More refined time dimension features.
[0099] S3.4. In the feature fusion layer, the spatial variable feature H c and time variable characteristic H M Feature fusion is performed to obtain feature W, and its feature fusion expression is: Output to the fully connected layer.
[0100] In S3.4, we enter the important feature integration. The main purpose of this step is to effectively combine the spatial characteristics and temporal characteristics based on the previous three links. This combination is to integrate the different types of information extracted above into a composite comprehensive feature, and output the integrated results to prepare for the next step of data processing. Taking the previous subway passenger flow as an example, this step is to integrate the temporal and spatial characteristics into one, and pass the results to the subsequent stage for processing.
[0101] S3.5. After extracting the input feature W in the fully connected layer, the OD passenger flow prediction result is output.
[0102] The fully connected layer has 3 hidden layers, 1 input layer, and 1 output layer. The number of neurons is set to 256, the activation function is the softmax function, the input layer receives the feature W, and the output layer is denormalized.
[0103] In S3.5, a deep exploratory analysis and processing of the data is carried out on the basis of the previous comprehensive information W. Under the action of this fully connected layer (FC-Layers), the previously integrated information features are further mined, with the purpose of further refining the connotation of the features to make the obtained results more accurate. At this stage, the fully connected hierarchical structure is a one plus four layer structure of one (input layer) plus three (hidden layer), and is set with 256 node neurons, and the activation algorithm (softmax is selected here) is applied to enable the calculated results to output the expected target, which is the OD traffic passenger flow forecast value. In our example, this is like obtaining the possible passenger number forecast results for each subway line in each time period based on all the spatial and temporal related data information integrated in the early stage after multiple layers of complex calculations, so that the subway operator can make reasonable arrangements in advance to cope with different peak and trough conditions and optimize the overall service effect.
[0104] Embodiment 4
[0105] Next, see Figure 6 and 7 The specific steps of extracting features using the time domain convolutional network composed of causal convolution and dilated convolution in the present invention to obtain time variable features are described as follows:
[0106] Further optionally, in one implementation of the present invention, the time-domain convolutional network composed of causal convolution and dilated convolution is used to extract features to obtain time variable features, which are recorded as H M The specific steps include:
[0107] S3.3.1. Use the following calculation formula to calculate the time variable M k The calculation result is obtained by calculation, and the calculation formula is:
[0108]
[0109] In the formula, d is the dilation coefficient, g is the convolution kernel size, and f(e) is the e-th element in the convolution kernel. In deep learning, it is widely used in audio processing or signal analysis tasks that need to consider timing information. The above formula ensures that the network can capture dependencies within a specific range. d is the dilation coefficient that determines the sparsity of the parsing window, and g represents the convolution kernel size. It directly affects the length of the captured time series segment, which is the e-th element in the convolution kernel.
[0110] S3.3.2, the calculation result is first passed through the ReLU activation function, then the layer normalization processing, and finally the residual connection output is used. The output F(M) is expressed as:
[0111] F(M)=F(t)+M k .
[0112] The ReLU activation function introduces nonlinearity and enhances the expressiveness of the neural network model. Then the data is normalized by subtracting the mean and dividing by the standard deviation to ensure that the numerical distribution of each layer input is roughly stable. This can speed up the training process and improve the convergence efficiency. Finally, the residual connection is applied to output the results of this part. This connection allows deep models to learn better and solves the gradient disappearance problem, making it possible to train deeper networks. The direct path inside the residual block allows the forward and backward gradients to pass through several layers, thereby improving the learning effect and making the training more efficient and stable.
[0113] S3.3.3. The output result of the residual connection is normalized again to obtain the time variable feature H M .
[0114] After further processing the residual connection output F(M) mentioned above, we perform layer normalization again to obtain more standardized time variable features. This step ensures the uniformity of flow features between different layers of the network by adjusting the normalization again, reduces the interference caused by changes in numerical scale, helps more efficient information propagation, and improves the neural network's ability to understand features.
[0115] Embodiment 5
[0116] Next, see Figure 8 The rail transit passenger flow OD prediction system in the embodiment of the present invention is described in detail as follows:
[0117] like Figure 8 As shown, the rail transit passenger flow OD prediction system 80 includes a data collection unit 801 , a data processing unit 802 , a training unit 803 and a prediction unit 804 .
[0118] The data collection unit 801 is connected to the AFC system through a network or a transmission line. The data collection unit collects data from the AFC system of each station at a fixed interval and sends the data to the data processing unit 802. The data processing unit 802 is provided with multiple storage devices and processors. The data collected by the data collection unit 801 is stored in the storage device. At the same time, the processor extracts all the information in the storage device, takes the ID card number as the primary key, and the payment amount as the judgment condition. The payment amount of 0 is used as the starting station, and the payment amount is not 0 as the arrival station, forming a complete travel chain. Further, by counting the number of people and time at the starting station and the arrival station, a complete OD matrix is formed and stored in another storage medium.
[0119] Further, the OD matrix in the storage medium of the data processing unit 802 is sent to the training unit 803 in the form of network transmission, including but not limited to, and the training unit 803 trains a preset OD passenger flow prediction model, and transmits the trained model and the sorted data to the prediction unit 804. Optionally, the training unit 804 can be trained in a cloud training manner.
[0120] Furthermore, the prediction unit 804 contains at least one or more storage media and processors that can run large amounts of data, and input and output devices. In particular, the processor must have a GPU unit, and the GPU unit version must be at least 12.0 and above. The storage medium stores the trained model, and the processor receives the data collated by the processing unit, including sufficient historical passenger flow data, performs rail transit passenger flow OD method prediction in the prediction unit, and visualizes the results. The input and output devices enable interaction between the user and the system.
[0121] First, the data acquisition unit 801 is mainly used to construct an OD passenger flow data set. This means that the system must first process the original passenger flow data obtained from the automatic ticket vending and checking (AFC) system. Data processing includes comprehensive cleaning of the data source, elimination of invalid data, and processing of missing values or outliers, and combining these cleaned data with their related detailed entry and exit records to form OD (i.e., origin and destination) passenger flow information with clear start and end locations within a certain time span. For example, if the number of passengers passing through a station is 100,000 per day, the specific entry and exit data of these 100,000 passengers can be obtained through the log of the AFC system, and based on this, a statistical table of the number of passengers for each journey in a specific period of time on a certain day (OD passenger flow data set) can be compiled, so as to prepare for the establishment of a prediction model.
[0122] Secondly, the data processing unit 802 is mainly used to make a data table that more intuitively reflects the distribution of passenger flow, the OD matrix, based on the collected and sorted passenger flow data set. It not only records the information of which station each passenger departs from and where he arrives, but also pays special attention to revealing the structural characteristics of the interconnection between stations and the development dynamics of passenger flow changes at different times. For example, during the peak period of a holiday, the passenger flow from station A to station B on a certain route has increased compared with the past, and the overall mobility of the transportation network can be reflected in this process. By observing the OD matrix, analysts can see the actual number of people from a certain initial station to each destination station in the entire road network, the changing trends in different travel periods, and the spatial correlation patterns and other comprehensive dynamic characteristics.
[0123] Again, the goal of the training unit part 803 is to perform the training operation of the deep learning program based on the OD passenger flow model that has been created. At this stage, a technical path called iTransformer is used to train the prediction algorithm model, and the various parameter settings of the prediction model are continuously adjusted and optimized with the help of cross-validation technology. The loss function defines the degree of deviation between the predicted value and the actual value. The goal of the training process is to minimize such a deviation measurement indicator MSE (mean square error) so that the best algorithm can accurately predict future OD demand. In this process, the algorithm uses a large amount of known actual passenger flow trends in the past and current periods to perform simulation calculation exercises. Under repeated training, the prediction accuracy of the model is continuously improved until a relatively ideal fitting condition is achieved before entering the formal prediction stage.
[0124] Finally, the work content of the prediction unit 804 is: after a series of preparatory activities, the OD passenger flow data has been converted into a standardized input form (i.e., a matrix) so that the artificial intelligence module that has been trained and is on standby can quickly receive and analyze it. The core structure of this module is a deeply modified iTransformer framework design. When accepting new OD traffic patterns from the outside world as its operating parameters, it will go through the recursive process of variable feature embedding layer-multi-head self-attention encoding block-time dimension convolution operation-feature combination integrator and linear regressor in sequence. The result output at the end of this chain is the final product of scientifically and reasonably predicting various passenger flow distribution conditions that may occur in the urban rail transit system under any given conditions within the next period of time, helping management departments to better understand and timely allocate service resources, respond to possible crowd gathering or other emergency situations, accurately estimate the changes in passenger flow of each subway line and station, and assist transportation operation agencies in formulating effective scheduling plans to ensure the smooth travel of citizens.
[0125] It should be noted that the above are only preferred embodiments of the present application, and the patent protection scope of the present application is not limited thereto. Any equivalent structure or equivalent process transformation made using the contents of the specification and drawings of the present application, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A rail transit passenger flow OD prediction method, characterized in that: The following steps are involved: S1. Construct OD passenger flow data set: The cleaned passenger flow data is matched with the entry and exit information to form an OD passenger flow data set of a certain time step, where the passenger flow data is extracted from the automatic ticket vending and checking AFC system; S2. Generate OD matrix: For each station in the rail transit system, take the station as the starting station and other stations as different destination stations to extract the corresponding passenger flow from the OD passenger flow data set to generate the corresponding OD matrix; The OD matrix includes spatial and temporal relationships. In the OD matrix corresponding to each station, the spatial variables corresponding to the time series from the same starting station to different destination stations represent their spatial relationships. In the OD matrix corresponding to each station, the temporal variables corresponding to the same timestamp from the same starting station to different destination stations represent their temporal relationships. S3, OD passenger flow prediction: input the OD matrix into the trained OD prediction model to obtain the OD passenger flow prediction result; The OD prediction model is improved based on the iTransformer model, including a variable embedding layer, a multivariate attention mechanism layer, a time domain convolutional network layer, a feature fusion layer and a fully connected layer. The self-attention mechanism in the multivariate attention mechanism layer is used to extract features of the spatial relationship in the OD matrix. The time domain convolutional network layer includes causal convolution and dilated convolution, which are used to extract features of the temporal relationship in the OD matrix.
2. The method according to claim 1, characterized in that The specific steps of data cleaning include deleting duplicate values and correcting abnormal values using a smoothing correction method; The OD passenger flow dataset is denoted as D T=t ; Its expression is: Where, T = t represents different time, n = 1, 2, ..., n,, ..., n, D T=t is the OD data set at different times, d 12 (t), …d 1n (t) represents the passenger flow from the 2nd to the nth starting stations to the 1st station, where the passenger flow from the 1st station to the 1st station is zero, that is, the value of the first row and the first column in the formula; d 21 (t)…d n1 (t) represents the passenger flow from the 1st starting station to the 2nd to nth stations; the elements on the diagonal in the formula represent the passenger flow from the nth station to the nth station and are all 0.
3. The method according to claim 2, characterized in that In the rail transit system, the daily operation period of the rail transit system is divided into b time periods: represents the number of passengers from origin i to destination j in the Dth (1≤D≤s)th day interval p. For n destinations with origin i, the number of passengers on n OD pairs forms an n-dimensional OD vector F i (p,D) , expressed as: At this time, the OD matrix is recorded as Its expression is: In the formula, the spatial variable is The vector corresponding to each column in is denoted as Mc, and the time variable is The vector corresponding to each row in is denoted as M k .
4. The method according to claim 3, characterized in that The specific steps of OD passenger flow prediction include: S3.
1. OD matrix After entering the OD prediction model, its spatial variable Mc is input into the variable embedding layer, and its temporal variable M k Input to the time domain convolutional network layer; S3.2, the variable embedding layer embeds the vector, and then inputs it into the multivariate attention mechanism layer, in which the self-attention mechanism is used to extract the features in the spatial variable Mc, and the extracted results are sequentially subjected to residual connection and layer normalization to obtain the spatial variable features, which are recorded as H c , and output to the feature fusion layer; S3.
3. In the time domain convolutional network layer, first convert the time variable M k After transposition, the time domain convolution network composed of causal convolution and dilated convolution is used to extract features and obtain the time variable feature, which is recorded as H M , and output to the feature fusion layer; S3.
4. In the feature fusion layer, the spatial variable feature H c and time variable characteristic H M Feature fusion is performed to obtain feature W, and its feature fusion expression is: Output to the fully connected layer; S3.5, extract the input feature W in the fully connected layer and output the OD passenger flow prediction result; The fully connected layer has 3 hidden layers, 1 input layer, and 1 output layer. The number of neurons is set to 256, the activation function is the softmax function, the input layer receives the feature W, and the output layer is denormalized.
5. The method according to claim 4, characterized in that The time domain convolution network composed of causal convolution and dilated convolution is used to extract features to obtain the time variable feature, which is recorded as H M The specific steps include: S3.3.
1. Use the following calculation formula to calculate the time variable M k The calculation result is obtained by calculation, and the calculation formula is: Where d is the dilation coefficient, g is the convolution kernel size, and f(e) is the e-th element in the convolution kernel; S3.3.
2. The calculated result is first activated by the ReLU function, then normalized, and finally output using the residual connection. The output F(M) is expressed as: F(M) = F(t) + M k ; S3.3.
3. The output result of the residual connection is normalized again to obtain the time variable feature H M .
6. The method according to claim 1, characterized in that In the training process of the OD prediction model, cross-validation is used to update and optimize parameters. The loss function of the OD prediction model is MSE, and minimizing MAPE and RMSE is used as evaluation indicators to complete the model training.
7. A rail transit passenger flow OD prediction system, characterized in that: include: Data collection unit, data processing unit, training unit and prediction unit; The data collection unit is used to construct an OD passenger flow data set, specifically including: matching the cleaned passenger flow data with the entry and exit information to form an OD passenger flow data set of a certain time step, wherein the passenger flow data is extracted from the automatic ticket vending and checking AFC system; The data processing unit is used to generate an OD matrix, specifically including: for each station in the rail transit system, the station is taken as the starting station and other stations are taken as different destination stations to extract the corresponding passenger flow from the OD passenger flow data set to generate a corresponding OD matrix; wherein the OD matrix includes spatial relationship and time relationship, and in the OD matrix corresponding to each station, the spatial variables corresponding to the time series from the same starting station to different destination stations represent their spatial relationship, and in the OD matrix corresponding to each station, the time variables corresponding to the same timestamp from the same starting station to different destination stations represent their time relationship; The training unit is used to: use cross-validation to update and optimize parameters during the training of the OD prediction model. The loss function of the OD prediction model is MSE, and minimizing MAPE and RMSE is used as evaluation indicators to complete model training; The prediction unit is used for OD passenger flow prediction, specifically including: inputting the OD matrix into the trained OD prediction model to obtain the OD passenger flow prediction result; wherein the OD prediction model is improved based on the iTransformer model, including a variable embedding layer, a multivariate attention mechanism layer, a time domain convolutional network layer, a feature fusion layer and a fully connected layer. The self-attention mechanism in the multivariate attention mechanism layer is used to extract features of the spatial relationship in the OD matrix. The time domain convolutional network layer includes causal convolution and dilated convolution, which are used to extract features of the temporal relationship in the OD matrix.
Citation Information
Patent Citations
Urban rail transit multi-step short-time passenger flow prediction method based on attention mechanism
CN116227668A
Urban rail passenger flow prediction method based on dynamic multi-graph and multi-dimensional attention space-time neural network
CN117454119A
Urban rail transit station short-time passenger flow prediction model and prediction method
CN118298632A
Cited By
Multi-task learning-based multi-mode trip flow collaborative prediction method, system and device
CN119862994A
Subway passenger flow prediction method and system based on optimized plant growth algorithm and weighted convolution TimeXer
CN122288049A
