Method and device for optimizing frequent movement mode based on graph neural network
Through the method based on graph neural network, graph neural network is constructed and trained to process frequent trajectory data, which solves the problem of low computational efficiency in traditional algorithms when processing large-scale data, and realizes more efficient data processing and analysis.
Patent Information
- Application Number
- CN202510371012.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-27
- Publication Date
- 2025-04-25
AI Technical Summary
When traditional frequent trajectory data mining algorithms process large-scale geographical network structures and massive population trajectory data, there are problems such as low computing efficiency, poor real-time performance and slow response speed.
Using a graph neural network-based method, by constructing a graph neural network, the training data is converted into a target graph sub-graph set, and the graph neural network is trained using a loss function to obtain a frequently moving mode node set.
It improves computing efficiency, breaks through the limitations of insufficient efficiency of traditional data analysis methods, and can more efficiently process complex geographical network structures and large-scale population trajectory data.
Smart Images

Figure CN119886205A_ABST
Abstract
Description
Technical Field
[0001] The present invention generally relates to the technical field of geospatial data mining and analysis, and more specifically, to an optimization method and device for frequent movement patterns based on a graph neural network. Background Art
[0002] With the acceleration of urbanization and the rapid development of information technology, population trajectory data has exploded. Population trajectory data records the location changes of individuals in the time dimension, forming a rich map of mobile behavior. In-depth mining of frequent mobile behaviors in trajectory data can not only reveal the habits and rules of daily activities of social groups, but also predict possible future mobility trends, thereby providing reference for urban planning, public transportation system optimization, and medical resource allocation.
[0003] Mining frequently occurring population mobility behaviors from the explosively growing population trajectory data plays an irreplaceable role in decision-making support for improving urban management efficiency, ensuring public safety, and promoting economic development. Frequent trajectory data mining plays an indispensable role in urban management and public safety. Traditional frequent trajectory data mining is mostly based on rules or statistical models.
[0004] However, traditional algorithms have certain limitations when it comes to frequent trajectory data mining. When faced with a large geographic network structure and massive population trajectory data, due to the huge amount of computation, traditional algorithms are difficult to efficiently process large-scale data sets, so they have problems such as poor real-time performance, slow response speed and low computational efficiency. Summary of the invention
[0005] According to an embodiment of the present invention, an optimization scheme for frequent movement patterns based on graph neural networks is provided. This scheme can fully utilize the advantages of graph neural networks, improve computing efficiency, and break through the limitations of traditional data analysis methods in terms of inefficiency.
[0006] In a first aspect of the present invention, a method for optimizing frequent movement patterns based on a graph neural network is provided. The method comprises: Acquiring target trajectory data, wherein the target trajectory data includes training data; Constructing a graph neural network, converting the training data into a target graph subgraph set, using the target graph subgraph set, training the graph neural network according to the loss function of the graph neural network, and obtaining an objective function of the graph neural network; A frequent movement pattern node set is obtained based on the target graph subgraph set, and then the frequent movement pattern node set is updated according to the objective function of the graph neural network to obtain a frequent movement pattern.
[0007] Furthermore, the graph neural network includes: a preprocessing module, an aggregation module, a splicing module and a partial order embedding module; The preprocessing module is used to convert the training data into a target graph and decompose the target graph into a set of target graph subgraphs; The aggregation module is used to take each target graph subgraph in the target graph subgraph set as input and obtain an embedding vector of each target graph subgraph through an aggregation function; The splicing module is used to splice the embedding vectors of all target graph subgraphs into an embedding vector matrix; The partial order embedding module is used to obtain the objective function of partial order embedding based on the embedding vector matrix, and use the objective function of partial order embedding as the output of the graph neural network.
[0008] Furthermore, taking each target graph subgraph in the target graph subgraph set as input and obtaining an embedding vector of each target graph subgraph through an aggregation function includes: Based on the target graph subgraph, a central node of the target graph subgraph is obtained, a set of adjacent nodes of the target graph subgraph is obtained according to the central node, and then a feature of each adjacent node of the target graph subgraph in the set of adjacent nodes of the target graph subgraph is extracted; Aggregating the features of the target graph subgraph adjacent node set through the aggregation function of the graph neural network to obtain an aggregation result; The aggregation result is updated by using an update function of the graph neural network to obtain an embedding vector of the target graph subgraph; The aggregation result is: ; The embedding vector of the target graph subgraph is: ; in, is an aggregate function; is the central node of the target graph subgraph; is the set of adjacent nodes of the central node u of the target graph subgraph; is the aggregation result of the central node u of the target graph subgraph at the kth layer; is a node; is the embedding vector of the neighboring node v of the central node u of the target graph subgraph at the k-1 layer; is the embedding vector of the central node of the target graph at the kth layer; is the update function; It is the aggregation result of the central node u of the target graph subgraph at the k-1th layer.
[0009] Furthermore, the graph neural network further includes a conditional judgment module, which is used to constrain the aggregation module through an embedded conditional judgment function of the conditional judgment module; The embedded condition judgment function is: ; Where D is the dimension of the embedding vector; is the embedding vector of the central node of the target graph at the kth layer; is the embedding vector of the subgraph center node of the target graph subgraph at the kth layer; is the index of the embedding vector dimension.
[0010] Furthermore, the objective function of partial order embedding is obtained based on the embedding vector matrix, including: Randomly select two embedding vectors from the embedding vector matrix, and calculate the maximum square distance between every two embedding vectors; The objective function of partial order embedding is constructed by the maximum square distance.
[0011] Furthermore, constructing the objective function of partial order embedding through the maximum square distance includes: ; ; in, is the first embedded object; is the second embedded object; To embed in space and The maximum square distance of is the inner product of the first embedding vector; is the inner product of the second embedding vector; is the inner product of the third embedding vector; T is the objective function of partial order embedding; A is the inner product matrix of partial order embedding.
[0012] Furthermore, the construction process of the loss function of the graph neural network is: Obtaining a corresponding query graph according to each target graph subgraph in the target graph subgraph set, and then constructing a loss function based on the query graph; The loss function is: ; ; in, is the loss function; is the embedding vector of the target graph subgraph; is the embedding vector of the query graph; P is the set of positive samples of the query graph; N is the set of negative samples of the query graph; α is the boundary value between positive and negative samples; To the extent that the embedding conditions are not met.
[0013] Further, a frequent movement pattern node set is obtained based on the target graph subgraph set, and then the frequent movement pattern node set is updated according to the objective function of the graph neural network to obtain a frequent movement pattern, including: Calculating the probability distribution of all target graph subgraphs in the target graph subgraph set to obtain the probability distribution of the target graph; According to the probability distribution of the target graph, extracting nodes with the highest probability from the training data to obtain a starting node set; Initializing a frequent movement pattern node set through the starting node set, the frequent movement pattern node set including an adjacent node set, a frontier node set and a visited node set; Based on the objective function of the graph neural network, a model embedding vector of the starting node set and a candidate node embedding vector of the access node set are obtained, and then a score result is calculated using the model embedding vector and the candidate node embedding vector; The lowest score is selected from the score results, the frequent movement pattern node set is iteratively updated, and the updated frequent movement pattern node set is used as the frequent movement pattern.
[0014] In a second aspect of the present invention, a device for optimizing frequent movement patterns based on a graph neural network is provided. The device comprises: An acquisition module, used for acquiring target trajectory data, wherein the target trajectory data includes training data; A construction module is used to construct a graph neural network, convert the training data into a target graph subgraph set, and use the target graph subgraph set to train the graph neural network according to the loss function of the graph neural network to obtain an objective function of the graph neural network; An updating module is used to obtain a frequent movement pattern node set based on the target graph subgraph set, and then update the frequent movement pattern node set according to the objective function of the graph neural network to obtain a frequent movement pattern.
[0015] It should be understood that the contents described in the summary of the invention are not intended to limit the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The above and other features, advantages and aspects of the embodiments of the present invention will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. In the accompanying drawings, the same or similar reference numerals represent the same or similar elements, wherein: Figure 1 A flowchart of a method for optimizing frequent movement patterns based on a graph neural network according to an embodiment of the present invention is shown; Figure 2A block diagram of an aggregation module of a graph neural network according to an embodiment of the present invention is shown; Figure 3 A block diagram of a partial order embedding module of a graph neural network according to an embodiment of the present invention is shown; Figure 4 A block diagram of updating a frequent movement pattern node set according to an embodiment of the present invention is shown; Figure 5 A block diagram of an optimization device for frequent movement patterns based on a graph neural network according to an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0017] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0018] In addition, the term "and / or" in this article is only a description of the association relationship between the associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0019] In the present invention, a graph neural network is constructed through the training data of the target trajectory data, a target graph subgraph set is obtained based on the training data, and then the target graph subgraph set is used to train the graph neural network according to the loss function of the graph neural network to obtain the target function of the graph neural network; a frequent movement pattern node set is obtained based on the target graph subgraph set, and then the frequent movement pattern node set is updated according to the target function of the graph neural network to obtain the frequent movement pattern. In this way, complex geographic network structures and massive population trajectory data can be processed more efficiently.
[0020] Figure 1 A flowchart of an optimization method for frequent movement patterns based on a graph neural network according to an embodiment of the present invention is shown.
[0021] The method includes: S101. Acquire target trajectory data, where the target trajectory data includes training data.
[0022] In this embodiment, the target trajectory data refers to population trajectory data, which is information about the geographic location movement of individuals or groups within a certain period of time collected through existing technologies and methods. The existing technologies include but are not limited to mobile phone signals, GPS positioning, social media check-ins, transportation card records, camera monitoring, application software, and questionnaires.
[0023] Specifically, population trajectory data has the characteristics of spatiotemporal continuity, dynamics, and large-scale. The above characteristics record the movement paths of individuals or groups in time and space, and can reflect people's travel habits, activity patterns, and aggregation patterns. The characteristics of population trajectory data are that by summarizing the changes in the geographical location of individuals or groups in a specific time period, the spatiotemporal continuity and dynamic changes they have, they reveal the travel patterns, daily activity patterns, and the trends of crowd aggregation and dispersion. For example, QGIS (Quantum Geographic Information System, a free desktop GIS software) and visual interpretation are used to summarize the characteristics of population trajectory data.
[0024] S102. Construct a graph neural network, convert the training data into a target graph subgraph set, use the target graph subgraph set to train the graph neural network according to the loss function of the graph neural network, and obtain the target function of the graph neural network.
[0025] In this embodiment, the graph neural network includes: a preprocessing module, an aggregation module, a splicing module and a partial order embedding module.
[0026] The preprocessing module is used to convert the training data into a target graph and decompose the target graph into a set of target graph subgraphs.
[0027] In this embodiment, converting the training data into a target graph is to convert the training data into a graph structure by existing technical means to obtain a target graph, wherein the technical means include but are not limited to professional processing software and code compilation software, such as PyCharm (Python integrated development environment).
[0028] The aggregation module is used to take each target graph subgraph in the target graph subgraph set as input and obtain the embedding vector of each target graph subgraph through an aggregation function, such as Figure 2 As shown, including: S201, based on the target graph subgraph, obtain the central node of the target graph subgraph, obtain the target graph subgraph adjacent node set according to the central node, and then extract the features of each target graph subgraph adjacent node in the target graph subgraph adjacent node set. The specific process is as follows: (1) For each target graph subgraph in the target graph subgraph set, with the central node u∈GT of each target graph subgraph as the center, a k-hop subnetwork Gu is extracted around the central node u. The subnetwork Gu includes the subgraph central node u and all nodes within k-hop and the edges between them. Among them, k-hop is the set of nodes that the central node u can reach within k steps. For example, 1-hop refers to all adjacent nodes obtained after node u moves one step, that is, the set of adjacent nodes of node u.
[0029] As some optional implementations of this embodiment, it is assumed that the specific data of the target graph GT is represented as follows:
[0030] ; Among them, ('A', 'B') means that node A and node B are connected to each other, and the rest is the same as above.
[0031] Assume that the central node u is node B, and extract the 2-hop subnetwork Gu from the central node B. The specific extraction process is as follows: (1) Layer 0 (k=0): The central node B is the only node in layer 0, that is, the central node B is an isolated node.
[0032] (2) Layer 1 (k=1): All nodes obtained by moving one step from the central node B include A, C, and E.
[0033] (3) Layer 2 (k = 2): All nodes that can be reached by moving one step from the nodes in the first layer but have not yet been visited include D, F, G, and H.
[0034] The 2-hop subnetwork Gu extracted by the above steps (1)-(3) contains nodes {'B', 'A', 'C', 'E', 'D', 'F', 'G', 'H'} and all edges between these nodes. The hierarchical structure of the 2-hop subnetwork Gu is: Layer 0: {'B'}.
[0035] Layer 1: {'A', 'C', 'E'}.
[0036] Layer 2: {'D', 'F', 'G', 'H'}.
[0037] (2) Extracting features of each node in the adjacent node set of the target graph subgraph, where the node features are initial features. The initial features can be original features or generated by random initialization.
[0038] Specifically, the original features refer to node attributes that are obtained directly from the data without being processed or converted, such as the degree, label or other attributes of the node, and the graph structure refers to the connection method between the nodes. In this embodiment, the original features are obtained by embedding each Gu using a graph neural network. The embedding refers to the process of converting high-dimensional, complex input data into a lower-dimensional, continuous vector space representation. The embedding of this embodiment refers to the node features and graph structure of the embedded Gu. The original features are usually used to initialize the node representation in the graph neural network, and can be directly input into the model as the initial embedding vector of the node, or used after some preprocessing steps (such as normalization).
[0039] As some optional implementations of this embodiment, assuming that each node is represented by a simple feature vector with a number, the original feature of each node is: A: [1], B: [2], C: [3], D: [4], E: [5], F: [6], G: [7], H: [8].
[0040] As some optional implementations of this embodiment, the random initialization generation method may be one of the following: (1) Uniform distribution: The value of each feature dimension is randomly drawn from a uniform distribution within a specified range. The uniform distribution can be implemented by the corresponding function in the programming language, such as Python's numpy.random.uniform.
[0041] (2) Normal distribution (Gaussian distribution): The values on each feature dimension are randomly drawn from a normal distribution with a specific mean and variance. The normal distribution is implemented by the corresponding function in the programming language, such as Python's numpy.random.normal.
[0042] S202. Aggregate the features of the target graph subgraph adjacent node set through the aggregation function of the graph neural network to obtain an aggregation result.
[0043] The aggregation result is: ; in, is an aggregate function; is the central node of the target graph subgraph; is the set of adjacent nodes of the central node u of the target graph subgraph; is the aggregation result of the central node u of the target graph subgraph at the kth layer; is a node; is the embedding vector of the neighboring node v of the central node u of the target graph subgraph at the k-1 layer; is the embedding vector of the central node of the target graph at the kth layer.
[0044] As some optional implementations of this embodiment, based on the specific data edges of the target graph GT, for the new features of node B in edges, assuming that the adjacent nodes of node B are A, C, and E, and the adjacent nodes of nodes A, C, and E are D, F, and G, the specific aggregation process is as follows: (1) First-level aggregation: According to the aggregation function, the average of the features of node B’s neighboring nodes A, C, and E is taken as the first new feature of node B: , the first new feature of node B is used as the first aggregation result of node B.
[0045] (2) Second-level aggregation: According to the aggregation function, the average value of the features D, F, and G of the adjacent nodes of nodes A, C, and E is taken as the second new feature of node B: , the second new feature of node B is used as the second aggregation result of node B.
[0046] S203. Update the aggregation result through the update function of the graph neural network to obtain the embedding vector of the target graph subgraph.
[0047] The embedding vector of the target graph subgraph is: ; in, is the update function; It is the aggregation result of the central node u of the target graph subgraph at the k-1th layer.
[0048] Specifically, the update function Usually, a relatively simple nonlinear activation function (such as ReLU (Rectified Linear Unit, rectified linear unit) function, etc.) is used to update the features of the nodes, which enables each target subgraph central node to continuously aggregate the features of the adjacent node set of the corresponding target graph subgraph. The number of layers k of the GNN determines the range of node feature aggregation. Each additional layer of nodes can receive the features of the combination of more distant adjacent nodes, but the computational complexity will also increase. Therefore, in this embodiment, the number of layers is selected to be 5, so that this embodiment can fully capture the context information while avoiding excessive computational burden.
[0049] As some optional implementations of this embodiment, based on the specific data edges of the target graph GT, Assuming that the activation function is 2, the process of updating the aggregation result of node B in edges using the update function is as follows: (1) Use the update function to update the first aggregation result of node B: , after updating, the first feature of node B is [4, 6].
[0050] (2) Use the update function to update the second aggregation result of node B: , after updating, the second feature of node B is [8, 12, 8.34], and the second feature of node B is used as the embedding vector of node B.
[0051] The aggregation module enables each node to capture local structural information and propagate long-distance dependencies, thereby enhancing representation capabilities; at the same time, smoothing and translation invariance during the aggregation process ensure the stability and generalization of the model. At the same time, the aggregation module supports efficient use of computing resources and can be flexibly adjusted according to different tasks, suitable for a variety of application scenarios from simple to complex. In short, the aggregation module not only refines the node feature representation, but also significantly improves the performance and accuracy of graph neural networks in understanding complex graph data.
[0052] The splicing module is used to splice the embedding vectors of all target graph subgraphs into an embedding vector matrix.
[0053] The partial order embedding module, such as Figure 3 As shown, it is used to obtain the objective function of partial order embedding based on the embedding vector matrix, and the objective function of partial order embedding is used as the output of the graph neural network, including: S301. Randomly select two embedding vectors from the embedding vector matrix, and calculate the maximum square distance between every two embedding vectors.
[0054] S302, constructing a partial order embedding objective function through the maximum square distance, including: ; ; in, is the first embedded object; is the second embedded object; To embed in space and The maximum square distance of is the inner product of the first embedding vector; is the inner product of the second embedding vector; is the inner product of the third embedding vector; T is the objective function of partial order embedding; A is the inner product matrix of partial order embedding.
[0055] In this embodiment, it is necessary to calculate the maximum square distance between every two embedded vectors in the embedded vector matrix.
[0056] As some optional implementations of this embodiment, based on the specific data edges of the target graph GT, For the embedding vector [8, 12, 8.34] of node B and the embedding vector [4, 12, 8.25] of node A in edges, the inner product of the embedding vectors of node A and node B, as well as the inner product of each other (the inner product refers to the multiplication of the corresponding areas of the vectors and the addition of the results) are calculated. Then, the maximum square distance between node A and node B is calculated based on the inner product of the embedding vector of node A, the inner product of the embedding vector of node B, and the inner product of each other. Finally, the objective function of partial order embedding is obtained. The specific calculation process is as follows: (1) The inner product of the embedding vector of node B is: .
[0057] (2) The inner product of the embedding vector of node A is: .
[0058] (3) The inner product of the embedding vector of node A and the embedding vector of node B is: .
[0059] (4) The maximum square distance between node A and node B is: .
[0060] (5) According to steps (1)-(4), the maximum square distance between every two nodes is obtained, and the objective function of partial order embedding is obtained as: .
[0061] The partial order embedding module obtains the objective function of partial order embedding based on the embedding vector matrix, which can capture the hierarchical information between nodes, enhance the model's ability to distinguish subtle differences, and improve generalization performance. It not only supports the modeling of complex relationships and the interpretability of results, but also optimizes the utilization of computing resources.
[0062] After the graph neural network introduces the partial order embedding module, it can enhance the model's understanding of the hierarchical structure in complex networks and its ability to distinguish subtle differences, which can significantly improve the model's generalization performance and its ability to support complex relationship modeling. By introducing partial order constraints, the model can capture the hierarchical information between nodes, improve the interpretability of the results, and optimize the use of computing resources.
[0063] In this embodiment, the graph neural network further includes a condition judgment module, which is used to constrain the aggregation module through an embedded condition judgment function of the condition judgment module; The embedded condition judgment function is: ; Where D is the dimension of the embedding vector; is the embedding vector of the central node of the target graph at the kth layer; is the embedding vector of the subgraph center node of the target graph subgraph at the kth layer; is the index of the embedding vector dimension.
[0064] Specifically, the embedding vector of the subgraph of the target graph is Embedding vector of the target graph subgraph .
[0065] The conditional judgment function can ensure that the subgraph relationship can be preserved in the embedded space, so that the subgraph relationship in the embedded space can be judged by comparing geometric properties. The aggregation module is constrained by the conditional judgment function, so that the optimized graph neural network can accurately control the information propagation path, enhance the model flexibility and computational efficiency, improve the robustness of the model and the ability to model complex relationships, reduce noise interference, concentrate resources on the most critical information transmission, and promote the interpretability of the results, making GNN more robust and efficient in a variety of application scenarios.
[0066] In this embodiment, the process of constructing the loss function of the graph neural network is: According to each target graph subgraph in the target graph subgraph set, its corresponding query graph is obtained, and then a loss function is constructed based on the query graph.
[0067] Specifically, the query graph is divided into positive samples and negative samples; positive samples are obtained by sampling the central nodes and edges of the target graph subgraph; negative samples are obtained by adding edges, adding nodes, removing edges, removing nodes, etc. based on the positive samples.
[0068] As some optional implementations of this embodiment, based on the specific data edges of the target graph GT, The process of obtaining positive samples and negative samples is as follows: (1) The process of obtaining positive samples is as follows: select the central node and the target graph subgraph in the edges.
[0069] Select the central node of the target graph subgraph: randomly select one or more nodes as the central nodes, for example, select node B as the central node.
[0070] Construct the target graph subgraph: Starting from the central node B, sample and obtain the subgraph within a certain range (such as 1-hop or 2-hop). For node B, construct a 1-hop subgraph.
[0071] Assume that the central node of the 1-hop subgraph is B, the adjacent nodes are A, C, E, and the edge list is , the positive samples can be subgraphs containing these nodes and edges.
[0072] (2) The process of obtaining negative samples is as follows: negative samples can be generated by modifying positive samples. Specific operations include adding edges, adding nodes, removing edges, removing nodes, etc.
[0073] Assume that the node set of positive samples is , the transformation list of positive samples is .
[0074] Add Edge: Add an edge , then the new edge list is .
[0075] Add node: Add node Z. After adding node Z, you need to add the edges associated with it. , then the new node set is , the new edge list is .
[0076] Remove Edge: Removes an edge , then the new edge list is .
[0077] Remove point: Remove node C. After removing node C, remove all edges associated with it. The new node set is , the new edge list is .
[0078] In this embodiment, the loss function is: ; ; in, is the loss function; is the embedding vector of the central node of the target graph at the kth layer; is the embedding vector of the central node of the query graph at the kth layer; P is the set of positive samples of the query graph; N is the set of negative samples of the query graph; α is the boundary value between positive and negative samples; To the extent that the embedding conditions are not met.
[0079] Specifically, the embedding condition for the positive sample of the query graph is: ; The embedding condition of negative samples of the query graph is .
[0080] By constructing a loss function through the query graph and using the loss function to train the graph neural network, we can strengthen the model's goal-oriented learning, improve generalization performance and expressiveness, optimize the utilization of computing resources, and promote the interpretability of the results.
[0081] S103, obtaining a frequent movement pattern node set based on the target graph subgraph set, and then updating the frequent movement pattern node set according to the objective function of the graph neural network to obtain a frequent movement pattern, such as Figure 4 As shown, including: S401, calculating the probability distribution of all target graph subgraphs in the target graph subgraph set to obtain the probability distribution of the target graph, including: ; in, For the m The number of nodes in the target graph subgraph; is the total number of subgraph sets of the target graph; For the m The probability distribution of the target graph subgraphs.
[0082] As some optional implementations of this embodiment, based on the subgraph within the 2-hop range of the specific data edges of the target graph GT, starting from node I, the following subgraph can be constructed: son Figure 1 : Contains nodes and edge .
[0083] son Figure 2 : Contains nodes and edge . ...... Subgraph n (until the entire target graph is covered).
[0085] Assume that after sampling, 10 subgraphs are obtained, and the total number of nodes in the 10 subgraphs is 100 nodes. Figure 1 The probability distribution is 3 / 100.
[0086] S402: According to the probability distribution of the target graph, extract the node with the highest probability from the training data to obtain a starting node set.
[0087] As some optional implementations of this embodiment, the largest probability subgraph is selected according to the probability distribution. Figure 1 is the largest probability subgraph, because Figure 1 It is a subgraph constructed starting from node I, so according to the maximum probability principle, node I is selected as the starting node.
[0088] S403: Initializing a frequent movement mode node set through the starting node set, wherein the frequent movement mode node set includes an adjacent node set, a front node set and a visited node set, including: ; Among them, is the set of adjacent nodes; is the frontier node set; is the set of access nodes; is the starting node set.
[0089] Specifically, the starting node set Initially, it only contains the starting node set; the frontier node set Initially, it only contains the starting node set; access node set Initially only the starting node set is included.
[0090] As some optional implementations of this embodiment, it is assumed that the starting node For I, the set of frequently moving pattern nodes initialized is: Adjacent node set : Contains all nodes directly connected to I, i.e., {'J', 'L'}.
[0091] Frontier Node Collection : Initially, only the starting node I is included.
[0092] Accessing a node collection : Initially, only the starting node I is included.
[0093] S404: Based on the objective function of the graph neural network, the model embedding vector of the starting node set and the candidate node embedding vector of the access node set are obtained, and then the score result is calculated by the model embedding vector and the candidate node embedding vector. The specific calculation formula is: ; in, For the score result; is the batch of embedding vectors; is the index of the batch of embedding vectors; U is the model output dimension; is the index of the model output dimension; p is the model prediction result; emb b is the model embedding vector; cand is the candidate node embedding vector.
[0094] As some optional implementations of this embodiment, assuming that the embedding vector batch R=2 and the model output dimension K=3, for each batch, a model embedding vector and a candidate node embedding vector of the access node set are generated. The prediction result p of the model can be expressed as a matrix, in which each row corresponds to the prediction result of a candidate node.
[0095] For each output dimension k, find the index j corresponding to the maximum value: k = 1, maximum value 0.8, j = 2; k = 2, maximum value 0.6, j = 3; k = 3, maximum value 0.7, j = 1. Accumulate the above maximum values and repeat this process for all batches, and finally take the negative sign to get the final score S.
[0096] S405, selecting the lowest score in the score results, iteratively updating the frequent movement pattern node set, and using the updated frequent movement pattern node set as the frequent movement pattern. The specific updating formula is: ; in, is the updated adjacent node set; is the updated frontier node set; is the updated access node set; is the set of nodes with the best score.
[0097] As some optional implementations of this embodiment, assuming that after the scoring results are obtained in S404, J has the lowest score, the updated frequent movement pattern node set is: Adjacent node set : Contains all nodes directly connected to J, that is, .
[0098] Frontier Node Collection : Remove I and add node J.
[0099] Accessing a node collection : Add J to the access node .
[0100] Specifically, the iterative process is: obtain the corresponding target graph subgraph set according to the updated frequent mobile pattern node set, and use it as input to iteratively execute S401~S405 until there are no nodes that can be traversed or the node number requirement of the frequent subgraph pattern is reached (which can be set according to needs, 5 in this example), and the frequent mobile pattern node set obtained after the iteration is used as the frequent mobile pattern.
[0101] According to an embodiment of the present invention, the representation of nodes, edges and the entire graph is learned through message passing between nodes, and the complex network graph data is efficiently processed and analyzed through the message passing mechanism between nodes to capture its structure and characteristics, thereby improving computing efficiency.
[0102] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the described order of actions, because according to the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present invention.
[0103] The above is an introduction to a method embodiment. The following is a further explanation of the scheme of the present invention through a device embodiment having the same inventive concept as the method in the aforementioned embodiment.
[0104] like Figure 5 As shown, the device 500 includes: The acquisition module 510 is used to acquire target trajectory data, where the target trajectory data includes training data.
[0105] Construction module 520 is used to construct a graph neural network, convert the training data into a target graph subgraph set, use the target graph subgraph set to train the graph neural network according to the loss function of the graph neural network, and obtain the target function of the graph neural network.
[0106] The updating module 530 is used to obtain a frequent movement pattern node set based on the target graph subgraph set, and then update the frequent movement pattern node set according to the objective function of the graph neural network to obtain a frequent movement pattern.
[0107] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the described module can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0108] In the technical solution of the present invention, the acquisition, storage and application of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0109] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0110] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for optimizing frequent movement patterns based on graph neural networks, characterized in that: include: Acquiring target trajectory data, wherein the target trajectory data includes training data; Construct a graph neural network, convert the training data into a target graph subgraph set, use the target graph subgraph set, train the graph neural network according to the loss function of the graph neural network, and obtain the target function of the graph neural network; the graph neural network includes: a preprocessing module, an aggregation module, a splicing module and a partial order embedding module; the preprocessing module is used to convert the training data into a target graph and decompose the target graph into a target graph subgraph set; the aggregation module is used to take each target graph subgraph in the target graph subgraph set as input and obtain the embedding vector of each target graph subgraph through the aggregation function; the splicing module is used to splice the embedding vectors of all target graph subgraphs into an embedding vector matrix; the partial order embedding module is used to obtain the target function of partial order embedding based on the embedding vector matrix, and use the target function of partial order embedding as the output of the graph neural network; The step of taking each target graph subgraph in the target graph subgraph set as input and obtaining an embedding vector of each target graph subgraph through an aggregation function includes: Based on the target graph subgraph, the central node of the target graph subgraph is obtained, the target graph subgraph adjacent node set is obtained according to the central node, and then the features of each target graph subgraph adjacent node in the target graph subgraph adjacent node set are extracted; the features of the target graph subgraph adjacent node set are aggregated by the aggregation function of the graph neural network to obtain an aggregation result; the aggregation result is updated by the update function of the graph neural network to obtain an embedding vector of the target graph subgraph; The aggregation result is: ; The embedding vector of the target graph subgraph is: in, is an aggregate function; is the central node of the target graph subgraph; is the set of adjacent nodes of the central node u of the target graph subgraph; is the aggregation result of the central node u of the target graph subgraph at the kth layer; is a node; is the embedding vector of the neighboring node v of the central node u of the target graph subgraph at the k-1 layer; is the embedding vector of the central node of the target graph at the kth layer; is the update function; is the aggregation result of the central node u of the target graph subgraph at the k-1 layer; Obtaining a frequent movement pattern node set based on the target graph subgraph set, and then updating the frequent movement pattern node set according to the objective function of the graph neural network to obtain a frequent movement pattern, including: Calculate the probability distribution of all target graph subgraphs in the target graph subgraph set to obtain the probability distribution of the target graph; extract the node with the highest probability from the training data according to the probability distribution of the target graph to obtain the starting node set; initialize the frequent mobile pattern node set through the starting node set, and the frequent mobile pattern node set includes an adjacent node set, a frontier node set and a visited node set; based on the objective function of the graph neural network, obtain the model embedding vector of the starting node set and the candidate node embedding vector of the visited node set, and then calculate the scoring result through the model embedding vector and the candidate node embedding vector; select the lowest score in the scoring result, iteratively update the frequent mobile pattern node set, and use the updated frequent mobile pattern node set as the frequent mobile pattern.
2. The method according to claim 1, characterized in that The graph neural network also includes a conditional judgment module, which is used to constrain the aggregation module through an embedded conditional judgment function of the conditional judgment module; The embedded condition judgment function is: Where D is the dimension of the embedding vector; is the embedding vector of the central node of the target graph at the kth layer; is the embedding vector of the subgraph center node of the target graph subgraph at the kth layer; is the index of the embedding vector dimension.
3. The method according to claim 1, characterized in that The objective function of partial order embedding is obtained based on the embedding vector matrix, including: Randomly select two embedding vectors from the embedding vector matrix, and calculate the maximum square distance between every two embedding vectors; The objective function of partial order embedding is constructed by the maximum square distance.
4. The method according to claim 3, characterized in that: The objective function of partially order embedding is constructed by the maximum square distance, comprising: ; ; in, is the first embedded object; is the second embedded object; To embed in space and The maximum square distance of is the inner product of the first embedding vector; is the inner product of the second embedding vector; is the inner product of the third embedding vector; T is the objective function of partial order embedding; A is the inner product matrix of partial order embedding.
5. The method according to claim 1, characterized in that The construction process of the loss function of the graph neural network is: Obtaining a corresponding query graph according to each target graph subgraph in the target graph subgraph set, and then constructing a loss function based on the query graph; The loss function is: ; ; in, is the loss function; is the embedding vector of the central node of the target graph at the kth layer; is the embedding vector of the central node of the query graph at the kth layer; P is the set of positive samples of the query graph; N is the set of negative samples of the query graph; α is the boundary value between positive and negative samples; To the extent that the embedding conditions are not met.
6. An optimization device for frequent movement patterns based on graph neural networks, characterized in that: include: An acquisition module, used for acquiring target trajectory data, wherein the target trajectory data includes training data; A construction module is used to construct a graph neural network, convert the training data into a target graph subgraph set, use the target graph subgraph set, train the graph neural network according to the loss function of the graph neural network, and obtain the target function of the graph neural network; the graph neural network includes: a preprocessing module, an aggregation module, a splicing module and a partial order embedding module; the preprocessing module is used to convert the training data into a target graph and decompose the target graph into a target graph subgraph set; the aggregation module is used to take each target graph subgraph in the target graph subgraph set as input and obtain the embedding vector of each target graph subgraph through the aggregation function; the splicing module is used to splice the embedding vectors of all target graph subgraphs into an embedding vector matrix; the partial order embedding module is used to obtain the target function of partial order embedding based on the embedding vector matrix, and use the target function of partial order embedding as the output of the graph neural network; The step of taking each target graph subgraph in the target graph subgraph set as input and obtaining an embedding vector of each target graph subgraph through an aggregation function includes: Based on the target graph subgraph, the central node of the target graph subgraph is obtained, the target graph subgraph adjacent node set is obtained according to the central node, and then the features of each target graph subgraph adjacent node in the target graph subgraph adjacent node set are extracted; the features of the target graph subgraph adjacent node set are aggregated by the aggregation function of the graph neural network to obtain an aggregation result; the aggregation result is updated by the update function of the graph neural network to obtain an embedding vector of the target graph subgraph; The aggregation result is: ; The embedding vector of the target graph subgraph is: in, is an aggregate function; is the central node of the target graph subgraph; is the set of adjacent nodes of the central node u of the target graph subgraph; is the aggregation result of the central node u of the target graph subgraph at the kth layer; is a node; is the embedding vector of the neighboring node v of the central node u of the target graph subgraph at the k-1 layer; is the embedding vector of the central node of the target graph at the kth layer; is the update function; is the aggregation result of the central node u of the target graph subgraph at the k-1 layer; An updating module, used to obtain a frequent movement pattern node set based on the target graph subgraph set, and then update the frequent movement pattern node set according to the objective function of the graph neural network to obtain a frequent movement pattern, including: Calculate the probability distribution of all target graph subgraphs in the target graph subgraph set to obtain the probability distribution of the target graph; extract the node with the highest probability from the training data according to the probability distribution of the target graph to obtain the starting node set; initialize the frequent mobile pattern node set through the starting node set, and the frequent mobile pattern node set includes an adjacent node set, a frontier node set and a visited node set; based on the objective function of the graph neural network, obtain the model embedding vector of the starting node set and the candidate node embedding vector of the visited node set, and then calculate the scoring result through the model embedding vector and the candidate node embedding vector; select the lowest score in the scoring result, iteratively update the frequent mobile pattern node set, and use the updated frequent mobile pattern node set as the frequent mobile pattern.