A social event discovery method based on hierarchical multi-relation graph and text fusion
By constructing a multi-relationship message graph and implementing hierarchical encoding, combined with bidirectional cross-modal alignment and event-aware comparative learning of text sequences, the problems of incomplete capture of event association features and modal differences in traditional technologies are solved, achieving efficient and accurate social event discovery.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NORTHEASTERN UNIV CHINA
- Filing Date
- 2026-02-26
- Publication Date
- 2026-05-19
AI Technical Summary
Traditional social event detection technologies suffer from insufficient capture of event correlation features, modal differences, and a lack of hierarchical mining and incremental maintenance mechanisms when processing social platform message streams, resulting in low identification efficiency and difficulty in meeting real-time requirements.
A multi-relationship message graph is constructed, hierarchical graph encoding is implemented, and bidirectional cross-modal alignment is performed by combining multi-hop subgraph sampling and graph convolutional encoding with text sequences. Event-aware contrastive learning and adaptive clustering algorithms are adopted to incrementally maintain historical knowledge.
It achieves deep integration of structural and semantic features, improving the accuracy and timeliness of event recognition, adapting to the dynamic update characteristics of social platform message streams, and enabling rapid response to new events.
Smart Images

Figure CN121765144B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data mining technology, and more particularly to a method for discovering social events based on hierarchical multi-relationship graphs and text fusion. Background Technology
[0002] With the rapid development of social media platforms, massive amounts of messages are continuously generated in real-time streams, covering various social dynamics, user opinions, and interactive behaviors. These messages constitute an important data carrier reflecting the state of social operation. Their content is not isolated but forms complex internal connections through various forms such as entity association, topic aggregation, and user interaction. These interconnected information conceal various socially influential events, making social event discovery a key technology. This technology aims to accurately identify sets of events with common characteristics from disordered, massive message streams, providing data support for scenarios such as public opinion monitoring, public decision-making, and hot topic tracking. Currently, event discovery technology is gradually developing towards multimodal fusion and structured analysis, requiring the simultaneous mining of textual semantic information and structured relational information from messages, and adapting to the dynamic updates and diverse types of messages on social media platforms, in order to achieve efficient and accurate event identification and tracking, meeting the needs of different fields for real-time event perception.
[0003] Traditional social event detection techniques have several limitations when processing social media message streams. Some techniques focus solely on extracting semantic features from the text, neglecting structured relationships such as entity co-occurrence and topic associations between messages. This results in an incomplete capture of event-related features and difficulty in accurately distinguishing messages that are semantically similar but belong to different events. Other techniques attempt to combine graph structures for analysis, but lack hierarchical mining of multi-relationship graphs, failing to effectively extract structural dependency information at different levels. Furthermore, traditional methods suffer from modality discrepancies when fusing structural features with textual semantic features, leading to inaccurate feature representation. Simultaneously, traditional contrastive learning methods do not fully incorporate historical event information, resulting in insufficient sample discrimination. The use of fixed parameters in clustering makes it difficult to adapt to message data with varying semantic densities and weakens the ability to handle noisy samples. Most techniques also lack effective incremental maintenance mechanisms, requiring repeated training for continuously updated message streams. This is not only inefficient but also fails to retain historical event knowledge, making it unsuitable for the real-time requirements of dynamic event detection. Summary of the Invention
[0004] To address the aforementioned technical problems, this invention provides a social event discovery method based on hierarchical multi-relationship graphs and text fusion. The method first collects message stream data from social platforms, cleans and extracts features to construct a multi-relationship message graph, and initializes node features. Then, hierarchical graph encoding is achieved through multi-hop subgraph sampling and graph convolutional coding to output structural representations. Subsequently, the structural representations are mapped to soft prefix sequences, bidirectionally aligned with the text sequence across modalities, and sentence-level semantic representations are extracted. Model parameters are optimized through event-aware contrastive learning, and finally, an adaptive parameter clustering algorithm is used to obtain the event set, while incremental maintenance preserves historical knowledge. This method deeply integrates structural and semantic features, improving the accuracy and timeliness of event recognition and adapting to the dynamic updating characteristics of social platform message streams.
[0005] The technical means employed in this invention are as follows:
[0006] A method for discovering social events based on hierarchical multi-relationship graphs and text fusion includes:
[0007] Social media platform message stream data is collected, and after data cleaning and core feature extraction, a multi-relationship message graph is constructed. The BERT-base-uncased model is used to initialize the initial features of the nodes.
[0008] For each relation in the multi-relation message graph, multi-hop subgraph sampling is performed, followed by RGCNConv graph convolutional encoding, RelationAttention weighted fusion, hierarchical fusion, and MLP transformation, to output the structural representation of the node.
[0009] The structural representation is mapped to a learnable soft prefix sequence, which is then concatenated with the text TokenEmbedding sequence after bidirectional alignment by the Bidirectional-Cross-modal-Alignment module, and input into the RoBERTa-large model to extract sentence-level semantic representation;
[0010] A historical cache is maintained for each event. A set of positive and negative samples is constructed based on the cache. The correlation value between the sentence-level semantic representation of the current sample and the positive and negative samples is calculated. The overall loss of sample-level contrastive learning and event-aware cache contrastive learning is calculated in sequence. The overall loss is used as the optimization objective, and the learnable parameters of the model are updated through the Adam optimizer.
[0011] The DBSCAN algorithm is used to cluster the sentence-level semantic representation to obtain an event set, and the model parameters are updated according to a preset incremental period to retain historical event knowledge.
[0012] Furthermore, the data cleaning includes duplicate message removal, spelling error correction, and entity and topic tag parsing, wherein:
[0013] The criteria for removing duplicate messages are that the text content is completely identical and the time difference between publication is ≤60 seconds;
[0014] The spelling error correction method uses the edit distance matching method, and automatically corrects the spelling error when the edit distance is not greater than the preset error tolerance threshold.
[0015] The entity and topic tag parsing is achieved using the spaCy toolkit combined with a social hot topic domain dictionary.
[0016] Furthermore, the multi-relationship message graph includes entity co-occurrence relationships, topic tag co-occurrence relationships, and user mention co-occurrence relationships, wherein:
[0017] The determination of the co-occurrence relationship of the entities is based on the fact that the two messages share at least one named entity;
[0018] The criteria for determining the co-occurrence relationship of the topic tags are that two messages contain the same hashtag and case differences are ignored;
[0019] The criteria for determining the co-occurrence relationship of user mentions are that two messages mention the same @user account.
[0020] Furthermore, the rules for sampling the multi-hop subgraph are as follows:
[0021] The number of edges in a jump graph is set to a first upper limit. If the limit is exceeded, the edges are retained by sorting them according to the message publication timestamp;
[0022] The size of the source node, the number of outgoing edges per step, and the size of the candidate edges are all set with a second upper limit to balance coverage and computational cost;
[0023] The higher-order subgraph is based on the lower-order subgraph. Edges are randomly sampled according to a preset ratio and a third upper limit is set to control the size of the higher-order neighborhood.
[0024] Each hop subgraph is deduplicated using a triple identifier consisting of the source node ID, the target node ID, and the relation type.
[0025] Furthermore, in the RGCNConv graph convolutional encoding:
[0026] The calculation method for sampling subgraphs is as follows:
[0027]
[0028] in, It is the first Jump, the first Under class relations, the first The feature representation of each node. Number of jumps For relational types, For node indexing, It is the first Under class relations, the first node of all nodes Jump feature representation set, The adjacency matrix after adding self-loops, For degree matrix, For learnable weights, It is the ReLU activation function. It is the negative 1 / 2 power of the degree matrix;
[0029] The calculation method when the sampled subgraph is empty is as follows:
[0030]
[0031] in, This is the initial feature matrix of the node.
[0032] Furthermore, in the RelationAttention weighted fusion:
[0033] The attention score is calculated as follows:
[0034]
[0035] in, It is the first Under class relations, the first The node and the first Attention score between nodes It is the transpose operator for matrices and vectors. For feedforward network parameters, For the first Jump node representation, For relationship Learnable embedding vectors, This represents vector concatenation. It is the hyperbolic tangent activation function;
[0036] The calculation method for relation-weighted fusion is as follows:
[0037]
[0038] in, For the first The node after multi-relation weighted fusion is the first Jump feature representation, Indicates all Summation based on class relationships, The normalized relation weights, , This is an operation that normalizes the attention scores for all relation types. For the first The node at the th The first class relation Jump feature representation, For relational types, It is the target node index. Number of jumps This represents the total number of relation types.
[0039] Furthermore, in the hierarchical fusion and MLP transformation:
[0040] The calculation method for hierarchical fusion is as follows:
[0041]
[0042]
[0043] in, Indicates the first The result of multi-hop feature weighted fusion of nodes It is a normalization function. Learnable weights for skipping levels The maximum number of hops sampled for a multi-hop subgraph. Number of jumps These are the features after residual fusion; For the first The node after multi-relation weighted fusion is the first Jump feature representation;
[0044] The MLP transform is calculated as follows:
[0045]
[0046] in, This represents the final structural representation of the node after MLP transformation. MLP stands for Multilayer Perceptron.
[0047] Furthermore, the Bidirectional-Cross-modal-Alignment module performs bidirectional alignment, including prefix-text alignment and text-prefix alignment, wherein:
[0048] The prefix-text alignment is calculated as follows:
[0049]
[0050] in, It is the soft prefix sequence obtained after text-prefix alignment. It is a soft prefix sequence. It is a text sequence. It is the transpose operator for matrices and vectors. Here is the attention weight matrix. For feature dimension, LN For layer normalization, It is a normalization function;
[0051] The text-prefix alignment is calculated as follows:
[0052]
[0053] in, It is the updated text tokenEmbedding sequence obtained after prefix-text alignment. , , This is the reverse attention weight matrix.
[0054] Furthermore, the RoBERTa-large model extracts sentence-level semantic representations, including:
[0055] The spliced sequence After inputting the RoBERTa-large model, extract the position indices from its output sequence. Vectors as sentence-level semantic representations The calculation method is as follows:
[0056]
[0057] in, It is the final extracted sentence-level semantic representation. This is the concatenation result of aligning the soft prefix sequence with the text TokenEmbedding sequence. The length of the soft prefix sequence. The hidden state of the first text token after prefix extraction is used as a sentence-level semantic representation for the RoBERTa-large model. It is an index identifier.
[0058] Furthermore, the parameters of the Adam optimizer are set as follows: the initial learning rate is... Weight decay coefficient, exponential decay rate of first-moment estimation The exponential decay rate estimated by the second moment , It is a very small constant, the training batch size is 32, the maximum number of training rounds is 30, and if the NMI metric on the validation set does not improve for 5 consecutive rounds, the early stop mechanism is triggered.
[0059] Furthermore, the formula for calculating the correlation value is as follows:
[0060]
[0061] in, It is the similarity between the current sample and the comparison sample. For the semantic representation of the current sample, To compare the semantic representations of the samples, it is necessary to perform calculations beforehand. , Execute separately L 2. Normalization yes and The vector dot product.
[0062] Furthermore, the formula for calculating the sample-level contrast loss is as follows:
[0063]
[0064] in, For the positive sample set, For the current sample The corresponding set of negative samples, For temperature coefficient, It is a natural exponential function. For a single sample The sample-level contrast loss, It is a sentence-level semantic representation of positive samples, and is An element in a set This is the current sample The corresponding set of positive samples, This is the current sample Compared with positive samples sinusoidal similarity, It is the sentence-level semantic representation of the sample to be computed. It is a sentence-level semantic representation of the negative sample. This is the current sample With negative samples The sinusoidal similarity.
[0065] Furthermore, the formula for calculating the overall loss is as follows:
[0066]
[0067] in, It is the overall loss of event-aware cache contrastive learning. This represents the number of valid samples.
[0068] Furthermore, the parameter settings and clustering process of the DBSCAN algorithm are as follows:
[0069] The text semantic density is determined by the average pairwise cosine similarity of all sentence-level semantic representations in the current message block, and the neighborhood radius (eps) is adaptively determined based on the text semantic density of the current message block.
[0070] The minimum sample size (min-samples) is dynamically adjusted based on the total number of messages in the current message block.
[0071] The distance metric used is cosine distance, and DBSCAN clustering is performed on samples within the block.
[0072] During the clustering process, samples marked as noise points are stored separately in a temporary set and re-participated in DBSCAN clustering when processing the next message block;
[0073] For each event set obtained by clustering, calculate the average cosine similarity of all samples within it. If it is lower than a preset threshold, immediately split it and re-cluster it.
[0074] Furthermore, the window size of the incremental period That is, a model update is performed after processing 3 consecutive message blocks; when inheriting model parameters, the graph convolutional layer weights of the HMGE module, the attention layer weights of the BCAM module, and the weights of the first 10 Transformer layers of the RoBERTa-large model are retained; only the weights of the MLP layer of the HMGE module, the mapping layer of the BCAM module, the last 2 Transformer layers of the RoBERTa-large model, and their output layer are fine-tuned.
[0075] Compared with the prior art, the present invention has the following advantages:
[0076] 1. This invention integrates multi-dimensional message data from social platforms, constructs a multi-relationship message graph, and implements hierarchical encoding. It deeply mines potential connections between messages, such as entity co-occurrence, topic association, and user mentions. At the same time, it transforms the node structure representation into a learnable soft prefix sequence and performs bidirectional cross-modal alignment with the text semantic representation, achieving the organic integration of structural and semantic features. During the hierarchical encoding process, multi-hop subgraph sampling and weighted fusion are used to capture structural dependencies at different levels. The bidirectional alignment mechanism effectively eliminates modal differences, allowing the extracted sentence-level semantic representation to not only cover rich contextual information but also accurately convey the core meaning of the text. This significantly improves the recognizability of event-related features, provides solid support for subsequent clustering, helps to accurately distinguish different types of social events, and reduces recognition errors caused by feature bias.
[0077] 2. This invention utilizes the synergistic combination of event-aware contrastive learning and dynamic clustering strategies. It constructs a set of positive and negative samples based on historical cache, and strengthens the semantic aggregation effect of similar event samples and the distinguishability of dissimilar samples through reasonable association calculation and loss optimization. Simultaneously, it employs an adaptive parameter-adjusting clustering algorithm to properly handle noisy samples and message data of varying densities. An incremental maintenance mechanism continuously retains historical event knowledge, enabling efficient updates of model parameters and adapting to the dynamic characteristics of social platform message streams. It can quickly respond to newly emerging events without repeated training. This design ensures stable and efficient discovery of various social events in a continuously input data stream, while also improving the timeliness and accuracy of event discovery by optimizing feature extraction and clustering processes. It effectively addresses the needs of scenarios with large message volumes, rapid updates, and complex types on social platforms. Attached Figure Description
[0078] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0079] Figure 1 This is a flowchart of the method of the present invention.
[0080] Figure 2 This is a schematic diagram illustrating data transmission in each step of the method of the present invention. Detailed Implementation
[0081] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0082] It should be noted that the terms "first", "second", etc. in the description, claims and above-mentioned drawings of the present invention are used to distinguish similar objects, and do not necessarily have to be used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances, so that the embodiments of the present invention described here can be implemented in an order other than those illustrated or described here. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device comprising a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0083] Embodiment [[ID=V5]]
[0084] The present invention provides a method for discovering social events based on the fusion of hierarchical multi-relational graphs and texts. In this embodiment, the discovery of non-emergency public opinion events of "urban public transportation optimization discussion" on the Weibo platform is used as a scenario. The discussions related to this event are semantically scattered and data-sparse on the Weibo platform. Users scatteredly post messages around sub-topics such as new subway lines, bus stop adjustments, fare discount plans, etc., without a concentrated information peak of explosive outbreak. Traditional methods based on high-frequency word co-occurrence are difficult to effectively aggregate relevant messages. In this embodiment, the HMGTF model is used to mine and aggregate relevant messages of such discussions from the real-time Weibo message stream, form a complete event set, and provide support for public opinion analysis. The specific steps are as Figure 1 shown.
[0085] S1. Construction of multi-relational graph:
[0086] Collect the real-time message stream data on the Weibo platform within the past 30 days that contains relevant keywords such as bus, subway, traffic optimization, and stop adjustment, covering information such as the text, @mentioned accounts, topic tags, and release timestamps posted by users. [[ID=1V6]]
[0087] Clean the collected data. First, eliminate duplicate messages. Messages with exactly the same text content and a time difference of ≤ 60 seconds in release time will be merged to reduce the interference of redundant calculations on subsequent processing. Then, use the edit distance matching method to correct spelling mistakes. The edit distance threshold is set to 2. For example, correct "ditie Line 3" to "subway Line 3" and "gongjiao stop" to "bus stop" to ensure the accuracy of text information and improve the subsequent entity recognition effect. Finally, use the spaCy toolkit combined with a social hot topic domain dictionary to parse the entities and topic tags in each message. Entities include subway Line 3, bus terminal, etc., and topic tags include urban bus optimization, new subway line, etc., providing a basis for subsequent relationship construction.
[0088] Each cleaned Weibo message is treated as a node in the graph. An edge is constructed based on three relationship types to form a multi-relationship message graph. Entity co-occurrence relationship is determined by whether two messages share at least one named entity. Topic tag co-occurrence relationship is determined by whether two messages contain the same hashtag and ignore case differences. User mention co-occurrence relationship is determined by whether two messages mention the same @user account. The three relationships comprehensively capture the correlation dimensions between messages.
[0089] The BERT-base-uncased model is used to encode each node, obtaining initial feature vectors to provide reliable initial data support for subsequent graph encoding. Figure 2 As shown.
[0090] S2, Hierarchical graph coding:
[0091] For each relationship in the multi-relation message graph, 1-hop, 2-hop, and 3-hop subgraph sampling are performed. The 1-hop subgraph retains a maximum of 800 edges. If this is exceeded, the edges are sorted by message publication timestamp and the most recently published edges are retained to ensure the latest association information is obtained. When sampling the 2-hop subgraph, the number of source nodes is ≤30, the number of outgoing edges per step is ≤3, and the number of candidate edges is ≤400 to balance the association coverage and computational efficiency. The 3-hop subgraph is based on the 2-hop subgraph, with edges randomly sampled at a ratio of 1:13, and finally 30 edges are retained to avoid the computational explosion caused by high-order sampling. Each hop subgraph is deduplicated using a triple identifier of source node ID, target node ID, and relationship type to eliminate the interference of duplicate edges on feature extraction.
[0092] For each hop of the sampled subgraph, RGCNConv graph convolutional encoding is performed. When the sampled subgraph is not empty, the adjacency matrix after adding self-loops, the degree matrix, and the node feature representation of the previous hop are combined. Through weight matrix transformation and ReLU activation function, structural dependencies under different relationships are mined, where:
[0093] When the sampling subgraph is empty, the initial feature matrix of the nodes is directly transformed by weight matrix and ReLU activation to ensure consistent output feature dimensions and maintain process continuity. The calculation method for sampling subgraphs is as follows:
[0094] ;
[0095] in, It is the first Jump, the first Under class relations, the first The feature representation of each node. Number of jumps For relational types, For node indexing, It is the first Under class relations, the first node of all nodes Jump feature representation set, The adjacency matrix after adding self-loops, For degree matrix, For learnable weights, It is the ReLU activation function. It is the negative 1 / 2 power of the degree matrix;
[0096] The calculation method when the sampled subgraph is empty is as follows:
[0097] ;
[0098] in, This is the initial feature matrix of the node.
[0099] For each hop of convolutionally encoded node features, RelationAttention weighted fusion is performed. First, attention scores are calculated by concatenating the node features with the corresponding learnable embedding vectors of the relationships, then passing the concatenation through a feedforward network and a hyperbolic tangent activation function to obtain the association strength between nodes under different relationships. Then, a relation-weighted fusion calculation is performed, and the attention scores for all relationship types are normalized using softma. The attention scores are calculated as follows:
[0100] ,
[0101] in, It is the first Under class relations, the first The node and the first Attention score between nodes It is the transpose operator for matrices and vectors. For feedforward network parameters, For the first Jump node representation, For relationship Learnable embedding vectors, This represents vector concatenation. It is a hyperbolic tangent activation function that highlights relationships that are more valuable for event aggregation and suppresses interference from irrelevant relationships, resulting in a skip-level feature representation of each node after multi-relation weighted fusion.
[0102] The calculation method for relation-weighted fusion is as follows:
[0103]
[0104] in, For the first The node after multi-relation weighted fusion is the first Jump feature representation, Indicates all Summation based on class relationships, The normalized relation weights, , This is an operation that normalizes the attention scores for all relation types. For the first The node at the th The first class relation Jump feature representation, For relational types, It is the target node index. Number of jumps This represents the total number of relation types.
[0105] A hierarchical fusion calculation method is adopted to process the weighted fusion features from 1 hop to 3 hops. The hierarchical fusion calculation method is as follows:
[0106]
[0107]
[0108] in, Indicates the first The result of multi-hop feature weighted fusion of nodes It is a normalization function, and the weights can be learned by skipping levels. Normalized weighted summation integrates structural information from different ranges; then the fusion result is added to the 1-hop feature to alleviate the oversmoothing problem in deep propagation of graph neural networks and preserve nearest neighbor details. Learnable weights for skipping levels The maximum number of hops sampled for a multi-hop subgraph. Number of jumps These are the features after residual fusion; For the first The node after multi-relation weighted fusion is the first Jump feature representation;
[0109] The MLP transform is calculated as follows:
[0110]
[0111] in, This represents the final structural representation of the node after MLP transformation. MLP stands for Multilayer Perceptron. Through the MLP transformation calculation method, the residual fused features are input into the multilayer perceptron for nonlinear transformation, and the final structural representation of the node is output, thereby improving the discriminative ability of the features.
[0112] S3, Bidirectional cross-modal alignment:
[0113] The node structure representation obtained by hierarchical graph encoding is mapped to a learnable soft prefix sequence with a sequence length of 32. The dimension of the mapping weight matrix is 128×768. The weight matrix is initialized with a normal distribution with a mean of 0 and a variance of 0.02, so that the structural information can be adapted to the input form of text encoding.
[0114] Each Weibo message's text content is tokenized to generate a text token embedding sequence. This sequence is consistent with the vocabulary of the RoBERTa-large model, with a vocabulary size of 50265 and a maximum sequence length of 256, ensuring complete encoding of the text information.
[0115] The soft prefix sequence and the text TokenEmbedding sequence are input into the Bidirectional-Cross-modal-Alignment module for bidirectional alignment. Prefix-text alignment uses the soft prefix sequence as the query and the text TokenEmbedding sequence as the key and value. After attention calculation and softma normalization, the results are fused with text features, and then normalized through layers to obtain the aligned soft prefix sequence. This allows structural information to actively locate relevant semantic segments in the text. The calculation method for prefix-text alignment is as follows:
[0116]
[0117] in, It is the soft prefix sequence obtained after text-prefix alignment. It is a soft prefix sequence. It is a text sequence. It is the transpose operator for matrices and vectors. Here is the attention weight matrix. For feature dimension, LN For layer normalization, It is a normalization function;
[0118] Text-prefix alignment uses the text token embedding sequence as the query and the soft prefix sequence as the key and value. It performs the same attention calculation, fusion, and layer normalization operations to obtain the aligned text token embedding sequence. This allows text semantics to correct deviations in structural information. The calculation method for text-prefix alignment is as follows:
[0119]
[0120] in, It is the updated text tokenEmbedding sequence obtained after prefix-text alignment. , , This is the reverse attention weight matrix.
[0121] The aligned soft prefix sequence is concatenated with the text TokenEmbedding sequence to form a fused sequence, which is then input into the RoBERTa-large model. After inputting the RoBERTa-large model, the position indices in its output sequence are extracted as follows: Vectors as sentence-level semantic representations The calculation method is as follows:
[0122]
[0123] in, It is the final extracted sentence-level semantic representation. This is the concatenation result of aligning the soft prefix sequence with the text TokenEmbedding sequence. The length of the soft prefix sequence. The hidden state of the first text token after prefix extraction is used as a sentence-level semantic representation for the RoBERTa-large model. It is an index identifier that fully integrates information from both structural and textual modalities, improving the accuracy of semantic capture.
[0124] S4, Event-Aware Comparative Learning:
[0125] Maintain a historical cache for each potential event, storing sentence-level semantic representations of related messages that have been discovered for that event, and continuously aggregate diverse contexts and historical forms of the same event to provide rich material for constructing positive and negative samples.
[0126] For the sentence-level semantic representation of the message to be processed, other semantic representations in its event cache are used as the positive sample set, and all other semantic representations in the event cache are used as the negative sample set to avoid noise interference from random negative samples. A sinusoidal similarity calculation method is used to calculate the association value between the current sample sentence-level semantic representation and each semantic representation in the positive and negative sample sets. The formula for calculating the association value is as follows:
[0127]
[0128] in, It is the similarity between the current sample and the comparison sample. For the semantic representation of the current sample, To compare the semantic representations of the samples, it is necessary to perform calculations beforehand. , Execute separately L 2. Normalization ensures the stability and accuracy of similarity calculation; yes and The vector dot product.
[0129] By employing a sample-level contrastive loss calculation method, combined with temperature coefficient adjustment of similarity weights, the aggregation degree of the current sample with positive samples and the separation degree with negative samples are enhanced. Then, through an event-aware cached contrastive learning overall loss calculation method, the loss values of all effective samples are averaged to obtain the global loss. The calculation formula for the sample-level contrastive loss is as follows:
[0130]
[0131] in, For the positive sample set, For the current sample The corresponding set of negative samples, For temperature coefficient, Natural exponential function, For a single sample The sample-level contrast loss, It is a sentence-level semantic representation of positive samples, and is An element in a set This is the current sample The corresponding set of positive samples, This is the current sample Compared with positive samples sinusoidal similarity, It is the sentence-level semantic representation of the sample to be computed. It is a sentence-level semantic representation of the negative sample. This is the current sample With negative samples The sinusoidal similarity.
[0132] The formula for calculating the overall loss of the event-aware cache contrastive learning is as follows:
[0133]
[0134] in, It is the overall loss of event-aware cache contrastive learning. This represents the number of valid samples.
[0135] Using global loss as the optimization objective, the Adam optimizer is employed to update the learnable parameters of the model. The initial learning rate of the Adam optimizer is... Weight decay coefficient, exponential decay rate of first-moment estimation The exponential decay rate estimated by the second moment , It is a very small constant, the training batch size is 32, the maximum number of training rounds is 30, and if the NMI index on the validation set does not improve for 5 consecutive rounds, the early stopping mechanism is triggered to ensure the efficiency and stability of model training.
[0136] S5. Event Clustering and Incremental Maintenance:
[0137] The DBSCAN algorithm is used to cluster the sentence-level semantic representation to obtain an event set, and the model parameters are updated according to a preset incremental period to retain historical event knowledge, wherein:
[0138] The parameter settings and clustering process of the DBSCAN algorithm are as follows:
[0139] The semantic density of the text is determined by the average pairwise cosine similarity of all sentence-level semantic representations in the current message block, and the neighborhood radius (eps) is adaptively determined based on the semantic density of the current message block. In this embodiment, when the average pairwise cosine similarity is ≥0.6, it is determined to be high density, and the eps value is 0.6; when the average pairwise cosine similarity is <0.6, it is determined to be low density, and the eps value is 0.8, to adapt to message data of different densities.
[0140] The minimum sample size (min-samples) is dynamically adjusted based on the total number of messages in the current message block. In this embodiment, when the total number of messages is ≤500, the min-samples value is 6; when the total number of messages is >500, the min-samples value is 8, ensuring the rationality of the clustering results.
[0141] The distance metric used is cosine distance, which is 1 minus the cosine similarity between two sentence-level semantic representations. DBSCAN clustering is performed on samples within the block.
[0142] During the clustering process, samples marked as noise points are stored separately in a temporary set and re-participated in DBSCAN clustering when processing the next message block, reducing the omission of effective information;
[0143] For each event set obtained from clustering, the average cosine similarity of all samples within it is calculated. If it is lower than a preset threshold, it is immediately split and re-clustered. In this embodiment, the preset threshold is 0.75. Each event set obtained from clustering must satisfy the condition that the average cosine similarity of all samples within it is ≥0.75. Event sets that do not meet this condition will be split and re-clustered to ensure the purity of the event sets.
[0144] Set the window size for the increment period. After processing every three consecutive message blocks, the model parameters are updated once. During the parameter update, the weights of the graph convolutional layer of the hierarchical multi-relation graph encoder, the weights of the attention layer of the bidirectional cross-modal alignment module, and the weights of the first 10 Transformer layers of the RoBERTa-large model are retained. Only the weights of the MLP layer of the hierarchical multi-relation graph encoder, the mapping layer of the bidirectional cross-modal alignment module, the last two Transformer layers of the RoBERTa-large model, and their output layer are fine-tuned, so that the model can quickly adapt to the changes in data distribution in the new message block while retaining historical event knowledge.
[0145] In summary, the above methods successfully aggregated all scattered messages related to discussions on urban public transportation optimization from the Weibo message stream, forming a complete event set including sub-events such as discussions on new stations for Metro Line 3, feedback on bus fare discount schemes, and suggestions for suburban bus route adjustments. Evaluation showed that the model in this embodiment achieved an NMI score above 0.91, an AMI score above 0.89, and an ARI score above 0.85, significantly outperforming traditional event discovery methods and effectively solving the aggregation challenges caused by the semantic dispersion and data sparsity of non-sudden events.
[0146] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for discovering social events based on hierarchical multi-relationship graphs and text fusion, characterized in that, include: S1. Collect message stream data from social platforms, clean the data and extract core features, construct a multi-relationship message graph, and use the BERT-base-uncased model to initialize the initial features of the nodes; S2. Perform multi-hop subgraph sampling on each relation of the multi-relation message graph, and sequentially perform RGCNConv graph convolutional encoding, RelationAttention weighted fusion, hierarchical fusion and MLP transformation to output the structural representation of the node; S3. The structural representation is mapped to a learnable soft prefix sequence, which is then concatenated with the text TokenEmbedding sequence after bidirectional alignment by the Bidirectional-Cross-modal-Alignment module, and input into the RoBERTa-large model to extract sentence-level semantic representation; S4. Maintain a historical cache for each event, construct a set of positive and negative samples based on the cache, calculate the correlation value between the sentence-level semantic representation of the current sample and the positive and negative samples, and sequentially calculate the overall loss of sample-level contrastive loss and event-aware cache contrastive learning; use the overall loss as the optimization objective, and update the learnable parameters of the model through the Adam optimizer. S5. The DBSCAN algorithm is used to cluster the sentence-level semantic representation to obtain an event set, and the model parameters are updated according to a preset incremental period to retain historical event knowledge.
2. The social event discovery method based on hierarchical multi-relationship graph and text fusion according to claim 1, characterized in that, The data cleaning includes duplicate message removal, spelling error correction, and entity and topic tag parsing, wherein: The criteria for removing duplicate messages are that the text content is completely identical and the time difference between publication is ≤60 seconds; The spelling error correction method uses the edit distance matching method, and automatically corrects the spelling error when the edit distance is not greater than the preset error tolerance threshold. The entity and topic tag parsing is achieved using the spaCy toolkit combined with a social hot topic domain dictionary.
3. The social event discovery method based on hierarchical multi-relationship graph and text fusion according to claim 1, characterized in that, The multi-relationship message graph includes entity co-occurrence relationships, topic tag co-occurrence relationships, and user mention co-occurrence relationships, wherein: The determination of the co-occurrence relationship of the entities is based on the fact that the two messages share at least one named entity; The criteria for determining the co-occurrence relationship of the topic tags are that two messages contain the same hashtag and case differences are ignored; The criteria for determining the co-occurrence relationship of user mentions are that two messages mention the same @user account.
4. The social event discovery method based on hierarchical multi-relationship graph and text fusion according to claim 1, characterized in that, The rules for multi-hop subgraph sampling are as follows: The number of edges in a jump graph is set to a first upper limit. If the limit is exceeded, the edges are retained by sorting them according to the message publication timestamp; The size of the source node, the number of outgoing edges per step, and the size of the candidate edges are all set with a second upper limit to balance coverage and computational cost; The higher-order subgraph is based on the lower-order subgraph. Edges are randomly sampled according to a preset ratio and a third upper limit is set to control the size of the higher-order neighborhood. Each hop subgraph is deduplicated using a triple identifier consisting of the source node ID, the target node ID, and the relation type.
5. The social event discovery method based on hierarchical multi-relationship graph and text fusion according to claim 1, characterized in that, In the RGCNConv graph convolutional encoding: The calculation method for sampling subgraphs is as follows: in, It is the first Jump, the first Under class relations, the first The feature representation of each node. Number of jumps For relation types, For node indexing, It is the first Under class relations, the first node of all nodes Jump feature representation set, The adjacency matrix after adding self-loops, For degree matrix, For learnable weights, It is the ReLU activation function. It is the negative 1 / 2 power of the degree matrix; The calculation method when the sampled subgraph is empty is as follows: in, This is the initial feature matrix of the node.
6. The social event discovery method based on hierarchical multi-relationship graph and text fusion according to claim 1, characterized in that, In the RelationAttention weighted fusion: The attention score is calculated as follows: in, It is the first Under class relations, the first The node and the first Attention score between nodes It is the transpose operator for matrices and vectors. For feedforward network parameters, For the first Jump node representation, For relationship Learnable embedding vectors, This represents vector concatenation. It is the hyperbolic tangent activation function; The calculation method for relation-weighted fusion is as follows: in, For the first The node after multi-relation weighted fusion is the first Jump feature representation, Indicates all Summation based on class relationships, The normalized relation weights, , This is an operation that normalizes the attention scores for all relation types. For the first The node at the th The first class relation Jump feature representation, For relation types, It is the target node index. Number of jumps This represents the total number of relation types.
7. The social event discovery method based on hierarchical multi-relationship graph and text fusion according to claim 1, characterized in that, In the hierarchical fusion and MLP transformation: The calculation method for hierarchical fusion is as follows: in, Indicates the first The result of multi-hop feature weighted fusion of nodes It is a normalization function. Learnable weights for skipping levels The maximum number of hops sampled for a multi-hop subgraph. Number of jumps These are the features after residual fusion; For the first The node after multi-relation weighted fusion is the first Jump feature representation; The MLP transform is calculated as follows: in, This represents the final structural representation of the node after MLP transformation. MLP stands for Multilayer Perceptron.
8. The social event discovery method based on hierarchical multi-relationship graph and text fusion according to claim 1, characterized in that, The Bidirectional-Cross-modal-Alignment module performs bidirectional alignment, including prefix-text alignment and text-prefix alignment, wherein: The prefix-text alignment is calculated as follows: in, It is the soft prefix sequence obtained after text-prefix alignment. It is a soft prefix sequence. It is a text sequence. It is the transpose operator for matrices and vectors. Here is the attention weight matrix. For feature dimension, LN For layer normalization, It is a normalization function; The text-prefix alignment is calculated as follows: in, It is the updated text tokenEmbedding sequence obtained after prefix-text alignment. , , This is the reverse attention weight matrix.
9. A method for discovering social events based on hierarchical multi-relationship graphs and text fusion as described in claim 1, characterized in that, The RoBERTa-large model extracts sentence-level semantic representations, including: The spliced sequence After inputting the RoBERTa-large model, extract the position indices from its output sequence. Vectors as sentence-level semantic representations The calculation method is as follows: in, It is the final extracted sentence-level semantic representation. This is the concatenation result of aligning the soft prefix sequence with the text TokenEmbedding sequence. The length of the soft prefix sequence. The hidden state of the first text token after prefix extraction is used as a sentence-level semantic representation for the RoBERTa-large model. It is an index identifier.
10. A method for discovering social events based on hierarchical multi-relationship graphs and text fusion as described in claim 1, characterized in that, The parameter settings and clustering process of the DBSCAN algorithm are as follows: The semantic density of the text is determined by the average pairwise cosine similarity of all sentence-level semantic representations in the current message block, and the neighborhood radius is adaptively determined based on the semantic density of the current message block. The minimum sample size (min-samples) is dynamically adjusted based on the total number of messages in the current message block. The distance metric used is cosine distance, and DBSCAN clustering is performed on samples within the block. During the clustering process, samples marked as noise points are stored separately in a temporary set and re-participated in DBSCAN clustering when processing the next message block; For each event set obtained by clustering, calculate the average cosine similarity of all samples within it. If it is lower than a preset threshold, immediately split it and re-cluster it.