A trajectory sequence prediction method, electronic device and storage medium based on spatiotemporal trajectory representation mining

Through the method of spatial and temporal trajectory characterization mining, the trajectory data is processed using the Transformer model and the multi-head attention mechanism, which solves the problem of insufficient processing efficiency and accuracy of timing trajectory sequence data in the existing technology, and achieves more efficient and accurate trajectory sequence prediction .

CN118485181BActive Publication Date: 2024-12-20HARBIN INST OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410663873.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-27
Publication Date
2024-12-20
Estimated Expiration
2044-05-27

AI Technical Summary

Technical Problem

The prior art lacks efficiency and accuracy in processing timing trajectory sequence data, especially in large-scale and high-dimensional data processing, the calculation complexity is high, the memory consumption is high, and it is difficult to deeply mine the internal laws and patterns of trajectory data.

Method used

The method based on spatiotemporal trajectory representation mining is adopted to predict the trajectory sequence through data cleaning, same user trajectory merging, coordinate point conversion, region coding, position coding and multi-head attention mechanism in the Transformer model, and map the trajectory data using deep characterization learning technology. To the low-dimensional vector space, extract spatiotemporal features and make predictions.

Benefits of technology

Improve the processing efficiency and accuracy of trajectory sequence data, can have a deeper understanding of the temporal and spatial characteristics in trajectory data, enhance the robustness and robustness of the model, and can make effective predictions in the presence of noise and outliers. , improves prediction accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118485181B_ABST
    Figure CN118485181B_ABST
Patent Text Reader

Abstract

This invention relates to a trajectory sequence prediction method, electronic device, and storage medium based on spatiotemporal trajectory representation mining, belonging to the fields of urban intelligent computing and data mining technology. To improve the efficiency and accuracy of processing time-series trajectory sequence data, the invention includes: collecting spatiotemporal trajectory data; preprocessing the spatiotemporal trajectory data; padding all preprocessed spatiotemporal trajectory data to the longest length of the collected trajectory data using a padding technique; performing a masking operation to obtain masked spatiotemporal trajectory data; performing position encoding; and feeding the position-encoded spatiotemporal trajectory sequence into a Transformer model using a fully connected network layer incorporating multi-head attention for training. The output from the attention layer is fed into a feedforward neural network layer for processing, yielding a spatiotemporal feature representation of the input trajectory data, which is then fed into a decoder to output the trajectory prediction result. This invention provides accurate predictions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of urban intelligent computing and data mining, and specifically relates to a trajectory sequence prediction method based on spatiotemporal trajectory representation mining, an electronic device and a storage medium. Background Art

[0002] With the rapid development of technologies such as the Internet of Things, big data, and cloud computing, the data world has ushered in unprecedented changes. These advanced technologies have not only significantly improved the efficiency and capabilities of data processing, but also made the collection, storage, and analysis of large-scale data accessible and the cost significantly reduced. Among them, trajectory data, as an important data type, is gradually showing its great value in various fields of society. And thanks to the widespread popularity of smartphones and GPS positioning technology, it has become easy to obtain trajectory data. These data record in detail key information such as people's travel routes, speeds, and stay times, and can truly reflect people's travel habits, lifestyles, and urban traffic conditions. Through in-depth mining of these trajectory data, we can gain insight into the operating laws of society and provide valuable decision-making support for many fields. In the future, with the continuous advancement of technology and the continuous expansion of application scenarios, the potential of trajectory data will be further explored and exerted, contributing more to the development and progress of society.

[0003] In trajectory prediction research, the method of using neural networks for data mining has shown its unique advantages and high efficiency. First, neural networks have excellent feature extraction capabilities in trajectory data processing. Trajectory data is rich in spatiotemporal information, and neural networks can automatically capture and extract these features, significantly improving the accuracy and efficiency of analysis. Secondly, because traditional data mining methods often face challenges such as high computational complexity and high memory consumption when processing large-scale, high-dimensional trajectory data, neural networks can efficiently process large-scale data while maintaining high computational efficiency due to their distributed processing and parallel computing capabilities. In addition, neural networks also have excellent generalization capabilities, can deeply explore the inherent laws and patterns of trajectory data, and perform effective predictive analysis on unknown trajectory data. Therefore, in practical applications, using neural networks for trajectory prediction analysis is a method with great potential and prospects. Summary of the invention

[0004] The problem to be solved by the present invention is to improve the efficiency and accuracy of processing time series trajectory sequence data, and propose a trajectory sequence prediction method, electronic device and storage medium based on spatiotemporal trajectory representation mining.

[0005] To achieve the above object, the present invention is implemented through the following technical solutions:

[0006] A trajectory sequence prediction method based on spatiotemporal trajectory representation mining includes the following steps:

[0007] S1. Collect spatiotemporal trajectory data, perform data cleaning, merge trajectories of the same user, convert coordinate points, and encode regions on the spatiotemporal trajectory data to obtain preprocessed spatiotemporal trajectory data;

[0008] S2. The preprocessed spatiotemporal trajectory data obtained in step S1 are padded by a filling technique to fill the length of all preprocessed spatiotemporal trajectory data to the longest length of the collected trajectory data, and then a mask operation is performed to obtain masked spatiotemporal trajectory data;

[0009] S3. Position-encoding the masked spatiotemporal trajectory data obtained in step S2 to obtain a position-encoded spatiotemporal trajectory sequence;

[0010] S4. The position-encoded spatiotemporal trajectory sequence obtained in step S3 is transmitted to the fully connected network layer based on multi-head attention in the Transformer model for training, and the output result of the self-attention layer is output;

[0011] S5. The output result of the self-attention layer obtained in step S4 is transmitted to the feedforward neural network layer for processing to obtain a spatiotemporal feature representation result including the input trajectory data;

[0012] S6. The spatiotemporal feature representation result including the input trajectory data obtained in step S5 is transmitted to the decoder, and the trajectory prediction result is output.

[0013] Furthermore, the specific implementation method of step S1 includes the following steps:

[0014] S1.1. Collect spatiotemporal trajectory data for data cleaning;

[0015] S1.2. Merge the same user's tracks:

[0016] The cleaned data is sorted in chronological order by user, the base station with the most occurrences in each hour is selected, the trajectory data is merged, and the trajectory data is processed into Tu i = <pot1,pot2,…,pot n ,user i >, among which, pot n is the GPS latitude and longitude coordinates of the nth region, user i is the ith user id, the trajectory data is the trajectory representation of each user, and each set of trajectory data consists of 25 values, representing the base station number and the corresponding user id for each hour in a 24-hour day;

[0017] S1.3. Then perform coordinate point conversion:

[0018] Divide the urban area into grids, assign each area an independent number, and convert the GPS track points into coordinate points. The expression is:

[0019] pot j =grid j

[0020] Among them, pot j is the GPS longitude and latitude coordinates of the jth region, grid j Number the grid divisions for the jth region;

[0021] Get Tu i = <grid a ,grid b ,…,grid n ,user i ,>;

[0022] S1.4. Then perform regional coding:

[0023] Using the geocoding method, a clear mapping relationship is established between each trajectory and its corresponding geographical area: first, all areas are clustered according to the trajectory density C = Cluster (R) to form K clusters;

[0024] Then the cluster is subdivided by S=Subdivide(C);

[0025] An internal encoding program is deployed in each cluster to perform a priority sorting operation P = PrioritySort(S, D) on regions according to trajectory density, where D is the trajectory density of each geographic region;

[0026] Finally, we get:

[0027] Tu i =<[Subdivide(grid a ),PrioritySort(grid a )],[Subdivide(grid b ),PrioritySort(grid b )],…,[Subdivide(grid n ),PrioritySort(grid n )],user i ,>

[0028] Among them, [Subdivide(grid n ),PrioritySort(grid n )] is the encoding splicing operation.

[0029] Furthermore, the longest length Tu in the collected trajectory data in step S2 i The expression for max is:

[0030] Tu i max= <grid a ,grid b ,…,grid n ,…,grid m axlen,user i >.

[0031] Furthermore, in step S3, the position encoding is generated by a combination of sine and cosine functions. For the position pos in the input trajectory sequence and the dimension m of the obtained vector embedding, the expression of the position encoding is:

[0032]

[0033] Among them, PE(pos,2m) is the 2m-th dimension position encoding value at position pos, calculated using the sine function;

[0034] PE(pos,2m+1) is the 2m+1th dimension position encoding value at position pos, calculated using the cosine function, and k is the dimension index of the position encoding.

[0035] Furthermore, the specific implementation method of step S4 includes the following steps:

[0036] S4.1. Setting the self-attention layer to the trajectory sequence matrix X∈R m*d As input, m is the length of the trajectory vector and d is the dimension of the trajectory vector;

[0037] X is passed through three learnable weight matrices W Q , W K and W V Perform linear transformation: Q = XW Q ,K=XW K ,V=XW V , get the self-attention scores with different position weights

[0038] S4.2. The attention weight matrix A is calculated by the self-attention mechanism, and then the final self-attention output result Z = AV is obtained by AV calculation, where V is the value matrix, and V is obtained by the matrix X and the weight matrix W V Perform a linear transformation to obtain .

[0039] Furthermore, the feedforward neural network layer of step S5 is composed of a fully connected layer and an activation function ReLU function. After being processed by the encoder, the output is the spatiotemporal feature representation result containing the input trajectory data. (i) , the expression is:

[0040] Result (i) =ReLU(A i W+b)

[0041] Among them, W is the weight matrix, b is the bias vector, A i is the feature matrix of the i-th trajectory data, and ReLU is the activation function.

[0042] Furthermore, the decoder in step S6 converts the spatiotemporal feature representation result containing the input trajectory data into the probability distribution of the corresponding trajectory points through a linear transformation and a Softmax function, and outputs the trajectory prediction result. Given the linearly transformed output T of the decoder, the expression of the Softmax function is:

[0043]

[0044] Where T is the output after linear transformation, exp(T) represents the exponential value of each element in T, Represents the sum of all index values, n is the dimension of the output;

[0045] The Softmax function converts each element into a probability value so that the sum of the probabilities of all elements is 1.

[0046] Furthermore, in step S6, the predicted trajectory point features are input into the decoder, which is then converted into a corresponding coding sequence and compared with the actual data to estimate the loss generated by the model. The evaluation indicators of the prediction results include a comparison chart of the true value and the predicted value, R 2 , MAE, MSE and RMSE indicators.

[0047] An electronic device includes a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of a trajectory sequence prediction method based on spatiotemporal trajectory representation mining when executing the computer program.

[0048] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method for predicting a trajectory sequence based on spatiotemporal trajectory representation mining is implemented.

[0049] Beneficial effects of the present invention:

[0050] The trajectory sequence prediction method based on spatiotemporal trajectory representation mining described in the present invention uses deep representation learning technology to map the original trajectory data to a low-dimensional vector space, and then performs trajectory analysis and prediction. Based on the Transformer model, the trajectory data representation extraction is obtained, and the position encoding layer is introduced with the time and space characteristics of the spatiotemporal trajectory data. The sequence data is mapped to a high-dimensional space to extract the encoded deep information. At the same time, the time correlation of the trajectory sequence is obtained, and the complex time and space dependencies in the trajectory data are learned. And by using the attention mechanism, the model is trained to deeply understand the spatial correlation between each trajectory point. In order to improve the robustness and robustness of the model, a hidden code training method is adopted to simulate the frequency inconsistency, distortion and other problems that may occur when collecting trajectory data by randomly masking Mask. Finally, cluster analysis of trajectory sequence data is implemented, and the prediction task is used as the final model evaluation indicator.

[0051] The trajectory sequence prediction method based on spatiotemporal trajectory representation mining described in the present invention can become more efficient and accurate when processing time-series trajectory sequence data. At the same time, because the noise and outliers in the real sampling trajectory are simulated, the model can also be prevented from being disturbed by the trajectory point offset, and the accuracy in prediction or subsequent tasks will also be improved. And it will not be overly dependent on trajectory points in specific positions during training, thereby enhancing its robustness. The use of hidden code training can better understand the correlation between the points in the sequence, and even in the sampling trajectory at low frequency, effective trajectory prediction information can be mined. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] Figure 1 This is a flow chart of a trajectory sequence prediction method based on spatiotemporal trajectory representation mining described in the present invention. DETAILED DESCRIPTION

[0053] In order to make the purpose, technical solution and advantages of the present invention more clear, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention, that is, the specific embodiments described are only part of the embodiments of the present invention, rather than all of the specific embodiments. The components of the specific embodiments of the present invention described and shown in the drawings herein can be arranged and designed in various different configurations, and the present invention can also have other embodiments.

[0054] Therefore, the following detailed description of the specific embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents the selected specific embodiments of the present invention. Based on the specific embodiments of the present invention, all other specific embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present invention.

[0055] In order to further understand the content, features and effects of the present invention, the following specific implementation methods are given as examples, and the attached Figure 1 The detailed instructions are as follows: Specific implementation method one:

[0057] A trajectory sequence prediction method based on spatiotemporal trajectory representation mining includes the following steps:

[0058] S1. Collect spatiotemporal trajectory data, perform data cleaning, merge trajectories of the same user, convert coordinate points, and encode regions on the spatiotemporal trajectory data to obtain preprocessed spatiotemporal trajectory data;

[0059] Furthermore, the specific implementation method of step S1 includes the following steps:

[0060] S1.1. Collect spatiotemporal trajectory data for data cleaning;

[0061] S1.2. Merge the same user's tracks:

[0062] The cleaned data is sorted in chronological order by user, the base station with the most occurrences in each hour is selected, the trajectory data is merged, and the trajectory data is processed into Tu i = <pot1,pot2,…,pot n ,user i >, among which, pot n is the GPS latitude and longitude coordinates of the nth region, user i is the ith user id, the trajectory data is the trajectory representation of each user, and each set of trajectory data consists of 25 values, representing the base station number and the corresponding user id for each hour in a 24-hour day;

[0063] S1.3. Then perform coordinate point conversion:

[0064] Divide the urban area into grids, assign each area an independent number, and convert the GPS track points into coordinate points. The expression is:

[0065] pot j =grid j

[0066] Among them, pot jis the GPS longitude and latitude coordinates of the jth region, grid j Number the grid divisions for the jth region;

[0067] Get Tu i = <grid a ,grid b ,…,grid n ,user i ,>;

[0068] S1.4. Then perform regional coding:

[0069] Using the geocoding method, a clear mapping relationship is established between each trajectory and its corresponding geographical area: first, all areas are clustered according to the trajectory density C = Cluster (R) to form K clusters;

[0070] Then the cluster is subdivided by S=Subdivide(C);

[0071] An internal encoding program is deployed in each cluster to perform a priority sorting operation P = PrioritySort(S, D) on regions according to trajectory density, where D is the trajectory density of each geographic region;

[0072] Finally, we get:

[0073] Tu i =<[Subdivide(grid a ),PrioritySort(grid a )],[Subdivide(grid b ),PrioritySort(grid b )],…,[Subdivide(grid n ),PrioritySort(grid n )],user i ,>

[0074] Among them, [Subdivide(grid n ),PrioritySort(grid n )] is the encoding splicing operation;

[0075] S2. The preprocessed spatiotemporal trajectory data obtained in step S1 are padded by a filling technique to fill the length of all preprocessed spatiotemporal trajectory data to the longest length of the collected trajectory data, and then a mask operation is performed to obtain masked spatiotemporal trajectory data;

[0076] Furthermore, the longest length Tu in the collected trajectory data in step S2i The expression for max is:

[0077] Tu i max= <grid a ,grid b ,…,grid n ,…,grid m axlen,user i >

[0078] S3. Position-encoding the masked spatiotemporal trajectory data obtained in step S2 to obtain a position-encoded spatiotemporal trajectory sequence;

[0079] Furthermore, in step S3, the position encoding is generated by a combination of sine and cosine functions. For the position pos in the input trajectory sequence and the dimension m of the obtained vector embedding, the expression of the position encoding is:

[0080]

[0081] Among them, PE(pos,2m) is the 2m-th dimension position encoding value at position pos, calculated using the sine function;

[0082] PE(pos,2m+1) is the 2m+1th dimension position encoding value at position pos, calculated using the cosine function, and k is the dimension index of the position encoding;

[0083] S4. The position-encoded spatiotemporal trajectory sequence obtained in step S3 is transmitted to the fully connected network layer based on multi-head attention in the Transformer model for training, and the output result of the self-attention layer is output;

[0084] Furthermore, the specific implementation method of step S4 includes the following steps:

[0085] S4.1. Setting the self-attention layer to the trajectory sequence matrix X∈R m*d As input, m is the length of the trajectory vector and d is the dimension of the trajectory vector;

[0086] X is passed through three learnable weight matrices W Q , W K and W V Perform linear transformation: Q = XW Q ,K=XW K ,V=XW V , get the self-attention scores with different position weights

[0087] S4.2. The attention weight matrix A is calculated by the self-attention mechanism, and then the final self-attention output result Z = AV is obtained by AV calculation, where V is the value matrix, and V is obtained by the matrix X and the weight matrix W V Perform a linear transformation to obtain;

[0088] S5. The output result of the self-attention layer obtained in step S4 is transmitted to the feedforward neural network layer for processing to obtain a spatiotemporal feature representation result including the input trajectory data;

[0089] Furthermore, the feedforward neural network layer of step S5 is composed of a fully connected layer and an activation function ReLU function. After being processed by the encoder, the output is the spatiotemporal feature representation result containing the input trajectory data. (i) , the expression is:

[0090] Result (i) =ReLU(A i W+b)

[0091] Among them, W is the weight matrix, b is the bias vector, A i is the feature matrix of the i-th trajectory data, and ReLU is the activation function;

[0092] S6. The spatiotemporal feature representation result including the input trajectory data obtained in step S5 is transmitted to the decoder, and the trajectory prediction result is output;

[0093] Furthermore, the decoder in step S6 converts the spatiotemporal feature representation result containing the input trajectory data into the probability distribution of the corresponding trajectory points through a linear transformation and a Softmax function, and outputs the trajectory prediction result. Given the linearly transformed output T of the decoder, the expression of the Softmax function is:

[0094]

[0095] Where T is the output after linear transformation, exp(T) represents the exponential value of each element in T, Represents the sum of all index values, n is the dimension of the output;

[0096] The Softmax function converts each element into a probability value so that the sum of the probabilities of all elements is 1;

[0097] Furthermore, in step S6, the predicted trajectory point features are input into the decoder, which is then converted into a corresponding coding sequence and compared with the actual data to estimate the loss generated by the model. The evaluation indicators of the prediction results include a comparison chart of the true value and the predicted value, R 2 , MAE, MSE and RMSE indicators.

[0098] In order to verify the improvement of the time series trajectory prediction ability of the trajectory sequence prediction method based on spatiotemporal trajectory representation mining described in this embodiment compared with the mainstream deep learning algorithm, the trajectory prediction architecture of the CNN and LSTM hybrid model, the trajectory prediction architecture of the TCN model, the trajectory prediction architecture of the TCN and Transformer hybrid model, and the trajectory prediction architecture of the GRU model were selected.

[0099] The trajectory prediction architecture of the CNN and LSTM hybrid model mainly extracts local features of the input data through the convolutional neural network in the CNN model, which can effectively extract valuable spatial features from the original trajectory data, while LSTM is good at processing time dependencies in sequence data and can better understand the dynamic changes of the trajectory. The trajectory prediction architecture of the TCN model mainly captures and processes long-term dependencies in time series data through one-dimensional convolution layers, dilated convolutions, and residual blocks. This architecture performs well when processing data with time correlation and is particularly suitable for tasks such as trajectory prediction. The trajectory prediction architecture of the TCN and Transformer hybrid model can comprehensively utilize the advantages of the two models to improve the accuracy and efficiency of trajectory prediction, and has significant advantages when processing complex and dynamic trajectory data.

[0100] For the evaluation indicators of the prediction results, the comparison chart of the true value and the predicted value, R 2 , MAE, MSE and RMSE indicators.

[0101] When the trajectory sequence data set is the same, the numerical size of the trajectory point is predicted using the comparison model, the given predicted trajectory point is output and the average prediction error is calculated. The comparison experimental results are listed in Table 1:

[0102] Table 1 Comparison of model indicators

[0103]

[0104] It can be seen from Table 1 that by comparing with various verification indicators, the method of this embodiment can obtain the spatiotemporal trajectory prediction result more accurately. Specific implementation method 2:

[0106] An electronic device includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of a trajectory sequence prediction method based on spatiotemporal trajectory representation mining described in a specific implementation mode 1 are implemented.

[0107] The computer device of the present invention may be a device including a processor and a memory, such as a single chip microcomputer including a central processing unit, etc. Moreover, the processor is used to implement the steps of the above-mentioned trajectory sequence prediction method based on spatiotemporal trajectory representation mining when executing the computer program stored in the memory.

[0108] The processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0109] The memory may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Specific implementation method three:

[0111] A computer-readable storage medium having a computer program stored thereon, characterized in that when the computer program is executed by a processor, a trajectory sequence prediction method based on spatiotemporal trajectory representation mining described in a specific implementation mode 1 is implemented.

[0112] The computer-readable storage medium of the present invention can be any form of storage medium that can be read by a processor of a computer device, including but not limited to a non-volatile memory, a volatile memory, a ferroelectric memory, etc. The computer-readable storage medium stores a computer program. When the processor of the computer device reads and executes the computer program stored in the memory, the steps of the above-mentioned trajectory sequence prediction method based on spatiotemporal trajectory representation mining can be implemented.

[0113] The computer program includes computer program code, which may be in source code form, object code form, executable file or some intermediate form, etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc.

[0114] It should be noted that relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0115] Although the present application has been described above with reference to specific embodiments, various modifications may be made thereto and parts thereof may be replaced with equivalents without departing from the scope of the present application. In particular, as long as there is no structural conflict, the various features in the specific embodiments disclosed in the present application may be used in combination with each other in any manner, and the fact that these combinations are not exhaustively described in this specification is only for the sake of omitting space and saving resources. Therefore, the present application is not limited to the specific embodiments disclosed herein, but includes all technical solutions falling within the scope of the claims.

Claims

1. A trajectory sequence prediction method based on spatiotemporal trajectory representation mining, It is characterized in that The steps include: S1. Collect spatiotemporal trajectory data, perform data cleaning, merge trajectories of the same user, convert coordinate points, and encode regions on the spatiotemporal trajectory data to obtain preprocessed spatiotemporal trajectory data; The specific implementation method of step S1 includes the following steps: S1.

1. Collect spatiotemporal trajectory data for data cleaning; S1.

2. Merge the same user's tracks: The cleaned data is sorted in chronological order by user, the base station with the most occurrences in each hour is selected, the trajectory data is merged, and the trajectory data is processed into Tu i = <pot 1 , pot 2 ,...,pot n ,user i >, among which, pot n is the GPS latitude and longitude coordinates of the nth region, user i is the ith user id, the trajectory data is the trajectory representation of each user, and each set of trajectory data consists of 25 values, representing the base station number and the corresponding user id for each hour in a 24-hour day; S1.

3. Then perform coordinate point conversion: Divide the urban area into grids, assign each area an independent number, and convert the GPS track points into coordinate points. The expression is: CAN j =grid j Among them, pot j is the GPS longitude and latitude coordinates of the jth region, grid j Number the grid division of the jth region; Get Tu i = <grid a , grid b , ..., grid n ,user i ,>; S1.

4. Then perform regional coding: Using the geocoding method, a clear mapping relationship is established between each trajectory and its corresponding geographical area: first, all areas are clustered according to the trajectory density C = Cluster (R) to form K clusters; Then the cluster is subdivided by S=Subdivide(C); An internal encoding program is deployed in each cluster to perform a priority sorting operation P = PrioritySort (S, D) on the regions according to the trajectory density, where D is the trajectory density of each geographical region; Finally, we get: Tu i =<[Subdivide(grid a ),PrioritySort(grid a )],[Subdivide(grid b ),PrioritySort(grid b )],..., [Subdivide(grid n ),PrioritySort(grid n )],user i ,> Among them, [Subdivide(grid n ), PrioritySort(grid n )] is the encoding splicing operation; S2. The preprocessed spatiotemporal trajectory data obtained in step S1 are padded by a filling technique to fill the length of all preprocessed spatiotemporal trajectory data to the longest length of the collected trajectory data, and then a mask operation is performed to obtain masked spatiotemporal trajectory data; The longest length Tu in the collected trajectory data in step S2 i The expression for max is: Tu i max=<grid a ,grid b ,…,grid n ,…,grid m axlen,user i >; S3. Position-encoding the masked spatiotemporal trajectory data obtained in step S2 to obtain a position-encoded spatiotemporal trajectory sequence; In step S3, the position encoding is generated by a combination of sine and cosine functions. For the position pos in the input trajectory sequence and the dimension m of the obtained vector embedding, the expression of the position encoding is: Where PE(pos,2m) is the 2m-th dimension position encoding value at position pos, calculated using the sine function; PE(pos, 2m+1) is the 2m+1th dimension position encoding value at position pos, calculated using the cosine function, and k is the dimension index of the position encoding; S4. The position-encoded spatiotemporal trajectory sequence obtained in step S3 is transmitted to the fully connected network layer based on multi-head attention in the Transformer model for training, and the output result of the self-attention layer is output; The specific implementation method of step S4 includes the following steps: S4.

1. Setting the self-attention layer to the trajectory sequence matrix X∈R m*d As input, m is the length of the trajectory vector and d is the dimension of the trajectory vector; X is passed through three learnable weight matrices W Q , W K and W V Perform linear transformation: Q = XW Q , K = XW K , V = XW V , get the self-attention scores with different position weights S4.

2. The attention weight matrix A is calculated by the self-attention mechanism, and then the final self-attention output result Z = AV is obtained by AV calculation, where V is the value matrix, and V is obtained by the matrix X and the weight matrix W V Perform a linear transformation to obtain; S5. The output result of the self-attention layer obtained in step S4 is transmitted to the feedforward neural network layer for processing to obtain a spatiotemporal feature representation result including the input trajectory data; The feedforward neural network layer in step S5 consists of a fully connected layer and an activation function ReLU function. After being processed by the encoder, the output is the spatiotemporal feature representation result containing the input trajectory data. (i) , the expression is: Result (i) =ReLU(A i W+b) Among them, W is the weight matrix, b is the bias vector, A i is the feature matrix of the i-th trajectory data, and ReLU is the activation function; S6. The spatiotemporal feature representation result including the input trajectory data obtained in step S5 is transmitted to the decoder, and the trajectory prediction result is output.

2. According to claim 1, a trajectory sequence prediction method based on spatiotemporal trajectory representation mining, It is characterized in that The decoder in step S6 converts the spatiotemporal feature representation of the input trajectory data into the probability distribution of the corresponding trajectory points through a linear transformation and a Softmax function, and outputs the trajectory prediction result. Given the linearly transformed output T of the decoder, the expression of the Softmax function is: Where T is the output after linear transformation, exp(T) represents the exponential value of each element in T. Represents the sum of all index values, n is the dimension of the output; The Softmax function converts each element into a probability value so that the sum of the probabilities of all elements is 1.

3. According to claim 2, a trajectory sequence prediction method based on spatiotemporal trajectory representation mining, It is characterized in that In step S6, the predicted trajectory point features are input into the decoder, which is then converted into the corresponding coding sequence and compared with the actual data to estimate the loss of the model. The evaluation indicators of the prediction results include the comparison chart of the true value and the predicted value, R 2 , MAE, MSE and RMSE indicators.

4. An electronic device, It is characterized in that The method comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of a trajectory sequence prediction method based on spatiotemporal trajectory representation mining as described in any one of claims 1 to 3 when executing the computer program.

5. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the method for trajectory sequence prediction based on spatiotemporal trajectory representation mining according to any one of claims 1 to 3 is implemented.