Bus get-off station identification method and system based on CatBoost

Through the method of identifying bus stops based on CatBoost, the bus line data is separated and the Python machine learning framework is used to solve the problems of low efficiency and insufficient accuracy of identifying bus stops in the existing technology, and efficient and accurate get-off is achieved Site identification has optimized the bus system services.

CN119249268APending Publication Date: 2025-01-03XIHUA UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411308643.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-19
Publication Date
2025-01-03

AI Technical Summary

Technical Problem

The existing technology is difficult to effectively identify bus stops, especially when dealing with large-scale multi-classification problems, which are inefficient and have low data utilization, and are costly to train models, so they cannot provide effective data support.

Method used

The method of identifying bus stops based on CatBoost is adopted to reduce the difficulty of model learning by separating data from different bus routes, and the data processing and model training is used in Python's CatBoost machine learning framework to improve recognition accuracy and credibility.

Benefits of technology

It realizes efficient processing of large-scale multi-source bus data, improves the accuracy and credibility of stop recognition, reduces the complexity and cost of model training, and optimizes the service quality of the bus system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119249268A_ABST
    Figure CN119249268A_ABST
Patent Text Reader

Abstract

The invention provides a CatBoost-based bus get-off station identification method and system, and the method comprises the steps: collecting and fusing bus station data, GPS data and IC card swiping data, and obtaining initial bus get-on and get-off station data through a trip chain algorithm; performing feature engineering processing on the bus IC card swiping data, including decomposing time column features, identifying workdays and holidays, and fusing geographic positions and external weather data; performing data preprocessing, and converting the data into a feature and label form for model training; building a CatBoost model based on a Python language, setting proper training parameters, and training and testing the model; and using the trained model to predict the data of the unrecognized getting-off stations. The method has the advantages that the recognition accuracy and credibility of the model are improved, and the model learning difficulty is reduced. The problems of low accuracy and low efficiency in traditional get-off station identification are effectively solved, and the method has good data processing capability and practicability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of traffic big data analysis, and in particular to a method and system for identifying bus alighting sites based on CatBoost. Background Art

[0002] At present, the rapid development of new energy vehicle technology has significantly lowered the threshold for car purchases, the proportion of small and medium-sized cars in cities has increased rapidly, and the attractiveness of public transportation has significantly decreased, leading to aggravated urban traffic congestion. In order to alleviate this problem, it is necessary to think about how to improve the attractiveness of public transportation. Use technical means to analyze public transportation big data and find out the problems that need to be optimized in public transportation operations, such as bus timetables and bus routes, so as to optimize public transportation services. In recent years, urban transportation big data technology has continued to develop, and bus card swiping data has become one of the important data that objectively reflects the current status of public transportation. However, at present, most urban public transportation in my country adopts the "one ticket system", that is, passengers only need to swipe the card when getting on the bus, but do not need to swipe the card when getting off the bus, resulting in the lack of passenger alighting stations and related time information in the collected IC card information. Passenger alighting and alighting information is a key part of building a public transportation travel chain for travelers, and is also a basic condition for mastering public transportation OD. Therefore, it is necessary to accurately identify the alighting and alighting stations and alighting times of public transportation passengers. At present, the common technical method in the industry is to identify the data of bus alighting stations by developing various algorithms, analyze the current characteristics of public transportation operation, and propose better policy measures.

[0003] How to effectively identify the alighting station of bus passengers based on limited data has been one of the hot topics in the field of public transportation research in recent years. Some researchers have proposed that based on the current bus GPS data and bus IC card swiping data, time information and spatial information are used as the basis for judgment to form a travel chain, and then the bus alighting station is judged based on the travel chain. For example, the Chinese invention patent with an application date of 2023.02.24 and an application number of CN202211424041 discloses a bus individual travel decision model; the Chinese invention patent with an application date of 2019.02.19 and an application number of CN201910123126.0 discloses a bus alighting station identification and verification method based on multi-source data mining; the Chinese invention patent with an application date of 2020.12.29 and an application number of CN202011593440.4 discloses a method for identifying the alighting station of bus IC card passengers when the travel chain is broken. However, the travel chain method has an obvious limitation: since the travel chain algorithm can only form a travel chain based on data with fixed commuting trips, the data that can be used to form a travel chain using the algorithm only accounts for a small part of all the data, and the data utilization rate is low, resulting in the algorithm not being universal and unable to effectively provide data support.

[0004] Another group of researchers have established machine learning models for training and identifying bus passengers' alighting stations, and XGBoost and random forest models are generally used. For example, the Chinese invention patent with an application date of 2023.06.30 and an application number of CN202310789299 discloses a bus passenger alighting station inference method based on travel chain and ensemble learning. This type of model usually uses a small amount of data for training and fitting, and then identifies the alighting station information. However, when dealing with large-scale multi-classification problems, this type of model has many deficiencies in efficiency and feature processing, and the algorithm has high computational cost and low efficiency. For example, XGBoost and random forest models are not compatible with data, and a large amount of data preprocessing is required to adapt to model training; when processing large amounts of data, more hardware resources are required, and the ability to save the model is missing. Errors are prone to occur during model training, which takes more time to train the model. Summary of the invention

[0005] In view of the defects of the prior art, the present invention provides a method and system for identifying bus alighting stations based on CatBoost, so as to realize efficient processing of large-scale multi-source bus data. At the same time, in order to make the CatBoost method more suitable for the bus alighting station identification scenario, the present invention proposes to reduce the difficulty of model learning by separating different bus line data, thereby improving the accuracy and credibility of model identification.

[0006] The technical problem solved by the present invention is: solving the problem that the bus alighting station cannot be successfully identified in the combined time and space algorithm; at the same time, a simple data processing method is adopted to identify the alighting station data using the Python-based CatBoost machine learning framework; by separating different bus line data, the learning difficulty of the machine learning model is reduced, and the accuracy and credibility of model recognition are improved.

[0007] In order to achieve the above invention object, the technical solution adopted by the present invention is as follows:

[0008] A method for identifying bus alighting stations based on CatBoost includes the following steps:

[0009] Step S1, collect bus station data and bus GPS data. Integrate bus GPS data and IC card swiping data, and obtain preliminary bus boarding and alighting station data through the travel chain algorithm;

[0010] Step S2, feature engineering is performed on the bus IC card swiping data, and the time column features of the original bus boarding and alighting station data are decomposed to identify working days and holidays;

[0011] Step S3, pre-processing the bus IC card swiping data, integrating the bus boarding and alighting station data structure, and converting the data into features and labels, where the boarding and alighting station is used as the label value of the input set;

[0012] Step S4, building a CatBoost model for bus alighting station identification, building the model based on Python language, and setting model training parameters such as loss function and evaluation index;

[0013] Step S5, training, testing and saving the CatBoost model for bus alighting station identification, dividing the data into a training set and a test set according to the structure required by the model, and inputting them into the model, and training and testing are performed by adjusting the model parameters;

[0014] Step S6, using the bus alighting station identification CatBoost model saved in step S5 to predict the alighting station.

[0015] Furthermore, in step S1, the collecting and preprocessing of bus boarding and alighting station data specifically includes the following steps:

[0016] Step 101: collect IC card swiping data and spatiotemporal data of public transportation vehicles provided by local public transportation companies, organize the data sets, and mine relevant column features in the data;

[0017] Step 102: Calculate the time interval using the following formula based on the bus spatiotemporal data, bus company IC card swiping data, and bus station information data:

[0018] ΔT=|T boarding -T arrival

[0019] Where T boarding Indicates the time when the passenger swipes the card, T arrive Indicates the time when the vehicle arrives at the station, with a time interval of ΔT;

[0020] Step 103, traverse all card swipe data. According to the formula in step 102, if ΔT≤30s, it is considered that the boarding station of the current card swipe record is a stop for the bus, otherwise it is not, and the next card swipe data is judged. If a card swipe record and all bus GPS data do not meet the conditions in step 102, it is considered "invalid data";

[0021] Step 104: sort out all the card swiping data including the boarding station, use the travel chain method to capture the travel characteristics and transfer characteristics of the IC card swiping data, complete the travel chain, and obtain the alighting station information of some data.

[0022] Furthermore, in step S2, the feature engineering also includes extracting geographic location information of passengers getting on and off the bus from the card swiping data, and extracting weather information related to the passengers getting on and off the bus.

[0023] Furthermore, in step S4, the alighting station identification problem is regarded as a multi-classification problem in machine learning, and the following multi-classification loss function is used:

[0024]

[0025] Where ω i is the weight of the i-th alighting station, N represents the total number of samples, M represents the total number of alighting station names, a i is the result of applying the model to the i-th alighting station.

[0026] Furthermore, in step S4, accuracy is selected as the evaluation index of the CatBoost model, as shown in the following formula:

[0027]

[0028] where ω i is the weight of the i-th alighting station, N represents the total number of samples, M represents the total number of alighting stations, and a i is the result of applying the model to the i-th alighting station.

[0029] Furthermore, in step S4, the CatBoost model automatically encodes the classification features of the string type, and the specific encoding method is as follows:

[0030]

[0031] Where T represents the value of converting the categorical feature into a numerical result, n refers to the number of bus line names in the current boarding station, p is the personal setting parameter value, and a refers to the number of current boarding stations in all samples.

[0032] Furthermore, in step S3, the bus card swiping data preprocessing specifically includes the following steps:

[0033] Step 501: Extract the card swiping data including the alighting station, and divide the data into a data table for each line according to the line name. The final input data set is D j ={(x i ,y i )} i=1,2,K,n Where j is the bus line name, x represents the feature data, and y represents the get-off station;

[0034] Step 502: Establish a get-off station identification model for the data of each route, and the specific objective function is:

[0035] O j =F j (D j )

[0036] O j Refers to the prediction result of the j-line model, that is, the set of alighting station names O j ={(y i )} i=1,2,K,n , F j This is the machine learning model used by route j to identify bus alighting points. j Refers to the j-line input dataset.

[0037] Furthermore, the objective function of the CatBoost model is based on a gradient boosting decision tree, and its specific form is as shown below:

[0038]

[0039] Where y is the true value, is the predicted value, l is the loss function, and Ω(f) is the regularization term.

[0040] The CatBoost model uses a gradient boosting algorithm to construct a decision tree. The specific form of gradient boosting is as follows:

[0041] F m (x) = F m-1 (x)+γ m h m (x)

[0042] Among them, F m (x) is the predicted value of the mth tree, F m-1 (x) is the cumulative prediction value of the first m-1 trees, γ m is the learning rate, h m (x) is the prediction function of the mth tree.

[0043] The CatBoost model includes an L2 regularization term to prevent overfitting of the model. The specific formula is as follows:

[0044]

[0045] Among them, λ is the regularization parameter, K is the number of leaf nodes in the tree, and ω k is the weight of the kth leaf node.

[0046] Furthermore, the card swiping data of the alighting station that cannot be obtained in step S1 is extracted, the data features are processed in the same manner as step S2, and the alighting station is predicted using the model saved in step S5.

[0047] The present invention discloses a bus alighting station identification system based on CatBoost, which can be used to implement the above-mentioned bus alighting station identification method, specifically including:

[0048] Data collection module: responsible for collecting and storing bus station data, bus GPS data and IC card swiping data. Input includes bus station data (such as station name, location, etc.), real-time GPS data of buses and IC card swiping data (such as swiping time, route information, etc.).

[0049] Data fusion module: Fusion of bus GPS data and IC card swiping data, combined with the travel chain algorithm to preliminarily identify bus boarding and alighting station data, and generate a preliminary boarding and alighting station data set.

[0050] Feature Engineering Module: Perform feature engineering on the fused IC card swiping data, decompose the time column features of the original boarding and alighting station data, identify weekdays and holidays, and extract other features, including geographic location features and external weather data.

[0051] Data preprocessing module: Integrate and normalize bus boarding and alighting station data, and convert the data into the features and labels required for model training. The boarding and alighting station is used as the label value of the input set to provide structured data for model training.

[0052] Model building module: Build a CatBoost model for bus alighting station identification based on Python language, set the model's training parameters, including loss function, evaluation index and learning rate, and prepare the training data and test data required for the model.

[0053] Model training and testing module: The preprocessed data is divided into training sets and test sets, and input into the CatBoost model for training. The model adjusts parameters to minimize the loss function and is verified on the test set to ensure the accuracy and stability of the model.

[0054] Model saving and loading module: After training, the CatBoost model is saved as a file for subsequent loading and use. This module is responsible for the persistent storage and loading functions of the model to ensure that the system can make predictions on new data.

[0055] Prediction module: Use the trained CatBoost model to predict the card swiping data for unrecognized alighting stations, input new data into the model, output the predicted alighting station results, and complete the unrecognized alighting and boarding data.

[0056] The present invention also discloses a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor realizes the above-mentioned bus alighting station identification when executing the program.

[0057] The present invention also discloses a computer-readable storage medium, on which a computer program is stored. When the program is executed by a processor, the above-mentioned bus alighting station identification is realized.

[0058] Compared with the prior art, the advantages of the present invention are:

[0059] Efficient processing of large-scale bus data: The method of the present invention uses the CatBoost algorithm, which is specially designed for bus big data scenarios and realizes efficient processing of large-scale, multi-source bus data. This efficiency enables the system to process a large amount of card swipe data and GPS data, improving the speed and capacity of data processing.

[0060] Improve recognition accuracy and credibility: The proposed data preprocessing method for separating different bus routes reduces the learning difficulty of the model, thereby improving the model's recognition accuracy and credibility of the alighting point. This method can reduce confusion between different routes and improve the performance of the model in practical applications.

[0061] Solve the technical difficulties in identifying bus alighting stations: This method provides a new solution to the problem of being unable to successfully identify bus alighting stations in the combined time and space algorithm. By applying the Python-based CatBoost machine learning framework, the data processing process is simplified and the recognition ability of the model is enhanced.

[0062] Improve the working efficiency of the model: The method of separating the data of different bus routes optimizes the data preprocessing process, allowing the model to focus more on the data of specific routes, improving the overall working efficiency and the response speed of the model.

[0063] Enhance the simplicity and reliability of data processing: The present invention adopts a simple data processing method, reduces the complex data preprocessing steps, makes the system more reliable in practical applications, and reduces the complexity of data processing and model training.

[0064] Optimizing the service quality of public transportation systems: Accurate identification of alighting stations can help public transportation systems optimize route planning and scheduling, improve operational efficiency, and enhance passenger service experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0065] Figure 1 is a flow chart of a method for identifying a bus alighting station according to an embodiment of the present invention;

[0066] Figure 21 is a CatBoost model validation set accuracy graph for line 104 of embodiment of the present invention;

[0067] Figure 3 It is a CatBoost model training loss regression graph of line 104 of embodiment of the present invention. DETAILED DESCRIPTION

[0068] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below with reference to the accompanying drawings and examples.

[0069] like Figure 1 As shown, the present invention provides a method for identifying bus alighting stations based on CatBoost, comprising the following steps:

[0070] Step S1, collect bus boarding and alighting station data and bus GPS data. Integrate bus GPS data and IC card swiping data, and obtain preliminary bus boarding and alighting station data through the travel chain algorithm. ;

[0071] Step S2: Public transportation IC card swiping data feature engineering;

[0072] Step S3, pre-processing of bus IC card swiping data;

[0073] Step S4, building a CatBoost model for identification of alighting stations;

[0074] Step S5, training, testing and saving the CatBoost model for identification of the alighting station;

[0075] Step S6, identification of the alighting station.

[0076] In step S1, the data of bus boarding and alighting stations are collected and preprocessed to solve the following problem: the current storage method of bus card swiping data in most cities is backward, and the data structure has not been effectively updated. There are cases where the bus IC card swiping data does not contain the boarding station information, and it is necessary to merge it with the local bus GPS through an algorithm to fill in the boarding station information of the bus IC card swiping data. According to the time information and spatial information and other features in the card swiping data, the travel trajectory of each IC card is reproduced using the travel chain method, and then part of the alighting station information is obtained based on the travel trajectory. The fusion of bus GPS data and IC card swiping data and obtaining preliminary bus boarding and alighting station data through the travel chain algorithm includes the following steps:

[0077] Step 101: collect IC card swiping data and spatiotemporal data of public transportation vehicles provided by local public transportation companies, and organize the data set;

[0078] Step 102: Based on the bus spatiotemporal data, the bus company IC card swiping data and the bus station information data, the calculation formula is as shown in formula (1):

[0079] ΔT=|T boarding -T arrival | (1)

[0080] Where T boarding Indicates the time when the passenger swipes the card, T arrive It indicates the time when the vehicle arrives at the station. The time interval is ΔT. The time interval is calculated using an absolute value to avoid accidental exclusion of valid data due to delays in equipment recording time.

[0081] For example, a card swiping data record time is July 30 12:00:00, the card swiping route is bus No. 1, and there is a GPS data of bus No. 1 stopping at Beijing Road Station at 12:00:15 on July 30, at which time ΔT = 15s;

[0082] Step 103, traverse all card swipe data. According to the formula in step 102, if ΔT≤30, it is considered that the boarding station of the current card swipe record is the stop of the bus, otherwise it is not, and return to step 102 to judge the next card swipe data. If a card swipe record and all bus GPS data cannot meet the conditions in step 102, it is considered as "bad data" and the boarding station of the data is set to "999";

[0083] Step 104: sort out all the card swiping data including the boarding station, develop the travel chain method, capture the travel characteristics and transfer characteristics of the current IC card swiping data, complete the travel chain, and obtain the alighting station information of some data.

[0084] In step S2, the feature engineering of public transportation IC card swiping data is mainly used to supplement the data features in the data, and to provide richer information by increasing the data dimension, thereby improving the learning ability and effect of the machine learning algorithm in subsequent work. Specifically, feature engineering can reveal potential patterns and relationships in the data, enhance the generalization ability of the algorithm, reduce the risk of overfitting, and ultimately improve the prediction accuracy and stability of the model. The feature engineering of public transportation IC card swiping data specifically includes the following steps:

[0085] Step 201, extracting more specific time features such as year, month, day, etc. from the bus boarding time data;

[0086] Determine whether the day is a working day or a holiday; determine whether the boarding time is during the morning or evening rush hour;

[0087] Step 202: Use the longitude and latitude of the bus boarding point to indicate the location of the station;

[0088] Step 203: Combine the original data with the information of the public data set to extract and construct features that are effective for identifying the alighting station, such as the weather, temperature, and station coordinate information of the day;

[0089] Step 204: Combine the extracted time and geographic location features with the original data to generate a rich feature set;

[0090] In step S3, the bus IC card swiping data preprocessing is mainly used to integrate the data processed in the previous steps. Considering that in machine learning, by artificially reducing unnecessary dimensions, the prediction effect of the model can be improved, and data noise and computational overhead can be reduced. At the same time, the application of the line model can effectively avoid the problem that the identified get-off station does not belong to the station in the line, thereby improving the accuracy of data processing and the robustness of the model. In addition, the preprocessing step also includes data cleaning, missing value filling and outlier detection to ensure the quality of the input data, thereby improving the performance of the overall model. The bus IC card swiping data preprocessing specifically includes the following steps:

[0091] Step 301, integrating public transportation characteristic data and IC card swiping data;

[0092] Step 302: extract the card swiping data containing the alighting station, and divide the data into a data table for each line according to the line name, that is, the final input data set is D j ={(x i ,y i )} i=1,2,K,n Where j is the bus route name, x represents the feature data, and y represents the get-off station. For example, the data in the bus route 1 table should only contain the card swiping data of route 1. The input data set is D1 = {(x i ,y i )} i=1,2,K,n ;

[0093] In step S4, the CatBoost model for identifying the alighting station is mainly used for the model parameter selection of the main model CatBoost selected by the present invention. Each bus stop is regarded as a category in the classification problem. If the number of bus stops is much greater than 2, the alighting station identification problem is regarded as a multi-classification problem in machine learning. The CatBoost model construction specifically includes the following steps:

[0094] Step 401: CatBoost model is used for data training. The official document website of the model is catboost.ai. According to the tutorial provided by the official document, the present invention uses Python as the programming language to build the model.

[0095] Step 402: Adjust various parameters in combination with the goal of the current task. Consider each bus stop as a category in the classification problem. If there are far more than two bus stops, the alighting station identification problem is considered as a multi-classification problem in machine learning. The loss function setting should use a function for multi-classification problems. The present invention uses a multi-classification function to set parameters for the loss function. The specific form is as follows: i is the weight of the i-th alighting station, N represents the total number of samples, M represents the total number of alighting station names, a i is the result of applying the model to the i-th alighting station, as shown in formula (2):

[0096]

[0097] Since the accuracy of alighting station identification directly affects the service quality of the public transportation system, the reliability of data analysis, the effectiveness of safety management, and the realization of commercial value, the accuracy rate is selected as the evaluation index of the model, as shown in formula (3):

[0098]

[0099] where ω i is the weight of the i-th alighting station, N represents the total number of samples, M represents the total number of alighting stations, and a i is the result of applying the model to the i-th alighting station.

[0100] In step S5, the training, testing and saving of the CatBoost model for identification of the alighting station are mainly used to optimize and verify the performance of the CatBoost model. Specifically, by training the model, the CatBoost model can learn and capture the complex patterns and features in the bus IC card swiping data, thereby improving the accuracy of its identification of the alighting station. The testing process is designed to evaluate the performance of the model on unseen data, thereby ensuring its generalization ability and stability. Finally, the trained model is saved for quick loading and use in practical applications. The training, testing and saving of the CatBoost model specifically include the following steps:

[0101] Step 501: extract the card swiping data containing the alighting station, and divide the data into a data table for each line according to the line name, that is, the final input data set is D j ={(x i ,y i )} i=1,2,K,n Where j is the name of the bus route. For example, the data in the bus route 1 table should only contain the card swiping data of route 1. The input data set is D1={(x i ,y i )} i=1,2,K,n ;

[0102] Step 502: Repeat the model building work in step S4 to build a get-off station identification model for the data of each route, using the formula shown in formula (4):

[0103] O j =F j (D j ) (4)

[0104] O j Refers to the prediction result of the j-line model, that is, the set of alighting station names O j ={(y i )} i=1,2,K,n , F j This is the machine learning model used by route j to identify bus alighting points. In this invention, the CatBoost model is used. j Refers to the j-line input dataset.

[0105] The specific process of training is expressed by the formula as follows:

[0106] The objective function of the CatBoost model for bus stop identification is based on the gradient boosting decision tree (GBDT) as shown in formula (5):

[0107]

[0108] Where y is the true value, is the predicted value, l is the loss function, and Ω(f) is the regularization term.

[0109] The CatBoost model for bus alighting station identification uses the gradient boosting algorithm to construct a decision tree. Gradient boosting is shown in formula (6):

[0110] F m (x) = F m-1 (x)+γ m h m (x) (6)

[0111] where F m (x) is the predicted value of the mth tree, F m-1 (x) is the cumulative prediction value of the first m-1 trees, γ m is the learning rate, h m (x) is the prediction function of the mth tree.

[0112] The CatBoost model for bus stop identification includes an L2 regularization term to prevent overfitting of the model, as shown in formula (7):

[0113]

[0114] λ is the regularization parameter, K is the number of leaf nodes in the tree, ω k is the weight of the kth leaf node.

[0115] Step 503: Save the model locally and name it with the line name, and determine whether all lines have trained models, otherwise return to step 502.

[0116] In the step S6, the identification of the alighting station is mainly used for the ultimate purpose of the present invention. Specifically, the data lacking the alighting station information is input into the trained and verified CatBoost model in step S5, and the alighting station information in these data can be identified through the prediction function of the model. This process can not only supplement the missing data, but also improve the integrity and accuracy of the overall data. In addition, by analyzing the input data, the model can automatically identify and fill in the missing alighting station information, thereby optimizing the data set and providing reliable support for subsequent analysis and decision-making. This process ensures the high quality of the data and the practicality of the model, so that the final output data can more accurately reflect the actual alighting behavior of the passengers. The identification of the alighting station specifically includes the following steps:

[0117] Step 601, taking out the IC card swiping data that does not contain the alighting station in step 104, and dividing the data into multiple data tables identified by lines according to step 501;

[0118] Step 602, repeat the feature engineering method in step S2 on the data extracted in step 601;

[0119] Step 603, loading the model saved in step 503;

[0120] Step 604: Input the data for the alighting station to be identified, and fill the predicted alighting station into the table. At this point, the alighting station identification of all data is completed. The specific process is shown in formula (8):

[0121] O j =F j (D j ) (8)

[0122] O j Refers to the prediction result of the j-line model, that is, the set of alighting station names O j ={(y i )} i=1,2,K,n , F j This is the machine learning model used by route j to identify bus alighting stations. In this invention, the CatBoost bus alighting station identification model is used. j Refers to the j-line input feature dataset.

[0123] The following are specific examples to further illustrate the present invention:

[0124] There are about 30 million IC card swiping data in a certain two weeks in November 2022 in a certain city, and the data dictionary is shown in Table 1. There are about 10 million spatiotemporal data of buses in the same period, and the data dictionary is shown in Table 2. The coordinate data of bus stops are obtained based on the public data on the Internet of the city, and the boarding and alighting stops of regular buses are identified and verified. Taking the bus data of line 104 as an example, suppose there is a bus record with an arrival time of 3:20:15 on November 1, 2022, and a departure time of 3:20:25 on November 1, 2022, and the arrival stop is Beijing Road. At this time, all card swiping records of this period are found according to the bus number, that is, the IC card swiping records within 30 seconds from the bus entering the station to the bus leaving the station.

[0125] Combining various data sources, the total amount is approximately 20 million pieces of data containing boarding stations.

[0126] Table 1 IC card swipe data part data dictionary

[0127]

[0128] Table 2 Partial data dictionary of bus spatiotemporal data

[0129]

[0130]

[0131] The research problem of this embodiment is to combine IC card swiping data with bus spatiotemporal data into data containing boarding station information. The entire data set is processed by the trip chain method to obtain part of the alighting station information, and finally 9765679 data containing alighting stations are obtained, where the field table is shown in Table 3:

[0132] Table 3 contains the data dictionary of the alighting stations

[0133]

[0134] In the feature engineering, by collecting public data from the Internet, this embodiment supplements the coordinates of the boarding point, the number of stations on the line, the number of stations on the entire line, and the time information. The data dictionary after the specific feature engineering is shown in Table 4:

[0135] Table 4 Data dictionary after feature engineering

[0136]

[0137] Changing the data table format is implemented by Python code:

[0138] y_data=data['exstation_name']

[0139] x_data=data.drop(['exstation_name'],axis=1)

[0140] x_data['card_no']=x_data['card_no'].astype('str')

[0141] cat_fea=['card_no','enstation_name','line_name','card_type']

[0142] all_dataset=Pool(data=x_data,label=y_data,cat_features=cat_fea)

[0143] Initialize the CatBoost model parameters. The parameters used in this embodiment are shown in Table 5.

[0144] Table 5 Model parameters

[0145]

[0146] Use Python to traverse and read the data, divide the data into training set and test set in a ratio of 8:2, and transform the data in the same way. Input the training set and test set into the newly created model at the same time, and let the model train and fit with the same parameters. Loop until each line has its own alighting station recognition model.

[0147] Here, we take the data of bus route 104 as an example, and extract 33,679 data items containing the alighting stations. We split the data in a ratio of 8:2 to obtain 26,943 training data items and 6,736 test data items. After the model is instantiated, the training data and test data are input into the model training. Figure 2 This is the accuracy graph of the validation set during model training. Figure 3 This is the loss graph of the test set during model training. Save the model locally and name it "104 bus stop identification model.csv".

[0148] All 104 routes in the original data are extracted, and the data of the identified alighting stations are removed, that is, the data that the trip chain method cannot successfully identify the alighting stations still has 36,062 data. This type of data is converted using the same feature engineering data processing method, and the features of the original data are supplemented as training data features.

[0149] Load the previously saved "104 route alighting station identification model.csv" and input it into the model in the order of feature column names that are exactly the same as the training data. The model can identify the alighting stations of the remaining data with the trained parameters. Finally, 69,741 data of 104 routes including boarding stations and alighting stations are formed.

[0150] Repeat the above steps for 104 routes for each line respectively, and finally integrate the IC card alighting and swiping data of these two weeks, and finally obtain about 20 million IC card swiping data containing alighting station information.

[0151] In another embodiment of the present invention, a bus alighting station identification system based on CatBoost is provided. The system can be used to implement the above-mentioned bus alighting station identification method, specifically including:

[0152] Data collection module: responsible for collecting and storing bus station data, bus GPS data and IC card swiping data. Input includes bus station data (such as station name, location, etc.), real-time GPS data of buses and IC card swiping data (such as swiping time, route information, etc.).

[0153] Data fusion module: Fusion of bus GPS data and IC card swiping data, combined with the travel chain algorithm to preliminarily identify bus boarding and alighting station data, and generate a preliminary boarding and alighting station data set.

[0154] Feature Engineering Module: Perform feature engineering on the fused IC card swiping data, decompose the time column features of the original boarding and alighting station data, identify weekdays and holidays, and extract other features, including geographic location features and external weather data.

[0155] Data preprocessing module: Integrate and normalize bus boarding and alighting station data, and convert the data into the features and labels required for model training. The boarding and alighting station is used as the label value of the input set to provide structured data for model training.

[0156] Model building module: Build a CatBoost model for bus alighting station identification based on Python language, set the model's training parameters, including loss function, evaluation index and learning rate, and prepare the training data and test data required for the model.

[0157] Model training and testing module: The preprocessed data is divided into training sets and test sets, and input into the CatBoost model for training. The model adjusts parameters to minimize the loss function and is verified on the test set to ensure the accuracy and stability of the model.

[0158] Model saving and loading module: After training, the CatBoost model is saved as a file for subsequent loading and use. This module is responsible for the persistent storage and loading functions of the model to ensure that the system can make predictions on new data.

[0159] Prediction module: Use the trained CatBoost model to predict the card swiping data for unrecognized alighting stations, input new data into the model, output the predicted alighting station results, and complete the unrecognized alighting and boarding data.

[0160] In another embodiment of the present invention, a terminal device is provided, the terminal device includes a processor and a memory, the memory is used to store a computer program, the computer program includes program instructions, and the processor is used to execute the program instructions stored in the computer storage medium. The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc., which are the computing core and control core of the terminal, which are suitable for implementing one or more instructions, and are specifically suitable for loading and executing one or more instructions to implement the corresponding method flow or corresponding functions; the processor described in the embodiment of the present invention can be used for the operation of the bus alighting station identification method.

[0161] In another embodiment of the present invention, a storage medium is provided, specifically a computer-readable storage medium (Memory), which is a memory device in a terminal device for storing programs and data. It is understandable that the computer-readable storage medium here can include both the built-in storage medium in the terminal device and the extended storage medium supported by the terminal device. The computer-readable storage medium provides a storage space, which stores the operating system of the terminal. In addition, one or more instructions suitable for being loaded and executed by the processor are also stored in the storage space, and these instructions can be one or more computer programs (including program codes). It should be noted that the computer-readable storage medium here can be a high-speed RAM memory, or a non-volatile memory (non-volatile memory), such as at least one disk storage.

[0162] One or more instructions stored in a computer-readable storage medium may be loaded and executed by a processor to implement the corresponding steps of the bus alighting station identification method in the above embodiment; one or more instructions in the computer-readable storage medium may be loaded and executed by a processor.

[0163] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0164] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0165] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0166] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0167] Those skilled in the art will appreciate that the embodiments described herein are intended to help readers understand the implementation methods of the present invention, and should be understood that the protection scope of the present invention is not limited to such special statements and embodiments. Those skilled in the art can make various other specific variations and combinations that do not deviate from the essence of the present invention based on the technical revelations disclosed by the present invention, and these variations and combinations are still within the protection scope of the present invention.

Claims

1. A method for identifying bus alighting stations based on CatBoost, comprising the following steps: Step S1, collect bus station data and bus GPS data; integrate bus GPS data and IC card swiping data, and obtain preliminary bus boarding and alighting station data through travel chain algorithm; Step S2, feature engineering is performed on the bus IC card swiping data, and the time column features of the original bus boarding and alighting station data are decomposed to identify working days and holidays; Step S3, pre-processing the bus IC card swiping data, integrating the bus boarding and alighting station data structure, and converting the data into features and labels, where the boarding and alighting station is used as the label value of the input set; Step S4, building a CatBoost model for bus alighting station identification, building the model based on Python language, and setting model training parameters such as loss function and evaluation index; Step S5, training, testing and saving the CatBoost model for bus alighting station identification, dividing the data into a training set and a test set according to the structure required by the model, and inputting them into the model, and training and testing are performed by adjusting the model parameters; Step S6, using the bus alighting station identification CatBoost model saved in step S5 to predict the alighting station.

2. The method for identifying a bus stop according to claim 1, characterized in that: In step S1, the collection and preprocessing of bus boarding and alighting station data specifically includes the following steps: Step 101: collect IC card swiping data and spatiotemporal data of public transportation vehicles provided by local public transportation companies, organize the data sets, and mine relevant column features in the data; Step 102: Calculate the time interval using the following formula based on the bus spatiotemporal data, bus company IC card swiping data, and vehicle station information data: ΔT=|T boarding -T arrival Where T boarding Indicates the time when the passenger swipes the card, T arrive Indicates the time when the vehicle arrives at the station, with a time interval of ΔT; Step 103, traverse all card swiping data; judge according to the formula in step 102, if ΔT≤30s, it is considered that the boarding station of the current card swiping record is the stop station of the bus, otherwise it is not, and the next card swiping data is judged. If a card swiping record and all bus GPS data cannot meet the conditions in step 102, it is considered as "invalid data"; Step 104: sort out all the card swiping data including the boarding station, use the travel chain method to capture the travel characteristics and transfer characteristics of the IC card swiping data, complete the travel chain, and obtain the alighting station information of some data.

3. The method for identifying a bus alighting station according to claim 1, characterized in that: In step S2, the feature engineering also includes extracting geographic location information of passengers getting on and off the bus from the card swiping data, and extracting weather information related to the passengers getting on and off the bus.

4. The method for identifying a bus stop according to claim 1, characterized in that: In step S4, the alighting station identification problem is regarded as a multi-classification problem in machine learning, and the following multi-classification loss function is used: Where ω i is the weight of the i-th alighting station, N represents the total number of samples, M represents the total number of alighting station names, a i is the result of applying the model to the i-th alighting station.

5. The method for identifying a bus alighting station according to claim 1, characterized in that: In step S4, the accuracy is selected as the evaluation index of the CatBoost model, as shown in the following formula: where ω i is the weight of the i-th alighting station, N represents the total number of samples, M represents the total number of alighting stations, and a i is the result of applying the model to the i-th alighting station.

6. The method for identifying a bus alighting station according to claim 1, characterized in that: In step S4, the CatBoost model automatically encodes the classification features of the string type. The specific encoding method is as follows: Where T represents the value of converting the categorical feature into a numerical result, n refers to the number of bus line names in the current boarding station, p is the personal setting parameter value, and a refers to the number of current boarding stations in all samples.

7. The method for identifying a bus alighting station according to claim 1, characterized in that: In step S3, the bus card swiping data preprocessing specifically includes the following steps: Step 501: Extract the card swiping data including the alighting station, and divide the data into a data table for each line according to the line name. The final input data set is D j ={(x i ,y i )} i=1,2,K,n Where j is the bus line name, x represents the feature data, and y represents the get-off station; Step 502: Establish a get-off station identification model for the data of each route, and the specific objective function is: O j =F j (D j ) O j Refers to the prediction result of the j-line model, that is, the set of alighting station names O j ={(y i )} i=1,2,K,n , F j This is the machine learning model used by route j to identify bus alighting points. j Refers to the j-line input dataset.

8. The method for identifying a bus alighting station according to claim 1, characterized in that: The objective function of the CatBoost model is based on a gradient boosted decision tree; The CatBoost model uses a gradient boosting algorithm to build a decision tree; The CatBoost model includes an L2 regularization term to prevent the model from overfitting.

9. The method for identifying a bus alighting station according to claim 1, characterized in that: Extract the card swiping data for the alighting station that cannot be obtained in step S1, process the data features in the same way as step S2, and use the model saved in step S5 to predict the alighting station.

10. A bus alighting station identification system based on CatBoost, characterized in that: The system can be used to implement the bus alighting station identification method according to any one of claims 1 to 9, specifically comprising: Data collection module: responsible for collecting and storing bus station data, bus GPS data and IC card swiping data; input includes bus station data, real-time bus GPS data and IC card swiping data; Data fusion module: Fusion of bus GPS data and IC card swiping data, combined with the travel chain algorithm to preliminarily identify bus boarding and alighting station data, and generate a preliminary boarding and alighting station data set; Feature Engineering Module: Perform feature engineering on the fused IC card swiping data, decompose the time column features of the original boarding and alighting station data, identify working days and holidays, and extract other features, including geographic location features and external weather data; Data preprocessing module: Integrate and normalize the data of bus boarding and alighting stations, and convert the data into the features and labels required for model training. The boarding and alighting stations are used as the label values ​​of the input set to provide structured data for model training. Model building module: Build a CatBoost model for bus stop identification based on Python, set the model's training parameters, including loss function, evaluation index, and learning rate, and prepare the training and test data required for the model; Model training and testing module: The preprocessed data is divided into training set and test set, and input into CatBoost model for training. The model adjusts parameters to minimize the loss function and is verified on the test set to ensure the accuracy and stability of the model. Model saving and loading module: After training, the CatBoost model is saved as a file for subsequent loading and use; this module is responsible for the persistent storage and loading functions of the model to ensure that the system can predict new data; Prediction module: Use the trained CatBoost model to predict the card swiping data for unrecognized alighting stations, input new data into the model, output the predicted alighting station results, and complete the unrecognized alighting and boarding data.