A short-term bus passenger flow prediction method based on stacking in multiple environments
By using the stacking method in multiple environments, combined with multi-dimensional features and multiple machine learning models, high-precision prediction of short-term bus passenger flow is achieved, which solves the problem of inaccurate passenger flow prediction in the existing technology and provides effective information for bus dispatching. basis for resource allocation.
Patent Information
- Application Number
- CN202210352351.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-04
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2042-04-04
AI Technical Summary
Existing technology is difficult to accurately predict short-term bus passenger flow under multi-factor conditions, affecting the effectiveness of bus operation and dispatch strategies.
A stacking-based multi-environment short-term bus passenger flow prediction method is adopted. By obtaining multi-dimensional feature data, the rank correlation coefficient, SVM model, random forest model and Bayesian voting method are used to predict the passenger flow of lines, traffic communities and stations, and Make comprehensive adjustments to achieve high accuracy in passenger flow forecasting.
It significantly improves the accuracy of short-term bus passenger flow prediction, reduces the prediction error, and provides a reference for optimal resource allocation for bus dispatching.
Smart Images

Figure BDA0003581187920000021 
Figure BDA0003581187920000022 
Figure BDA0003581187920000031
Abstract
Description
Technical Field
[0001] The invention relates to the research fields of time series, data mining and intelligent transportation, and in particular to a short-term public transportation passenger flow prediction method under multiple environments based on stacking. Background Art
[0002] The bus dispatching strategy is the guarantee of the bus priority strategy. As an important basis for bus resource allocation and bus network planning, the accuracy of short-term bus passenger flow is related to the success or failure of bus operation dispatching strategy.
[0003] In order to improve the prediction accuracy of short-term bus passenger flow under multi-factor conditions, the present invention proposes a short-term bus passenger flow prediction model under multiple environments based on big data; analyzes the correlation between multiple conditions such as rainfall, temperature, holidays and bus passenger flow, and reveals the impact of different rainfall levels on bus passenger flow; at the same time, uses a multi-model integration algorithm and Bayesian voting method to achieve high prediction accuracy of passenger flow prediction. Summary of the invention
[0004] In order to overcome the shortcomings of the prior art, the present invention provides a short-term bus passenger flow prediction method under multiple environments based on stacking, which can accurately predict short-term bus passenger flow and provide a reference for optimizing resource allocation for bus scheduling. The technical solution is as follows:
[0005] In a first aspect, a short-term public transport passenger flow prediction method under multiple environments based on stacking is provided, and the method comprises the following steps:
[0006] Step 1, obtaining passenger flow data and feature data;
[0007] The basic data is obtained from the passenger flow data of some bus routes in a city, and the multi-dimensional features include:
[0008] Route name; day type; weather type; temperature type; route length; route type; whether it is a holiday; whether it passes by a school; whether it passes by a shopping mall; degree of overlap with the subway line; degree of overlap with other bus routes.
[0009] Let the data feature dimension be X = (X1, X2, ..., X m ), where m is the number of features, X i A vector value representing each feature.
[0010] The time interval of the passenger flow data of each line is 10-30 minutes. The number of time periods per day is recorded as n, and the passenger flow of the corresponding time period is recorded as y1, y2, ..., y n ;
[0011] The daily passenger flow Y and feature X of a certain route are expressed as follows:
[0012]
[0013] Where m is the number of features and n is the number of time periods.
[0014] Step 2: route passenger flow prediction;
[0015] (1) Using the rank correlation coefficient to analyze the correlation between route passenger flow and weather type
[0016] Using the control variable method, the rank correlation coefficient is calculated to calculate the impact of weather types on bus passenger flow. The rank correlation coefficient r j for:
[0017]
[0018] where r j is the rank correlation coefficient of the jth feature. When it is positive, it indicates positive correlation, when it is negative, it indicates negative correlation, and when it is zero, it indicates no correlation. ij is the difference in rank between each pair of samples of the two variables, that is, the variable x ij With y i The difference.
[0019] (2) Set the rank correlation coefficient threshold c, c>0, and use the features when the absolute value of the rank correlation coefficient is greater than c to train the SVM model.
[0020] In addition to the feature when the absolute value of the rank correlation coefficient is greater than c, the passenger flow in the same time window t days before the prediction date is added as a training sample. The training sample is split into a training set and a test set. The training set is input into the SVM model for training, and the SVM prediction model is established. The prediction accuracy p1 is obtained using the test set.
[0021] A prediction sample is constructed, and the prediction sample is input into the SVM prediction model to obtain the predicted boarding passenger flow of the line in the target time window.
[0022] Step 3, passenger flow prediction in traffic area;
[0023] Divide the traffic areas;
[0024] Use multi-dimensional features to train a random forest model:
[0025] In addition to the multi-dimensional features, the passenger flow in the same time window t days before the prediction and the passenger flow in the same time window that can directly reach the transportation area are added as training samples. The training samples are split into training set and test set. The training set is input into the random forest model for training, and the random forest prediction model is established. The prediction accuracy p2 is obtained using the test set.
[0026] Construct a prediction sample, input the prediction sample into the random forest prediction model, and obtain the predicted passenger flow of the traffic community in the target time window.
[0027] Step 4: passenger flow prediction for each station on the route;
[0028] Use multi-dimensional features to train the ridge regression model: In addition to multi-dimensional features, add the passenger flow in the same time window t days before the prediction and the passenger flow at related stations that can be directly reached on the same line as training samples, split the training samples into training set and test set, input the training set into the ridge regression model for training, establish the ridge regression prediction model, and use the test set to obtain the prediction accuracy p3.
[0029] A prediction sample is constructed and input into a ridge regression prediction model to obtain the predicted passenger flow of the station in the target time window.
[0030] Step 5: Comprehensively adjust the route passenger flow prediction results, traffic zone passenger flow prediction results, and station passenger flow prediction results to give the final passenger flow prediction results of the three.
[0031] Preferably, by performing correlation analysis on the data features according to the method in step 2(1), the following can be obtained:
[0032] Day type and weather type: There is a strong negative correlation between rainy weather and bus passenger flow on weekdays, and an extremely strong negative correlation on weekends. As the amount of rainfall increases, the adverse impact on passenger flow increases;
[0033] Route type and weather type: There is a strong negative correlation between nighttime bus rainy weather and bus passenger flow, and there is an extremely strong negative correlation between tourist routes. As the amount of rainfall increases, the adverse impact on passenger flow increases;
[0034] Route length and weather type: There is a strong negative correlation between long-distance bus rainy weather and bus passenger flow. As the amount of rainfall increases, the adverse impact on passenger flow also increases.
[0035] Preferably, in order to ensure the rationality of the data in each time period and eliminate the differences caused by time variability, step 2 introduces a data smoothing term "passenger flow deviation rate" α:
[0036]
[0037] Where α is the hourly passenger flow deviation rate; V i is the actual passenger flow in the i-th time window of the day; is the average passenger flow of 9 periods, that is That is, the optimized passenger flow is V i *(1-α).
[0038] Preferably, step 3 divides the traffic zones, first by administrative boundaries to form a preliminary traffic center; then by natural barriers such as rivers, lakes, mountains, forests, city walls, railways, and expressways, and checks whether relatively independent land use areas of scenic spots, large shopping malls, and transportation hubs are separated, and if separated, they need to be appropriately merged; then the balance of the traffic zone division is evaluated by region, and based on the balance evaluation results, detailed divisions are made or zones are merged in combination with urban roads.
[0039] Preferably, step 5 specifically includes:
[0040] Assume that the passenger flow prediction result of a certain traffic zone in a certain time window is a i , the passenger flow prediction result of the station in the traffic zone in the same time window is a i1 ,a i2 ,…,a iH , where H is the total number of stations included in the traffic zone. The Bayesian voting method is used to adjust the passenger flow prediction value of each station. The specific formula is as follows
[0041]
[0042] use As the final prediction value instead of a ij .
[0043] The prediction accuracy is improved by giving higher weights to models with higher accuracy to complement each other.
[0044] Assume that the passenger flow forecast result of a certain route in a certain time window is a i , the passenger flow prediction result of the station belonging to this line in the same time window is a i1 ,a i2 ,…,a ik , where k is the total number of stations included in the line. The Bayesian voting method is used to adjust the passenger flow prediction value of each station. The specific formula is as follows:
[0045]
[0046] use As the final prediction value instead of a ij .
[0047] Based on the predicted values of each station in each time window, the Bayesian voting method is used to obtain the final predicted value of the station passenger flow:
[0048]
[0049] Then, the final predicted value of passenger flow at each station is used The final passenger flow of the traffic area and the final passenger flow of the line can be obtained by summing up the calculation.
[0050] Compared with the prior art, one of the above technical solutions has the following beneficial effects: by selecting strong correlation features through rank correlation coefficient and Pearson correlation coefficient, using SVM to realize short-term bus passenger flow prediction of routes; then using random forest model to realize short-term bus passenger flow prediction of traffic areas, and then using ridge regression model to realize short-term bus passenger flow prediction of stations, and finally completing the final prediction value repair through Bayesian voting, which greatly reduces the prediction error. It realizes accurate prediction of short-term bus passenger flow and provides a reference basis for optimizing resource allocation for bus dispatching. DETAILED DESCRIPTION
[0051] In order to illustrate the technical solution and working principle of the present invention, the embodiments of the present invention will be described in further detail below. All the above optional technical solutions can be combined in any way to form optional embodiments of the present invention, which will not be described one by one here.
[0052] The terms "step 1", "step 2", "step 3", and the like in the specification and claims of the present application are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchanged where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those described herein.
[0053] The present disclosure provides a short-term public transport passenger flow prediction method under multiple environments based on stacking, the method comprising the following steps:
[0054] Step 1, obtaining passenger flow data and feature data;
[0055] The basic data is obtained from the passenger flow data of some bus routes in a city, and the multi-dimensional features include:
[0056] Route name; day type (weekday, weekend); weather type (no rain, light rain, moderate rain, heavy rain, rainstorm); temperature type (suitable temperature, high / low temperature); route length; route type (tourist line, city trunk line, city branch line, city express line, express bus, night bus, peak-hour line); whether it is a holiday; whether it passes through a school; whether it passes through a shopping mall; degree of overlap with the subway line (no overlap, partial overlap, high overlap, complete overlap); degree of overlap with other bus routes (no overlap, partial overlap, high overlap, complete overlap).
[0057] Let the data feature dimension be X = (X1, X2, ..., X m ), where m is the number of features, X i A vector value representing each feature.
[0058] The time interval of the passenger flow data of each line is 15 minutes. The number of time periods per day is recorded as n, and the passenger flow of the corresponding time period is recorded as y1, y2, ..., y n ;
[0059] The daily passenger flow Y and feature X of a certain route are expressed as follows:
[0060]
[0061] Where m is the number of features and n is the number of time periods.
[0062] Step 2: route passenger flow prediction;
[0063] (1) Using the rank correlation coefficient to analyze the correlation between route passenger flow and weather type
[0064] Using the control variable method, the rank correlation coefficient is calculated to calculate the impact of weather types (0, 1, 2, 3, 4, 5 levels represent the amount of rainfall, and the rainfall increases from 0 to 4) on bus passenger flow. The rank correlation coefficient r j for:
[0065]
[0066] where r j is the rank correlation coefficient of the jth feature. When it is positive, it indicates positive correlation, when it is negative, it indicates negative correlation, and when it is zero, it indicates no correlation. ij is the difference in rank between each pair of samples of the two variables, that is, the variable x ij With y i The difference.
[0067] Preferably, by performing correlation analysis on the data features according to the method in step 2(1), the following can be obtained:
[0068] 1) Day type and weather type: There is a strong negative correlation between rainy weather and bus passenger flow on weekdays and an extremely strong negative correlation on weekends. As the amount of rainfall increases, the adverse impact on passenger flow increases.
[0069] The reason why rainfall has a greater impact on bus passenger flow on non-working days is that travel on weekdays is mostly rigid commuting demand for work purposes, and rigid demand is almost unaffected by external factors; while weekend travel is mainly flexible demand such as tourism and shopping. Once adverse weather conditions such as rain occur, most residents will change their travel methods or cancel their trips.
[0070] 2) Route type and weather type: There is a strong negative correlation between nighttime bus rainy weather and bus passenger flow, and there is an extremely strong negative correlation between tourist routes. As the amount of rainfall increases, the adverse impact on passenger flow increases. Moreover, the passenger flow of bus routes of different nature and importance is affected differently by rainy weather.
[0071] The reason why rainfall has a greater impact on passenger flow on tourist lines is that tourist lines are generally used mainly for tourist travel. Once adverse weather conditions such as rainfall occur, most residents will cancel their trips.
[0072] 3) Route length and weather type: There is a strong negative correlation between long-distance bus rainy weather and bus passenger flow. As the amount of rainfall increases, the adverse impact on passenger flow also increases.
[0073] The reason why rainfall has a greater impact on long-distance bus passenger flow is that long-distance buses are generally cross-district lines or detour routes. Once adverse weather conditions such as rain occur, travel time will be greatly increased, and most residents will change their travel methods.
[0074] Similarly, the Pearson correlation coefficient can also be used to obtain the corresponding influence relationship of temperature type.
[0075] (2) Set the rank correlation coefficient threshold c, c>0, and use the features when the absolute value of the rank correlation coefficient is greater than c to train the SVM (rbf kernel) model.
[0076] In addition to the feature when the absolute value of the rank correlation coefficient is greater than c, the passenger flow in the same time window t days before the prediction date is added as a training sample. The training sample is split into a training set and a test set. The training set is input into the SVM model for training, and the SVM prediction model is established. The prediction accuracy p1 is obtained using the test set.
[0077] A prediction sample is constructed, and the prediction sample is input into the SVM prediction model to obtain the predicted boarding passenger flow of the line in the target time window.
[0078] Preferably, in order to ensure the rationality of the data in each time period and eliminate the differences caused by time variability, step 2 introduces a data smoothing term "passenger flow deviation rate" α:
[0079]
[0080] Where α is the hourly passenger flow deviation rate; V i is the actual passenger flow in the i-th time window of the day; is the average passenger flow of 9 periods, that is That is, the optimized passenger flow is V i *(1-α).
[0081] Step 3, passenger flow prediction in traffic area;
[0082] Divide the traffic areas;
[0083] Preferably, step 3 divides the traffic zones, firstly according to administrative boundaries (streets, towns and villages) to form a preliminary traffic center; then according to natural obstacles such as rivers, lakes, mountains, forests, city walls, railways, expressways, etc., and checks whether areas with relatively independent land use such as scenic spots, large shopping malls, and transportation hubs are separated. If separated, they need to be appropriately merged; then the balance of the traffic zone division is evaluated by region, usually based on the area of the traffic zone, which is generally about 1-2 square kilometers. The area of the outer area can be appropriately expanded, and according to the balance evaluation results, the zones are subdivided or merged in combination with urban roads.
[0084] Use multi-dimensional features to train a random forest model:
[0085] In addition to the multi-dimensional features, the passenger flow in the same time window t days before the prediction and the passenger flow in the same time window that can directly reach the transportation area are added as training samples. The training samples are split into training set and test set. The training set is input into the random forest model for training, and the random forest prediction model is established. The prediction accuracy p2 is obtained using the test set.
[0086] Construct a prediction sample, input the prediction sample into the random forest prediction model, and obtain the predicted passenger flow of the traffic community in the target time window.
[0087] Step 4: passenger flow prediction for each station on the route;
[0088] Use multi-dimensional features to train the ridge regression model: In addition to multi-dimensional features, add the passenger flow in the same time window t days before the prediction and the passenger flow at related stations that can be directly reached on the same line as training samples, split the training samples into training set and test set, input the training set into the ridge regression model for training, establish the ridge regression prediction model, and use the test set to obtain the prediction accuracy p3.
[0089] A prediction sample is constructed and input into a ridge regression prediction model to obtain the predicted passenger flow of the station in the target time window.
[0090] Step 5: Comprehensively adjust the route passenger flow prediction results, traffic zone passenger flow prediction results, and station passenger flow prediction results to give the final passenger flow prediction results of the three.
[0091] Preferably, step 5 specifically includes: assuming that the passenger flow prediction result of a certain traffic zone in a certain time window is a i , the passenger flow prediction result of the station in the traffic zone in the same time window is a i1 ,a i2 ,…,a iH, where H is the total number of stations included in the traffic zone. The Bayesian voting method is used to adjust the passenger flow prediction value of each station. The specific formula is as follows
[0092]
[0093] use As the final prediction value instead of a ij .
[0094] The prediction accuracy is improved by giving higher weights to models with higher accuracy to complement each other.
[0095] Assume that the passenger flow forecast result of a certain route in a certain time window is a i , the passenger flow prediction result of the station belonging to this line in the same time window is a i1 ,a i2 ,…,a ik , where k is the total number of stations included in the line. The Bayesian voting method is used to adjust the passenger flow prediction value of each station. The specific formula is as follows:
[0096]
[0097] use As the final prediction value instead of a ij .
[0098] Based on the predicted values of each station in each time window, the Bayesian voting method is used to obtain the final predicted value of the station passenger flow:
[0099]
[0100] Then, the final predicted value of passenger flow at each station is used The final passenger flow of the traffic area and the final passenger flow of the line can be obtained by summing up the calculation.
[0101] The above is an exemplary description of the present invention. Obviously, the specific implementation of the present invention is not limited to the above-mentioned method. All non-substantial improvements made by adopting the method concept and technical solution of the present invention; or directly applying the above-mentioned concept and technical solution of the present invention to other occasions without improvement or equivalent replacement, are within the protection scope of the present invention.
Claims
1. A short-term bus passenger flow prediction method based on stacking in multiple environments. It is characterized in that The method comprises the following steps: Step 1, obtaining passenger flow data and feature data; The basic data is obtained from the passenger flow data of some bus routes in a city, and the multi-dimensional features include: Route name; day type; weather type; temperature type; route length; route type; whether it is a holiday; whether it passes by a school; whether it passes by a shopping mall; degree of overlap with the subway line; degree of overlap with other bus routes; Let the data feature dimension be X=(X 1 ,X 2 ,…,X m ), where m is the number of features, X i Represents the vector value of each feature; The time interval of the passenger flow data of each line is 10-30 minutes. The number of time periods per day is recorded as n, and the passenger flow of the corresponding time period is recorded as y. 1 ,y 2 ,…,y n ; The daily passenger flow Y and feature X of a certain route are expressed as follows: Where m is the number of features and n is the number of time periods; Step 2: route passenger flow prediction; (1) Use the rank correlation coefficient to analyze the correlation between route passenger flow and weather type; Using the control variable method, the rank correlation coefficient is calculated to calculate the impact of weather types on bus passenger flow. The rank correlation coefficient r j for: where r j is the rank correlation coefficient of the jth feature. When it is positive, it indicates positive correlation; when it is negative, it indicates negative correlation; when it is zero, it indicates no correlation. ij is the difference in rank between each pair of samples of the two variables, that is, the variable x ij With y i The difference between (2) Setting the rank correlation coefficient threshold c, c>0, and using the features when the absolute value of the rank correlation coefficient is greater than c to train the SVM model; In addition to the feature when the absolute value of the rank correlation coefficient is greater than c, the passenger flow in the same time window t days before the prediction date is added as a training sample. The training sample is split into a training set and a test set. The training set is input into the SVM model for training, and the SVM prediction model is established. The prediction accuracy p is obtained using the test set. 1 ; Constructing a prediction sample, inputting the prediction sample into the SVM prediction model, and obtaining the predicted passenger flow of the line in the target time window; Step 3, passenger flow prediction in traffic area; Divide the traffic areas; Use multi-dimensional features to train a random forest model: In addition to the multi-dimensional features, the passenger flow in the same time window of the day before the prediction and the passenger flow in the same time window that can directly reach the traffic area are added as training samples. The training samples are split into training sets and test sets. The training set is input into the random forest model for training, and the random forest prediction model is established. The prediction accuracy p is obtained using the test set. 2 ; Constructing a prediction sample, inputting the prediction sample into a random forest prediction model, and obtaining a predicted passenger flow of the traffic community in a target time window; Step 4: passenger flow prediction for each station on the route; Use multi-dimensional features to train the ridge regression model: In addition to the multi-dimensional features, add the predicted passenger flow in the same time window t days before the day before the train and the passenger flow at the relevant stations that can be directly reached on the same line as training samples, split the training samples into training sets and test sets, input the training set into the ridge regression model for training, establish the ridge regression prediction model, and use the test set to obtain the prediction accuracy p 3 ; Constructing a prediction sample, inputting the prediction sample into a ridge regression prediction model, and obtaining a predicted passenger flow of the station in a target time window; Step 5: Comprehensively adjust the route passenger flow prediction results, traffic zone passenger flow prediction results, and station passenger flow prediction results to give the final passenger flow prediction results of the three.
2. According to the stacking-based short-term public transport passenger flow prediction method in multiple environments as described in claim 1, It is characterized in that By performing correlation analysis on the data features according to the method in step 2(1), we can obtain: Day type and weather type: There is a strong negative correlation between rainy weather and bus passenger flow on weekdays, and an extremely strong negative correlation on weekends. As the amount of rainfall increases, the adverse impact on passenger flow increases; Route type and weather type: There is a strong negative correlation between nighttime bus rainy weather and bus passenger flow, and there is an extremely strong negative correlation between tourist routes. As the amount of rainfall increases, the adverse impact on passenger flow increases; Route length and weather type: There is a strong negative correlation between rainy weather and bus passenger flow for long-distance buses; as the amount of rainfall increases, the adverse impact on passenger flow also increases.
3. According to the stacking-based short-term public transport passenger flow prediction method in multiple environments as described in claim 1, It is characterized in that Step 2: In order to ensure the rationality of the data in each period and eliminate the differences caused by time variability, the data smoothing term "passenger flow deviation rate" α is introduced: Where α is the hourly passenger flow deviation rate; V i is the actual passenger flow in the i-th time window of the day; is the average passenger flow of 9 periods, that is That is, the optimized passenger flow is V i *(1-α).
4. According to the stacking-based short-term public transport passenger flow prediction method in multiple environments as described in claim 1, It is characterized in that Step 3: Divide the traffic zones. First, divide them according to administrative boundaries to form a preliminary traffic center. Then divide them according to natural obstacles such as rivers, lakes, mountains, forests, city walls, railways, and expressways. Check whether the relatively independent land use areas of scenic spots, large shopping malls, and transportation hubs are separated. If separated, they need to be appropriately merged. Then evaluate the balance of the traffic zone division by region. Based on the balance assessment results, make detailed divisions or merge zones in combination with urban roads.
5. A stacking-based short-term public transport passenger flow prediction method in multiple environments according to any one of claims 1 to 4, It is characterized in that Step 5 specifically includes: Assume that the passenger flow prediction result of a certain traffic zone in a certain time window is a i , the passenger flow prediction result of the station in the traffic zone in the same time window is a i1 ,a i2 ,…,a iH , where H is the total number of stations included in the traffic zone. The Bayesian voting method is used to adjust the passenger flow prediction value of each station. The specific formula is as follows use As the final prediction value instead of a ij ; The prediction accuracy is improved by giving higher weights to the models with higher accuracy to complement each other; Assume that the passenger flow forecast result of a certain route in a certain time window is a i , the passenger flow prediction result of the station belonging to this line in the same time window is a i1 ,a i2 ,…,a ik , where k is the total number of stations included in the line; the Bayesian voting method is used to adjust the passenger flow prediction value of each station. The specific formula is as follows: use As the final prediction value instead of a ij ; Based on the predicted values of each station in each time window, the Bayesian voting method is used to obtain the final predicted value of the station passenger flow: Then, the final predicted value of passenger flow at each station is used The final passenger flow of the traffic area and the final passenger flow of the line can be obtained by summing up the calculation.
