User group classification method based on spatio-temporal trajectory features
By extracting the spatiotemporal characteristics of trajectory data and combining attention mechanisms and graph neural networks, the problem of difficulty in capturing spatiotemporal semantic information of trajectory data is solved in the existing technology, and a more accurate classification of user groups is achieved.
Patent Information
- Application Number
- CN202510293155.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-13
- Publication Date
- 2025-04-15
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The prior art is difficult to effectively capture dynamic and complex spatiotemporal semantic information in trajectory data, and traditional methods have limitations in processing high-dimensional data and capturing complex dependencies of spatiotemporal sequence data.
The user group classification method based on spatiotemporal trajectory characteristics is adopted, and the time and spatial characteristics are extracted through the feature extraction module, combined with the time attention perception module and the spatial structure perception module, generate the spatiotemporal feature embedding representation of the trajectory sequence, and integrate the time and spatial information through the spatiotemporal information fusion module to finally predict the user group category.
It can simultaneously capture and fuse dynamic and complex semantic information of temporal and spatial in the trajectory data, improve the accuracy of user group classification and overcome the limitations of traditional methods when processing high-dimensional data and spatiotemporal sequence data.
Smart Images

Figure CN119830113A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of mobile communication and spatiotemporal data mining, and in particular relates to a user group classification method based on spatiotemporal trajectory features. Background Art
[0002] Signaling trajectory data is based on the interaction between mobile phones and base stations and the coverage of base stations in real geographic space, which can restore users' living and travel activities. These GPS coordinate points do not represent the actual location of users, but the location of base stations where users' mobile phones communicate with base stations. They have the characteristics of full-time coverage and a wide user base, which have significant advantages in trajectory data analysis.
[0003] At present, most studies based on trajectory classification focus on using spatiotemporal information and activity patterns to classify trajectory data into predefined categories, such as travel modes, detection of abnormal users, etc., and rarely involve the identification of user groups to which the trajectory belongs, such as distinguishing between specific occupational groups such as online car-hailing drivers and couriers. In addition, traditional classification research mainly adopts rule screening, traditional classical algorithms or cumbersome machine learning methods. They usually require complex feature engineering and a large amount of domain knowledge. At the same time, they have limitations in processing high-dimensional data and capturing complex dependencies of spatiotemporal sequence data, and cannot effectively capture dynamic and complex spatiotemporal semantic information of trajectories. For example, the crowd classification method based on spatiotemporal data trajectory features proposed by Jin Canghong et al. first cleans the collected spatiotemporal data, extracts pedestrian trajectories, compresses the trajectories, and finally classifies them according to the spatiotemporal characteristics of the trajectories (such as travel time, trajectory duration, speed, etc.), and further performs weak classification and individual identification. It relies on complex rules and feature engineering, and fails to effectively capture the dynamic and complex spatiotemporal semantic information in trajectory data.
[0004] With the continuous development of deep learning technology, researchers have gradually explored the application of neural network models in trajectory classification. Although recurrent neural networks and their variants perform well in processing time series data, they have efficiency issues when dealing with long sequence data. The self-attention mechanism model was introduced into the field of trajectory classification due to its excellent performance. It generates trajectory embedding by comprehensively analyzing input features and spatiotemporal information, but the self-attention mechanism cannot fully capture the spatial semantic information. With the emergence of graph neural networks, this type of model has shown significant advantages in structured data processing. Therefore, how to use graph neural networks in traffic network analysis, combined with spatial information and attention mechanisms, to improve the accuracy of trajectory classification has become an urgent problem to be solved. Summary of the invention
[0005] In order to solve the above technical problems, the present invention provides a user group classification method based on spatiotemporal trajectory features, comprising the following steps:
[0006] Step S1: obtaining the original signaling data of the user, constructing a trajectory sequence, counting the base station features in the trajectory sequence, calculating the transition probability, and constructing a transition probability matrix based on the transition probability;
[0007] Step S2: input the trajectory sequence into a feature extraction module to extract the time feature initial embedding H and the space feature initial embedding F therein respectively;
[0008] Step S3: Input H into the temporal attention perception module, extract the time interval matrix and modify the attention score in combination with the time decay function to generate a temporal feature embedding representation sequence ;
[0009] Step S4: construct a sparse directed graph of base stations based on the transfer probability matrix, and construct a distance matrix D; input the sparse directed graph of base stations, D and F into the spatial structure perception module, capture the spatial proximity and dynamic transfer mode of base stations through an adaptive nonlinear exponential decay function, and generate a spatial feature embedding representation sequence ;
[0010] Step S5: and Input the spatiotemporal information fusion module to integrate the temporal and spatial information of the trajectory layer by layer to generate a spatiotemporal feature embedding representation sequence of the trajectory sequence ;
[0011] Step S6: The classification result prediction module is input to process the spatiotemporal embedding of the trajectory sequence and output the user group category.
[0012] Beneficial effects:
[0013] 1. Traditional classification research relies on rule screening, classical algorithms or cumbersome machine learning methods, which usually require complex feature engineering and a lot of domain knowledge, and have limitations in processing high-dimensional data and capturing complex dependencies of spatiotemporal sequence data, making it difficult to effectively capture dynamic and complex spatiotemporal semantic information in trajectory data. Compared with methods that only rely on self-attention mechanisms or graph neural networks, the method of the present invention can simultaneously capture and fuse dynamic and complex temporal and spatial semantic information in trajectory data.
[0014] 2. The present invention proposes a temporal attention perception module, which extracts timestamp matrices of different granularities. The time series reflects the periodic activities within a day, such as the traffic patterns of morning and evening rush hours. The weekly series can capture the different patterns of weekdays and weekends, and designs a nonlinear logarithmic scaling time decay function. Compared with the traditional "query-key" attention model, the attention score is corrected by combining the time interval matrix and the time decay function to capture the globality and periodicity of time.
[0015] 3. The present invention proposes a spatial structure perception module. Compared with the traditional method that relies on the GPS coordinate sequence of the trajectory, the spatial structure perception module base station transfer probability matrix constructs a base station sparse directed graph, using indirect spatial position representation. Compared with the microscopic GPS coordinates, it can better capture the mobile mode at the grid level. For example, the base stations at the intersection usually have high transfer probabilities in multiple directions, while the base stations near the one-way street will show obvious directional transfer probabilities, and the transfer probabilities of the base stations near the straight road are more concentrated at both ends. Through the trainable adaptive nonlinear exponential decay function, combined with the real spatial distance information, and fused with the weight of the graph attention mechanism, the interaction weights between nodes are dynamically adjusted to accurately capture the directed spatial proximity and transfer patterns of the trajectory points. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 A schematic diagram of a user group classification method based on spatiotemporal trajectory features of the present invention;
[0017] Figure 2 It is a schematic diagram of the framework of the user group classification model based on spatiotemporal trajectory features;
[0018] Figure 3 Schematic diagram of the structure of the temporal attention layer;
[0019] Figure 4 Schematic diagram of the structure of the spatial graph attention layer;
[0020] Figure 5 It is a structural diagram of the spatiotemporal information fusion module. DETAILED DESCRIPTION
[0021] 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 in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0022] Embodiment 1
[0023] like Figure 1 As shown, a user group classification method based on spatiotemporal trajectory features provided by an embodiment of the present invention includes the following steps:
[0024] Step S1: Obtain the original signaling data of the user, construct a trajectory sequence, count the base station features in the trajectory sequence, calculate the transition probability, and construct a transition probability matrix based on the transition probability;
[0025] Step S2: Input the trajectory sequence into the feature extraction module to extract the temporal feature initial embedding H and the spatial feature initial embedding F;
[0026] Step S3: Input H into the temporal attention perception module, extract the time interval matrix and modify the attention score in combination with the time decay function to generate a temporal feature embedding representation sequence ;
[0027] Step S4: construct a sparse directed graph of base stations based on the transfer probability matrix, and construct a distance matrix D; input the sparse directed graph of base stations, D and F into the spatial structure perception module, capture the spatial proximity and dynamic transfer mode of base stations through an adaptive nonlinear exponential decay function, and generate a spatial feature embedding representation sequence ;
[0028] Step S5: and Input the spatiotemporal information fusion module to integrate the temporal and spatial information of the trajectory layer by layer to generate a spatiotemporal feature embedding representation sequence of the trajectory sequence ;
[0029] Step S6: The classification result prediction module is input to process the spatiotemporal embedding of the trajectory sequence and output the user group category.
[0030] The present invention constructs a user group classification model based on spatiotemporal trajectory features, including: a feature extraction module, a time attention perception module, a spatial structure perception module, a spatiotemporal information fusion module and a classification result prediction module. Figure 2 A schematic diagram of the framework of the user group classification model based on spatiotemporal trajectory features is shown.
[0031] In one embodiment, the above step S1: obtaining the original signaling data of the user, constructing a trajectory sequence, counting the base station features in the trajectory sequence, calculating the transition probability, and constructing a transition probability matrix based on the transition probability, specifically includes:
[0032] Step S11: Construct the user's trajectory sequence based on the original signaling data: ,in, represents the signaling data sequence of user i, T is the length of the signaling data sequence, For a single signaling data, ,in, Respectively represent the user ID, base station ID, base station longitude, base station latitude and the timestamp of the user entering the base station;
[0033] Step S12: Count the trajectory sequences of all users and obtain the base station Transfer to base station The number of , base station The total number of transfers is , then the base station Transfer to base station The transition probability , generate the transition probability matrix of the base station;
[0034] Step S13: Count the trajectory sequences of all users and extract base station features, including: base station population density (the average number of users passing by per day), average dwell time per person (the daily dwell time of users at the base station), maximum population density (the maximum number of users staying at the base station at the same time, used to identify hot spots during peak hours), and minimum population density (the minimum number of users staying at the base station at the same time, used to identify activities during non-peak hours).
[0035] In one embodiment, the above step S2: inputs the trajectory sequence into the feature extraction module, extracts the time features therein and initially embeds and spatial feature initial embedding , specifically including:
[0036] Step S21: The base station longitude, base station latitude and the timestamp of the user entering the base station are input into the feature extraction module. The longitude and latitude coordinates of the base station are first processed through a fully connected feedforward network, which consists of two linear layers and a GELU activation function. The longitude and latitude coordinates are generated into longitude and latitude embedding vectors. :
[0037] (1)
[0038] in, and They represent the trainable parameter matrices, and They represent bias terms, GELU represents the GELU activation function, and represents the latitude and longitude coordinates of base station i;
[0039] Step S22: For each base station in the trajectory sequence, the corresponding timestamp Convert to time index (1 to 24) and week index (1 to 7) respectively: and ,in , Yes Functions for converting to time series index and week series index;
[0040] Step S23: Construct the location code of the base station:
[0041] (2)
[0042] (3)
[0043] in, is the position of the base station in the trajectory sequence, and the odd and even numbers are calculated separately; d is the dimension of the position encoding;
[0044] Step S24: concatenate the base station's latitude and longitude embedding vector, time index, week index and position code to obtain the base station's trajectory embedding vector:
[0045] (4)
[0046] Step S25: concatenate the trajectory embedding vectors of the base stations in the trajectory sequence to generate the initial embedding of the temporal features: , where T is the length of the trajectory sequence;
[0047] Step S26: The base station features and their latitude and longitude coordinates are extracted by the feature extraction module. The generation process of is similar to that of , except that position encoding is not used, and the static feature projection extracted from the graph structure composed of base stations is used to generate the initial embedding F of spatial features.
[0048] In one embodiment, the above step S3: input H into the time attention perception module, extract the time interval matrix and modify the attention score in combination with the time decay function to generate a time feature embedding representation sequence , specifically including:
[0049] Step S31: inputting H into a temporal attention perception module, which includes: a temporal attention layer, a normalization layer, and a position-by-position feedforward neural network;
[0050] Step S32: In the temporal attention layer, use and To calculate the time interval matrix of the time series and the week series, which can respectively reflect the differences between the hours between different trajectory points and the differences between the days of the week:
[0051] (5)
[0052] (6)
[0053] Among them, the length of the time interval matrix is consistent with the length of the input trajectory sequence;
[0054] The embodiment of the present invention uses time series to reflect periodic activities within a day, such as traffic patterns of morning and evening rush hours; the week series is used to capture different patterns of weekdays and weekends, such as leisure activities on weekends and working patterns on weekdays.
[0055] Step S33: Apply the time decay function to the time interval matrix of the time sequence and the week sequence for nonlinear logarithmic scaling, so that the attention score increases as the time interval shortens, focusing on the correlation of adjacent time points:
[0056] (7)
[0057] (8)
[0058] Step S34: The calculation results of the periodic and temporal time decay functions are mapped to a high-dimensional space through linear transformation and LeakyReLU function and merged:
[0059] (9)
[0060] Among them, LeakyReLU is the activation function; Linear represents the linear layer; ‖ represents the concatenation operation of the vector; and They are the time series time interval matrix and the week series time interval matrix obtained by formula (7) and (8) respectively;
[0061] Then the dimension reduction process is performed to obtain the time-attenuated attention score after the dimension reduction process. , to match the hidden dimension of the attention score:
[0062] (10)
[0063] Step S35: Based on the traditional query-key attention score, the time decay attention score is corrected to obtain the output of the time attention layer:
[0064] (11)
[0065] Among them, Q is the query matrix, K is the key matrix, and V is the value matrix; are the dimensions of the query, key, and value vectors;
[0066] like Figure 3 Shown is a schematic diagram of the structure of the temporal attention layer;
[0067] Step S36: Process the output of the temporal attention layer through the residual and normalization layers:
[0068] (12)
[0069] Then through the position-by-position feedforward neural network To process:
[0070] (13)
[0071] in, and is a trainable parameter matrix; and is the bias term; ReLU activation function.
[0072] Finally, the output of the position-by-position feedforward network is subjected to residual connection and layer normalization to obtain the final output temporal feature embedding representation sequence of the temporal attention perception module. :
[0073] (14).
[0074] In one embodiment, the above step S4: constructs a sparse directed graph of base stations based on the transfer probability matrix, and constructs a distance matrix D; inputs the sparse directed graph of base stations, D and F into the spatial structure perception module, captures the spatial proximity and dynamic transfer mode of the base stations through an adaptive nonlinear exponential decay function, and generates a spatial feature embedding representation sequence , specifically including:
[0075] Step S41: Based on the transition probability matrix, for each base station i, retain the nodes connected to the top K largest transition probabilities as valid edges; define the transition probability values of the valid edges as the matrix P′:
[0076] (15)
[0077] Construct the edge set of the directed graph based on P′ ,Combining base stations as nodes, a sparse directed graph of base stations is constructed;
[0078] Step S42: Construct a distance matrix D, where each element Represents the spatial distance between the i-th base station and the j-th base station:
[0079] (16)
[0080] in, and represents the longitude and latitude of base station i, and represents the longitude and latitude of base station j;
[0081] Define an adaptive nonlinear exponential decay function , ensuring that spatially adjacent points have higher relevance and interactivity, integrating spatial distance information and strengthening the weight of neighbors :
[0082] (17)
[0083] in, is a trainable parameter matrix;
[0084] Step S43: Input the base station sparse directed graph, distance matrix D and spatial feature initial embedding f into the spatial structure perception module composed of the spatial graph attention layer, and calculate the spatial graph attention score :
[0085] (18)
[0086] (19)
[0087] in, is the initial spatial attention score of base station i and base station j, and are the initial embeddings of spatial features of base station i and base station j, , , is a trainable parameter matrix; is the nonlinear exponential decay function defined by formula (17);
[0088] is the final spatial attention score of base station i and base station j, is the activation function; is an exponential function, is the set of neighbor nodes of base station i;
[0089] like Figure 4 As shown, it is a schematic diagram of the structure of the spatial graph attention layer;
[0090] Step S44: By combining the characteristics of the neighboring nodes of base station i and , calculate the features of base station i, and concatenate the outputs of the multi-head graph attention mechanism:
[0091] (20)
[0092] in, is the set of neighbor nodes of base station i, is the feature embedding vector of base station j in the lth layer of the graph attention mechanism, is the activation function; is the number of heads of the multi-head attention mechanism; is a trainable parameter matrix;
[0093] Step S45: concatenate the corresponding base station feature embedding vectors in the trajectory sequence to generate a spatial feature embedding representation sequence of the trajectory sequence :
[0094] (twenty one).
[0095] In one embodiment, the above step S5: and Input the spatiotemporal information fusion module to integrate the temporal and spatial information of the trajectory layer by layer to generate a spatiotemporal feature embedding representation sequence of the trajectory sequence , specifically including:
[0096] Step S51: and Input the spatiotemporal information fusion module and calculate the fusion weight vector:
[0097] (twenty two)
[0098] in, is the activation function sigmoid; and is a trainable parameter matrix; is the bias term; is the embedding representation of the base station corresponding to the i-th timestamp of the output of the l-th layer of the temporal attention perception module; It is the base station node of the lth layer of the spatial structure perception module Embedding representation of ;
[0099] Step S52: Integrate the temporal and spatial information of the trajectory of the lth layer to generate a temporal and spatial feature embedding representation sequence of the lth layer trajectory sequence:
[0100] (twenty three)
[0101] in, Represents the element-wise product operation;
[0102] The spatiotemporal information fusion mechanism designed in the present invention combines the temporal and spatial features, adaptively fuses the temporal information and corresponding spatial features of the base station node corresponding to the i-th timestamp in the signaling trajectory sequence, thereby improving the accuracy of trajectory classification, enhancing the adaptability of the model to different scenarios, capturing complex spatiotemporal relationships, and thus fully understanding the user's mobility pattern, effectively solving the limitations of spatiotemporal features when used alone;
[0103] Step S53: Repeat steps S3 to S5 through the L-layer structure, integrate the temporal and spatial information of the trajectory layer by layer, and generate a temporal and spatial feature embedding representation sequence of the trajectory sequence , where L represents the last layer, the Lth layer;
[0104] Figure 5 The structural diagram of the spatiotemporal information fusion module is shown.
[0105] The present invention does not limit the number of layers of the temporal attention perception module, the spatial structure perception module, and the spatiotemporal information fusion module. In the embodiments of the present invention, L of the above three modules is set to 4.
[0106] In one embodiment, the above step S6: Input the classification result prediction module, process the spatiotemporal embedding of the trajectory sequence, and output the user group category, including:
[0107] Step S61: Input classification result prediction module for mean pooling:
[0108] (twenty four)
[0109] in, represents the length of the trajectory sequence;
[0110] The purpose of mean pooling in this step is to extract global features by averaging the features of all base station nodes.
[0111] Step S62: average pooled features Classification is performed through a multi-layer perceptron, and the predicted category probability distribution is finally output:
[0112] (25)
[0113] in, and is the trainable parameter matrix and bias term of the output layer, represents the nonlinear transformation of MLP, and the softmax function Convert to class probability distribution , take the group corresponding to the highest probability as the final user group classification result.
[0114] Step S63: Constructing the cross entropy loss function , which is used to measure the difference between the predicted category distribution and the true category distribution:
[0115] (26)
[0116] Among them, N represents the total number of samples, C represents the number of classification categories, Representation sample Belongs to category The real label, Represents the sample predicted by the model Belongs to category probability.
[0117] The user classification labels of the training samples of the embodiment of the present invention are: online car-hailing drivers, couriers, and other ordinary people. The data set is divided into training set, validation set and test set, with a ratio of 0.8:0.1:0.1. Comparative experiments were carried out on four evaluation indicators: accuracy, precision, recall and F1 score. The experiment selected multiple baseline models for comparison, including SVM, Random Forest, GBDT, LSTM, GRU, BILSTM, Transformer, GAT+Transformer, MtrajRec, and the method of the present invention (Ours), to comprehensively evaluate the performance of each model in the task. The experimental results are shown in Table 1.
[0118] Table 1 Comparative experimental results
[0119] The present invention is based on computer science and a variety of machine learning algorithms. Its implementation requires certain programming, machine learning, and deep learning foundations. It is carried out on the China Mobile Information Platform, using NVIDIA A100 GPU for model training, and the graphics card has 40G running memory. Signaling trajectory data is stored in the China Mobile Information Platform to facilitate efficient data reading and user privacy protection. The model codes of the present invention are all written in Python, mainly relying on the PyTorch framework, Scikit-learn library, NumPy library, and Pandas library to ensure the rigor of the research and the reliability of the results.
[0120] The above embodiments are provided only for the purpose of describing the present invention, and are not intended to limit the scope of the present invention. The scope of the present invention is defined by the appended claims. Various equivalent substitutions and modifications made without departing from the spirit and principles of the present invention should all be included within the scope of the present invention.
Claims
1. A user group classification method based on spatiotemporal trajectory features, characterized in that: include: Step S1: obtaining the original signaling data of the user, constructing a trajectory sequence, counting the base station features in the trajectory sequence, calculating the transition probability, and constructing a transition probability matrix based on the transition probability; Step S2: input the trajectory sequence into a feature extraction module to extract the time feature initial embedding H and the space feature initial embedding F therein respectively; Step S3: Input H into the temporal attention perception module, extract the time interval matrix and modify the attention score in combination with the time decay function to generate a temporal feature embedding representation sequence ; Step S4: constructing a base station sparse directed graph based on the shift probability matrix, and constructing a distance matrix D; The base station sparse directed graph, D and F are input into the spatial structure perception module, and the spatial proximity and dynamic transfer mode of the base stations are captured through an adaptive nonlinear exponential decay function to generate a spatial feature embedding representation sequence. ; Step S5: and Input the spatiotemporal information fusion module to integrate the temporal and spatial information of the trajectory layer by layer to generate a spatiotemporal feature embedding representation sequence of the trajectory sequence ; Step S6: The classification result prediction module is input to process the spatiotemporal embedding of the trajectory sequence and output the user group category.
2. The user group classification method based on spatiotemporal trajectory features according to claim 1 is characterized in that: The step S1: obtaining the original signaling data of the user, constructing a trajectory sequence, counting the base station features in the trajectory sequence, calculating the transition probability, and constructing a transition probability matrix based on the transition probability, specifically includes: Step S11: Construct the user's trajectory sequence based on the original signaling data: ,in, represents the signaling data sequence of user i, T is the length of the signaling data sequence, For a single signaling data, ,in, Respectively represent the user ID, base station ID, base station longitude, base station latitude and the timestamp of the user entering the base station; Step S12: Count the trajectory sequences of all users and obtain the base station Transfer to base station The number of , base station The total number of transfers is , then the base station Transfer to base station The transition probability , generate the transition probability matrix of the base station; Step S13: Count the trajectory sequences of all users and extract base station features, including: base station population density, average stay time per person, maximum population density and minimum population density.
3. The user group classification method based on spatiotemporal trajectory features according to claim 2 is characterized in that: The step S2: inputting the trajectory sequence into a feature extraction module to extract the temporal feature initial embedding H and the spatial feature initial embedding F therein, specifically includes: Step S21: Input the base station longitude, base station latitude and the timestamp of the user entering the base station into the feature extraction module, first generate the longitude and latitude embedding vector : (1) in, and They represent the trainable parameter matrices, and They represent the bias terms, represents the GELU activation function, and represents the latitude and longitude coordinates of base station i; Step S22: For each base station in the trajectory sequence, the corresponding timestamp Convert to time index and week index respectively: and ,in , Yes Functions for converting to time series index and week series index; Step S23: Construct the location code of the base station: (2) (3) in, is the position of the base station in the trajectory sequence, and the odd and even numbers are calculated separately; d is the dimension of the position encoding; Step S24: concatenate the base station's latitude and longitude embedding vector, time index, week index and position code to obtain the base station's trajectory embedding vector: (4) Step S25: concatenate the trajectory embedding vectors of the base stations in the trajectory sequence to generate an initial embedding of the temporal features: , where T is the length of the trajectory sequence; Step S26: The base station features and their longitude and latitude coordinates are passed through the feature extraction module in a process similar to the generation process of H, except that position encoding is not used, and the static feature projection extracted from the graph structure formed by the base stations is used to generate the spatial feature initial embedding F.
4. The user group classification method based on spatiotemporal trajectory features according to claim 3 is characterized in that: Step S3: Input H into the time attention perception module, extract the time interval matrix and modify the attention score in combination with the time decay function to generate a time feature embedding representation sequence , specifically including: Step S31: inputting H into a temporal attention perception module, which includes: a temporal attention layer, a normalization layer, and a position-by-position feedforward neural network; Step S32: At the temporal attention layer, use and To calculate the time interval matrix of the time series and the week series, which can respectively reflect the differences between the hours between different trajectory points and the differences between the days of the week: (5) (6) Step S33: Apply the time decay function to the time interval matrix of the time sequence and the week sequence for nonlinear logarithmic scaling, so that the attention score increases as the time interval shortens, focusing on the correlation of adjacent time points: (7) (8) Step S34: The calculation results of the periodicity and time decay functions are mapped to a high-dimensional space through linear transformation and LeakyReLU function, and then merged: (9) Among them, LeakyReLU is the activation function; Linear represents the linear layer; ‖ represents the concatenation operation of the vector; and They are the time series time interval matrix and the week series time interval matrix obtained by formula (7) and (8) respectively; Then the dimension reduction process is performed to obtain the time-attenuated attention score after the dimension reduction process. , to match the hidden dimension of the attention score: (10) Step S35: Based on the traditional query-key attention score, the time decay attention score is corrected to obtain the output of the time attention layer: (11) Among them, Q is the query matrix, K is the key matrix, and V is the value matrix; are the dimensions of the query, key, and value vectors; Step S36: Process the output of the temporal attention layer through the residual and normalization layers: (12) Then through the position-by-position feedforward neural network To process: (13) in, and is a trainable parameter matrix; and is the bias term; ReLU activation function. Finally, the output of the position-by-position feedforward network is subjected to residual connection and layer normalization to obtain the final output temporal feature embedding representation sequence of the temporal attention perception module. : (14)。 5. The user group classification method based on spatiotemporal trajectory features according to claim 4 is characterized in that: The step S4: constructing a sparse directed graph of base stations based on the transfer probability matrix, and constructing a distance matrix D; inputting the sparse directed graph of base stations, D and F into the spatial structure perception module, capturing the spatial proximity and dynamic transfer mode of base stations through an adaptive nonlinear exponential decay function, and generating a spatial feature embedding representation sequence , specifically including: Step S41: Based on the transfer probability matrix, for each base station i, retain the nodes connected to the top K largest transfer probabilities as valid edges; define the transfer probability values of the valid edges as a matrix P′: (15) Construct the edge set of the directed graph based on P′ ,Combining base stations as nodes, a sparse directed graph of base stations is constructed; Step S42: Construct a distance matrix D, where each element Represents the spatial distance between the i-th base station and the j-th base station: (16) in, and represents the longitude and latitude of base station i, and represents the longitude and latitude of base station j; Define an adaptive nonlinear exponential decay function , ensuring that spatially adjacent points have higher relevance and interactivity, integrating spatial distance information and strengthening the weight of neighbors : (17) in, is a trainable parameter matrix; Step S43: Input the base station sparse directed graph, distance matrix D and spatial feature initial embedding F into the spatial structure perception module composed of the spatial graph attention layer, and calculate the spatial graph attention score : (18) (19) in, is the initial spatial attention score of base station i and base station j, and are the initial embeddings of spatial features of base station i and base station j, , , is a trainable parameter matrix; is the nonlinear exponential decay function defined by formula (17); is the final spatial attention score of base station i and base station j, is the activation function; is an exponential function, is the set of neighbor nodes of base station i; Step S44: By combining the characteristics of the neighboring nodes of base station i and , calculate the features of base station i, and concatenate the outputs of the multi-head graph attention mechanism: (20) in, is the set of neighbor nodes of base station i, is the feature embedding vector of base station j in the lth layer of the graph attention mechanism, is the activation function; is the number of heads of the multi-head attention mechanism; is a trainable parameter matrix; Step S45: concatenate the corresponding base station feature embedding vectors in the trajectory sequence to generate a spatial feature embedding representation sequence of the trajectory sequence : (21)。 6. The user group classification method based on spatiotemporal trajectory features according to claim 5 is characterized in that: Step S5: and Input the spatiotemporal information fusion module to integrate the temporal and spatial information of the trajectory layer by layer to generate a spatiotemporal feature embedding representation sequence of the trajectory sequence , specifically including: Step S51: and Input the spatiotemporal information fusion module and calculate the fusion weight vector: (22) in, is the activation function sigmoid; and is a trainable parameter matrix; is the bias term; is the embedded representation of the base station corresponding to the i-th timestamp of the output of the l-th layer of the temporal attention perception module; It is the base station node of the first layer of the spatial structure perception module Embedded representation of ; Step S52: Integrate the temporal and spatial information of the trajectory of the lth layer to generate a temporal and spatial feature embedding representation sequence of the lth layer trajectory sequence: (23) in, Represents the element-wise product operation; Step S53: Repeat steps S3 to S5 through the L-layer structure, integrate the temporal and spatial information of the trajectory layer by layer, and generate a temporal and spatial feature embedding representation sequence of the trajectory sequence , where L represents the last layer, the Lth layer.
7. The user group classification method based on spatiotemporal trajectory features according to claim 6 is characterized in that: Step S6: The input classification result prediction module processes the spatiotemporal embedding of the trajectory sequence and outputs the user group category, specifically including: Step S61: Input classification result prediction module for mean pooling: (24) in, represents the length of the trajectory sequence; Step S62: average pooled features Classification is performed through a multi-layer perceptron, and the predicted category probability distribution is finally output: (25) in, and is the trainable parameter matrix and bias term of the output layer, represents the nonlinear transformation of MLP, and the softmax function Convert to class probability distribution ; Step S63: Constructing the cross entropy loss function , which is used to measure the difference between the predicted category distribution and the true category distribution: (26) Among them, N represents the total number of samples, C represents the number of classification categories, Representation sample Belongs to category The real label, Represents the sample predicted by the model Belongs to category probability.
Citation Information
Patent Citations
Information processing method and device for vehicle behavior recognition, equipment and medium
CN116229602A
Data recovery method for complex form trajectory
CN118277368A
Track prediction method and device based on time-space diagram neural network learning model
CN119313962A
Movement prediction of pedestrians useful for autonomous driving
EP3706034A1
Cited By
Intelligent clustering mining method and system for customer group features fused with spatio-temporal data
CN120634608A