User position prediction method and device, terminal equipment and storage medium

A user location prediction model combining graph neural networks and bidirectional long short-term memory networks, optimized by a sparrow search algorithm, addresses the inefficiencies of existing methods by accurately predicting future locations, improving accuracy for commercial and public health applications.

CN119255199AActive Publication Date: 2025-01-03BEIJING ZHONGWANG ZHICE TECHNOLOGY CO LTD

Patent Information

Application Number
CN202411379481.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-30
Publication Date
2025-01-03
Estimated Expiration
2044-09-30

AI Technical Summary

Technical Problem

Existing user location prediction methods, such as the Markov chain method, fail to comprehensively consider complex environmental factors, leading to inefficiencies in predicting user locations.

Method used

A user location prediction model is developed using a combination of a graph neural network and a bidirectional long short-term memory neural network, optimized through a sparrow search algorithm, to accurately predict future locations based on historical data.

Benefits of technology

The model effectively considers environmental and historical factors, enhancing the accuracy of user location predictions, which is beneficial for commercial personalized recommendations and large-scale infectious disease prevention.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119255199A_ABST
    Figure CN119255199A_ABST
Patent Text Reader

Abstract

The invention discloses a user position prediction method and device, terminal equipment and a storage medium, and the method comprises the steps: obtaining the position data of a user at the current moment, and determining the position data of the user at the next moment according to a pre-trained position prediction model; the pre-trained position prediction model is obtained by training an initial training model according to historical position sample data of a user to obtain a training result and optimizing the training result by adopting a sparrow search algorithm, and the initial training model is established based on a graph neural network model and a bidirectional long-short-term memory neural network model; according to a sparrow search algorithm, a position prediction model is established based on a graph neural network model and a bidirectional long-short-term memory neural network model, and the position prediction model has the capability of accurately predicting the future position of a user according to a historical position sequence, so that environmental factors and historical access information of the user can be comprehensively considered, and the user experience is improved. And the accuracy of position prediction is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of computer technology, and in particular, relates to a method, apparatus, terminal device and storage medium for predicting a user location. Background Art

[0002] With the rapid development of mobile Internet, the acquisition and utilization of user location data has become an important research direction in the field of data mining and deep learning. User location data contains rich information, such as user behavior patterns and behavior preferences. This information is not only widely used in the business field, but also has important significance in public safety and social governance. From the perspective of business recommendation, by analyzing the user's location, we can mine the user's behavior habits, interest preferences and other information, which is of great value for providing personalized services or product recommendations; by analyzing the user's location, we can timely discover and prevent some possible safety risks, such as preventing infectious diseases. Therefore, studying the prediction method that ensures the accuracy of user location has positive social significance for improving business conversion rate as well as social stability and public safety.

[0003] In the field of user location prediction, the Markov chain method is used to predict user location. By extracting key locations in the historical location sequence and obtaining their access probabilities, a location transfer matrix is ​​constructed to predict the next location that the user is most likely to visit. However, this method ignores the complex interactions of environmental factors. How to comprehensively consider the complex interactions of environmental factors and improve the prediction efficiency of user location is an urgent problem that needs to be solved. Summary of the invention

[0004] The present application aims to provide a method, apparatus, terminal device and storage medium for predicting user location to solve the deficiencies in the prior art. The technical problem to be solved by the present application is achieved through the following technical solutions.

[0005] In a first aspect, an embodiment of the present application provides a method for predicting a user location, the method comprising:

[0006] Acquire the user's current location data, wherein the current location data at least includes user information, user location point information and historical access record information;

[0007] According to a pre-trained location prediction model, the location data of the user at the next moment is determined; wherein the pre-trained location prediction model is obtained by training an initial training model according to the user's historical location sample data, and optimizing the training result using a sparrow search algorithm, and the initial training model is established based on a graph neural network model and a bidirectional long short-term memory neural network model.

[0008] Optionally, the location prediction model is obtained in the following manner:

[0009] Acquire user historical location sample data, wherein the user historical location sample data at least includes sample user information, sample user location point information, and sample user visit history records;

[0010] Preprocessing the user's historical location sample data to obtain processed sample data;

[0011] Inputting the processed sample data into the graph neural network model to obtain representation vectors corresponding to each layer of the graph neural network model;

[0012] Input the representation vector into the MLP layer for feature fusion to obtain an access vector;

[0013] Inputting the access vector into the bidirectional long short-term memory neural network model to obtain a model output result, wherein the model output result at least includes user location data at the next moment;

[0014] Determining a loss function according to the user location data at the next moment and the preset location data;

[0015] The iterative data of the loss function is optimized according to the sparrow search algorithm to obtain the position prediction model.

[0016] Optionally, the method further comprises:

[0017] The user's historical location sample data is used to evaluate the prediction results of the location prediction model based on accuracy, precision, recall and F1 value.

[0018] Optionally, the inputting the representation vector into the MLP layer for feature fusion to obtain the access vector includes:

[0019] Based on the sample user location information, the information is embedded into the graph structure, and the nodes and edges are initialized to obtain the graph neural network model;

[0020] Convert the sample user information into user information in vector form, and input it into a learnable MLP embedding layer to obtain an embedding vector of the sample user information;

[0021] Input the access time into the learnable MLP embedding layer to obtain the embedding vector of time information;

[0022] The embedding vector of the sample user information, the embedding vector of the time information and the embedding vector of the sample user location point information are concatenated, and the concatenated result is subjected to feature dimension reduction and fusion processing to obtain the user's access vector.

[0023] Optionally, the bidirectional long short-term memory neural network model is used to perform forward layer processing and reverse layer processing to obtain forward layer processing results and reverse layer processing results, and the forward layer processing results and the reverse layer processing results are merged to obtain context information.

[0024] Optionally, determining the loss function according to the user location data at the next moment and the preset location data includes:

[0025] Calculating the loss value between the user location data at the next moment and the preset location data by using a cross entropy function;

[0026] The AdamW optimizer is used to iteratively back-propagate the loss value to the position prediction model, and the position prediction model is updated.

[0027] In a second aspect, an embodiment of the present application provides a device for predicting a user location, the device comprising:

[0028] An acquisition module, used to acquire the user's current location data, wherein the current location data at least includes user information, user location point information and historical access record information;

[0029] A prediction module is used to determine the location data of the user at the next moment according to a pre-trained location prediction model; wherein the pre-trained location prediction model is obtained by training an initial training model according to the user's historical location sample data, and optimizing the training result using a sparrow search algorithm, and the initial training model is established based on a graph neural network model and a bidirectional long short-term memory neural network model.

[0030] Optionally, the device further comprises a model training module, wherein the model training module is used to:

[0031] Acquire user historical location sample data, wherein the user historical location sample data at least includes sample user information, sample user location point information, and sample user visit history records;

[0032] Preprocessing the user's historical location sample data to obtain processed sample data;

[0033] Inputting the processed sample data into the graph neural network model to obtain representation vectors corresponding to each layer of the graph neural network model;

[0034] Input the representation vector into the MLP layer for feature fusion to obtain an access vector;

[0035] Inputting the access vector into the bidirectional long short-term memory neural network model to obtain a model output result, wherein the model output result at least includes user location data at the next moment;

[0036] Determining a loss function according to the user location data at the next moment and the preset location data;

[0037] The iterative data of the loss function is optimized according to the sparrow search algorithm to obtain the position prediction model.

[0038] Optionally, the model training module is used to:

[0039] The user's historical location sample data is used to evaluate the prediction results of the location prediction model based on accuracy, precision, recall and F1 value.

[0040] Optionally, the model training module is used to:

[0041] Based on the sample user location information, the information is embedded into the graph structure, and the nodes and edges are initialized to obtain the graph neural network model;

[0042] Convert the sample user information into user information in vector form, and input it into a learnable MLP embedding layer to obtain an embedding vector of the sample user information;

[0043] Input the access time into the learnable MLP embedding layer to obtain the embedding vector of time information;

[0044] The embedding vector of the sample user information, the embedding vector of the time information and the embedding vector of the sample user location point information are concatenated, and the concatenated result is subjected to feature dimension reduction and fusion processing to obtain the user's access vector.

[0045] Optionally, the bidirectional long short-term memory neural network model is used to perform forward layer processing and reverse layer processing to obtain forward layer processing results and reverse layer processing results, and the forward layer processing results and the reverse layer processing results are merged to obtain context information.

[0046] Optionally, the model training module is used to:

[0047] Calculating the loss value between the user location data at the next moment and the preset location data by using a cross entropy function;

[0048] The AdamW optimizer is used to iteratively back-propagate the loss value to the position prediction model, and the position prediction model is updated.

[0049] In a third aspect, an embodiment of the present application provides a terminal device, including: at least one processor and a memory;

[0050] The memory stores a computer program; the at least one processor executes the computer program stored in the memory to implement the user location prediction method provided in the first aspect.

[0051] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed, the method for predicting the user location provided in the first aspect is implemented.

[0052] The embodiments of the present application include the following advantages:

[0053] The user location prediction method, apparatus, terminal device and storage medium provided in the embodiments of the present application obtain the user's current moment location data, wherein the current moment location data includes at least user information, user location point information and historical access record information; and determine the user's location data at the next moment according to a pre-trained location prediction model; wherein the pre-trained location prediction model is obtained by training an initial training model according to the user's historical location sample data to obtain a training result, and optimizing the training result using a sparrow search algorithm, wherein the initial training model is established based on a graph neural network model and a bidirectional long short-term memory neural network model. The embodiments of the present application establish a location prediction model based on a sparrow search algorithm, a graph neural network model and a bidirectional long short-term memory neural network model, and the location prediction model has the ability to accurately predict the user's future location based on a historical location sequence. In this way, environmental factors and the user's historical access information can be comprehensively considered to improve the accuracy of location prediction, which is of great significance to the fields of commercial personalized recommendations and large-scale infectious disease prevention and control. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] In order to more clearly illustrate the embodiments of the present application or the existing technical solutions, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0055] Figure 1 A flowchart of a method for predicting a user location provided in one embodiment of the present application;

[0056] Figure 2 A summary diagram of the SSA optimized GNN-BiLSTM position data prediction method provided in one embodiment of the present application;

[0057] Figure 3 A flowchart of data preprocessing provided in one embodiment of the present application;

[0058] Figure 4 A flowchart of constructing an SSA-optimized GNN-BiLSTM model provided in an embodiment of the present application;

[0059] Figure 5 An example of a location data graph structure provided for an embodiment of the present application;

[0060] Figure 6 LSTM unit diagram provided for an embodiment of the present application;

[0061] Figure 7 A BiLSTM unit diagram provided for an embodiment of the present application;

[0062] Figure 8 A flow chart of a sparrow search algorithm provided in an embodiment of the present application;

[0063] Fig. 9 A model training flow chart provided for an embodiment of the present application;

[0064] Fig.10 It is a structural block diagram of an embodiment of a user location prediction device of the present application;

[0065] Fig.11 It is a structural diagram of a terminal device of the present application. DETAILED DESCRIPTION

[0066] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.

[0067] An embodiment of the present application provides a user location prediction method for predicting the user's future location. The execution subject of this embodiment is a user location prediction device, which is set on a terminal device, for example, the terminal device at least includes a computer terminal, etc.

[0068] Reference Figure 1 , shows a flowchart of a method for predicting a user location according to an embodiment of the present invention, the method may specifically include the following steps:

[0069] S101, obtaining the user's current location data, wherein the current location data at least includes user information, user location point information and historical access record information;

[0070] Specifically, the terminal device obtains the user's current location data, which may be the location data input by the user or obtained from the network.

[0071] S102. Determine the user's location data at the next moment based on a pre-trained location prediction model; wherein the pre-trained location prediction model is obtained by training an initial training model based on the user's historical location sample data, and optimizing the training result using a sparrow search algorithm, and the initial training model is established based on a graph neural network model and a bidirectional long short-term memory neural network model.

[0072] The location prediction model is pre-trained on the terminal device, and the user's historical location sample data is used to train the initial training model to obtain a training result. The initial training model is established based on a graph neural network model and a bidirectional long short-term memory neural network model. The training result is then continuously optimized using a sparrow search algorithm to obtain the location prediction model. In this way, after the terminal device obtains the user's current location data, it inputs it into the location prediction model to obtain the user's next location data.

[0073] Specifically, the terminal device obtains the user's historical location data, wherein the user location data set includes user information, user location point information, and user access records;

[0074] The user location sequence is uniformly represented by G(U,V,E,C), where U represents the set of all users, V represents the set of all location points, E represents the set of all user-location point visits, and C represents the set of all user historical access records.

[0075] For a specific user u, its historical location sequence can be expressed as C u ={ <u,v 1 ,t 1 >,..., <u,v i ,t i >,..., <u,v n ,t n >}, where <u,v 1 ,t 1 >, the triple represents the user u at time t i Visited location v i , that is, an access record is generated. Finally, the data of users whose access records are above the set threshold are retained, and the access events belonging to the same user are arranged in chronological order and stored separately;

[0076] According to all historical position representation vectors, the user historical position sequence representation vector is constructed, including node and edge embedding vectors, user embedding vectors, and time embedding vectors, and finally converted into the access vector e c Each user’s access vector sequence is processed by two independent LSTM layers: a forward layer processes the sequence from the beginning to the current time step, and a reverse layer processes the sequence from the end to the current time step. The outputs of these two layers are merged at each time step to provide complete contextual information.

[0077] The final output of the BiLSTM model passes through a learnable MLP embedding layer to give a possible probability distribution of the next location point, which can be used to determine the next visited location of the user based on the output result.

[0078] The embodiment of the present application proposes a location data prediction model GNN-BiLSTM based on a combination of a graph neural network (GNN) and a bidirectional long short-term memory neural network (BiLSTM). This model has the advantages of a graph neural network and a single long short-term memory neural network. At the same time, it uses a sparrow search algorithm (SSA) to make up for the shortcomings of random initialization parameters of traditional neural network models, and obtains the spatial features of user location nodes, so as to further improve the accuracy of location data prediction.

[0079] The method for predicting user location provided in the embodiment of the present application obtains the user's current moment location data, wherein the current moment location data includes at least user information, user location point information and historical access record information; determines the user's location data at the next moment according to a pre-trained location prediction model; wherein the pre-trained location prediction model is obtained by training an initial training model according to the user's historical location sample data to obtain a training result, and optimizing the training result using a sparrow search algorithm, and the initial training model is established based on a graph neural network model and a bidirectional long short-term memory neural network model. The embodiment of the present application establishes a location prediction model based on a sparrow search algorithm, a graph neural network model and a bidirectional long short-term memory neural network model, and the location prediction model has the ability to accurately predict the user's future location based on a historical location sequence. In this way, environmental factors and user historical access information can be comprehensively considered to improve the accuracy of location prediction, which is of great significance to fields such as commercial personalized recommendations and large-scale infectious disease prevention and control.

[0080] Another embodiment of the present application further supplements the method for predicting the user location provided in the above embodiment.

[0081] Figure 2 This is a summary diagram of the SSA optimized GNN-BiLSTM position data prediction method shown in the present invention:

[0082] S11. Data preprocessing: Collect user location data, assign a unified ID to the location points in the location, standardize the user location data format, construct a user location data set, and divide the data set according to the location sequence segments to form 80% training set data, 10% validation set data and 10% test set data.

[0083] S12. Build a model: Build a GNN-BiLSTM model based on a combination of a graph neural network (GNN) and a bidirectional long short-term memory neural network (BiLSTM), and initialize the model; the model includes a GNN embedding module for representing location point information, a user embedding module for representing user information, a time embedding module for representing time information, a fusion module for fusing location point and user information, a BiLSTM module for realizing location data prediction, and a parameter optimization module for optimizing the model.

[0084] S13. Model training: The training set data is input into the GNN-BiLSTM model. The location point id, user id, and time point are passed through the GNN and basic embedding layer to form their own representation vectors. The features are then fused through the MLP layer to form an access vector. The fused feature vector sequence is sent to the BiLSTM model, and its output is the final location prediction result of the model, that is, the location data of the user at the next time point. The loss function is calculated for the predicted location data and the actual location data, and the loss value is back-propagated to complete the iterative training of the model. After each iterative training is completed, the validation set data and SSA are used to tune the hyperparameters, and the optimal model is obtained through repeated iterations.

[0085] S14. User location prediction: Input the test set data into the trained SSA-optimized GNN-BiLSTM model to obtain the location data predicted by the model, and use multiple evaluation indicators to measure the location prediction ability of the model.

[0086] Optionally, the location prediction model is obtained by:

[0087] Obtain user historical location sample data, the user historical location sample data at least including sample user information, sample user location point information and sample user visit history records;

[0088] Preprocessing the user's historical location sample data to obtain processed sample data;

[0089] Specifically, data preprocessing: collect user location data, assign a unified ID to the location points in the location, standardize the user location data format, construct a user location dataset, and divide the dataset according to the location sequence segments to form 80% training set data, 10% validation set data and 10% test set data.

[0090] like Figure 3 As shown, user location data is collected, a unified ID is assigned to the location points in the location, and the user location data format is standardized. A user location data set is constructed, and the data set is divided according to the location sequence segment to form 80% training set data, 10% validation set data and 10% test set data. The data mainly includes:

[0091] S21, loading user location data set: the user location data set includes user information (including user ID, etc.), user location point information (including location point ID, etc.) and user access records (including user ID, user access location point ID, access time, etc.);

[0092] S22. Data preprocessing: The data set is uniformly represented by G(U,V,E,C), where U represents the set of all users, V represents the set of all locations, E represents the set of all user-location visits, and C represents the set of all user historical visit records. For a specific user u, its historical location sequence can be represented as C u ={ <u,v 1 ,t 1 >,..., <u,v i ,t i >,..., <u,v n ,t n >}, where <u,v 1 ,t 1 >, the triple represents the user u at time t i Visited location v i , that is, an access record is generated. Finally, the data of users whose access records are above the set threshold are retained, and the access events belonging to the same user are arranged in chronological order and stored separately;

[0093] S23, data set division: the location sequence of each user is divided in a ratio of 8:1:1 to form a training set, a validation set and a test set. The training set, the validation set and the training set all contain the continuous access information of each user, but they do not overlap with each other.

[0094] Input the processed sample data into the graph neural network model to obtain the representation vectors corresponding to each layer of the graph neural network model;

[0095] Specifically, a GNN-BiLSTM model based on a combination of a graph neural network (GNN) and a bidirectional long short-term memory neural network (BiLSTM) is constructed and initialized; the model includes a GNN embedding module for characterizing location point information, a user embedding module for characterizing user information, a time embedding module for characterizing time information, a fusion module for fusing location point and user information, a BiLSTM module for realizing location data prediction, and a parameter optimization module for optimizing the model.

[0096] Input the representation vector into the MLP layer for feature fusion to obtain the access vector;

[0097] Input the access vector into a bidirectional long short-term memory neural network model to obtain a model output result, wherein the model output result at least includes user location data at the next moment;

[0098] Determine the loss function based on the user's location data at the next moment and the preset location data;

[0099] The iterative data of the loss function is optimized according to the sparrow search algorithm to obtain the position prediction model.

[0100] Specifically, the training set data is input into the GNN-BiLSTM model, and the location point id, user id, and time point are passed through the GNN and basic embedding layer to form their own representation vectors, and then the features are fused through the MLP layer to form an access vector. The fused feature vector sequence is sent to the BiLSTM model, and its output is the final location prediction result of the model, that is, the location data of the user at the next time point. The loss function is calculated between the predicted location data and the actual location data, and the loss value is back-propagated to complete the iterative training of the model. After each iterative training is completed, the validation set data and SSA are used to tune the hyperparameters, and the optimal model is obtained by repeated iterations.

[0101] First, collect and preprocess user location data, build a data set and divide it into training set, validation set and test set. Then, use GNN and other embedding methods to learn the embedded representation of location points, users and user access time, fuse the representations of the three and input them into the BiLSTM prediction model for training. Finally, after each iteration of model training, SSA is used to optimize the model hyperparameters, and finally obtain the best combination of parameters, so that the model has the ability to accurately predict the user's future location based on the historical location sequence, which is of great significance to the fields of commercial personalized recommendation and large-scale infectious disease prevention and control.

[0102] The basic idea of ​​the sparrow search algorithm is to simulate the social behavior of sparrows when foraging, including foraging, vigilance and random exploration. Each individual in the algorithm has a current position (a vector of parameters to be optimized) and a food amount (the performance of the current parameter settings). They move in the search space to find a better solution, thereby better realizing the hyperparameter tuning of the deep learning model to achieve better user location prediction performance.

[0103] Optionally, the method further comprises:

[0104] The user's historical location sample data is used to evaluate the prediction results of the location prediction model based on accuracy, precision, recall and F1 value.

[0105] The test set data is input into the trained SSA-optimized GNN-BiLSTM model to obtain the location data predicted by the model, and a variety of evaluation indicators are used to measure the location prediction ability of the model. The GNN-BiLSTM user location prediction model trained on the training set and based on the validation set data and SSA optimization is applied to the test set data, and the model prediction results will be evaluated based on accuracy, precision, recall, and F1-Score.

[0106] Optionally, the representation vector is input into the MLP layer for feature fusion to obtain an access vector, including:

[0107] Based on the sample user location information, the information is embedded into the graph structure, and the nodes and edges are initialized to obtain the graph neural network model;

[0108] Convert the sample user information into vectorized user information and input it into the learnable MLP embedding layer to obtain the embedding vector of the sample user information;

[0109] Input the access time into the learnable MLP embedding layer to obtain the embedding vector of time information;

[0110] The embedding vector of the sample user information, the embedding vector of the time information and the embedding vector of the sample user location point information are concatenated, and the concatenated result is subjected to feature dimension reduction and fusion processing to obtain the user's access vector.

[0111] Optionally, a bidirectional long short-term memory neural network model is used to perform forward layer processing and reverse layer processing to obtain forward layer processing results and reverse layer processing results, and the forward layer processing results and reverse layer processing results are merged to obtain context information.

[0112] Optionally, determining a loss function according to the user position data at the next moment and the preset position data includes:

[0113] The loss value between the user's location data at the next moment and the preset location data is calculated through the cross entropy function;

[0114] The AdamW optimizer is used to iteratively back-propagate the loss value to the position prediction model and update the position prediction model.

[0115] like Figure 4 As shown, it is a flowchart of the SSA optimized GNN-BiLSTM model construction shown in the present invention: constructing a GNN-BiLSTM model based on a combination of a graph neural network (GNN) and a bidirectional long short-term memory neural network (BiLSTM), and initializing the GNN-BiLSTM model; the model includes a GNN embedding module for characterizing location point information, a user embedding module for characterizing user information, a time embedding module for characterizing time information, a fusion module for fusing location point and user information, a BiLSTM module for realizing location data prediction, and an SSA parameter optimization module for optimizing the model. The main steps are:

[0116] S31. Construct a graph neural network for embedding location point features: embed the location point information into the graph structure and complete the initialization of nodes and edges. For the initialization of edges between nodes, assume that there is a user access record sequence C in the training set data u , where there are two adjacent access records <u,v i ,t k >, <u,v j ,t k+1 >, then the position point v a and v b There is a one-way path between Figure 5 As shown, let f(v a ,v b ) represents the frequency of occurrence of this path in all paths, and this frequency is normalized as the weight of the edge between the location nodes, that is,

[0117]

[0118] The denominator ∑ n f(v i ,v n ) is used to normalize the weights. For the initialization of graph nodes, the current weighted graph structure and Node2Vec algorithm are used for probability walks to generate the initialization vector representation of each location point graph node. After initialization, the nodes are further aggregated through a multi-layer graph convolutional network (GCN). Specifically, suppose there are k nodes in the initialized graph, the dimension of the feature vector of each node is d, and the initial state of the graph is X∈R k×d, the degree matrix and adjacency matrix of the graph are D∈R d×d and A∈R d×d , calculate its Symmetric Normalized Laplacian matrix:

[0119]

[0120] For each specific value in the matrix:

[0121]

[0122] where deg(v i ) and deg(v j ) represent the degrees of nodes i and j, that is, A in the adjacency matrix i,j The value of .

[0123] Suppose the input of the lth layer in the multi-layer GCN is H l , H 0 =X, then the output of the lth layer / the input of the l+1th layer is:

[0124] H l+1 =σ(L sym H l W l ) (Formula 4)

[0125] Where σ(·) is a nonlinear activation function, W l is the learnable parameter of this layer. After the aggregation of multiple layers of GCN, a better embedding representation of the position point can be provided for subsequent tasks. The embedding vector of the position point node p is expressed by e p express;

[0126] S32. Construct user embedding vector: Represent users as OneHot vectors according to their IDs, and pass them through a learnable MLP embedding layer so that each user is mapped to a vector space with lower dimension. u =f embed (u) means;

[0127] S33. Constructing time embedding vector: The access time is embedded using the Time2Vec method, and the 24 hours of a day are divided into 48 windows. The time of each window is embedded using a learnable MLP layer and a sine function for representing time periodicity, that is,

[0128]

[0129] Where k is the embedding dimension, t is the temporal feature to be embedded, and w and b are a set of learnable network parameters;

[0130] S34, feature fusion: Since each access event is based on a triple<u,v,t> Therefore, the embedding vectors of location points, users, and time points obtained from the first to third steps are concatenated, and then the features are reduced and fused through an MLP layer with an activation function, that is,

[0131] e c =σ(w m [e t :e u :e p ]+b m )∈R d (Formula 6)

[0132] Among them [e t :e u :e p ] represents the concatenation of time, user, and location embedding vectors, w m and b m is a set of learnable network parameters, σ(·) represents the activation function, e c The unified vector representation of the user access event is obtained, whose dimension is d and is referred to as the access vector in the following text;

[0133] S35. Build a bidirectional long short-term memory network (BiLSTM): BiLSTM is a special recurrent neural network (RNN) that processes sequence data through two LSTM layers in opposite directions, so that it can simultaneously obtain past and future contextual information.

[0134] The internal structure of the LSTM unit is as follows Figure 6 As shown in the figure, there are three types of "gates" in the LSTM neural unit, namely input gate, output gate and forget gate. The function of the "gate" is similar to that of a switch, which can select and filter information. If sigmoid and a point-by-point multiplication operation are selected to achieve this function, the sigmoid function will output a number between 0 and 1, representing the proportion of information retained. The two extreme cases are: 0 means prohibiting all information from passing, and 1 means completely unlimited passing.

[0135] The three gating formulas of LSTM are as follows:

[0136] Input Gate:

[0137] i t =σ(W xi ·x t +W hi ·h t-1 +bi ) (Formula 7)

[0138] Forget Gate:

[0139] f t =σ(W xf ·x t +W hf ·h t-1 +b f ) (Formula 8)

[0140] Output Gate:

[0141] o t =σ(W xo ·x t +W ho ·h t-1 +b o ) (Formula 9)

[0142] The overall structure of BiLSTM, i.e. bidirectional LSTM, is as follows Figure 7 As shown, in BiLSTM, the access vector of each user It is processed by two independent LSTM layers: a forward layer processes the sequence from the beginning to the current time step, and a reverse layer processes the sequence from the end to the current time step. The outputs of these two layers are combined at each time step to provide complete context information.

[0143] For the input layer of the model, the embedding vector formed by location node, user, and time is used as a single access vector e for a single user. c , the access vectors of individual users are combined to form a position sequence This sequence will be used as the input vector of the BiLSTM model.

[0144] For the hidden layer of the model, since the BiLSTM model processes the input through two independent and opposite LSTM layers, the intermediate operation process is as follows:

[0145]

[0146] Here, LSTM (forward) and LSTM (backward) Respectively represent the internal calculation process of the forward and reverse LSTM at time step t.

[0147] For the output layer of the model, since BiLSTM is a LSTM unit that includes forward and reverse, the output of the BiLSTM layer is the concatenation of the forward and reverse hidden states, that is, The resulting output vector h tContains forward and backward information for each time step in the sequence.

[0148] The final output h of the BiLSTM model t After a learnable MLP embedding layer, the next location is predicted.

[0149] S36, Sparrow Search Algorithm (SSA) optimization model: The algorithm flow is as follows Figure 8 As shown:

[0150] Initialization: Generate a population of sparrows, where the position of each sparrow represents a potential solution (parameter vector to be optimized).

[0151] Foraging behavior: The sparrow updates its position based on the amount of food at the current location (the performance of the current parameter combination) and the information of neighboring sparrows. If the amount of food at the new location is richer, the sparrow will move to that location.

[0152] Vigilance behavior: To avoid local optimality, sparrows will conduct random exploration according to certain rules (such as probability or environmental factors), even if this means a temporary reduction in the amount of food.

[0153] Fitness evaluation: Evaluate the new location and amount of food for each sparrow to determine their fitness. Iterative update: Repeat the above foraging and vigilance behaviors until the termination condition is met.

[0154] Sparrow position update formula:

[0155]

[0156] in, represents the position of the i-th sparrow at the t-th iteration, that is, the vector of parameters to be optimized, including GNN node dimension, number of GNN network layers, number of BiLSTM hidden layers, and number of BiLSTM hidden layer units. is the position of the optimal solution of the group in the current iteration, that is, the optimal combination of parameters to be optimized, α is the learning factor, which is used to adjust the step size of the sparrow approaching the optimal solution, β is the exploration factor, which is used to introduce randomness to avoid premature convergence, and ∈ is a random perturbation that simulates the random exploration behavior of sparrows in the process of foraging.

[0157] In the sparrow search algorithm, the amount of food F for each sparrow is i (t) represents its fitness level at the tth iteration, and the amount of food for the optimal solution of the group Indicates the highest amount of food among all sparrows in the current iteration, that is, the best fitness. Fitness in this model refers to the final classification loss value of the model. The optimal fitness is obtained by the optimal sparrow position. The sparrow search algorithm calculates the optimal fitness through a series of parameter vectors to be optimized, that is, the optimal parameter combination, to obtain the optimal model. The formula for updating the amount of food is as follows:

[0158]

[0159] Here, γ is the food update factor, which controls the rate at which the food amount of each sparrow approaches the optimal food amount of the group. In this way, the algorithm not only encourages sparrows to move to a better solution, but also maintains the diversity of the search space to explore a wider solution area and avoid falling into the local optimum.

[0160] Fig. 9 The model overall training flow chart of the method shown in the present invention includes:

[0161] S41, forward propagation and loss calculation: The position data output by the model is the position data at the next time point. The loss between the prediction and the actual result is calculated by the cross entropy function. The formula is:

[0162]

[0163] Where N is the number of samples, M is the number of possible states of the position, and y ij is the actual observed position data, indicating whether the position of sample i falls within interval j (if yes, then y ij =1, otherwise y ij =0), p ij is the probability that the model predicts that the location of sample i falls within interval j.

[0164] The cross entropy loss function trains the model to more accurately predict future location data by minimizing the difference between the predicted probability distribution and the actual observed distribution.

[0165] S42, Backpropagation and parameter update: The AdamW optimizer is used to iteratively backpropagate the loss to the entire model to update the model parameters. In addition to the learnable parameters in the model, the artificially set hyperparameters include the node vector dimension of the graph convolutional network, the dimension of the location point, user and time embedding vectors, the access vector dimension, the maximum access vector sequence length, the dropout rate, and the batch size, number of iterations, learning rate, regularization parameter, learning rate adjustment strategy of the optimizer.

[0166] S43. Model evaluation and hyperparameter optimization: To verify the effectiveness of the GNN-BiLSTM user location prediction method based on SSA optimization, the trained and tuned model was evaluated on the validation set based on accuracy, precision, recall and F1-Score.

[0167] Accuracy = (TP + TN) / P + N (Formula 15)

[0168] Precision = TP / (TP+FP) (Formula 16)

[0169] Recall = TP / (TP+FN) (Formula 17)

[0170] F1-Score=2 / (1 / Precision+1 / Recall) (Formula 18)

[0171] Among them, TP represents the number of samples predicted as positive when they are actually positive, which is the true positive; FP represents the number of samples predicted as positive when they are actually negative, which is the false positive; FN represents the number of samples predicted as negative when they are actually positive, which is the false negative; TN represents the number of samples predicted as negative when they are actually negative, which is the true negative. In addition, TP+FP represents the number of all samples predicted as positive, FN+TN represents the number of all samples predicted as negative, TP+FN represents the number of samples actually positive, and FP+TN represents the number of samples actually negative.

[0172] The evaluation results are used as the amount of food in this round of sparrow sowing algorithm iteration, the sparrow population parameter combination is updated, and the model is retrained.

[0173] The method for predicting user location provided in the embodiment of the present application obtains the user's current moment location data, wherein the current moment location data includes at least user information, user location point information and historical access record information; determines the user's location data at the next moment according to a pre-trained location prediction model; wherein the pre-trained location prediction model is obtained by training an initial training model according to the user's historical location sample data to obtain a training result, and optimizing the training result using a sparrow search algorithm, and the initial training model is established based on a graph neural network model and a bidirectional long short-term memory neural network model. The embodiment of the present application establishes a location prediction model based on a sparrow search algorithm, a graph neural network model and a bidirectional long short-term memory neural network model, and the location prediction model has the ability to accurately predict the user's future location based on a historical location sequence. In this way, environmental factors and user historical access information can be comprehensively considered to improve the accuracy of location prediction, which is of great significance to fields such as commercial personalized recommendations and large-scale infectious disease prevention and control.

[0174] Another embodiment of the present application provides a user location prediction device, which is used to execute the user location prediction method provided in the above embodiment.

[0175] Reference Fig.10 , shows a structural block diagram of an embodiment of a user location prediction device of the present application, the device may specifically include the following modules: an acquisition module 1001 and a prediction module 1002, wherein:

[0176] The acquisition module 1001 is used to acquire the user's current location data, wherein the current location data at least includes user information, user location point information and historical access record information;

[0177] The prediction module 1002 is used to determine the user's location data at the next moment based on a pre-trained location prediction model; wherein the pre-trained location prediction model is obtained by training an initial training model based on the user's historical location sample data, and optimizing the training result using a sparrow search algorithm, and the initial training model is established based on a graph neural network model and a bidirectional long short-term memory neural network model.

[0178] The user location prediction device provided in the embodiment of the present application obtains the user's current moment location data, wherein the current moment location data at least includes user information, user location point information and historical access record information; determines the user's location data at the next moment according to a pre-trained location prediction model; wherein the pre-trained location prediction model is obtained by training an initial training model according to the user's historical location sample data to obtain a training result, and optimizing the training result using a sparrow search algorithm, and the initial training model is established based on a graph neural network model and a bidirectional long short-term memory neural network model. The embodiment of the present application establishes a location prediction model based on a sparrow search algorithm, a graph neural network model and a bidirectional long short-term memory neural network model. The location prediction model has the ability to accurately predict the user's future location based on a historical location sequence. In this way, environmental factors and user historical access information can be comprehensively considered to improve the accuracy of location prediction, which is of great significance to fields such as commercial personalized recommendations and large-scale infectious disease prevention and control.

[0179] Another embodiment of the present application further supplements the user location prediction device provided in the above embodiment.

[0180] Optionally, the device further includes a model training module, and the model training module is used to:

[0181] Obtain user historical location sample data, the user historical location sample data at least including sample user information, sample user location point information and sample user visit history records;

[0182] Preprocessing the user's historical location sample data to obtain processed sample data;

[0183] Input the processed sample data into the graph neural network model to obtain the representation vectors corresponding to each layer of the graph neural network model;

[0184] Input the representation vector into the MLP layer for feature fusion to obtain the access vector;

[0185] Input the access vector into a bidirectional long short-term memory neural network model to obtain a model output result, wherein the model output result at least includes user location data at the next moment;

[0186] Determine the loss function based on the user's location data at the next moment and the preset location data;

[0187] The iterative data of the loss function is optimized according to the sparrow search algorithm to obtain the position prediction model.

[0188] Optionally, the model training module is used to:

[0189] The user's historical location sample data is used to evaluate the prediction results of the location prediction model based on accuracy, precision, recall and F1 value.

[0190] Optionally, the model training module is used to:

[0191] Based on the sample user location information, the information is embedded into the graph structure, and the nodes and edges are initialized to obtain the graph neural network model;

[0192] Convert the sample user information into vectorized user information and input it into the learnable MLP embedding layer to obtain the embedding vector of the sample user information;

[0193] Input the access time into the learnable MLP embedding layer to obtain the embedding vector of time information;

[0194] The embedding vector of the sample user information, the embedding vector of the time information and the embedding vector of the sample user location point information are concatenated, and the concatenated result is subjected to feature dimension reduction and fusion processing to obtain the user's access vector.

[0195] Optionally, a bidirectional long short-term memory neural network model is used to perform forward layer processing and reverse layer processing to obtain forward layer processing results and reverse layer processing results, and the forward layer processing results and reverse layer processing results are merged to obtain context information.

[0196] Optionally, the model training module is used to:

[0197] Calculate the loss value between the user's location data at the next moment and the preset location data through the cross entropy function;

[0198] The AdamW optimizer is used to iteratively back-propagate the loss value to the position prediction model and update the position prediction model.

[0199] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0200] The user location prediction device provided in the embodiment of the present application obtains the user's current moment location data, wherein the current moment location data at least includes user information, user location point information and historical access record information; determines the user's location data at the next moment according to a pre-trained location prediction model; wherein the pre-trained location prediction model is obtained by training an initial training model according to the user's historical location sample data to obtain a training result, and optimizing the training result using a sparrow search algorithm, and the initial training model is established based on a graph neural network model and a bidirectional long short-term memory neural network model. The embodiment of the present application establishes a location prediction model based on a sparrow search algorithm, a graph neural network model and a bidirectional long short-term memory neural network model. The location prediction model has the ability to accurately predict the user's future location based on a historical location sequence. In this way, environmental factors and user historical access information can be comprehensively considered to improve the accuracy of location prediction, which is of great significance to fields such as commercial personalized recommendations and large-scale infectious disease prevention and control.

[0201] Yet another embodiment of the present application provides a terminal device for executing the user location prediction method provided in the above embodiment.

[0202] Fig.11 It is a schematic diagram of the structure of a terminal device of the present application, such as Fig.11 As shown, the terminal device includes: at least one processor 1101 and a memory 1102;

[0203] The memory stores a computer program; and at least one processor executes the computer program stored in the memory to implement the method for predicting the user location provided in the above embodiment.

[0204] The terminal device provided by the present embodiment obtains the user's current moment location data, wherein the current moment location data includes at least user information, user location point information and historical access record information; determines the user's location data at the next moment according to a pre-trained location prediction model; wherein the pre-trained location prediction model is obtained by training an initial training model according to the user's historical location sample data to obtain a training result, and optimizing the training result using a sparrow search algorithm, and the initial training model is established based on a graph neural network model and a bidirectional long short-term memory neural network model. The embodiment of the present application establishes a location prediction model based on a sparrow search algorithm, a graph neural network model and a bidirectional long short-term memory neural network model. The location prediction model has the ability to accurately predict the user's future location based on a historical location sequence. In this way, environmental factors and the user's historical access information can be comprehensively considered to improve the accuracy of location prediction, which is of great significance to fields such as commercial personalized recommendations and large-scale infectious disease prevention and control.

[0205] Yet another embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed, the method for predicting the user location provided in any of the above embodiments is implemented.

[0206] According to the computer-readable storage medium of this embodiment, by obtaining the user's current moment location data, wherein the current moment location data includes at least user information, user location point information and historical access record information; according to a pre-trained location prediction model, the user's location data at the next moment is determined; wherein the pre-trained location prediction model is obtained by training an initial training model according to the user's historical location sample data to obtain a training result, and the training result is optimized by using a sparrow search algorithm, and the initial training model is established based on a graph neural network model and a bidirectional long short-term memory neural network model. The embodiment of the present application establishes a location prediction model based on a sparrow search algorithm, a graph neural network model and a bidirectional long short-term memory neural network model. The location prediction model has the ability to accurately predict the user's future location based on a historical location sequence. In this way, environmental factors and user historical access information can be comprehensively considered to improve the accuracy of location prediction, which is of great significance to fields such as commercial personalized recommendations and large-scale infectious disease prevention and control.

[0207] It should be noted that the above detailed descriptions are exemplary and are intended to provide further explanation of the present application. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by those of ordinary skill in the art to which the present application belongs.

[0208] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit the exemplary embodiments according to the present application. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should also be understood that when the terms "comprise" and / or "include" are used in this specification, it indicates the presence of features, steps, operations, devices, components and / or combinations thereof.

[0209] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein.

[0210] In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units that are not explicitly listed or inherent to these processes, methods, products, or apparatuses.

[0211] For ease of description, spatially relative terms, such as "above", "above", "on the upper surface of", "above", etc., may be used herein to describe the spatial positional relationship between a device or feature and other devices or features as shown in the figure. It should be understood that spatially relative terms are intended to include different orientations of the device in use or operation in addition to the orientation described in the figure. For example, if the device in the accompanying drawings is inverted, the device described as "above other devices or structures" or "above other devices or structures" will be positioned as "below other devices or structures" or "below other devices or structures". Thus, the exemplary term "above" may include both "above" and "below". The device may also be positioned in other different ways, such as rotated 90 degrees or in other orientations, and the spatially relative descriptions used herein are interpreted accordingly.

[0212] In the above detailed description, reference is made to the accompanying drawings, which form a part of this document. In the accompanying drawings, similar symbols typically identify similar components unless the context indicates otherwise. The illustrated embodiments described in the detailed description, drawings, and claims are not meant to be limiting. Other embodiments may be used, and other changes may be made, without departing from the spirit or scope of the subject matter presented herein.

[0213] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A method for predicting a user location, characterized in that: The method comprises: Acquire the user's current location data, wherein the current location data at least includes user information, user location point information and historical access record information; According to a pre-trained location prediction model, the location data of the user at the next moment is determined; wherein the pre-trained location prediction model is obtained by training an initial training model according to the user's historical location sample data, and optimizing the training result using a sparrow search algorithm, and the initial training model is established based on a graph neural network model and a bidirectional long short-term memory neural network model.

2. The method for predicting a user location according to claim 1, characterized in that: The position prediction model is obtained in the following way: Acquire user historical location sample data, wherein the user historical location sample data at least includes sample user information, sample user location point information, and sample user visit history records; Preprocessing the user's historical location sample data to obtain processed sample data; Inputting the processed sample data into the graph neural network model to obtain representation vectors corresponding to each layer of the graph neural network model; Input the representation vector into the MLP layer for feature fusion to obtain an access vector; Inputting the access vector into the bidirectional long short-term memory neural network model to obtain a model output result, wherein the model output result at least includes user location data at the next moment; Determining a loss function according to the user location data at the next moment and the preset location data; The iterative data of the loss function is optimized according to the sparrow search algorithm to obtain the position prediction model.

3. The method for predicting a user location according to claim 2, characterized in that: The method further comprises: The user's historical location sample data is used to evaluate the prediction results of the location prediction model based on accuracy, precision, recall and F1 value.

4. The method for predicting a user location according to claim 2, characterized in that: The step of inputting the representation vector into the MLP layer for feature fusion to obtain an access vector includes: Based on the sample user location information, the information is embedded into the graph structure, and the nodes and edges are initialized to obtain the graph neural network model; Convert the sample user information into user information in vector form, and input it into a learnable MLP embedding layer to obtain an embedding vector of the sample user information; Input the access time into the learnable MLP embedding layer to obtain the embedding vector of time information; The embedding vector of the sample user information, the embedding vector of the time information and the embedding vector of the sample user location point information are concatenated, and the concatenated result is subjected to feature dimension reduction and fusion processing to obtain the user's access vector.

5. The method for predicting a user location according to claim 4, characterized in that: The bidirectional long short-term memory neural network model is used to perform forward layer processing and reverse layer processing to obtain forward layer processing results and reverse layer processing results, and the forward layer processing results and the reverse layer processing results are merged to obtain context information.

6. The method for predicting a user location according to claim 2, characterized in that: The determining of the loss function according to the user location data at the next moment and the preset location data includes: Calculating the loss value between the user location data at the next moment and the preset location data by using a cross entropy function; The AdamW optimizer is used to iteratively back-propagate the loss value to the position prediction model, and the position prediction model is updated.

7. A device for predicting a user location, characterized in that: The device comprises: An acquisition module, used to acquire the user's current location data, wherein the current location data at least includes user information, user location point information and historical access record information; A prediction module is used to determine the location data of the user at the next moment according to a pre-trained location prediction model; wherein the pre-trained location prediction model is obtained by training an initial training model according to the user's historical location sample data, and optimizing the training result using a sparrow search algorithm, and the initial training model is established based on a graph neural network model and a bidirectional long short-term memory neural network model.

8. The data access control device according to claim 7, characterized in that: The device also includes a model training module, which is used to: Acquire user historical location sample data, wherein the user historical location sample data at least includes sample user information, sample user location point information, and sample user visit history records; Preprocessing the user's historical location sample data to obtain processed sample data; Inputting the processed sample data into the graph neural network model to obtain representation vectors corresponding to each layer of the graph neural network model; Input the representation vector into the MLP layer for feature fusion to obtain an access vector; Inputting the access vector into the bidirectional long short-term memory neural network model to obtain a model output result, wherein the model output result at least includes user location data at the next moment; Determining a loss function according to the user location data at the next moment and the preset location data; The iterative data of the loss function is optimized according to the sparrow search algorithm to obtain the position prediction model.

9. A terminal device, characterized in that: include: at least one processor and memory; The memory stores a computer program; The at least one processor executes the computer program stored in the memory to implement the method for predicting a user position according to any one of claims 1 to 6.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed, the method for predicting the user position according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Cooperative positioning method for simultaneous positioning and tracking

    CN114501310A

  • Neural network forecasting method for navigation satellite clock error data

    CN116976393A

  • CSI indoor positioning method and device based on graph neural network

    CN117939402A

  • Trajectory prediction method and device for moving target

    CN118397037A

  • Partitioning Information In Neural Network-Based Video Coding

    US20230051066A1

Cited By

  • Wireless signal optimization method and electronic equipment

    CN120151866A

  • A wireless signal optimization method and electronic device

    CN120151866B