An interpretable source localization method from coarse to fine granularity
By constructing an interpretable source localization model and combining graph diffusion fusion technology and transformer encoder, the computational burden and low efficiency of source localization of misinformation in social media networks are solved, achieving efficient, accurate and interpretable source localization.
Patent Information
- Application Number
- CN202411791697.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-06
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2044-12-06
AI Technical Summary
Existing methods for locating sources of misinformation in social media networks suffer from high computational burden, low computational efficiency, and insufficient interpretability, making it particularly difficult to achieve efficient and accurate source location in real-time scenarios.
An interpretable source localization method from coarse-grained to fine-grained is adopted. By constructing an interpretable source localization model, including a general feature extractor, a coarse-to-fine converter and a post-processing module, a global view of the social network is obtained by using graph diffusion fusion technology. Feature extraction and interaction are performed by combining a transformer encoder to reduce computational complexity, and the interpretability of the model is improved by using a kernelized attention module.
It achieves efficient parallel computing while generating interpretable diffusion interpretations, improving the accuracy and interpretability of source localization, avoiding cascading errors, and realizing efficient end-to-end source localization.
Smart Images

Figure CN119739900B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data processing, and particularly relates to a coarse-to-fine interpretable source localization method. BACKGROUND
[0002] Social media networks are ubiquitous in contemporary society, with users represented as nodes and relationships between users represented as edges. However, in addition to benign social interactions, these networks facilitate the spread of misinformation and disinformation, which can have adverse effects. For example, some pandemic infections are accompanied by a large amount of misinformation spread on social media platforms, which can hinder the public from obtaining authentic guidelines to avoid infection of the pandemic. Therefore, it is crucial to our daily life to identify the sources of disinformation spread on social networks through graph analysis techniques. Existing signal source localization methods can be divided into three categories: (1) methods that utilize sensor observations, (2) methods that can obtain a complete infection graph, and (3) methods that utilize multiple infection snapshots (same graph with different timestamps). In practice, deploying sensors to collect high-fidelity observations requires a large amount of time and resource cost. Moreover, recent studies show that methods that rely on complete infection graphs suffer from an ill-posed problem because multiple potential sources can produce the same infection graph. Two sources can produce a completely identical infected graph. It is different from traditional (semi-) supervised tasks, where the correct label for the same input can be diverse. Therefore, with multiple snapshot information, the source localization problem can reduce the ambiguity of the problem and produce more accurate results.
[0003] However, the existing methods still have the following limitations. Limitation 1: The feature construction process of the current state-of-the-art model only uses limited graph structure context information. This obvious imbalance can lead to a large amount of computational burden and overfitting susceptibility. Therefore, it is important to redesign the feature construction to avoid these problems. Limitation 2: The computational efficiency of mainstream learning-based methods is still insufficient in real-time source localization scenarios. The complete observation method first learns the underlying propagation model before reasoning. The TGASI method adopts a two-stage optimization paradigm, first learning the influence matrix, and then extracting features based on the estimate. These two-stage methods result in a large amount of delay. In addition, TGASI constructs high-dimensional topological features and utilizes gated recurrent units to model the timestamp sequence, thus excluding parallelization. Therefore, more efficient source localization techniques suitable for real-time applications are imperative. Limitation 3: The interpretability techniques of source localization are limited because they only output the raw nodes of the prediction without explanation. In practice, identifying the possible diffusion fusion pathways that lead to the predicted source can provide more insights than the source prediction alone. However, existing methods lack the ability to produce this explanatory auxiliary output while inferring the source. SUMMARY
[0004] Therefore, it is necessary to provide an interpretable and efficient coarse-to-fine interpretable source localization method aiming at the above technical problems.
[0005] A coarse-to-fine interpretable source localization method, the method comprising:
[0006] Obtaining a social network and a set of graph snapshots observed on the social network; the social network comprises a node set and an edge set; the set of graph snapshots comprises a set of infection states of nodes; constructing an interpretable source localization model; the interpretable source model comprises a general feature extractor, a coarse-to-fine converter and a post-processing module; the coarse-to-fine converter comprises a coarse-grained transformer encoder and a fine-grained transformer encoder;
[0007] Generating node features of the social network according to the general feature extractor, comprising: obtaining a global view of the social network by using a graph diffusion fusion technology to obtain a graph diffusion matrix; multiplying the graph diffusion model by the node infection state to obtain the global attribute of the node; and obtaining the final node feature by splicing the global attribute and the attribute of the infection state;
[0008] Inputting the final node feature and the pre-set position embedding into the coarse-to-fine converter, projecting the input according to three linear projection matrices in the coarse-grained transformer encoder to obtain a query key; calculating the output of the single-layer encoder according to the query key; performing multi-head attention calculation on the output of the single-layer encoder and outputting a snapshot representation matrix through a fully connected feedforward network and a residual connection layer; in the fine-grained transformer encoder, interacting fine-grained node information according to the kernel attention module to obtain the kernel feature of the node; constructing a kernel feature matrix using the kernel feature of each node; performing kernel multi-head attention calculation on the kernel feature matrix and outputting a hidden representation matrix through a fully connected feedforward network and a residual connection layer;
[0009] In the post-processing module, the prediction probability of each node is calculated according to the hidden representation matrix and the attention value between the nodes, and the node with the highest prediction probability is taken as the interpretable source localization result.
[0010] In one embodiment, the global view of the social network is obtained by using a graph diffusion fusion technology to obtain a graph diffusion matrix, comprising:
[0011] The global view of the social network is obtained by using a graph diffusion fusion technology to obtain a graph diffusion matrix
[0012] S PPR =α(I n -(1-α)D -1 / 2 AD -1 / 2 )
[0013] S hcat = exp(βAD -1 - β).
[0014] wherein, is an identity matrix, and a is a restart probability, is a diagonal matrix A, and β is a diffusion time.
[0015] In one embodiment, the input is projected according to three linear projection matrices in a coarse-grained transformer encoder to obtain a query key, comprising:
[0016] The input is projected according to three linear projection matrices in a coarse-grained transformer encoder to obtain a query key is
[0017]
[0018] wherein, and denote the projection matrix of the l-th layer, and H (l-1) denotes the input.
[0019] In one embodiment, the output of the single-layer encoder is subjected to multi-head attention calculation and output a snapshot representation matrix through a fully connected feedforward network and a residual connection layer, comprising:
[0020] The output of the single-layer encoder is subjected to multi-head attention calculation and output a snapshot representation matrix through a fully connected feedforward network and a residual connection layer is
[0021]
[0022] H (l) = LayerNorm(FFN(MultiHead(H (l) ))+ H (l-1) )
[0023] wherein, LayerNorm is a layer normalization, FFN is a two-layer fully connected feedforward network, MultiHead is a multi-head attention mechanism, H (l) is the output of the l-th layer encoder.
[0024] In one embodiment, the snapshot representation matrix is interacted with fine-grained node information in a kernel attention module in a fine-grained transformer encoder to obtain a kernel feature with certain time and memory complexity, comprising:
[0025] The snapshot representation matrix is interacted with fine-grained node information in a kernel attention module in a fine-grained transformer encoder to obtain a kernel feature with certain time and memory complexity is
[0026]
[0027] where φ(·) denotes the dot product of the random characteristic pulse kernel approximation feature mapping, i.e., the kernel attention module, and is the projection matrix of the fine-grained Transformer, and n represents the total number of nodes.
[0028] In one of the embodiments, the kernel feature matrix is subjected to kernel multi-head attention calculation and output hidden representation matrix after passing through the full connection feedforward network and residual connection layer, including:
[0029] The kernel feature matrix is subjected to kernel multi-head attention calculation and output hidden representation matrix after passing through the full connection feedforward network and residual connection layer
[0030] P = LayerNorm(FFN(KMultiHead(P (l) ))+P (l-1) )
[0031] where P (l) represents the hidden representation of the l layer, and KMultiHead is the kernel multi-head attention module.
[0032] In one of the embodiments, the prediction probability of each node is calculated according to the hidden representation matrix and the attention value between the nodes in the post-processing module, further including:
[0033] The prediction probability of each node is calculated according to the hidden representation matrix and the attention value between the nodes in the post-processing module
[0034] P r = P :,1 + λ2C
[0035]
[0036] where P ;,1 represents the first column of P, represents the probability of the node being infected, λ2 is a hyperparameter for controlling the importance of the post-processing module, and A i,j represents the attention value between node i and node j, is the projection matrix of the fine-grained Transformer.
[0037] In one of the embodiments, the attention score between nodes is calculated according to the kernelized attention module, the loss function of the fine-grained transformer encoder is set by using the attention score, the fine-grained transformer encoder is trained according to the loss function, and the hidden representation matrix is updated by using the trained fine-grained transformer encoder.
[0038] In one of the embodiments, the attention score between nodes is calculated according to the kernelized attention module, including:
[0039] The attention score between nodes calculated according to the kernelized attention module is
[0040]
[0041] Wherein, φ(·) represents the dot product of the random characteristic pulse kernel approximation feature mapping, that is, the kernelized attention module, and represents the projection matrix of the fine-grained Transformer, and z represents the node.
[0042] In one of the embodiments, the loss function of the fine-grained transformer encoder is set by using the attention score, including:
[0043] The loss function of the fine-grained transformer encoder set by using the attention score is
[0044]
[0045] Wherein, ε p is the edge set between the infected nodes.
[0046] The above-described one from coarse-grained to fine-grained explainable source localization method, the application constructs an explainable source localization model; the explainable source model includes a general feature extractor, a coarse-to-fine converter and a post-processing module, the general feature extractor is used to extract propagation features without explicit influence matrix estimation, and a graph diffusion technique is used to obtain a condensed structure representation. In terms of computational efficiency, the application designs a CFT architecture supporting parallelization. First, a coarse-grained tansfommer encoder is set to capture the interaction between time-varying snapshots, then a fine-grained tansfonmer encoder is set to model the node-level interaction, and a kernel attention module is used to reduce the time complexity from O(N2) to O(N) to avoid high computational burden. According to the propagation contrast learning method, a loss function of the fine-grained tansfonmer encoder is designed for training and updating, the influence of the propagation path is highlighted to improve the explainability of the model. Finally, a post-processing module is proposed, which simulates how people consider the attention value of visualization to further improve the results. Through the modular design, the application maintains high computational efficiency while obtaining good source localization performance and generates explainable diffusion explanations, realizes one-stage end-to-end learning to avoid cascading errors, and realizes efficient parallel computing. BRIEF DESCRIPTION OF DRAWINGS
[0047] Figure 1 A flowchart of one embodiment of a coarse-grained to fine-grained explainable source localization method is shown.
[0048] Figure 2 A technical framework diagram of one embodiment of the explainable source localization method is shown.
[0049] Figure 3 An internal structure diagram of a computer device in one embodiment is shown. DETAILED DESCRIPTION
[0050] In order to make the purpose, technical scheme and advantages of the application clearer, the application will be further described in detail below in combination with the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the application and do not limit the application.
[0051] In one embodiment, as shown in Figure 1 a coarse-grained to fine-grained explainable source localization method is provided, including the following steps:
[0052] Step 102: Obtain the social network and the set of graph snapshots observed on the social network; the social network includes a set of nodes and a set of edges; the set of graph snapshots includes a set of infection states of nodes; construct an interpretable source localization model; the interpretable source model includes a general feature extractor, a coarse-to-fine converter, and a post-processing module; the coarse-to-fine converter includes a coarse-grained transformer encoder and a fine-grained transformer encoder.
[0053] This application performs interpretable source localization to identify the source of propagating information, given a set of observed snapshots. First, definitions of social networks, network snapshots, and source localization are provided.
[0054] Define a social network: A social network G = {V, E, A} consists of a set of nodes V = {v1, v2, ..., vn}, where |V| = n; (2) a set of edges ε, where |ε| = m, and edges e i,j =(v i v j )∈ε represents node v i and v j There are links; and (3) adjacency matrix It represents the structural information of the network.
[0055] Network snapshots: Given a social network, a set of usable graph snapshots can be obtained. A snapshot image It was collected at timestamp k, where It is the set of infection states of the nodes. If the observed node v i He was infected, otherwise
[0056] Source localization: The source localization problem is based on a social network G and observed snapshots. The task to find the source node, where 1 represents the original source, and 0 otherwise.
[0057] First, construct an end-to-end interpretable source localization model, such as Figure 2 As shown, the system includes a Universal Feature Extractor (UFE), a Coarse-to-Fine Transformer (CFT) comprising a coarse-grained transformer encoder and a fine-grained transformer encoder, and a Post-Processing Module (PPM). First, features are generated using the Universal Feature Extractor (UFE), and then these features are fed into the Coarse-to-Fine Transformer (CFT) to capture time-varying snapshots and interactions between nodes. Finally, the Post-Processing Module (PPM) refines the results based on the generated edge attention values.
[0058] At step 104, the node features of the social network are generated according to the general feature extractor, including: obtaining a global view of the social network by using a graph diffusion fusion technology to obtain a graph diffusion matrix; multiplying the graph diffusion model by the node infection state to obtain the global attribute of the node; and obtaining the final node feature by splicing the global attribute and the attribute of the infection state.
[0059] Due to the lack of node features in the real-world social network, the global structure information of the graph is considered and the diffusion result is combined to preliminarily enrich the node attribute. Subsequently, the enriched node attribute is fed into the tansfommer architecture to effectively capture the interaction between time-varying snapshots. The present application does not need to estimate the underlying propagation model or use the actual influence matrix, thereby improving its applicability and reducing the error accumulation caused by estimation inaccuracy.
[0060] Unlike the previous method of coding structure information in a static manner, the present application incorporates the structure information of the graph into the node attribute while considering the diffusion state. In addition, the previous method allocates more dimensions to the structure embedding, intending to enhance the learning ability of the model. However, this method also increases the computational complexity and can cause overfitting problems. In order to solve the above problems, the present application uses the graph diffusion fusion technology to obtain the global view of the graph structure. Subsequently, the importance of each node in the graph can be quantified, and it is used to determine the suspicious ability of each node. The personalized PageRank (PPR) and head kernel are two popular diffusion processes used by the present application. Among them, the PPR diffusion uses T = D - 1 A and θ i =α(1-α) i ,where is a diagonal matrix A, and α is a restart probability. The heat kernel diffusion uses T = D -1 A and θ i =e -β β i / i!, where β is the diffusion time. Therefore, the graph diffusion matrix S PPR can be calculated by using the above two diffusion processes, which also avoids multiple calculations. Then the diffusion matrix S PPR is multiplied by the node infection state Y, thereby obtaining the rich global attribute X g .
[0061]
[0062] The structure-rich node attribute X g can be obtained by connecting and And the embedding X in the time slice can be obtained by concatenating the infection status one-hot features
[0063]
[0064] The final node features are input to the tansfommer encoder.
[0065] In step 106, the final node features and the pre-set position embedding are input into the coarse-to-fine converter. In the coarse-grained transformer encoder, the input is projected according to three linear projection matrices to obtain a query key; the output of the single-layer encoder is calculated according to the query key; the multi-head attention calculation is performed on the output of the single-layer encoder, and the snapshot representation matrix is output after passing through the fully connected feedforward network and the residual connection layer; in the fine-grained transformer encoder, the snapshot representation matrix is interacted with fine-grained node information according to the kernel attention module to obtain the kernel features of the nodes; the kernel feature matrix is constructed using the kernel features of each node; and the kernel multi-head attention calculation is performed on the kernel feature matrix, and the hidden representation matrix is output after passing through the fully connected feedforward network and the residual connection layer.
[0066] When rich node attributes X = {X1, X2, …, X T are obtained, a coarse-grained transformer encoder is used to capture the interaction between time-varying snapshots, so that the information interaction between different snapshots is more effective. However, the attention calculation in this process is a parallel calculation method, which may cause the loss of relative position information, such as the order of snapshots in the graph. In order to preserve the relative position information, the position input H (0) = X: H (0) = H (0) + E pos is added to the input of the transformer, where represents the position embedding with the same dimension as H.
[0067] Then, the input is projected using three linear projection matrices to obtain the query Q, K and V keys. The attention score is obtained by the dot product between the Q key and the K key
[0068]
[0069] where d is the dimension of the hidden representation.
[0070] The output of the single-layer encoder is obtained by weighting the V key using the attention score
[0071]
[0072] The process of multi-head attention is formulated as:
[0073]
[0074] where, is the projection matrix.
[0075] In addition, the coarse-grained transformer encoder also contains a two-layer fully connected feed-forward network (FFN) and a residual connection to the output of the multi-head attention calculation, and finally, the output of the transformer encoder is obtained by stacking L1 layers, and the output snapshot representation matrix is the mean pooling of the final transformer layer output, and L1 is the number of layers in the coarse-grained transformer encoder.
[0076] After obtaining the snapshot representation matrix , in order to achieve an interpretable result, it is necessary to measure the correlation between each edge. The intuitive way is to use the attention score to measure the correlation between each node, and this can be achieved by using the transformer encoder above. However, the time complexity of the vanilla-transformer encoder is O(n2), which is not suitable for large-scale graphs, and the fine-grained transformer encoder is designed in this application. Z is represented as a graph with multiple nodes, represented as Z=(z1,z2,...,z n ). By designing an efficient kernelized attention module, the fine-grained node information is interacted with the time and memory complexity of First, according to the positive random feature (PRF) approximation of the dot product φ(·) of the feature mapping, the input node feature is mapped to a high-dimensional space with a size of m, based on the kernel view, the attention mechanism can be modeled as a linear dot product of kernelized features
[0077]
[0078] where, since and can be pre-computed for each node, the time complexity of the kernelized attention module is reduced to
[0079] The kernelized feature matrix is constructed using the kernelized features of each node; the kernelized multi-head attention is calculated on the kernelized feature matrix, and the hidden representation matrix P is output after passing through the fully connected feed-forward network and the residual connection layer.
[0080] Where, similar to the transformer module above, multi-head attention is also used, but instead of the standard attention module, a kernelized attention module is used. The process of kernelized transformer is:
[0081]
[0082] Where, KMultiHead is the kernelized multi-head attention module.
[0083] After obtaining the kernelized attention score, it can be used to measure the correlation between each node. However, the fine-grained transformer does not consider the structure information of the graph, which is the same as forming a sequence graph, that is, each node is connected. Therefore, it is necessary to add a structure constraint in the kernelized Transformer to better adapt to the graph source positioning problem. For each edge ε = {(e i , e j )}, the attention score is calculated by the kernelized attention module as
[0084]
[0085] Then, edge-level regularization is introduced. For the set of graph snapshots Take and as an example. First, extract the candidate propagation path between G1 and G2, as follows:
[0086]
[0087] Where, ε p is the edge set between infected nodes, representing the candidate propagation path, and ε p = ε \ ε n represents the negative edge.
[0088] The coarse-grained and fine-grained Transformer encoders are used to aggregate time-varying information and measure the correlation between each edge.
[0089] Step 108, in the post-processing module, the prediction probability of each node is calculated according to the hidden representation matrix and the attention value between nodes, and the node with the highest prediction probability is taken as the explainable source positioning result.
[0090] PPM is designed to further enhance the results. In the framework of the present application, the source node should show strong connection with the infected nodes in the initial snapshot. Therefore, the attention value between the source node and the infected node in the first snapshot is used to enhance the result. The revised probability is used as the final prediction as
[0091] P r= P :,1 + λ2C
[0092]
[0093] where P :,1 denotes the first column of P, and λ2is a hyperparameter to control the importance of the post-processing module. A i,j denotes the attention value between node i and node j. The principle behind this equation is that in the first snapshot, the attention value between the source node and the infected node should be greater than that of other nodes. The second observation is that information should spread from closely related nodes to nodes that are farther away. Therefore, neighbors of the first infected node with lower attention scores should be filtered out. In equation A i,j only one aggregation is performed on the neighbors.
[0094] Meanwhile, the loss function of the interpretable source positioning model is designed as
[0095]
[0096] where λ1is a hyperparameter to control the importance of propagation contrastive learning, is the cross-entropy loss for the source positioning task.
[0097] The above one coarse-to-fine interpretable source positioning method, the application constructs an interpretable source positioning model; the interpretable source model includes a general feature extractor, a coarse-to-fine converter and a post-processing module, the general feature extractor is used to extract propagation features without explicit influence matrix estimation, and a condensed structure representation is obtained by using a graph diffusion technique. In terms of computational efficiency, the application designs a CFT architecture that supports parallelization. First, a coarse-grained tansfommer encoder is set to capture the interaction between time-varying snapshots, then a fine-grained tansfonmer encoder is set to model node-level interaction, and a kernel attention module is used to reduce the time complexity from O(N2) to O(N) to avoid high computational burden. And according to the propagation contrastive learning method, the loss function of the fine-grained tansfonmer encoder is designed to train and update, the model's interpretability is improved by highlighting influential propagation paths. Finally, a post-processing module is proposed, which further improves the results by simulating how people consider visual attention values. Through the modular design, the application maintains high computational efficiency while achieving good source positioning performance and generating interpretable diffusion explanations, realizing one-stage end-to-end learning to avoid cascading errors and achieving efficient parallel computing.
[0098] In one of the embodiments, a global view of the social network is obtained by using a graph diffusion fusion technique to obtain a graph diffusion matrix, comprising:
[0099] The global view of the social network is obtained by using the graph diffusion fusion technology, and a graph diffusion matrix is obtained
[0100] S PPR = a(I n -(1-a)D -1 / 2 AD -1 / 2 )
[0101] S heat = exp(βAD -1 -β).
[0102] wherein, is a unit matrix, a is a restart probability, is a diagonal matrix A, and β is a diffusion time.
[0103] In one of the embodiments, the input is projected according to three linear projection matrices in the coarse-grained transformer encoder to obtain the query key, including:
[0104] The input is projected according to three linear projection matrices in the coarse-grained transformer encoder to obtain the query key, including
[0105]
[0106] wherein, and denote the projection matrix of the l-th layer, H (l-1) denotes the input.
[0107] In one of the embodiments, the output of the single-layer encoder is subjected to multi-head attention calculation and is outputted through a fully connected feedforward network and a residual connection layer to output a snapshot representation matrix, including:
[0108] The output of the single-layer encoder is subjected to multi-head attention calculation and is outputted through a fully connected feedforward network and a residual connection layer to output a snapshot representation matrix, including
[0109]
[0110] H (l) = LayerNorm(FFN(MultiHead(H (l) ))+H (l-1) )
[0111] wherein, LayerNorm is a layer normalization, FFN is a two-layer fully connected feedforward network, MultiHead is a multi-head attention mechanism, H (l) is the output of the l-th layer encoder.
[0112] In one of the embodiments, the kernelized attention module is used to interact the fine-grained node information in the fine-grained transformer encoder to obtain the kernelized features with certain time and memory complexity, including:
[0113] The kernelized attention module is used to interact the fine-grained node information in the fine-grained transformer encoder to obtain the kernelized features, including:
[0114]
[0115] wherein, φ(·) represents the dot product of the random characteristic pulse kernel approximation feature mapping, i.e. the kernelized attention module, and represents the projection matrix of the fine-grained transformer, and n represents the total number of nodes.
[0116] In one of the embodiments, the kernelized multi-head attention calculation is performed on the kernelized feature matrix, and the hidden representation matrix is output after passing through the full connection feedforward network and the residual connection layer, including:
[0117] The kernelized multi-head attention calculation is performed on the kernelized feature matrix, and the hidden representation matrix is output after passing through the full connection feedforward network and the residual connection layer, including:
[0118] P = LayerNorm(FFN(KMultiHead(P (l) ))+P (l-1) )
[0119] wherein, P (l) represents the hidden representation of the l layer, and KMultiHead is the kernelized multi-head attention module.
[0120] In one of the embodiments, the prediction probability of each node is calculated according to the hidden representation matrix and the attention value between the nodes in the post-processing module, further including:
[0121] The prediction probability of each node is calculated according to the hidden representation matrix and the attention value between the nodes in the post-processing module, including:
[0122] P r = P :,1 + λ2C
[0123]
[0124] wherein, P ;,1 represents the first column of P, represents the probability of the node being infected, λ2 is a hyperparameter for controlling the importance of the post-processing module, and A i,j represents the attention value between the node i and the node j. is the projection matrix of the fine-grained Transformer.
[0125] In one of the embodiments, the attention scores between nodes are calculated according to the kernelized attention module, a loss function of the fine-grained transformer encoder is set by using the attention scores, the fine-grained transformer encoder is trained according to the loss function, and the hidden representation matrix is updated by using the trained fine-grained transformer encoder.
[0126] In one of the embodiments, the attention scores between nodes are calculated according to the kernelized attention module, including:
[0127] The attention scores between nodes are calculated according to the kernelized attention module
[0128]
[0129] wherein φ(·) represents a dot product of a random characteristic pulse kernel approximation feature mapping, that is, the kernelized attention module, and is the projection matrix of the fine-grained Transformer, and z represents a node.
[0130] In one of the embodiments, a loss function of the fine-grained transformer encoder is set by using the attention scores, including:
[0131] The loss function of the fine-grained transformer encoder is set by using the attention scores
[0132]
[0133] wherein ε p is a set of edges between infected nodes.
[0134] It should be understood that, although each step in the flowchart of Figure 1 is displayed in sequence according to the indication of the arrow, these steps are not necessarily executed in sequence according to the indication of the arrow. Unless explicitly stated in this article, the execution of these steps has no strict order limitation, and these steps can be executed in other orders. Moreover, Figure 1 At least part of the steps in may include multiple sub-steps or multiple stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily sequential, but can be alternately executed with other steps or at least part of the sub-steps or stages of other steps.
[0135] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 3 As shown, the computer device includes a processor, memory, network interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The network interface is used to communicate with external terminals via a network connection. When executed by the processor, the computer program implements an interpretable source localization method ranging from coarse-grained to fine-grained. The display screen can be a liquid crystal display (LCD) or an e-ink display. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the computer device casing, or an external keyboard, touchpad, or mouse.
[0136] Those skilled in the art will understand that Figure 3 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0137] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer readable storage medium, and when the computer program is executed, the processes of the above-mentioned embodiments of the methods can be included. Any reference to memory, storage, databases, or other media in the embodiments provided by the present application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration but not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0138] The technical features of the above embodiments can be combined in any way. In order to make the description simple, not all possible combinations of the technical features in the above embodiments are described, but as long as the combinations of the technical features do not exist, they should be considered as the scope of the present application.
[0139] The above embodiments only express several implementation manners of the present application, and the description is more specific and detailed, but it should not be understood as a limitation on the scope of the patent. It should be pointed out that for ordinary skilled in the art, without departing from the concept of the present application, some modifications and improvements can be made, which are all within the scope of the present application. Therefore, the scope of the patent of the present application should be subject to the appended claims.
Claims
1. An interpretable source localization method from coarse to fine granularity, characterized in that, The method comprises: Obtaining a social network and a set of observed graph snapshots of the social network; the social network comprises a set of nodes and a set of edges; the set of observed graph snapshots comprises a set of infection states of the nodes; constructing an interpretable source positioning model; the interpretable source positioning model comprises a general feature extractor, a coarse-to-fine converter and a post-processing module; the coarse-to-fine converter comprises a coarse-grained transformer encoder and a fine-grained transformer encoder; Generating node features of the social network according to the general feature extractor, comprising: obtaining a global view of the social network by using a graph diffusion fusion technology to obtain a graph diffusion matrix; multiplying the graph diffusion matrix by the node infection state to obtain the global attribute of the node; and obtaining the final node features by splicing the global attribute and the attribute of the infection state; Inputting the final node features and the pre-set position embedding into the coarse-to-fine converter, projecting the input according to three linear projection matrices in the coarse-grained transformer encoder to obtain a query key; calculating the output of the single-layer encoder according to the query key; performing multi-head attention calculation on the output of the single-layer encoder and outputting a snapshot representation matrix through a fully connected feedforward network and a residual connection layer; in the fine-grained transformer encoder, interacting fine-grained node information according to the kernel attention module to obtain the kernel features of the nodes; constructing a kernel feature matrix using the kernel features of each node; performing kernel multi-head attention calculation on the kernel feature matrix and outputting a hidden representation matrix through a fully connected feedforward network and a residual connection layer; In the post-processing module, calculating the prediction probability of each node according to the hidden representation matrix and the attention value between the nodes, and taking the node with the highest prediction probability as the interpretable source positioning result.
2. The method of claim 1, wherein, Obtaining a global view of the social network by using a graph diffusion fusion technology to obtain a graph diffusion matrix, comprising: Obtaining a global view of the social network by using a graph diffusion fusion technology to obtain a graph diffusion matrix is S PPR = a(I n -(1 - a)D -1 / 2 AD -1 / 2 ) -1 S heat = exp(βAD -1 -β). wherein is the identity matrix, and a is the restart probability, is a diagonal matrix, and β is the diffusion time.
3. The method of claim 1, wherein, Projecting the input according to three linear projection matrices in the coarse-grained transformer encoder to obtain a query key, comprising: Projecting the input according to three linear projection matrices in the coarse-grained transformer encoder to obtain a query key is wherein and denotes the projection matrix of the layer l.
4. The method of claim 3, wherein, Performing multi-head attention calculation on the output of the single-layer encoder and outputting a snapshot representation matrix through a fully connected feedforward network and a residual connection layer, comprising: Performing multi-head attention calculation on the output of the single-layer encoder and outputting a snapshot representation matrix through a fully connected feedforward network and a residual connection layer is H (l) = LayerNorm(FFN(MultiHead(H (l) )+ H (l-1) )) where LayerNorm is layer normalization, FFN is a two-layer fully connected feed-forward network, MultiHead is a multi-head attention mechanism, H (l) is the output of the l-th encoder.
5. The method of claim 1, wherein, In the fine-grained transformer encoder, interacting fine-grained node information according to the kernel attention module to obtain the kernel features, comprising: where φ(·) denotes the dot product of the random characteristic pulse kernel approximation feature mapping, i.e., the kernel attention module, and denotes the projection matrix of the fine-grained Transformer, and n denotes the total number of nodes.
6. The method of claim 4, wherein, Performing kernel multi-head attention calculation on the kernel feature matrix and outputting a hidden representation matrix through a fully connected feedforward network and a residual connection layer, comprising: Performing kernel multi-head attention calculation on the kernel feature matrix and outputting a hidden representation matrix through a fully connected feedforward network and a residual connection layer is The kernelized feature matrix is subjected to kernelized multi-head attention calculation and output of a hidden representation matrix is performed after a fully connected feedforward network and a residual connection layer P = LayerNorm(FFN(KMultiHead(P (l) ))+ P (l-1) ) where P (l) represents the hidden representation of the l-th layer, KMultiHead is a kernelized multi-head attention module.
7. The method of claim 5, wherein, In the post-processing module, the prediction probability of each node is calculated according to the hidden representation matrix and the attention value between the nodes, and the post-processing module further comprises: P r = P :,1 + λ2C where P ;,1 represents the first column of P, represents the probability of a node being infected, A i,j represents the attention value of node i and node j, represents the projection matrix of the fine-grained Transformer.
8. The method of claim 1, wherein, The method further comprises: The attention score between the nodes is calculated according to the kernelized attention module, a loss function of the fine-grained transformer encoder is set by using the attention score, the fine-grained transformer encoder is trained according to the loss function, and the hidden representation matrix is updated by using the trained fine-grained transformer encoder.
9. The method of claim 8, wherein, The attention score between the nodes is calculated according to the kernelized attention module, and the attention score comprises: The attention score between the nodes is calculated according to the kernelized attention module, and the attention score comprises where φ(·) denotes the dot product of the random characteristic pulse kernel approximation feature mapping, that is, the kernel attention module, denotes the projection matrix of the fine-grained Transformer, and z denotes the node.
10. The method of claim 9, wherein, The loss function of the fine-grained transformer encoder is set by using the attention score, and the loss function comprises: The loss function of the fine-grained transformer encoder is set by using the attention score, and the loss function comprises:
Citation Information
Patent Citations
Propagation source positioning method based on encoder and decoder framework
CN117034134A