A method for predicting bus arrival time

Optimizing the parameters of the LSTM neural network through the Haiou algorithm solves the problem that it is difficult to find the optimal parameter combination in the existing technology by manually adjusting the parameters, and accurately predicting the bus arrival time and improving the prediction effect.

CN117218828BActive Publication Date: 2024-12-13EAST CHINA JIAOTONG UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311066747.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-23
Publication Date
2024-12-13
Estimated Expiration
2043-08-23

AI Technical Summary

Technical Problem

In the prior art, when training an LSTM neural network for prediction of bus arrival time, it requires manual parameter adjustment, making it difficult to find the optimal model parameter combination, resulting in poor prediction effect.

Method used

The model parameters of the LSTM neural network are tuned by using the Seagull algorithm, and the initial parameters are randomly generated and the optimal parameter combination is found using the Seagull algorithm, and the model parameters are automatically adjusted to improve prediction performance.

Benefits of technology

It greatly reduces the workload of manual parameter adjustment, improves the performance of the LSTM neural network, and can accurately predict bus arrival time based on historical data and current information, helping passengers better plan their travel.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117218828B_ABST
    Figure CN117218828B_ABST
Patent Text Reader

Abstract

The present invention provides a method for predicting bus arrival time, which belongs to the technical field of bus arrival time prediction, including: processing a bus GPS data set to obtain a training set and a test set; using the initial model parameters of an LSTM neural network as the position parameters of a seagull in a seagull algorithm; using the position parameters of the seagull as the model parameters of the LSTM neural network; inputting the training set into the LSTM neural network to train the LSTM neural network, and when the mean square error M1 of the output result and the expected value is the smallest, obtaining a first LSTM neural network; inputting the test set into the first LSTM neural network, and obtaining the mean square error M2 of the output value and the expected value; using M2 as the fitness of the seagull; using the position parameters of the seagull corresponding to the minimum fitness as the optimal model parameters of the LSTM neural network; inputting the bus GPS data set into the trained LSTM neural network to obtain the bus arrival time. The method can accurately predict the bus arrival time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of bus arrival time prediction, and in particular relates to a bus arrival time prediction method. Background Art

[0002] The continuous increase in the number of motor vehicles has brought convenience to people, but it has also been accompanied by a series of traffic problems. At the same time, automobile exhaust emissions will also produce a large amount of substances that pollute the environment. Especially in the context of today's "carbon neutrality and carbon peak" era, it is particularly important to curb the growth of motor vehicle ownership, vigorously develop public transportation, and increase the proportion of public transportation. However, the use rate of public transportation has not been greatly improved because of the serious delays of public transportation and the long waiting time for public transportation. Therefore, it is necessary to improve the accuracy of the prediction of bus arrival time to attract more public transportation trips.

[0003] Existing technology uses LSTM neural network to predict the arrival time of buses. However, in the process of training LSTM neural network, manual parameter adjustment is required. For some complex model parameter combinations and configuration problems, manual parameter adjustment is often difficult to achieve the optimal effect, resulting in poor prediction results. Summary of the invention

[0004] In order to overcome the above-mentioned deficiencies in the prior art, the present invention provides a method for predicting bus arrival time.

[0005] In order to achieve the above object, the present invention provides the following technical solutions:

[0006] A method for predicting bus arrival time, comprising:

[0007] Obtain bus schedules, the running distances between each bus stop, and the corresponding walking time as the bus arrival GPS data set, and divide the bus arrival GPS data set into a training set and a test set;

[0008] The model parameters of the LSTM neural network are optimized using the Seagull algorithm, and the optimized LSTM neural network is trained using the bus arrival GPS data set to obtain an LSTM neural network that can predict bus arrival times.

[0009] Input the real-time bus arrival GPS data into the LSTM neural network that can predict the bus arrival time to obtain the bus arrival time;

[0010] The optimization of the model parameters of the LSTM neural network by the Seagull algorithm specifically includes:

[0011] Randomly generate a set of initial model parameters of the LSTM neural network;

[0012] The initial model parameters of the LSTM neural network are used as the position parameters of the seagull in the seagull algorithm;

[0013] The position parameters of each seagull are input into the LSTM neural network as the model parameters of the LSTM neural network;

[0014] The training set is input into the LSTM neural network to train the LSTM neural network. When the mean square error M1 between the output of the LSTM neural network and the expected value is the smallest, the first LSTM neural network is obtained. The test set is input into the first LSTM neural network to find the mean square error M2 between the output value of the first LSTM neural network and the expected value. M2 is used as the fitness of the seagull in the seagull algorithm.

[0015] If the minimum fitness among the seagulls is greater than the threshold, adjust the position parameters of the seagulls until the minimum fitness among the seagulls is less than the threshold; the position parameters of the seagulls corresponding to the minimum fitness among the seagulls are used as the optimal model parameters of the LSTM neural network.

[0016] Further, the initial model parameters of the LSTM neural network are used as the position parameters of the seagull in the seagull algorithm, including:

[0017] The learning rate of the LSTM neural network in the initial model parameters is used as the new position that does not conflict with the neighboring seagulls;

[0018] The number of iterations of the LSTM neural network in the initial model parameters is used as the direction of the optimal seagull position;

[0019] The number of nodes in the first hidden layer of the LSTM neural network in the initial model parameters is used as the distance between the seagull and the best seagull;

[0020] The number of nodes in the second hidden layer of the LSTM neural network in the initial model parameters is taken as the optimal position of the seagull.

[0021] Further, the adjusting the position parameters of the seagull comprises:

[0022] According to the fitness of the seagull P s Calculating the optimal position of the seagull

[0023] Calculate the positions of the remaining seagulls

[0024]

[0025]

[0026]

[0027]

[0028] Where k represents the current iteration number; f c Represents the control variable A f The model parameter of frequency, f c is 2, K max is the maximum number of iterations; Indicates the current location of the seagull; is the optimal position; r d Randomly select a value in the interval [0, 1]; Indicates a new position that does not conflict with neighboring gulls; Indicates the direction of the best seagull position; is the distance between the remaining gulls and the best gull;

[0029] Calculate the new attack position of the seagull

[0030]

[0031]

[0032] r1=ak×(a / K max )

[0033] Where r is the radius of the spiral flight of the seagull during the attack; θ is a random angle value in the interval [0, 2π]; u and v are constants; e is the base of the natural logarithm; a is a constant with a value of 2; r2∈[0,2π] takes a random value; r3∈[0,1] takes a random value;

[0034] Update the optimal position and fitness value of the seagull;

[0035] Perturb the optimal position and determine the optimal position of the new seagull:

[0036]

[0037]

[0038]

[0039] Where TD(z) represents the t-distribution with degree of freedom parameter z; ω is the adaptive parameter; c = 0.1, b = 1; K max is the maximum number of iterations; pe∈[0,1]; is the new position of the seagull after the t-distribution perturbation, P best Yes, Seagull is the best location.

[0040] Furthermore, the bus GPS data set also includes:

[0041] Bus running direction, running time, weather temperature, weather relative humidity, and 1-hour precipitation.

[0042] Furthermore, the running distance between each bus stop is:

[0043]

[0044] Where Δd is the distance between two GPS data points; R is the radius of the earth, which is 6371 km; They represent the latitude values ​​(in radians) of two GPS data points respectively; Δλ represents the longitude difference between two GPS data points.

[0045] Furthermore, it also includes: matching the arrival time of buses at each station in the input variables with the weather influencing factors through time synchronization, and the input variables are:

[0046]

[0047] Where: x k is the input variable of step k; is the arrival time of the last bus from stop 1 to stop 2 corresponding to the input in step k; is the weather temperature value in the weather influencing factor corresponding to the previous bus input in step k; is the relative humidity value of the weather influencing factor corresponding to the previous bus input in step k; is the 1-hour precipitation value in the weather influencing factors corresponding to the previous bus input in step k; is the weather temperature value in the weather influencing factors corresponding to the predicted bus route input in step k; is the relative humidity value in the weather influencing factors corresponding to the predicted bus route input in step k; is the 1-hour precipitation value among the weather influencing factors corresponding to the predicted bus route input in the kth step.

[0048] Furthermore, after obtaining the bus schedules, the running distances between each bus stop and the corresponding walking time as the bus arrival GPS data set, the bus arrival GPS data set is divided into two different running directions, and the running time of each running direction is divided into morning peak, flat peak and evening peak.

[0049] Furthermore, the influencing factors of the morning peak, off-peak and evening peak include: the number of people, the number of vehicles, the road environment, the number of intersections that the bus passes through, the form of each station, and the weather.

[0050] The method for predicting bus arrival time provided by the present invention has the following beneficial effects:

[0051] The present invention uses an LSTM neural network to predict the arrival time of a bus. When training the LSTM neural network, the parameters of the LSTM neural network are used as the position parameters of the seagull, the mean square error of the LSTM neural network test set is used as the fitness of the seagull, and the seagull algorithm is used to find the optimal model parameter combination; it can not only automatically find the optimal model parameter combination, greatly reducing the workload of manual parameter adjustment, but also improve the performance of the LSTM neural network. The trained LSTM neural network can accurately predict the arrival time of the bus based on historical data and current information, which can help passengers better plan their travel. The invention solves the problem that in the prior art, manual parameter adjustment is required during the training of the LSTM neural network. For some complex model parameter combinations and configuration problems, manual parameter adjustment is often difficult to achieve the optimal effect, resulting in poor prediction results. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] In order to more clearly illustrate the embodiment of the present invention and its design scheme, the following briefly introduces the drawings required for this embodiment. The drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0053] Figure 1 This is a flow chart of the method for predicting bus arrival time of the present invention;

[0054] Figure 2 It is the bus station operation process analysis diagram of the present invention;

[0055] Figure 3 It is a schematic diagram of the LSTM model structure of the present invention. DETAILED DESCRIPTION

[0056] In order to enable those skilled in the art to better understand the technical solution of the present invention and implement it, the present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and cannot be used to limit the scope of protection of the present invention.

[0057] Example:

[0058] The present invention provides a method for predicting bus arrival time, specifically as follows Figure 1As shown, it includes: processing a bus GPS data set to obtain a training set and a test set; randomly generating a set of initial model parameters of an LSTM neural network; using the initial model parameters of the LSTM neural network as the position parameters of the seagull in the seagull algorithm; inputting the position parameters of each seagull into the LSTM neural network as the model parameters of the LSTM neural network; inputting the training set into the LSTM neural network to train the LSTM neural network, and when the mean square error M1 between the result output by the LSTM neural network and the expected value is the smallest, a first LSTM neural network is obtained; inputting the test set into the first LSTM neural network to calculate the mean square error M2 between the output value of the first LSTM neural network and the expected value; using M2 as the fitness of the seagull in the seagull algorithm; if the minimum fitness among the seagulls is greater than a threshold, adjusting the position parameters of the seagulls until the minimum fitness among the seagulls is less than the threshold; using the position parameters of the seagulls corresponding to the minimum fitness among the seagulls as the optimal model parameters of the LSTM neural network to obtain a trained LSTM neural network; inputting bus GPS data sets of different directions and different time periods into the trained LSTM neural network to predict and analyze the bus arrival time.

[0059] Taking into account the characteristics of bus operation, which is fixed-line driving and fixed-point parking, and the operating status is periodic and regular, the present invention intends to use the improved Seagull algorithm to optimize the LSTM model to predict and analyze the bus arrival time, so as to more accurately predict the bus arrival time.

[0060] The following are implementation details of the present invention:

[0061] The bus GPS data set is processed into a data set that can be input into the model after line data processing, station data processing, time conversion processing, displacement calculation processing, and quantitative processing of the influencing factor feature set. The displacement calculation process takes into account that the earth itself is a sphere. In order to minimize the calculation error, the Haversine formula of the sine function is used to calculate the displacement between two points:

[0062]

[0063] Where Δd is the distance between two GPS data points; R is the radius of the earth, which is 6371 km; They represent the latitude values ​​(in radians) of two GPS data points respectively; Δλ represents the longitude difference (in radians) of two GPS data points.

[0064] At the same time, factors such as people, vehicles, road environment, number of intersections, platform forms and weather that affect the arrival time of buses are considered. After processing, the bus arrival GPS data set is divided into two different running directions and morning peak, flat peak and evening peak, and is input into the model proposed by the present invention for prediction and analysis.

[0065] like Figure 2 As shown, the present invention will use LSTM to predict the bus arrival time. The input variables will include various influencing factors in the bus operation process and historical data of the bus arrival time in the same direction and time period. The output variable is the predicted value of the bus arrival time.

[0066] like Figure 3 As shown, the present invention uses the introduction of nonlinear convergence factors to improve parameters, the introduction of local search and global search capabilities of the sine-cosine operator coordination algorithm, and the introduction of an adaptive distribution mutation strategy to perform perturbation mutation to generate new solutions. The improved Seagull algorithm optimizes the model parameters such as the learning rate, number of iterations, and number of nodes in the two hidden layers of the LSTM network to construct the ISOA-LSTM bus arrival time prediction model. The specific implementation steps are as follows:

[0067] S1. Initialization parameters. Define the initial parameter values ​​of the improved Seagull algorithm and the initial parameters of the LSTM neural network structure, input the weather temperature, relative humidity, and 1-hour precipitation in the weather influencing factors into the prediction model for analysis, divide the data set into a training set and a test set, and the prediction time step is 1.

[0068] The bus arrival time at each station in the input variables and the weather influencing factors are mainly corresponded through time synchronization. The specific symbolic description is as follows:

[0069]

[0070] Where: x k is the input variable of step k; is the arrival time of the last bus from stop 1 to stop 2 corresponding to the input in step k; is the weather temperature value in the weather influencing factor corresponding to the previous bus input in step k; is the relative humidity value of the weather influencing factor corresponding to the previous bus input in step k; is the 1-hour precipitation value in the weather influencing factors corresponding to the previous bus input in step k; is the weather temperature value in the weather influencing factors corresponding to the predicted bus route input in step k; is the relative humidity value in the weather influencing factors corresponding to the predicted bus route input in step k; is the 1-hour precipitation value among the weather influencing factors corresponding to the predicted bus route input in the kth step.

[0071] S2. Initialize the seagull position;

[0072] S3. Calculate the seagull fitness P s , taking the mean square error of the LSTM model test set as the fitness value, the optimal position of the seagull is

[0073] S4. Calculate the seagull position according to the relevant formula

[0074]

[0075]

[0076] Where k represents the current iteration number; f c Represents the control variable A f The model parameters of frequency are tested with different values ​​and it is found that when f c When the value is 2, the result is more reasonable; so its value is set to 2, K max is the maximum number of iterations; Indicates the current location of the seagull; is the best seagull position; r d Randomly select values ​​in the interval [0, 1]; is the distance between the gull and the best gull.

[0077] S5. Calculate the new attack position of the seagull according to the relevant formula

[0078]

[0079]

[0080] r1=ak×(a / K max )

[0081] Among them, r is the radius of the spiral flight of the seagull when performing an attack; θ is a random angle value in the interval [0, 2π]; u and v are constants; e is the base of the natural logarithm; a is a constant with a value of 2; r2∈[0,2π] takes a random value; r3∈[0,1] takes a random value.

[0082] S6. Update the best seagull position and fitness value;

[0083] S7. Determine the optimal position for disturbance according to the relevant formula and determine the optimal position:

[0084]

[0085]

[0086]

[0087] Where TD(z) represents the t-distribution with degree of freedom parameter z; ω is the adaptive parameter; c = 0.1, b = 1; K max is the maximum number of iterations; pe∈[0,1].

[0088] S8. Determine whether the end condition is met, if so, output the optimal value, otherwise jump to step 1.

[0089] S9. Use the output optimal value as the model parameter of the optimized LSTM network, train the LSTM neural network, and finally output the bus arrival time prediction result.

[0090] The present invention improves the original Seagull algorithm by introducing a nonlinear convergence factor to improve parameters, introducing the local search and global search capabilities of the sine-cosine operator coordination algorithm, and introducing an adaptive distributed mutation strategy to perform perturbation mutation to generate new solutions. The Seagull algorithm improved the standard Seagull algorithm, optimized the model parameters such as the learning rate, number of iterations, and number of nodes in two hidden layers of the LSTM network, and constructed an ISOA-LSTM bus arrival time prediction model.

[0091] The model proposed in the present invention combines the advantages and disadvantages of the improved Seagull optimization algorithm and the long short-term memory neural network, which can reduce the probability of local optimality and overfitting. The design of the model has good stability and can achieve more accurate prediction of bus arrival time.

[0092] The embodiments described above are only preferred specific implementation modes of the present invention, and the protection scope of the present invention is not limited thereto. Any simple changes or equivalent replacements of the technical solutions that can be obviously obtained by any technician familiar with the field within the technical scope disclosed in the present invention belong to the protection scope of the present invention.

Claims

1. A method for predicting bus arrival time, characterized in that: include: Obtain bus schedules, the running distances between each bus stop, and the corresponding walking time as the bus arrival GPS data set, and divide the bus arrival GPS data set into a training set and a test set; The model parameters of the LSTM neural network are optimized using the Seagull algorithm, and the optimized LSTM neural network is trained using the bus arrival GPS data set to obtain an LSTM neural network that can predict bus arrival times. Input the real-time bus arrival GPS data into the LSTM neural network that can predict the bus arrival time to obtain the bus arrival time; The optimization of the model parameters of the LSTM neural network by the Seagull algorithm specifically includes: Randomly generate a set of initial model parameters of the LSTM neural network; The initial model parameters of the LSTM neural network are used as the position parameters of the seagull in the seagull algorithm; The position parameters of each seagull are input into the LSTM neural network as the model parameters of the LSTM neural network; The training set is input into the LSTM neural network to train the LSTM neural network. When the mean square error M1 between the output of the LSTM neural network and the expected value is the smallest, the first LSTM neural network is obtained. The test set is input into the first LSTM neural network to find the mean square error M2 between the output value of the first LSTM neural network and the expected value. M2 is used as the fitness of the seagull in the seagull algorithm. If the minimum fitness among the seagulls is greater than the threshold, adjust the position parameters of the seagulls until the minimum fitness among the seagulls is less than the threshold; the position parameters of the seagulls corresponding to the minimum fitness among the seagulls are used as the optimal model parameters of the LSTM neural network; The initial model parameters of the LSTM neural network are used as the position parameters of the seagull in the seagull algorithm, including: The learning rate of the LSTM neural network in the initial model parameters is used as the new position that does not conflict with the neighboring seagulls; The number of iterations of the LSTM neural network in the initial model parameters is used as the direction of the optimal seagull position; The number of nodes in the first hidden layer of the LSTM neural network in the initial model parameters is used as the distance between the seagull and the best seagull; The number of nodes in the second hidden layer of the LSTM neural network in the initial model parameters is used as the optimal position of the seagull; The adjusting of the position parameters of the seagull comprises: According to the fitness of the seagull P s Calculating the optimal position of the seagull Calculate the positions of the remaining seagulls Where k represents the current iteration number; f c Represents the control variable A f The model parameter of frequency, f c is 2, K max is the maximum number of iterations; Indicates the current location of the seagull; is the optimal position; r d Randomly select a value in the interval [0, 1]; Indicates a new position that does not conflict with neighboring gulls; Indicates the direction of the best seagull position; is the distance between the remaining gulls and the best gull; Calculate the new attack position of the seagull r1=ak×(a / K max ) Where r is the radius of the spiral flight of the seagull during the attack; θ is a random angle value in the interval [0, 2π]; u and v are constants; e is the base of the natural logarithm; a is a constant with a value of 2; r2∈[0,2π] takes a random value; r3∈[0,1] takes a random value; Update the optimal position and fitness value of the seagull; Perturb the optimal position and determine the optimal position of the new seagull: Where TD(z) represents the t-distribution with the degree of freedom parameter z; ω is the adaptive parameter; c = 0.1, b = 1; K max is the maximum number of iterations; pe∈[0,1]; is the new position of the seagull after the t-distribution perturbation, P best Yes, Seagull is the best location.

2. A method for predicting bus arrival time according to claim 1, characterized in that: The bus arrival GPS data set also includes: Bus running direction, running time, weather temperature, weather relative humidity, and 1-hour precipitation.

3. A method for predicting bus arrival time according to claim 1, characterized in that: The running distance between each bus stop is: Where Δd is the distance between two GPS data points; R is the radius of the earth, which is 6371 km; They represent the latitude values ​​of two GPS data points respectively; Δλ represents the longitude difference between two GPS data points.

4. A method for predicting bus arrival time according to claim 2, characterized in that: Also includes: The bus arrival time at each station in the input variables is matched with the weather influencing factors through time synchronization. The input variables are: Where: x k is the input variable of step k; is the arrival time of the last bus from stop 1 to stop 2 corresponding to the input in step k; is the weather temperature value in the weather influencing factor corresponding to the previous bus input in step k; is the relative humidity value of the weather influencing factor corresponding to the previous bus input in step k; is the 1-hour precipitation value in the weather influencing factors corresponding to the previous bus input in step k; is the weather temperature value in the weather influencing factors corresponding to the predicted bus route input in step k; is the relative humidity value in the weather influencing factors corresponding to the predicted bus route input in step k; is the 1-hour precipitation value among the weather influencing factors corresponding to the predicted bus route input in the kth step.

5. A method for predicting bus arrival time according to claim 1, characterized in that: After obtaining the bus schedule, the running distance between each bus stop and the corresponding walking time as the bus arrival GPS data set, the bus arrival GPS data set is divided into two different running directions, and the running time of each running direction is divided into morning peak, flat peak and evening peak.

6. A method for predicting bus arrival time according to claim 5, characterized in that: The influencing factors of the morning peak, off-peak and evening peak include: number of people, number of vehicles, road environment, number of intersections passed by the bus, the form of each station and weather.