# Research on GPS User Trajectory Analysis and Behavior Prediction Based on Swarm Intelligence Algorithm

Authors: Guangyong Zhou
Journal: Journal of Sensors
 (2022)

---

## Abstract

Under the social background of the rapid development of big data, human beings have gradually moved towards a comprehensive digital era, and people have begun to apply digital technology in various fields. Therefore, it is necessary to study methods that can efficiently process big data and solve problems such as data intelligence. Intelligent products and applications that we use everywhere in our lives are changing people’s lives. Among them, location service is one of the important technical supports. No matter which software is opened on the mobile phone, it will prompt us to open location service. Location prediction is an important part of location-based services and plays an indispensable role in the recommendation system and urban resource planning. At present, GPS-based trajectory data is widely concerned in position prediction task. GPS trajectory data belongs to spatiotemporal series data, which not only contains time and position information but also contains abundant context information in trajectory sequence. Most of the traditional position prediction methods focus on the position sequence in GPS trajectory but do not fully mine the context information in the trajectory, which leads to poor prediction results. The intelligent optimization algorithm greatly enriches the optimization technology and provides a feasible solution for those combinatorial optimization problems which are difficult to deal with by traditional optimization technology. GPS trajectory data has the advantages of wide coverage, quick update, easy collection, and low cost, and it also implies abundant road network information. As a result, GPS trajectory data of users has gradually become a new data source for automatic construction of urban road network and has also become a research hotspot of many scholars. In this paper, the idea of swarm intelligence algorithm and swarm intelligence algorithm are used to design and implement a data analysis and behavior prediction system for calculating GPS user trajectory, aiming at solving the shortcomings of existing GPS tracking and positioning.


---

## Body

## 1. Introduction

Invisible information resources are closely related to our lives. How to mine useful value from these important information resources has become a hot topic discussed by many scholars. Big data contains all kinds of important information of people, such as users’ travel habits, consumption habits, and behavior characteristics. We can collect important information for big data analysis and further tap the diversified value of users, so as to provide more targeted services. With the continuous development of positioning technology, vehicles, mobile phones, smart and convenient products, and other devices with GPS, services are collecting user trajectory data every minute. Reference [1] proposes an intelligent swarm algorithm, which can accurately estimate the posterior state in nonlinear systems and show higher tracking accuracy. Literature [2] describes that the improved SFLA algorithm has faster convergence in cloud computing. Reference [3] analyzes the techniques of well trajectory prediction and collision risk assessment, which can improve drilling efficiency and ensure the safety and reliability of drilling process. Literature [4] expounds the analysis of the unbalanced entrance space and, on this basis, puts forward relevant suggestions and measures to optimize it. Reference [5] based on the GRNN algorithm for ship trajectory analysis and [6] ocean transport ship trajectory analysis. In reference [7], the flight trajectory of stratospheric airship was analyzed and studied in view of the influence of traditional propeller on environmental changes such as atmospheric density. Literature [8] analyzes and studies the multidimensional and sparse trajectory data of downhole workers, and improves the accuracy of abnormal trajectory discrimination. The analysis of trajectory characteristics and the relationship between trajectory and the position of car body parts in reference [9] provides reference for cab design. Reference [10] analyzes three applications of ship trajectory clustering, extracts three ship motion patterns, and enriches the characteristics of ship behavior patterns. Reference [11] studies the establishment of dynamic equations to analyze the flight trajectory of rotating oblique projectile under wind speed. Reference [12] studies the analysis of urban vehicle trajectory to predict whether the road condition information is congested and studies the intelligent vehicle trajectory of SD card in [13], which realizes the off-line debugging function and improves the debugging efficiency. Literature [14] describes multivariable trajectory analysis for fault detection. In reference [15], the trajectory equation of projectile under the influence of air resistance and the equation of projectile angle when the range is maximum are derived. With the help of MATLAB numerical calculation function, the trajectory curves under different resistance coefficients, projectile mass, initial velocity, and projectile angle are simulated. Literature [16] describes the detection of heart disease by swarm intelligence optimization algorithm. Literature [17] analyzes and summarizes the research and development direction of train operation control technology based on swarm intelligence. In reference [18], a multi-UAV autonomous control algorithm is proposed to improve the success rate of UAV cluster in air combat. Literature [19] discusses the multidisciplinary viewpoints and methods of swarm intelligence computing, the parallel implementation of multiswarm cooperation and bionic network hardware, and swarm intelligence has important applications in aerospace TT&C, UAV intelligent TT&C, and other fields. Reference [20] proposes a new multiobjective virtual machine merging algorithm based on ant swarm intelligence. Literature [21] expounds the advantages of swarm intelligence algorithm, and literature [22] expounds the core ideas and basic principles of swarm intelligence optimization algorithm. Literature [23] expounds the intelligent bee colony firefly algorithm to predict the national electricity consumption in China. The swarm intelligence algorithm optimized in reference [24] has remarkable effect on engineering structure optimization, which can effectively improve the functionality and safety of engineering structure, improve the benefit and value of engineering projects, and is worth popularizing and practicing. Literature [25] studies innovative policies from the perspective of the ant colony swarm intelligence theory.


## 2. Overview and Superiority of Swarm Intelligence Algorithm

### 2.1. Introduction to Intelligent Swarm Algorithms

The swarm intelligence algorithm is a kind of intelligent algorithm evolved from nature, which establishes a mathematical model by observing the living habits of biological groups in nature and then solves practical problems in reality. Cluster is a common phenomenon in nature, such as birds foraging, ants looking for food, bees collecting honey, fish rear-end collision, and clustering. In the long process of evolution, individuals constantly adapt and develop through mutual cooperation and competition with groups, accept various tests of nature, and finally win the common victory of the whole group. Different scholars have carried out in-depth research on cluster phenomenon, and the development of swarm intelligence algorithm has a broader prospect and will be widely used. Applied in various fields, calculation and modeling are relatively simple and easy to implement. The requirements of computer CPU and memory in data processing are not high. In addition, it is not limited to a specific problem, so we can solve various problems through heuristic search. The development process of swarm intelligence algorithm is shown in Figure1:Figure 1
Development chart.


### 2.2. Advantages of Intelligent Swarm Algorithm

A swarm intelligence optimization algorithm includes many algorithms, such as random forest algorithm and particle swarm optimization. In recent years, many new algorithms have emerged, such as forest algorithm, bird swarm algorithm, and pigeon swarm algorithm. The new swarm intelligence algorithm provides new ideas and methods for solving many problems that need to be optimized in reality. The characteristic of these algorithms is to combine group optimization method with big data mining to choose the optimal solution. By analyzing all the solutions of practical problems, the distribution of solutions is obtained according to the problem characteristics and algorithm optimization process, and the solution structure of the problem to be solved is established. On the basis of the association between the problem to be solved and the algorithm, the problem can be solved better. The practical problem is modeled as a search problem that searches the optimal value in the space formed by all solutions, and the swarm intelligence optimization algorithm guides the search process through heuristic information. In the search process, multiple individuals search for the optimal solution together through competition and cooperation. Because there are many individuals working together to search at the same time, the swarm optimization algorithm has a kind of potential parallelism. Different from the conventional numerical solution, the swarm optimization algorithm has almost no restrictions on the properties (monotonicity, differentiability, and modality) of the objective function. It does not even need to know the expression of the objective function, so the swarm intelligence optimization algorithm greatly expands the range of solvable optimization problems, and can be widely used in various optimization problems, such as dynamic optimization problems, constrained optimization problems, uncertain environment optimization problems, and multiobjective optimization problems.


## 2.1. Introduction to Intelligent Swarm Algorithms

The swarm intelligence algorithm is a kind of intelligent algorithm evolved from nature, which establishes a mathematical model by observing the living habits of biological groups in nature and then solves practical problems in reality. Cluster is a common phenomenon in nature, such as birds foraging, ants looking for food, bees collecting honey, fish rear-end collision, and clustering. In the long process of evolution, individuals constantly adapt and develop through mutual cooperation and competition with groups, accept various tests of nature, and finally win the common victory of the whole group. Different scholars have carried out in-depth research on cluster phenomenon, and the development of swarm intelligence algorithm has a broader prospect and will be widely used. Applied in various fields, calculation and modeling are relatively simple and easy to implement. The requirements of computer CPU and memory in data processing are not high. In addition, it is not limited to a specific problem, so we can solve various problems through heuristic search. The development process of swarm intelligence algorithm is shown in Figure1:Figure 1
Development chart.


## 2.2. Advantages of Intelligent Swarm Algorithm

A swarm intelligence optimization algorithm includes many algorithms, such as random forest algorithm and particle swarm optimization. In recent years, many new algorithms have emerged, such as forest algorithm, bird swarm algorithm, and pigeon swarm algorithm. The new swarm intelligence algorithm provides new ideas and methods for solving many problems that need to be optimized in reality. The characteristic of these algorithms is to combine group optimization method with big data mining to choose the optimal solution. By analyzing all the solutions of practical problems, the distribution of solutions is obtained according to the problem characteristics and algorithm optimization process, and the solution structure of the problem to be solved is established. On the basis of the association between the problem to be solved and the algorithm, the problem can be solved better. The practical problem is modeled as a search problem that searches the optimal value in the space formed by all solutions, and the swarm intelligence optimization algorithm guides the search process through heuristic information. In the search process, multiple individuals search for the optimal solution together through competition and cooperation. Because there are many individuals working together to search at the same time, the swarm optimization algorithm has a kind of potential parallelism. Different from the conventional numerical solution, the swarm optimization algorithm has almost no restrictions on the properties (monotonicity, differentiability, and modality) of the objective function. It does not even need to know the expression of the objective function, so the swarm intelligence optimization algorithm greatly expands the range of solvable optimization problems, and can be widely used in various optimization problems, such as dynamic optimization problems, constrained optimization problems, uncertain environment optimization problems, and multiobjective optimization problems.


## 3. Algorithm Set

### 3.1. Decision Tree Algorithm

Decision tree is a common supervised machine learning algorithm. The algorithm structure of self-decision tree is presented as a tree, which is similar to the way of thinking when human beings make choices in life.(1)
Information gain: information entropy is an index used to measure information uncertainty and is the basis for calculating information gain. Calculation formula:(1)EntD=−∑k=1npklog2pkThe smaller the Ent (D), the higher the purity of D.For the information gain of GPS trajectory featureα to sample set D, the expression is
(2)GainD,α=EntD−∑v=1vDvDEntD(2)
Information gain rate: the decision tree can use the information gain rate to select the optimal partition attribute, and the calculation formula is as follows:(3)Gain_ratioD,α=GainD,αIVa,where the expression forIVa is
(4)IVa=−∑Vv=1DvDlog2DvD(3)
Gini index: the probability that any two samples in the GPS trajectory feature sample set are inconsistent in their categories. The formula is as follows:(5)Gain_indexD,α=∑Vv=1DvDGiniDv


### 3.2. Ensemble Learning Method

By constructing multiple classifiers to achieve the learning purpose, the generalization performance can generally be better than that of a single classifier. The structure of ensemble learning is shown in Figure2.Figure 2
Ensemble learning structure diagram.


### 3.3. Random Forest Algorithm

Random forest algorithm is an extended variant of ensemble learning. Random forest is an ensemble learning algorithm based on decision tree. The random forest algorithm flow is shown in Figure3.Figure 3
Random forest algorithm flow.


### 3.4. XGBoost Algorithm and GBDT Algorithm

XGBoost algorithm is optimized on the basis of traditional algorithm, which is an efficient implementation of traditional algorithm, and can be applied to classification and regression problems. The algorithm flow is as follows:(1)
Initializef0x=0(2)
Whenm=1,2,⋯,MCalculate residual value:(6)rmi=yi−fm−1xi,i=1,2,⋯.Fitting residualrmi learns a regression tree to update fmx, and the formula is as follows:
(7)fmx=fm−1x+Tx;∅m.Get the ascending tree:(8)fMx=∑m=1MTx;∅m.GBDT algorithm flow:Input: training set sample(9)T=x1,y1,x2,y2,⋯,xm,ym.Output: suppose samplei=1,2,3,⋯,m, number of iterations t=1,2,3,⋯t.Calculate the negative gradient:(10)rti=−∂Lyi,fxi∂fxifx=ft−1x.Suppose the leaf regionJ=1,2,⋯,J.Calculate the best fit value:(11)ctj=argmin∑xi∈RtjLyi,ft−1x+c.Update learner:(12)ftx=ft−1x+∑j=1JctjIx∈Rtj,get
(13)fx=ftx=f0x+∑t=1T∑j=1JctjIx∈Rtj.


### 3.5. GPS Trajectory Feature Calculation

Trajectory feature is the motion parameter that describes the whole trajectory. This paper uses statistical method to extract trajectory feature based on GPS point feature.Coefficient of variation:CV=σ/μ,including σ is standard deviation and μ is mean value.Skewness:(14)skew=EX−μσ3.Kurtosis:
(15)kurt=EX−μσ4−3.Autocorrelation coefficient:(16)∑n−hi=1xi−μxi+h−μ∑ni=1xi−μ2.The calculation formula of the above characteristic parameters is as follows:(17)HCR=PcηPc=pipi∈P,piH>Ht,SR=PsnPs=psps∈P,piV>Vs,piVCRate=vi+1−viviVCR=PvηPv=pipi∈P,piVCRate>Vc.


### 3.6. Evaluation Index of Forecast Model

(1)
Precision and recall:(18)Precision=TPTP+FP,Recall=TPTP+FN(2)
Accuracy:(19)Accuracy=TP+TNTP+FP+FN+TN(3)
F1-score:(20)F‐Score=β2+1×Precision×Recallβ2×Precision+Recall(4)
The ROC curve takes the rate of false positive cases and the rate of true cases asx-axis and y-axis and selects all the partition thresholds to draw the curve, which plays a great role in dealing with the unbalanced period of model input samples. The calculation formula is as follows:(21)FPR=FPFP+TN,TPR=TPTP+FNPositive examples of prediction results are expressed by TP and FP, while negative examples are expressed by FN and TN.


## 3.1. Decision Tree Algorithm

Decision tree is a common supervised machine learning algorithm. The algorithm structure of self-decision tree is presented as a tree, which is similar to the way of thinking when human beings make choices in life.(1)
Information gain: information entropy is an index used to measure information uncertainty and is the basis for calculating information gain. Calculation formula:(1)EntD=−∑k=1npklog2pkThe smaller the Ent (D), the higher the purity of D.For the information gain of GPS trajectory featureα to sample set D, the expression is
(2)GainD,α=EntD−∑v=1vDvDEntD(2)
Information gain rate: the decision tree can use the information gain rate to select the optimal partition attribute, and the calculation formula is as follows:(3)Gain_ratioD,α=GainD,αIVa,where the expression forIVa is
(4)IVa=−∑Vv=1DvDlog2DvD(3)
Gini index: the probability that any two samples in the GPS trajectory feature sample set are inconsistent in their categories. The formula is as follows:(5)Gain_indexD,α=∑Vv=1DvDGiniDv


## 3.2. Ensemble Learning Method

By constructing multiple classifiers to achieve the learning purpose, the generalization performance can generally be better than that of a single classifier. The structure of ensemble learning is shown in Figure2.Figure 2
Ensemble learning structure diagram.


## 3.3. Random Forest Algorithm

Random forest algorithm is an extended variant of ensemble learning. Random forest is an ensemble learning algorithm based on decision tree. The random forest algorithm flow is shown in Figure3.Figure 3
Random forest algorithm flow.


## 3.4. XGBoost Algorithm and GBDT Algorithm

XGBoost algorithm is optimized on the basis of traditional algorithm, which is an efficient implementation of traditional algorithm, and can be applied to classification and regression problems. The algorithm flow is as follows:(1)
Initializef0x=0(2)
Whenm=1,2,⋯,MCalculate residual value:(6)rmi=yi−fm−1xi,i=1,2,⋯.Fitting residualrmi learns a regression tree to update fmx, and the formula is as follows:
(7)fmx=fm−1x+Tx;∅m.Get the ascending tree:(8)fMx=∑m=1MTx;∅m.GBDT algorithm flow:Input: training set sample(9)T=x1,y1,x2,y2,⋯,xm,ym.Output: suppose samplei=1,2,3,⋯,m, number of iterations t=1,2,3,⋯t.Calculate the negative gradient:(10)rti=−∂Lyi,fxi∂fxifx=ft−1x.Suppose the leaf regionJ=1,2,⋯,J.Calculate the best fit value:(11)ctj=argmin∑xi∈RtjLyi,ft−1x+c.Update learner:(12)ftx=ft−1x+∑j=1JctjIx∈Rtj,get
(13)fx=ftx=f0x+∑t=1T∑j=1JctjIx∈Rtj.


## 3.5. GPS Trajectory Feature Calculation

Trajectory feature is the motion parameter that describes the whole trajectory. This paper uses statistical method to extract trajectory feature based on GPS point feature.Coefficient of variation:CV=σ/μ,including σ is standard deviation and μ is mean value.Skewness:(14)skew=EX−μσ3.Kurtosis:
(15)kurt=EX−μσ4−3.Autocorrelation coefficient:(16)∑n−hi=1xi−μxi+h−μ∑ni=1xi−μ2.The calculation formula of the above characteristic parameters is as follows:(17)HCR=PcηPc=pipi∈P,piH>Ht,SR=PsnPs=psps∈P,piV>Vs,piVCRate=vi+1−viviVCR=PvηPv=pipi∈P,piVCRate>Vc.


## 3.6. Evaluation Index of Forecast Model

(1)
Precision and recall:(18)Precision=TPTP+FP,Recall=TPTP+FN(2)
Accuracy:(19)Accuracy=TP+TNTP+FP+FN+TN(3)
F1-score:(20)F‐Score=β2+1×Precision×Recallβ2×Precision+Recall(4)
The ROC curve takes the rate of false positive cases and the rate of true cases asx-axis and y-axis and selects all the partition thresholds to draw the curve, which plays a great role in dealing with the unbalanced period of model input samples. The calculation formula is as follows:(21)FPR=FPFP+TN,TPR=TPTP+FNPositive examples of prediction results are expressed by TP and FP, while negative examples are expressed by FN and TN.


## 4. Experiment

### 4.1. Data Preprocessing

The original GPS trajectory data will inevitably have abnormal data due to the instability of acquisition equipment and interference during acquisition, so it is necessary to preprocess the original GPS trajectory data. The trajectory preprocessing flow is shown in Figure4:Figure 4
Trajectory data preprocessing.The preprocessing of original GPS trajectory data includes trajectory segmentation and screening and data cleaning. The purpose is to remove the interference of abnormal data to feature engineering.Examples of GPS data: each set of data contains latitude, longitude, and time data, as shown in Table1:Table 1
GPS data.
LatitudeLongitudeAltitudeDateTime38.968014113.51523643812018-2-2306 : 23 : 0138.584079113.61223633812018-2-2306 : 23 : 1138.884063113.21523673812018-2-2306 : 23 : 2238.314064113.71523643812018-2-2306 : 23 : 3338.184051113.12423563812018-2-2306 : 23 : 3939.740946114.21322363932018-2-2306 : 23 : 49


### 4.2. Experimental Analysis of the Trajectory of Different Travel Modes

When GPS data is segmented, too few trajectory points mean that the trajectory duration is short, which cannot reflect the user’s motion pattern. Different travel modes will affect the accuracy of travel feature calculation and location prediction. Under such trajectory segmentation rules, the sample distribution of trajectory segments is as shown in Table2:Table 2
Distribution of track samples.
Travel modeNumber of trajectory segmentsLocation prediction accuracyWalking158087.6%Bicycle23986.4%Bus183489.9%Car210876.8%Subway329096.7%Train76697.9%The statistics of positioning prediction accuracy and position error based on the above table data are shown in Figure5.Figure 5
Statistical chart of position prediction accuracy and error.The influence of different speed and acceleration values of vehicles on positioning prediction values is shown in Table3:Table 3
Data table of different accelerations and velocities.
Travel modeVelocity (m/s)Acceleration (m/s2)Walking52Bicycle124Bus423Car5510Subway785Train824.5According to the different speeds and accelerations of different vehicles, the prediction accuracy and prediction error of the prediction model are shown in Figure6:Figure 6
Statistical chart of position prediction accuracy and error.


### 4.3. Experimental Results

Based on the classification result confusion matrix of random forest intelligence algorithm, XGBoost algorithm, CatBoost, and improved deep forest algorithm, the positioning prediction results are as follows: Tables4–7:Table 4
Confusion matrix of random forest classification.
Random forestPrediction categoryWalkingBicycleBusCarSubwayTrainRecallWalking5801000066.8%Bicycle6305000Bus01165502Car1222001003Subway000141Train1011033Precision72.3%Accuracy81.76%Table 5
XGBoost classification confusion matrix.
XGBoostPrediction categoryWalkingBicycleBusCarSubwayTrainRecallWalking483500080.8%Bicycle5333000Bus10255501Car1212051003Subway101121Train0011429Precision80.13%Accuracy82.66%Table 6
CatBoost classification confusion matrix.
CatBoostPrediction categoryWalkingBicycleBusCarSubwayTrainRecallWalking601910079.89%Bicycle5346100Bus00195501Car1351801220Subway001121Train1121028Precision79.13%Accuracy81.96%Table 7
Classification confusion matrix of improved deep forest algorithm.
CatBoostPrediction categoryWalkingBicycleBusCarSubwayTrainRecallWalking601911183.87%Bicycle8326110Bus01195511Car1132051222Subway000021Train1111126Precision85.13%Accuracy86.96%From the data in the above table, it can be seen that the comprehensive recognition performance of the improved deep forest is better than the three basic classifiers in the improved forest, because the deep forest structure combines Bagging and Boosting ideas to process feature vectors and optimize the training process.


### 4.4. Model Comparison

Comparison of ROC values of each class of four models: random forest intelligent algorithm, XGBoost algorithm, CatBoost, and improved deep forest algorithm, as shown in Figures7–10:Figure 7
Random forest ROC curve.Figure 8
XGBoost ROC curve.Figure 9
CatBoost ROC curve.Figure 10
Improved deep forest ROC curve.The area of the lower area corresponding to each classification category in the above figure, that is, area, represents the AUC value of the model. The larger the area, the better the comprehensive recognition effect of the model; otherwise, the effect is the worst.


### 4.5. Contrast Experiment

Compare the four algorithms comprehensively, as shown in Table8:Table 8
Index comparison table.
AccuracyPrecisionRecallF1AUCRandom forest0.790.840.870.850.75CatBoost0.840.850.9210.8020.793XGBoost0.840.850.9240.8080.799Improved deep forest0.870.880.950.910.82From the F1 value in the table, we can find that the improved deep forest model has the best performance; the algorithm and model proposed in this paper are effective and can provide high-accuracy recognition results as the trajectory classification basis of the position prediction model.


## 4.1. Data Preprocessing

The original GPS trajectory data will inevitably have abnormal data due to the instability of acquisition equipment and interference during acquisition, so it is necessary to preprocess the original GPS trajectory data. The trajectory preprocessing flow is shown in Figure4:Figure 4
Trajectory data preprocessing.The preprocessing of original GPS trajectory data includes trajectory segmentation and screening and data cleaning. The purpose is to remove the interference of abnormal data to feature engineering.Examples of GPS data: each set of data contains latitude, longitude, and time data, as shown in Table1:Table 1
GPS data.
LatitudeLongitudeAltitudeDateTime38.968014113.51523643812018-2-2306 : 23 : 0138.584079113.61223633812018-2-2306 : 23 : 1138.884063113.21523673812018-2-2306 : 23 : 2238.314064113.71523643812018-2-2306 : 23 : 3338.184051113.12423563812018-2-2306 : 23 : 3939.740946114.21322363932018-2-2306 : 23 : 49


## 4.2. Experimental Analysis of the Trajectory of Different Travel Modes

When GPS data is segmented, too few trajectory points mean that the trajectory duration is short, which cannot reflect the user’s motion pattern. Different travel modes will affect the accuracy of travel feature calculation and location prediction. Under such trajectory segmentation rules, the sample distribution of trajectory segments is as shown in Table2:Table 2
Distribution of track samples.
Travel modeNumber of trajectory segmentsLocation prediction accuracyWalking158087.6%Bicycle23986.4%Bus183489.9%Car210876.8%Subway329096.7%Train76697.9%The statistics of positioning prediction accuracy and position error based on the above table data are shown in Figure5.Figure 5
Statistical chart of position prediction accuracy and error.The influence of different speed and acceleration values of vehicles on positioning prediction values is shown in Table3:Table 3
Data table of different accelerations and velocities.
Travel modeVelocity (m/s)Acceleration (m/s2)Walking52Bicycle124Bus423Car5510Subway785Train824.5According to the different speeds and accelerations of different vehicles, the prediction accuracy and prediction error of the prediction model are shown in Figure6:Figure 6
Statistical chart of position prediction accuracy and error.


## 4.3. Experimental Results

Based on the classification result confusion matrix of random forest intelligence algorithm, XGBoost algorithm, CatBoost, and improved deep forest algorithm, the positioning prediction results are as follows: Tables4–7:Table 4
Confusion matrix of random forest classification.
Random forestPrediction categoryWalkingBicycleBusCarSubwayTrainRecallWalking5801000066.8%Bicycle6305000Bus01165502Car1222001003Subway000141Train1011033Precision72.3%Accuracy81.76%Table 5
XGBoost classification confusion matrix.
XGBoostPrediction categoryWalkingBicycleBusCarSubwayTrainRecallWalking483500080.8%Bicycle5333000Bus10255501Car1212051003Subway101121Train0011429Precision80.13%Accuracy82.66%Table 6
CatBoost classification confusion matrix.
CatBoostPrediction categoryWalkingBicycleBusCarSubwayTrainRecallWalking601910079.89%Bicycle5346100Bus00195501Car1351801220Subway001121Train1121028Precision79.13%Accuracy81.96%Table 7
Classification confusion matrix of improved deep forest algorithm.
CatBoostPrediction categoryWalkingBicycleBusCarSubwayTrainRecallWalking601911183.87%Bicycle8326110Bus01195511Car1132051222Subway000021Train1111126Precision85.13%Accuracy86.96%From the data in the above table, it can be seen that the comprehensive recognition performance of the improved deep forest is better than the three basic classifiers in the improved forest, because the deep forest structure combines Bagging and Boosting ideas to process feature vectors and optimize the training process.


## 4.4. Model Comparison

Comparison of ROC values of each class of four models: random forest intelligent algorithm, XGBoost algorithm, CatBoost, and improved deep forest algorithm, as shown in Figures7–10:Figure 7
Random forest ROC curve.Figure 8
XGBoost ROC curve.Figure 9
CatBoost ROC curve.Figure 10
Improved deep forest ROC curve.The area of the lower area corresponding to each classification category in the above figure, that is, area, represents the AUC value of the model. The larger the area, the better the comprehensive recognition effect of the model; otherwise, the effect is the worst.


## 4.5. Contrast Experiment

Compare the four algorithms comprehensively, as shown in Table8:Table 8
Index comparison table.
AccuracyPrecisionRecallF1AUCRandom forest0.790.840.870.850.75CatBoost0.840.850.9210.8020.793XGBoost0.840.850.9240.8080.799Improved deep forest0.870.880.950.910.82From the F1 value in the table, we can find that the improved deep forest model has the best performance; the algorithm and model proposed in this paper are effective and can provide high-accuracy recognition results as the trajectory classification basis of the position prediction model.


## 5. Conclusion

The rapid development and popularization of mobile Internet and positioning algorithm, artificial intelligence-led technologies, and applications are changing people’s lives. Among them, location prediction is an important part of location-based service, and the research results of this paper are effective for GPS trajectory prediction, as follows:(1)
A series of preprocessing methods are used to solve the problem of abnormal data sum of the original GPS trajectory data due to the instability of acquisition equipment and interference during acquisition(2)
The travel mode is one of the final factors that affect the location prediction results. The improved travel mode of deep forest recognition users is used as an assistant to the location prediction task to improve the accuracy of the location prediction model(3)
By comparing the ROC curves of random forest intelligence algorithm, XGBoost algorithm, CatBoost, and improved deep forest, it is found that the improved deep forest intelligence algorithm has the largest area under ROC curve, that is, the largest AUC value, and the better the model effect(4)
In the contrast experiment, the comprehensive comparison of five indexes of four intelligent algorithms is carried out, and it is further known that the improved intelligent algorithm for deep forest has the highest prediction efficiency



---

*Source: 7554560-2022-04-29.xml*