A large-scale public opinion event detection method based on constraint structure entropy sampling extension
By optimizing the unsupervised graph clustering method through structural entropy community constraints and multi-task learning, the problems of topological integrity and heterogeneous feature adaptability in ultra-large-scale public opinion networks are solved, and efficient public opinion event detection and clustering are achieved.
Patent Information
- Application Number
- CN202611092475.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-22
- Publication Date
- 2026-11-24
AI Technical Summary
Existing unsupervised graph clustering methods struggle to maintain model scalability and global topological integrity in ultra-large-scale public opinion networks, leading to problems such as hotspot event splitting, fragmentation of public opinion from the same source, and discrete node representations in the clustering results. Furthermore, they cannot effectively adapt to the identification of heterogeneous features and newly released public opinion entities.
A large-scale public opinion event detection method based on constrained structural entropy sampling extension is adopted. By structural entropy community constraints, community-aware sampling extension, and multi-task enhanced structural contrastive learning, the training process of ultra-large public opinion graphs is optimized to ensure global structural integrity and clustering accuracy.
High-quality unsupervised clustering was achieved in large-scale public opinion networks, maintaining the model's scalability and clustering accuracy. It can accurately capture the complete public opinion community topology, is applicable to heterogeneous public opinion scenarios, and improves the ability to identify new public opinion entities.
Smart Images

Figure CN123158274A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of graph machine learning and data mining technology, specifically to a large-scale public opinion event detection method based on constraint structure entropy sampling extension. Background Technology
[0002] Graph-structured data can describe complex relationships in social media, news platforms, citation networks, and multi-agent interactions. Unsupervised graph clustering, relying on the original topology and node attributes of the network, divides nodes into communities without manual annotation. It is a crucial underlying technology for downstream tasks such as sentiment aggregation, source event mining, network anomaly monitoring, and content recommendation. With the rapid growth of sentiment data on social media and short video platforms, reaching millions or even billions of entities across the network, manual annotation is very costly. Therefore, unsupervised graph clustering, with its high scalability and accuracy, has become a major research direction for large-scale sentiment analysis.
[0003] The main goal of unsupervised graph clustering is to group nodes into dense groups based solely on their intrinsic topology and node attributes, without using true labels. Formally, an undirected homogeneous graph can be represented as... ,here yes A set consisting of nodes It is an edge set. It is the node feature matrix. The dimension of the attribute space is represented. The connection pattern of the graph is determined by a symmetric adjacency matrix. To represent, Indicate node and There are edges between them. Given a graph. The goal is to learn the mapping function. Assign each node to One of the disjoint clusters, , It is the number of clusters obtained through predefined or inference.
[0004] Existing unsupervised graph clustering schemes primarily utilize graph neural networks and graph contrastive learning to build models. They learn discriminative embeddings of nodes through message passing and consistency regularization mechanisms, thereby improving the similarity of intra-cluster features and clustering accuracy. However, when applied to ultra-large-scale real-world public opinion networks, existing methods struggle to simultaneously maintain model scalability and the integrity of the global topology, and they also exhibit certain technical limitations. For scenarios involving small-batch training of ultra-large graphs, existing schemes mostly employ random sampling and local neighborhood sampling strategies. However, this approach fragments the global community topology. Traditional sampling only extracts local first-order neighborhood information of nodes, splitting users, posts, and comments corresponding to the same public opinion event into different training batches. This disrupts the continuity of the community structure within each batch.
[0005] Mainstream graph contrastive learning algorithms lack compensation methods for sampling fragmentation. Traditional structure-aware methods only use coarse and noisy basic graph statistics, failing to discover higher-order sentiment connections across users and propagation links. This results in insufficient global topological awareness of the model, leading to frequent issues such as hotspot event splitting, fragmentation of sentiment from the same source, and discrete node representations in clustering results. In general, existing unsupervised graph clustering methods have two main drawbacks: First, small-batch sampling naturally breaks down the topological continuity of the global community, continuously losing global structural information during training. Second, they lack refined global community constraints and multi-faceted representation optimization methods, failing to regularize community partitioning and effectively suppress fragmentation, thus failing to meet the high-precision clustering requirements of billion-level heterogeneous sentiment graphs.
[0006] In addition, existing general graph clustering methods typically use homogeneous graphs for modeling, which cannot well adapt to the heterogeneous features of multiple entities and relationships in public opinion scenarios. Comparing samples solely based on topological construction ignores public opinion information such as blog post text, accompanying images, and user time-series interactions. This results in poor identification of cold-start public opinion entities such as newly published blog posts and newly registered users. Furthermore, traditional random walk sampling is easily affected by viral blog posts and high-profile users, leading to an imbalance in the sampling distribution and distortion in association estimation. Summary of the Invention
[0007] To address the problems existing in the prior art, this invention provides a method for detecting large-scale public opinion events based on constraint structure entropy sampling extension.
[0008] This invention proposes a large-scale public opinion event detection method based on constrained structural entropy sampling extension. It designs three jointly optimized modules: structural entropy community constraint (SECC), community-aware sampling extension (CSampE), and multi-task enhanced structural contrastive learning (StructCL). These modules can balance scalability and global structural integrity during the training of ultra-large public opinion graphs, thereby accurately capturing the complete public opinion community topology and completing the clustering of high-quality events in large-scale public opinion networks without annotation.
[0009] The method of this invention addresses issues such as topological isolation, community fragmentation, and missing global topological features that occur in graph clustering during small-batch training, while maintaining good scalability and ensuring clustering accuracy. This method is suitable for unsupervised mining of homogeneous events involving large-scale public opinion entities.
[0010] The present invention provides a method for detecting large-scale public opinion events based on constraint structure entropy sampling extension, comprising the following steps: S1. Collect corresponding public opinion network data sources for homogeneous and heterogeneous public opinion scenarios respectively, and map the collected information in a unified manner to form a noisy original heterogeneous graph. S2. Perform standardization preprocessing on the original heterogeneous graph output by S1, sequentially performing cleaning, mathematical representation, feature encoding, time series generation, and graph size compression to obtain the standardized heterogeneous graph. S3. Based on the standardized heterogeneous graph obtained in S2, introduce entity uniqueness constraints to screen effective community pairings. Only perform original structural entropy change calculations on the selected pairings to complete the global community pre-division of the entire network public opinion entities offline, generate the mapping relationship from nodes to communities, and output the global community topology prior file based on the mapping relationship. S4. Based on the node-community mapping relationship and global community topology prior file obtained in S3, combined with the hierarchical induced subgraph obtained in S2 preprocessing, training batches are constructed to generate complete and fully preserved public opinion event topology expanded batch data. S5. Based on the expanded batch data obtained in S4, and combined with the multimodal features and time series obtained in S2, construct a multi-task joint loss function, and iteratively optimize the entity node discrimination embedding through the multi-task joint loss function; S6. Batch optimization of node embedding and total loss based on S5 output A multi-threaded parallel joint training framework was built, and the S5 comparative learning module model was continuously iterated under the global community prior constraint. After the model converged, batch forward inference was performed on all public opinion entities to obtain a unified global representation. Then, combined with the preset number of communities, unsupervised public opinion event clustering was completed, and standardized public opinion analysis results were output. Furthermore, in S1, the two types of online public opinion data sources collected are: (1) In a homogeneous public opinion scenario, blog posts and interactive users are used as nodes of a graph. Undirected edges are generated through interactive behaviors including likes, reposts and comments. Node attribute information, including blog post text, post popularity and posting time, is collected and saved simultaneously. (2) In heterogeneous public opinion scenarios, the node types are expanded; the directed or undirected interaction edges of forwarding, commenting, collecting, topic binding and keyword annotation are distinguished, of which forwarding, commenting and collecting are directed edges; topic binding and keywords are undirected edges; Completely record the associated entities, relationship types, all text and image data, and time-series related attributes corresponding to each interaction behavior, and map all collected information to form a noisy original heterogeneous graph. ,in, Represents a set of entity nodes. Represents the original set of edges in the interaction. and These correspond to the set of node types and the set of edge types, respectively.
[0011] Furthermore, the specific process of S2 is as follows: S2.1 Basic noise cleaning: Remove self-loop edges, repeated interaction edges, and isolated nodes with no interaction for a long time from the original heterogeneous graph; filter low-quality blog posts published by online trolls; and remove invalid graph structures. S2.2 Constructing a graph mathematical representation system (1) The global adjacency matrix is constructed as follows: In the formula, For a set of entity nodes, V ={ v 1, v 2,…, v N}, N This represents the total number of nodes. Represents all possible combinations of node pairs; if node and If there is a direct edge connecting them, then the corresponding elements of the matrix... The value is 1, otherwise The value is 0; i and j These are the row and column indices of the adjacency matrix, respectively. Adjacency matrix The Middle i Line number j The value of the column; (2) Based on edge type splitting of induced subgraphs, given an edge subset The formula for induced edge sets is: in, For the reason The set of edges induced by the specified edge type; Let be the starting node of the edge; Let be the endpoint node of the edge; A mapping function for edge types; for each edge type Generate the corresponding hierarchical induced subgraphs respectively. ; (3) The degree of a single node is calculated using the adjacency matrix, using the following formula: In the formula, For nodes The degree; (4) Calculate the total volume of the entire public opinion map. The formula is: In the formula, This represents the total volume of the public opinion image. This is a public opinion map; (5) The original node feature matrix is processed using minimum-maximum normalization. The normalization calculation formula is as follows: in, Representative node No. Original features; Indexed by feature dimension; These are the normalized eigenvalues; For the first The minimum value of a feature; For the first The maximum value of a feature; This is the normalized characteristic matrix; S2.3 Multimodal Feature Standardization Coding With normalized characteristic matrix Based on this, a unified representation of text and images is achieved. The text is then encoded using n-gram hashing to output a fixed-dimensional vector. In the formula, For text feature vectors; for 3D real space; For text feature dimensions; The accompanying image uses a pre-trained ViT encoder to generate image feature vectors. In the formula, Image feature vector; for 3D real space; Image feature dimension; Text dimension vectors and image feature vectors have fixed dimensions and uniform format, forming multimodal features; S2.4, Generate user interaction time sequence Traverse all user nodes and organize all user interactions in ascending order of timestamps to construct a time-series sequence: in, Represents a user node; For users The interaction sequence, a list of all blog post entities that the user has interacted with, arranged chronologically; For a moment User-interactive blog post entities; For the first n The timestamp of the next interaction; The time point at which the last interaction occurred; S2.5, Layered pruning at height nodes Set pruning coefficient , upper limit of degree Lower limit of degree Calculate the number of edges to retain for the target node: In the formula, The number of edges to retain for the target node after pruning; A hub node indicates a node with an extremely high degree in the graph that needs to be pruned and compressed. The original degree of the hub node; This is the median value of the original degree after exponential scaling; S2.6 Output Standardized Heterogeneous Graph: Integrate the processing results of S2.1-S2.5, and output the cleaned, normalized, and lightweight standardized heterogeneous graph H. std .
[0012] Furthermore, the specific process of S3 is as follows: S3.1 Community Initialization Read the complete set of entity nodes in a standardized heterogeneous graph Each independent entity node in the graph is divided into an initial independent community, completing the initial community construction and obtaining the complete set of initial communities: In the formula, For the community to gather; For each element within the community, the total number of communities across the entire network equals the total number of public opinion entities; S3.2 Calculate the combined entropy change Traverse all community pairings in the graph that have direct interaction edges. Perform entity uniqueness constraint determination, assuming the community to be merged. The internal entity set is ,Community The internal entity set is , For the set of high-traffic hub entities across the entire network, the formula for determining the uniqueness of entities is as follows: In the formula, and Independent community indexes in the community set; a pair is considered valid if and only if the entity uniqueness constraint determination formula holds; if the intersection is not empty, it is considered a false association combination formed by the hub node and is directly filtered. For valid pairings, the change in structural entropy resulting from the merger of the two communities is calculated using the structural entropy formula. The calculation formula is as follows: In the formula, For the community Total weight of cross-community edge trimming; The sum of the degrees of nodes within the community. The total volume of the entire standardized heterogeneous public opinion map; and Community and community The cut edge weight; and Community and community Volume; and Community and community Each node inside; For nodes degree, For a node within the community, A temporary number for nodes within the community; This represents the new community formed after the merger of the two communities; express and The increase or decrease in the global structural entropy of the merged public opinion graph. The smaller the value, the stronger the correlation between the two groups of communities; S3.3, Constrained Greedy Merge Pre-configure the total number of target public opinion communities required. and the ratio of single iterations All valid communities, after being filtered by entity uniqueness constraints, are paired up according to entropy change. Sort the values in ascending order from smallest to largest; select the first few columns of the sorted list. The proportional community performed a merge operation; After the community merger is completed, the entire network community collection will be updated in real time. Synchronously update the entity collection within each community Community edge weighting and community volume The updated parameters are directly used for the entropy change calculation in the next round of the loop, and the greedy merging process is executed repeatedly. S3.4 Forced Convergence Mechanism After each greedy merge, a convergence assessment is made: if the total number of communities still exceeds the preset target value... And no set satisfies When a valid pairing is achieved, the forced convergence mode is initiated: Based on the strength of interaction between communities, weakly connected communities are merged in descending order of strength, continuously reducing the number of communities until the total number of communities across the entire network reaches the preset target. ; S3.5, Output Community Mapping When the number of communities reaches the preset value Then, generate a mapping function that corresponds one-to-one between nodes and communities across the entire network. The mapping rules specify that for any entity node , It will output the unique public opinion community number to which the node belongs, and synchronously count and store the distribution of various entities within each community, including users, blog posts, comments, and topics, forming a complete global community topology prior file.
[0013] Furthermore, the specific process of S4 is as follows: S4.1 Initial Batch Seed Sampling Using a random uniform sampling method, all entity nodes of the normalized heterogeneous graph obtained from S2 are... Select the basic seed node set ; S4.2 Community Location Matching Read mapping function For each node in the seed set ,use Will Match the complete public opinion community to determine the complete community scope corresponding to each seed node; S4.3, Adaptive Community Expansion Based on the hierarchical induced subgraph generated by S2.2, a restarted random walk is performed in each hierarchical induced subgraph to distinguish different node types, including users, blog posts, and topic tags, and the associated access frequency of each node is counted. Differentiated expansion rules are set based on community size: If the community is small, it meets the requirements. To perform a full community expansion, all nodes in the entire community are added to the expansion set, while completely preserving the local topology. The formula for full community expansion is: in, The threshold for community size; The expanded set of backbone nodes is the final set of expanded nodes added to the training batch; To expand the number of nodes added; If the community is large, it meets the requirements. Then it will be carried out within the community. 'Second length is The random walk method counts the frequency of node visits, and structures with frequencies higher than the mean are added to the expanded backbone node set. The formula is: In the formula, Represents a node Average access frequency, This indicates that during a random walk within the community, the nodes... The set of all nodes reachable from the starting point. This indicates a node. Visiting nodes during a walk The number of times; To sum the variables, iterate through them; S4.4 Adaptive Sampling Resource Allocation Multi-Transformer feature aggregation encoder encoding: Configure the text Transformer encoder to use text feature vectors As input, a multi-head attention mechanism is used to mine the semantic associations between blog posts and keywords, and the corresponding text unimodal encoding is output. ; Configure the image Transformer encoder to use image feature vectors As input, the semantics of the image are abstracted, and the corresponding image unimodal code is output. ; Configure the user-time Transformer encoder to use time sequences Using this as input, we model the evolution of user interests over time, and the corresponding output is a single-modal time-series representation. ; Set dynamic computing power allocation rules to automatically allocate more sampling traversal times to high-value wandering paths that can uncover the correlation of public opinion from the same source. S4.5, Generate expanded training batches Set the initial seed node set The extended backbone node set obtained by hierarchical filtering By combining these elements, we obtain the final expanded training batch node set, using the following formula: To expand batch data. Furthermore, the dynamic computing power allocation rules are as follows: First, consider any path among all the walk paths generated in the first round of random walks of the hierarchical induced subgraph. Based on a weighted average of three-dimensional indicators—community connectivity, text-image semantics, and temporal interaction—the common origin value score is calculated. The formula is: in, The entity traversal path generated by a single restart random walk within a hierarchical induced subgraph; Indicates the starting node of the walk. Represents the public opinion entities traversed by the path; Indicates the maximum preset travel length of the path; Indicates the weight of the community connectivity index; Indicates the weight of the semantic similarity index between images and text; Indicates the weight of user time-series interaction metrics; This represents the comprehensive value score of public opinion from the same path, with a value of [0,1]. Score the connectivity of the path community; The average semantic similarity between the path image and text; The path temporal correlation score; Then based on the baseline number of walks Maximum number of walks Magnification factor The formula for calculating the number of basic traversals is: Introducing hub attenuation coefficient The corrected result is: In the formula, This represents the number of times the path has been traversed. This is a truncation function; The comprehensive value score of public opinion along the same path; Based on the comprehensive value of public opinion from the same source, the top 10% are divided into a high-value path pool, the top 10%-30% into a medium-value path pool, and the bottom 70% into a low-value path pool. 70%, 20%, and 10% of the total computing power resources are respectively allocated to the high, medium, and low-value path pools. The total computing power resources refer to the total computing budget available for random walks in a single round of batch sampling, specifically the upper limit of the total number of path walks in this round of sampling. The high-value path pool prioritizes the allocation of GPU-accelerated threads, and the number of traversals for each path is determined by... Formula calculation; simultaneously, a hub attenuation coefficient is introduced. The number of corrections is obtained by applying attenuation correction to the path whose starting node is the hub node. This reduces the computational load on popular hub paths; the low-to-medium value path pool only allocates ordinary CPU threads and reserves only a minimum number of threads. In addition to the sampling, a global total number of walks limit and a single community computing power isolation constraint are added; before each batch sampling, the score of each path is recalculated and the path pool division and walk number allocation are dynamically updated.
[0014] Furthermore, the specific process of S5 is as follows: S5.1, Construction of Batch Higher-Order Affinity Matrix For input expanded batch data The total number of entities in a batch is recorded as Within the batch, perform multiple rounds of hierarchical restart random walk operations on all entities, traversing each walk path and counting nodes. At the start, node Co-occurrence frequency of visits ; Construct a sparse high-order structure affinity matrix based on statistical results The formula for determining and calculating matrix elements is as follows: in, '' is the row index of the node within the batch, indicating the start of the random walk; '' is the column index of the node within the batch, representing the endpoint of the random walk; and The first in each batch '' node and the first '' nodes; Represented by nodes Starting from the hierarchical induced subgraph constraint, the set of all entities reachable by random walks; For higher-order affinity matrix elements, represent the matrix No. '' line number The value of the column; S5.2, The higher-order affinity matrix constructed in S5.1 Input the topology GCN mapping layer, extract the neighborhood topology features of each node in the current batch, and compare them with... and The input is fed into a multi-head self-attention fusion layer, which adaptively balances the contribution weights of topology and graph-text semantics, and outputs a unified basic embedding for a single node. ; S5.3, Construction of Joint Contrast Loss S5.3.1, Higher-order structural losses Based on high-order affinity matrix Filter each node The corresponding set of topological positive samples All entities within the set are related to Nodes exhibiting long-range, shared-origin public opinion correlations; other irrelevant entities within the batch are selected as the negative sample set. The multi-positive-sample InfoNCE loss is used to narrow the embedding distance between homologous nodes, and the higher-order structure loss is calculated as follows: in, exist The calculation formula represents the anchor node for contrastive learning; exist The calculation formula is for anchor points. Positive sample nodes with long-range homology exist; Cosine similarity; This refers to temperature hyperparameters. and Anchor points and positive sample nodes The unified embedding is output by the multi-head self-attention fusion layer of S5.2; The index variable for negative samples; For specific nodes in the set of negative samples; A unified embedding for negative samples; For higher-order structure loss; S5.3.2, Entity Content Comparison Loss For cold-start blog posts and newly registered users with no reposting or commenting interaction, align node embedding and , Using different entity image and text features from the same batch as negative samples, a dual-content InfoNCE loss is constructed and the average is taken. The formula for calculating the entity content comparison loss is as follows: In the formula, The loss value is used to compare entity content; The representative InfoNCE contrastive loss function; This is a set of negative image and text samples that are different from the current entity. This represents the expected or average value of all nodes within the batch. S5.3.3, User Temporal Behavior Loss Based on user interaction time series The objective is to construct a dual-branch time-series comparison, which is divided into the prediction loss of the next interaction behavior. Matching loss with long-term interests Two parts, the formula is: In the formula, The operator is used to calculate the expectation or mean of a user sequence. Indicates the earliest interaction, Indicates the most recent interaction; For blog posts The unified embedding, which is the node output by the multi-head self-attention fusion layer of S5.2. Basic embedding; This will form the basis for the next interactive blog post. For the negative sample set; Predict the loss for the next interaction; The loss is for matching long-term interests; the sum of the two types of losses constitutes the complete time-series optimization objective. , The total loss due to user's temporal behavior; S5.3.4, Total Loss Fusion Formula The three types of losses—high-order structure loss, entity content comparison loss, and user temporal behavior loss—are weighted and fused with balanced weights to obtain the overall module optimization loss. : in, , , The weighted hyperparameters, in order, are the higher-order structure loss, entity content comparison loss, and user temporal behavior loss. S5.4 Network parameter backpropagation update To optimize losses as a whole As the overall optimization objective, chained gradient backpropagation is performed to synchronously update all learnable parameters within the structure-contrast learning module, including the parameter set. These correspond to the weights of the text Transformer encoder, image Transformer encoder, user temporal Transformer encoder, and topological GCN mapping layer, respectively. The gradients of each parameter are obtained by weighting the partial derivatives of the total loss with respect to the parameters. The gradient calculation formula is as follows: The Adam adaptive optimizer is used to perform iterative parameter updates based on the gradient calculation formula. After completing one round of forward inference and backpropagation, the optimized node embeddings for this batch are output.
[0015] Furthermore, the specific process of S6 is as follows: S6.1, Multi-threaded Parallel Joint Training S6.1.1 Training Architecture Design: The four sub-tasks of community-aware sampling extension, multi-Transformer feature aggregation encoding, joint contrastive loss construction and network parameter backpropagation update adopt a multi-threaded asynchronous execution mode, and a synchronous read-write lock is set for the hash shared table that only stores node and community mapping; S6.1.2, Construction of Training Comprehensive Loss: The total loss output in S5 The community consistency regularization term is superimposed on top, and the formula for calculating the regularization term is: Overall training loss of the model for: in, For community consistency regularization loss; Community affiliation criteria, representing nodes and nodes They belong to the same public opinion community; The hyperparameters for balancing the regularization term; S6.1.3 Training Termination Determination Mechanism: Set dual convergence conditions: reaching the preset maximum number of iterations. Or the difference in losses over multiple consecutive rounds When the model has converged, This is the threshold for loss fluctuation; S6.2, Global Batch Embedded Inference After the model converges, the batch random sampling process is closed, and the entire normalized heterogeneous graph H is processed. std All entities are subjected to gradient-free forward inference in batches; the node embeddings of the inference output are concatenated batch by batch to obtain the complete global embedding matrix. : in, To unify the embedding dimensions; S6.3 Public Opinion Event Clustering and Business Result Output With global embedding matrix As the input for clustering, the K-means unsupervised clustering algorithm is used, and the number of clusters matches the number of target communities. The clustering optimization objective is to minimize the squared error within each cluster, as shown in the formula: in, This is the set of public opinion cluster tags corresponding to all entities; For indexing public opinion clusters; For the first The set of embedding vectors of all nodes within a public opinion cluster; For a single node, the global embedding vector comes from... A row of the matrix; For the first The cluster center of a public opinion cluster; After clustering is completed, the core indicators of each public opinion event cluster are automatically counted, including quantitative information such as participating users within the cluster, related blog posts, topic tags, total interaction popularity, and dissemination time range. The complete large-scale public opinion event detection results are output, forming a closed loop of the entire technical process from raw interaction data to homogeneous public opinion clustering.
[0016] This invention provides a method for detecting large-scale public opinion events based on constraint structure entropy sampling extension, which has the following beneficial effects: (1) This invention combines structural entropy theory and community quantity constraints to form a structural entropy community constraint operator. This operator optimizes the compactness of the community in the limited solution space, suppresses cluster fragmentation from the source, and makes the result of public opinion cluster division conform to the real propagation semantic distribution of social networks.
[0017] (2) The present invention designs a community-aware sampling extension method, which adds the complete global community to which the node belongs to the training batch in order to restore the topological association within the batch and enable the model to have complete community awareness capability when training the ultra-large public opinion graph.
[0018] (3) This invention reconstructs the higher-order association weights of batches through random walk structure similarity, so that the encoder generates more discriminative node embeddings, thereby improving the compactness within the public opinion cluster and the distinguishability between clusters.
[0019] (4) This invention forms a lightweight decoupling architecture through offline community pre-partitioning and online representation training, and combines it with low-complexity sampling and block comparison calculation to achieve efficient training of more than one million public opinion entities, while maintaining high-quality clustering performance and algorithm robustness.
[0020] (5) This invention uses constrained structural entropy and adaptive sampling to weaken the influence of important parameters. The algorithm can stably output high-quality clustering results within a wide parameter range and can adapt to various public opinion platform data such as social media and information without fine parameter tuning.
[0021] (6) This invention adds heterogeneous layered processing and multimodal time-series multi-task comparison branches, and combines text and image and user behavior information to improve the detection capability of niche long tail and newly emerging public opinion events, and support the application of downstream businesses such as public opinion tracing and risk assessment. Attached Figure Description
[0022] Figure 1 This is a flowchart of a large-scale public opinion event detection method based on constraint structure entropy sampling extension according to the present invention. Detailed Implementation
[0023] The present invention will be further described in detail below with reference to specific embodiments and accompanying drawings, but the scope of protection of the present invention is not limited to the content described.
[0024] Structural information theory was initially used to measure the structural information contained in a graph, primarily for calculating homogeneous graphs. The structural entropy reflects the uncertainty in the hierarchical partitioning of the graph. (Encoding tree) Determined homogeneous graph The structural information is defined as follows.
[0025] in, Representation diagram The sum of the degrees of all nodes in the encoding tree. Each vertex corresponds to a graph A subset of nodes . yes The volume is the sum of the degrees of all nodes in the subset. It is the vertex The parent vertex. From a subset of nodes arrive The sum of all edge weights can be considered as the total weight of the cut edge. Indicates random walk entry The probability of [the outcome]. (Figure) structural entropy It is the smallest . This represents a coding tree with a height not exceeding h. The entropy of the h-dimensional structure is defined as .
[0026] This invention prioritizes unsupervised, scalable, highly accurate, and robust performance. It is implemented as a complete, progressive process: data acquisition, data preprocessing, structural entropy community constraint partitioning, community-aware sampling expansion, structural contrastive learning representation optimization, multi-module joint training, and clustering output. Each module is interdependent and works collaboratively, forming an end-to-end closed loop from raw heterogeneous public opinion network data to standardized homogeneous public opinion clustering results. Figure 1 As shown, the specific steps are as follows: S1, Data Acquisition Collect raw public opinion interaction data as the input basis for the entire process.
[0027] This application defines a public opinion network that contains only two types of nodes, namely users and blog posts, and whose edge types are limited to interactive behaviors (such as forwarding, commenting, and liking), as a homogeneous public opinion scenario; and defines a public opinion network that contains multiple types of nodes, such as users, blog posts, comments, topic tags, and keywords, and whose edge types cover multiple relationships, such as forwarding, commenting, collecting, and topic binding, as a heterogeneous public opinion scenario; among them, the homogeneous public opinion scenario can be regarded as a special simplified form of heterogeneous graph.
[0028] This invention collects corresponding public opinion network data sources for two different public opinion scenarios, adapting to the data collection requirements of homogeneous public opinion graphs on a single platform and heterogeneous public opinion graphs across multiple platforms with multiple entities. The collection process is as follows: (1) In the homogeneous public opinion scenario, blog posts and interactive users are taken as nodes of the graph. Undirected edges are generated through interactive behaviors including likes, forwards and comments (in order to simplify the modeling of homogeneous graphs, the interactive behaviors in the homogeneous public opinion scenario are uniformly regarded as undirected edges). Node attribute information including blog post text, post popularity and post time is collected and saved simultaneously.
[0029] (2) In heterogeneous public opinion scenarios, the node types are expanded to include users, blog posts, comments, topic tags and keywords; and different directed or undirected interaction edges are distinguished, including forwarding, commenting, collecting, topic binding and keyword annotation. Forwarding, commenting and collecting are directed edges; topic binding and keywords are undirected edges.
[0030] Completely record the associated entities (interacting parties, such as users and blog posts), relationship types (actions between associated entities, such as forwarding, topic binding, etc.), and all image / text and time-series related attributes corresponding to each interaction. Map all collected information to form a noisy, original heterogeneous graph. This provides complete and standardized raw data support for subsequent processes such as stratified preprocessing and stratified sampling. Among these, Represents a set of entity nodes. Represents the original set of edges in the interaction. and These correspond to the set of node types and the set of edge types, respectively.
[0031] S2, Data Preprocessing The original heterogeneous graph output by S1 is subjected to standardized preprocessing, which includes cleaning, mathematical representation, feature encoding, temporal sequence generation and graph size compression, to obtain a standardized heterogeneous graph, providing a standardized and lightweight input for subsequent community partitioning and comparative learning.
[0032] S2.1 Basic noise cleaning: Remove self-loop edges, repeated interactive edges, and isolated nodes with no interaction in the graph, filter low-quality blog posts published by online trolls, and remove invalid graph structures to avoid interfering with subsequent structural entropy calculations and model convergence processes.
[0033] S2.2 Constructing a graph mathematical representation system (1) The global adjacency matrix is constructed as follows: In the formula, For a set of entity nodes, V ={ v 1, v 2,…, v N}, N This represents the total number of nodes. Represents all possible combinations of node pairs; if node and If there is a direct edge connecting them, then the corresponding elements of the matrix... The value is 1, otherwise The value is 0; among which, i and j These are the row and column indices of the adjacency matrix, distinguishing them as different nodes. Adjacency matrix The Middle i Line number j The value of the column.
[0034] (2) Based on edge type splitting of induced subgraphs, given an edge subset The formula for induced edge sets is: in, For the reason The set of edges induced by the specified edge type; It is the starting node of the edge (one of the endpoints of the edge); It is the endpoint of the edge (the other end of the edge); This is the original set of edges; This is an edge type mapping function that takes an edge as input and outputs its type. For each edge type... Generate the corresponding hierarchical induced subgraphs respectively. .
[0035] (3) The degree of a single node is calculated using the adjacency matrix, using the following formula: In the formula, For nodes The degree.
[0036] (4) Calculate the total volume of the entire public opinion map. The formula is: In the formula, This represents the total volume of the public opinion image. This is a public opinion map.
[0037] (5) To eliminate the differences in feature dimensions such as popularity and text length, the original node feature matrix is processed using minimum-maximum normalization. The normalization calculation formula is as follows: in, Representative node No. Original features; Indexed by feature dimension; The normalized eigenvalues unify the numerical distribution range of all features; For the first The minimum value of a feature; For the first The maximum value of a feature; This is the normalized feature matrix; normalization calculation unifies the distribution range of all feature values.
[0038] This invention is compatible with both homogeneous data sources on a single platform and heterogeneous data sources across platforms, and uniformly establishes the original heterogeneous graph. The invention first cleans dirty edges and isolated nodes, then cleans the online troll data, subsequently forming a hierarchical induced subgraph, and normalizing multimodal and temporal features.
[0039] S2.3 Multimodal Feature Standardization Coding With normalized characteristic matrix Based on this, a unified representation of text and images is achieved. The text is encoded using n-gram hashing to output a fixed-dimensional vector, transforming variable-length text into a unified numerical representation, which serves as the input feature for subsequent semantic analysis. In the formula, As a text feature vector, the text content such as blog post body and comments is converted into a fixed-length numerical vector through n-gram hash encoding; for A dimensional real space, where the dimension of the text feature vector is fixed. That is, all text is encoded into vectors of the same length; The text feature dimension is a pre-defined text encoding length, such as 512 dimensions, and all text vectors have the same length.
[0040] The accompanying image uses a pre-trained ViT encoder to generate image feature vectors, extracting visual semantic representations of the image: In the formula, The images accompanying the blog post are converted into fixed-length numerical vectors using a pre-trained ViT encoder, which are used as image feature vectors. For A fixed-dimensional real space represents the feature vector of an image. ; The image feature dimension is the pre-defined image encoding length, for example, 768 dimensions, and all image vectors have the same length.
[0041] Text dimension vectors and image feature vectors have fixed dimensions and uniform format, forming multimodal features, which serve as the standard input for entity-feature contrast loss, thereby completing the standardized encoding of text and image modal features.
[0042] S2.4, Generate user interaction time sequence Traverse all user nodes and organize all user interactions in ascending order of timestamps to construct a time-series sequence: in, Represents a user node; For users The interaction sequence, a list of all blog post entities that the user has interacted with, arranged chronologically; For a moment User-interacting blog post entities, users at a specific time point The blog post that receives real-time interaction (such as reposting, commenting, and liking); For the first n The timestamp of the next interaction; This refers to the time point when the last interaction occurred.
[0043] The complete user interaction time sequence retains the time sequence information of user interest evolution, which is used for time sequence comparison branches.
[0044] S2.5, Layered pruning at height nodes Set pruning coefficient , upper limit of degree Lower limit of degree Calculate the number of edges to retain for the target node: In the formula, The number of edges to retain for the target node after pruning; As hub nodes, nodes with extremely high degree in the graph (such as influential users and viral blog posts) need to be pruned and compressed; The original degree of the hub node, according to Redundant interactive edges are uniformly trimmed to compress the overall graph size while preserving the core public opinion propagation link, thereby reducing the computing power and memory overhead for subsequent community division and hierarchical sampling. This is the intermediate value of the original degree after exponential scaling, used to balance the number of edges retained and the compression intensity.
[0045] S2.6 Output Standardized Heterogeneous Graph: Integrate the processing results of S2.1-S2.5, and output the cleaned, normalized, and lightweight standardized heterogeneous graph H. std It is then directly fed into the next stage of the structural entropy community constraint module.
[0046] This invention designs a degree-constrained hierarchical pruning strategy for high-order hub nodes, compressing the graph size while preserving the main propagation links, and outputting topological statistics (including node degrees). The total volume of the public opinion map Multimodal feature vectors and user interaction time series provide standardized and unified inputs for community computing and comparative learning.
[0047] S3, Structural Entropy Community Constraints - Offline Global Community Prepartitioning This module, as a downstream offline computing unit in the preprocessing stage, receives the standardized heterogeneous graph output by S2 and, based on the results obtained in the preprocessing stage, calculates the node degree. The total volume of the public opinion map Based on the basic topological statistics, entity uniqueness constraints are introduced to screen valid community pairs. Only the original structural entropy change calculation is performed on the selected pairs. The global community pre-division of the entire network public opinion entities is completed offline in one go, generating the mapping relationship between nodes and communities, and outputting the global community topology prior file based on the mapping relationship.
[0048] S3.1 Community Initialization Read the complete set of entity nodes in a standardized heterogeneous graph Each independent entity node in the graph is divided into an initial independent community, completing the initial community construction and obtaining the complete set of initial communities: In the formula, For the community to gather; Each element in the set represents an independent community containing only a single node. At this point, the total number of communities across the entire network equals the total number of public opinion entities, providing an initial partitioning basis for subsequent community merging and iteration.
[0049] S3.2 Calculate the combined entropy change Traverse all community pairings in the graph that have direct interaction edges. First, the entity uniqueness constraint is determined. Let's assume the communities to be merged are... The internal entity set is ,Community The internal entity set is , For the set of high-traffic hub entities across the entire network, the formula for determining the uniqueness of entities is as follows: In the formula, and The index of an independent community in a community set; if and only if the entity uniqueness constraint determination formula holds, it means that the two groups of communities do not share a hub entity and have a real common source of public opinion dissemination association, and are determined to be a valid pairing; if the intersection is not empty, it is determined to be a false association combination formed by hub nodes, and is directly filtered out and does not participate in the entropy change solution.
[0050] For valid pairings, the change in structural entropy resulting from the merger of the two communities is calculated using the structural entropy formula. The calculation formula is as follows: In the formula, For the community Total weight of cross-community edge trimming; The sum of the degrees of nodes within the community. The total volume of the entire standardized heterogeneous public opinion map; and Community and community The cut edge weight; and Community and community Volume; and Community and community Each node inside; For nodes degree, For a node within the community, A temporary number for nodes within the community; This represents the new community formed after the merger of the two communities.
[0051] express and The increase or decrease in the global structural entropy of the merged public opinion graph. The smaller the value, the higher the global topological compactness after merging the two groups of communities, the better the aggregation effect of the same-origin public opinion, and the stronger the correlation between the two groups of communities. The entity uniqueness constraint can completely eliminate the entropy value estimation distortion caused by popular hub entities and avoid incorrectly identifying public opinion clusters with no substantial correlation as the same-origin community.
[0052] Popular social media posts and top users can cause distortion in the estimation of community merging entropy. This invention adds mutual exclusion constraints on hub entities to the traditional structural entropy merging calculation and filters out false association community pairs formed solely by popular nodes.
[0053] S3.3, Constrained Greedy Merge Pre-configure the total number of target public opinion communities required for the business. Single iteration merging ratio All valid communities, after being filtered by entity uniqueness constraints, are paired up according to entropy change. Sort the values in ascending order from smallest to largest; select the top columns (those that minimize global structural entropy). The community merge operation was performed. After the community merge was complete, the entire network community collection was updated in real time. Synchronously update the entity collection within each community Community edge weighting Community volume The updated parameters will be directly used for the entropy change calculation in the next round of the loop, and the greedy merging step will be executed repeatedly.
[0054] S3.4 Forced Convergence Mechanism After each greedy merge, a convergence assessment is made: if the total number of communities still exceeds the preset target value... And no set satisfies If a valid pairing is found, it means that the remaining communities do not have strong homology relationships. In this case, the system will initiate a forced convergence process. Based on the strength of the interaction relationships between communities, weakly related communities are merged in descending order of strength, continuously reducing the number of communities until the total number of communities in the entire network reaches the preset threshold. This approach prevents the algorithm from getting stuck at a local optimum and controls the fragmentation of shared public opinion into many small, fragmented communities at the source.
[0055] S3.5, Output Community Mapping When the number of communities reaches the preset value Then, generate a mapping function that corresponds one-to-one between nodes and communities across the entire network. The mapping rules specify that for any entity node , It will output the unique public opinion community number to which the node belongs, and synchronously count and store the distribution of various entities such as users, blog posts, comments, and topics within each community to form a complete global community topology prior file.
[0056] This invention utilizes both greedy iteration and forced convergence to achieve global offline community pre-partitioning and outputs a global mapping prior from nodes to communities. This fundamentally suppresses the fragmentation of public opinion clustering and solves the problem that traditional structural entropy methods have difficulty distinguishing between genuine homogeneous communities and hub-induced false communities.
[0057] S4. Community-aware sampling extension, batch construction and global topology preservation. The node-community mapping relationship obtained based on S3 The training batch is constructed by combining the global community topology prior file with the hierarchical induced subgraph obtained by S2 preprocessing, thereby generating an expanded batch of data that retains the complete public opinion event topology, which is then directly supplied to the subsequent multi-task enhanced structure comparison learning module.
[0058] S4.1 Initial Batch Seed Sampling Using a random uniform sampling method, all entity nodes of the normalized heterogeneous graph obtained from S2 are... Select the basic seed node set , as the initial base sample when creating a batch.
[0059] S4.2 Community Location Matching Read mapping function For each node in the seed set ,use Will The entire public opinion community to which each seed node belongs is matched to determine the scope of the entire community corresponding to each seed node, so as to prevent the sampling process from fragmenting the overall topology of a single public opinion event.
[0060] S4.3, Adaptive Community Expansion Based on the hierarchical induced subgraph generated by S2.2, a restart random walk is performed in each hierarchical induced subgraph to distinguish different node types such as users, blog posts, and topic tags, and the associated access frequency of each node is counted. Differentiated expansion rules are set based on community size: If the community is small, it meets the requirements. Therefore, a full community expansion is performed, adding all nodes of the entire community to the expansion set while completely preserving the local topology. The formula for full community expansion is: in, The threshold for community size; The expanded set of backbone nodes is the final set of expanded nodes added to the training batch; To expand the number of nodes added, iterate through any entity node within the community.
[0061] If the community is large, it meets the requirements. So, it will be carried out within the community. 'Second length is The random walk method counts the frequency of node visits, and structures with frequencies higher than the mean are added to the expanded backbone node set. The formula is: In the formula, Represents a node Average access frequency, This indicates that during a random walk within the community, the nodes... The set of all nodes reachable from the starting point. This indicates a node. Visiting nodes during a walk The number of times; To sum the variables, iterate through them; S4.4 Adaptive Sampling Resource Allocation Three independent Transformer encoders are configured to process text, image, and temporal data, respectively. Each encoder outputs a standardized single-modal representation vector. A multi-head self-attention fusion layer is then used to integrate neighborhood topological information, ultimately generating a unified-dimensional node representation. . Representing a predefined embedding dimension, the encoding logic of each branch is as follows: The input to the text Transformer encoder is the text feature vector. Furthermore, it utilizes a multi-head attention mechanism to perform semantic analysis on the text, mining the semantic relationships between blog posts and keywords to output the single-modal code belonging to the text. .
[0062] The input to the image Transformer encoder is the image feature vector. The semantics of the image are abstracted, and the single-modal encoding of the image is output. .
[0063] The input to the user-time Transformer encoder is a time sequence. It models the evolution of user interests over time and outputs a single-modal time-series representation. .
[0064] By setting dynamic computing power allocation rules, more sampling traversal times are automatically allocated to high-value walking paths that can uncover the correlation of public opinion from the same source, reducing the waste of computing power caused by isolated low-value entities and meaningless short paths, and alleviating the defect of unbalanced sampling distribution of hub nodes.
[0065] The dynamic computing power allocation rule is as follows: First, any path among all walk paths generated in the first round of random walks of the hierarchical induced subgraph. Based on a weighted average of three-dimensional indicators—community connectivity, text-image semantics, and temporal interaction—the common origin value score is calculated. The formula is: in, The entity traversal path generated by a single restart random walk within a hierarchical induced subgraph; Indicates the starting node of the walk. Represents the public opinion entities traversed by the path; Indicates the maximum preset travel length of the path; This indicates the weight of the community connectivity index, used to determine whether a path belongs to the same public opinion community. This indicates the weight of the semantic similarity index between text and images, measuring the degree of homogeneity between blog posts and accompanying images. This indicates the weight of user time-series interaction metrics, measuring the strength of the time-series correlation of user behavior. This represents the comprehensive value score of public opinion from the same source along the path, with a value of [0,1]. The higher the value, the easier it is to discover public opinion from the same source along the path, and the higher the priority of computing power allocation. Score the connectivity of the path community; The average semantic similarity between the path image and text; The score is the path temporal correlation score.
[0066] in, This serves as a marker for determining whether a path belongs to the same community; 1 = all entities along the path belong to the same public opinion community, 0 = the path contains unrelated entities across different communities; For nodes The community to which it belongs; This indicates the actual number of entity nodes contained in the current path. The maximum length hyperparameter of the random walk is preset globally; Where i and j represent the node (entity) indices within the path, respectively; This represents any two distinct entities within the path. Representing entities Text single-modal encoding, Representing entities Image single-mode coding, This represents the cosine similarity calculation function, which measures the semantic similarity between two sets of feature vectors; This indicates that all entities along the traversal path are paired and summed. This represents the total number of entity pairings within the path, used for normalization to obtain the mean.
[0067] in, This represents the number of consecutive interactive elements within the path that satisfy a temporal sequence relationship. This represents the total number of pairwise combinations of all entities within the path; A higher value indicates a stronger temporal continuity of user interaction behavior within the path and a higher probability of shared public opinion.
[0068] Then based on the baseline number of walks Maximum number of walks Magnification factor The formula for calculating the number of basic traversals is: Then introduce the hub attenuation coefficient The corrected result is: In the formula, This represents the number of times the path has been traversed. This is a truncation function; The comprehensive value score of public opinion along the same path.
[0069] Introducing hub attenuation coefficient To reduce the computational resource consumption of popular hub paths, paths are then sorted from highest to lowest based on their comprehensive value from the same source of public opinion. The top 10% are designated as a high-value path pool, the top 10%-30% as a medium-value path pool, and the bottom 70% as a low-value path pool. 70%, 20%, and 10% of the total computational resources are allocated preferentially to these three value path pools, respectively. Total computational resources refer to the total computational budget available for random walks in a single round of batch sampling, specifically quantified as the upper limit of the total number of path walks in this round of sampling.
[0070] The high-value path pool prioritizes the allocation of GPU-accelerated threads, and the number of traversals for each path is determined by... Formula calculation; simultaneously, a hub attenuation coefficient is introduced. The number of corrections is obtained by applying attenuation correction to the path whose starting node is the hub node. This reduces the computational load on popular hub paths. The low-to-medium value path pool allocates only regular CPU threads and reserves only a safety net. In addition to the previous sampling, a global total traversal limit and single-community computing power isolation constraints were added. Before each batch sampling round, the score of each path was recalculated and the path pool partitioning and traversal allocation were dynamically updated. More sampling traversal times were precisely allocated to high-value paths of shared public opinion, fully exploring long-range shared-source correlations, reducing computing power loss from ineffective paths, and alleviating the sampling distribution imbalance caused by hub nodes. The single-community computing power isolation constraint essentially limits the proportion of total computing power occupied by a single public opinion community, preventing hot communities from monopolizing sampling resources and ensuring that smaller communities can also obtain sufficient path coverage.
[0071] S4.5, Generate expanded training batches Set the initial seed node set The extended backbone node set obtained by hierarchical filtering By combining these elements, we obtain the final expanded training batch node set, as shown in the formula: To expand batch data, Internally, it fully preserves the complete related topology of the same public opinion event, solving the problem of the global community being fragmented during the small-batch training phase. It is fed as input into the multi-task enhanced structure comparison learning module.
[0072] This invention differs from traditional random, local neighborhood small-batch sampling. It utilizes the global community mapping output by SECC as a priori to match seed nodes, thereby obtaining a complete homogeneous public opinion community. Furthermore, it selects two different expansion strategies based on community size: full community inclusion and backbone walking screening, and combines them with a dynamic computing power allocation method to form a complete expanded training batch. This addresses the problems of small-batch training fragmenting the global community and losing long-range public opinion correlations, ensuring the topological continuity within the batch.
[0073] S5, Structural Comparison Learning Expanded batch data obtained from S4 The multimodal features and time-series sequences obtained in the preprocessing stage are integrated to construct a multi-task joint loss function. The entity node discrimination embedding is iteratively optimized, and the batch embedding results are continuously fed into the multi-threaded parallel joint training stage for iterative optimization.
[0074] S5.1, Construction of Batch Higher-Order Affinity Matrix For input expanded batch data The total number of entities in a batch is recorded as Within the batch, perform multiple rounds of hierarchical restart random walk operations on all entities, traversing each walk path and counting nodes. At the start, node Co-occurrence frequency of visits ; Construct a sparse high-order structure affinity matrix based on statistical results The formula for determining and calculating matrix elements is as follows: in, '' is the row index of the node within the batch, which is the starting node index, indicating the starting node of the random walk; '' is the column index of the node within the batch, which is the index of the target node and represents the endpoint of the random walk; and The first in each batch '' node and the first One node; Represented by nodes The set of all entities reachable by random walks under the constraint of a hierarchical induced subgraph, starting from the given point. For higher-order affinity matrix elements, represent the matrix No. '' line number The values in the '' column quantify the strength of long-range common-origin associations between nodes. The numerical value is directly quantized and The strength of long-range public opinion co-origin correlation between different sources can compensate for the shortcomings of the original first-order adjacency matrix, which can only characterize direct interactions and cannot capture cross-platform / cross-secondary propagation links, and provide accurate topological positive and negative sample basis for structural comparison tasks.
[0075] S5.2, The higher-order affinity matrix constructed in S5.1 Input the topology GCN mapping layer, extract the neighborhood topology features of each node in the current batch, and compare them with... and The input is fed into a multi-head self-attention fusion layer, which adaptively balances the contribution weights of topology and graph-text semantics, and outputs a unified basic embedding for a single node. .
[0076] S5.3, Construction of Joint Contrast Loss Based on high-order affinity matrix Single-modal encoding of text Image single-mode coding and single-modal time series characterization Independent contrastive losses are designed separately, and the spatial distribution of the embedding is constrained from three dimensions: result, content, and time series. The weighted fusion of the three types of losses yields the global optimization objective. .
[0077] S5.3.1, Higher-order structural losses Based on high-order affinity matrix Filter each node The corresponding set of topological positive samples All entities within the set are related to Nodes exhibiting long-range, shared-origin public opinion correlations; other irrelevant entities within the batch are selected as the negative sample set. The InfoNCE loss with multiple positive samples is used to narrow the embedding distance between homologous nodes. The loss calculation formula is as follows: in, exist In the calculation formula, the anchor node is the first node in the batch. ' ' nodes, serving as anchor points for comparative learning; exist In the calculation formula, the positive sample nodes are the anchor points. Nodes with long-range common origin associations; Cosine similarity; Temperature is a hyperparameter used to scale the embedding inner product and adjust the difficulty of distinguishing between positive and negative samples; and Anchor points and positive sample nodes The unified embedding is output by the multi-head self-attention fusion layer of S5.2; The index variable for negative samples; For a specific node in the negative sample set, the first node in the batch Each node entity; A unified embedding for negative samples; This is a high-order structural loss, which is specifically designed to optimize the internal topological compactness of public opinion events, avoiding the embedding of nodes of the same event that are far apart from each other.
[0078] S5.3.2, Entity Content Comparison Loss For cold-start blog posts with no reposts or comments, and newly registered users (lacking topological association information), align node embedding is performed. With image-text single-modal coding , Using different entity image and text features from the same batch as negative samples, a dual-content InfoNCE loss is constructed and the mean is taken. The calculation formula is as follows: In the formula, The loss value is used to compare entity content; The representative InfoNCE contrastive loss function; This is a set of negative image and text samples that are different from the current entity. It represents the expected / mean value of all nodes within a batch; by supplementing the missing topological association information through textual and graphical semantics, it solves the problem of the failure of cold-start public opinion entity representation and improves the detection capability of niche long-tail events.
[0079] S5.3.3, User Temporal Behavior Loss Based on user interaction time series The objective is to construct a dual-branch time-series comparison, which is divided into the prediction loss of the next interaction behavior. Long-term interest matching loss Two parts, the formula is: In the formula, The operator is used to calculate the expectation / mean of the user sequence. Indicates the earliest interaction, Indicates the most recent interaction; For blog posts The unified embedding, which is the node output by the multi-head self-attention fusion layer of S5.2. Basic embedding; This will form the basis for the next interactive blog post. For the negative sample set; To predict the loss for the next interactive behavior, constrain the temporal representation to match the user's next interactive blog post and capture short-term immediate interests; The loss is calculated by matching long-term interests with long-term interaction entities and mining users' long-term stable preferences. The sum of these two types of losses constitutes the complete time-series optimization objective. , To determine the total loss of user time-series behavior, we can explore implicit shared public opinion arising from the convergence of user interests.
[0080] S5.3.4, Total Loss Fusion Formula The three types of losses—high-order structure loss, entity content comparison loss, and user temporal behavior loss—are weighted and fused with balanced weights to obtain the overall module optimization loss. : in, , , The hyperparameters for balancing the higher-order structure loss, entity content comparison loss, and user temporal behavior loss are respectively, and can be fine-tuned according to the public opinion business scenario to achieve synergistic optimization of the three types of representation objectives.
[0081] S5.4 Network parameter backpropagation update To optimize losses as a whole As the overall optimization objective, chained gradient backpropagation is performed to synchronously update all learnable parameters within the structure-contrast learning module, including the parameter set. These correspond to the weights of the text encoder, image encoder, temporal encoder, and topological GCN mapping layer, respectively. The gradients of each parameter are obtained by weighting the partial derivatives of the total loss with respect to the parameters. The gradient calculation formula is as follows: The Adam adaptive optimizer is used to perform iterative parameter updates based on the gradient calculation formula. After completing one round of forward inference and backpropagation, the optimized node embeddings for this batch are output and continuously fed into the downstream multi-module parallel joint training stage for iterative iteration.
[0082] This invention utilizes hierarchical random walks to form batch high-order affinity matrices and mines long-range public opinion associations across entities. It combines three independent Transformer encoders—text, image, and user time-series—to fuse multi-faceted information. Three weighted joint comparison objectives are designed: high-order structural loss, image-text content loss, and user time-series loss. Furthermore, it addresses the problem of ineffective topological representation of cold-start blog posts and new users, enabling the learning of entity embeddings with topological, semantic, and temporal discriminative capabilities.
[0083] S6, multi-module joint training, global embedding inference and public opinion clustering output Batch optimization of node embedding and total loss based on S5 output A multi-threaded asynchronous parallel training framework was built, and the contrastive learning module model, constructed using S5 and including a text Transformer encoder, an image Transformer encoder, a temporal Transformer encoder, a topological GCN mapping layer, and a multi-head self-attention fusion layer, was continuously iterated under the global community prior constraint. After the model converged, batch forward inference was performed on all public opinion entities to obtain a unified global representation. Finally, unsupervised public opinion event clustering was completed by combining the preset number of communities, and standardized public opinion analysis results were output. The complete execution flow is as follows: S6.1, Multi-threaded Parallel Joint Training S6.1.1 Training Architecture Design: The four sub-tasks of community-aware sampling extension, multi-Transformer feature aggregation encoding, joint contrastive loss construction, and network parameter backpropagation update adopt a multi-threaded asynchronous execution mode. Synchronous read-write locks are set for the hash shared table that only stores node-community mappings, which greatly reduces the computational latency caused by multi-threaded resource contention and improves the training throughput efficiency of ultra-large public opinion graphs.
[0084] S6.1.2, Construction of Training Comprehensive Loss: The total loss output in S5 Based on this, a community consistency regularization term is superimposed to constrain entity embeddings within the same public opinion community to be as close as possible, thus offsetting the representation dispersion problem caused by batch sampling fragmentation. The formula for calculating the regularization term is: Overall training loss of the model for: in, For community consistency regularization loss; Community affiliation criteria, representing nodes and nodes Belonging to the same public opinion community (the mapping function output by S3) ( (Decision). Only when this condition is met will these two nodes be included in the calculation of this regularization term; This is a regularization term balancing hyperparameter used to control the strength of the community compactness constraint.
[0085] S6.1.3 Training Termination Judgment Mechanism: Set dual convergence conditions, one of which is a preset maximum number of iterations. Secondly, the loss fluctuation threshold The training loss difference over multiple iterations satisfies Or the number of iterations reaches the upper limit. When the model has converged, all parameter update operations are terminated.
[0086] This invention utilizes a multi-threaded asynchronous architecture for sampling, encoding, loss, and gradient updates to reduce computational overhead. A community consistency regularization term is superimposed on the total loss of multiple tasks to constrain the embeddings of nodes in the same community to be closer to each other and to offset the representational dispersion caused by sampling. The number of iteration rounds and loss fluctuation are set as the two convergence criteria to perform efficient and stable training on ultra-large public opinion graphs.
[0087] S6.2, Global Batch Embedded Inference After the model converges, the batch random sampling process is closed, and the entire normalized heterogeneous graph H is processed. std All entities are subjected to gradient-free forward inference in batches to avoid random perturbations during the training phase and ensure representation stability; the node embeddings of the inference output are concatenated batch by batch to obtain the complete global embedding matrix. : in, To unify the embedding dimensions, each row in the matrix corresponds to the fusion representation of a single public opinion entity, fully integrating three types of information: topology, text and images, and user time series. It can be stored for various downstream businesses such as offline public opinion review and online hot topic retrieval.
[0088] S6.3 Public Opinion Event Clustering and Business Result Output With global embedding matrix As the input for clustering, the K-means unsupervised clustering algorithm is used, and the number of clusters is matched with the pre-configured target community number in the structural entropy community constraint. The clustering optimization objective is to minimize the squared error within each cluster, as shown in the formula: in, This is the set of public opinion cluster tags corresponding to all entities; For indexing public opinion clusters; For the first The set of embedding vectors of all nodes within a public opinion cluster; For a single node, the global embedding vector comes from... A row of the matrix; Representing the The cluster center of public opinion clusters.
[0089] After clustering, the core metrics for each public opinion event cluster are automatically calculated, including: 1. Participating users within the cluster: Filter all user-type nodes within the cluster, remove duplicates, and count the total number; 2. Related blog posts: Filter blog posts and comment content nodes within the cluster, remove duplicates, and count the total number; 3. Topic Tags: Extract all blog posts within the cluster that are bound to specific topics and remove duplicates, then count the number of unique topic tags; 4. Total interaction popularity: Differentiated weights are assigned to different interaction behaviors, including forwarding, commenting and liking, after preprocessing, and the total interaction popularity value is obtained by weighted summation of all interaction behaviors within the cluster; 5. Propagation Time Range: Extract the timestamps of all interactions and publishing behaviors within the cluster, take the minimum and maximum timestamp values to form the propagation time interval, and output the complete time span from the earliest outbreak to the latest spread of public opinion as the propagation time range; This forms a closed-loop process from raw interactive data to clustering of public opinion from the same source.
[0090] After convergence, the model performs gradient-free batch inference on all public opinion entities to obtain the global embedding matrix. This paper configures K-means clustering using a preset target number of communities, automatically divides clusters of public opinion events from the same source, and statistically analyzes business indicators such as popularity, dissemination range, and participating entities, thereby completing the end-to-end output from raw interaction data to standardized public opinion detection results.
[0091] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.
Claims
1. A method for detecting large-scale public opinion events based on constraint structure entropy sampling extension, characterized in that: Includes the following steps: S1. Collect corresponding public opinion network data sources for homogeneous and heterogeneous public opinion scenarios respectively, and map the collected information in a unified manner to form a noisy original heterogeneous graph. S2. Perform standardization preprocessing on the original heterogeneous graph output by S1, sequentially performing cleaning, mathematical representation, feature encoding, time series generation, and graph size compression to obtain the standardized heterogeneous graph. S3. Based on the standardized heterogeneous graph obtained in S2, introduce entity uniqueness constraints to screen effective community pairings. Only perform original structural entropy change calculations on the selected pairings to complete the global community pre-division of the entire network public opinion entities offline, generate the mapping relationship from nodes to communities, and output the global community topology prior file based on the mapping relationship. S4. Based on the node-community mapping relationship and global community topology prior file obtained in S3, combined with the hierarchical induced subgraph obtained in S2 preprocessing, training batches are constructed to generate complete and fully preserved public opinion event topology expanded batch data. S5. Based on the expanded batch data obtained in S4, and combined with the multimodal features and time series obtained in S2, construct a multi-task joint loss function, and iteratively optimize the entity node discrimination embedding through the multi-task joint loss function; S6. Batch optimization of node embedding and total loss based on S5 output A multi-threaded parallel joint training framework was built, and the S5 comparative learning module model was continuously iterated under the global community prior constraint. After the model converged, batch forward inference was performed on all public opinion entities to obtain a unified global representation. Then, combined with the preset number of communities, unsupervised public opinion event clustering was completed, and standardized public opinion analysis results were output.
2. The method for detecting large-scale public opinion events based on constraint structure entropy sampling extension according to claim 1, characterized in that: In S1, the two types of online public opinion data sources collected are: (1) In a homogeneous public opinion scenario, blog posts and interactive users are used as nodes of a graph. Undirected edges are generated through interactive behaviors including likes, reposts and comments, and node attribute information is collected and saved simultaneously. (2) In heterogeneous public opinion scenarios, the node types are expanded; and directed interaction edges and undirected interaction edges are distinguished. Among them, forwarding, commenting and collecting are directed edges; topic binding and keywords are undirected edges. All collected information corresponding to each interaction behavior is mapped to form a noisy original heterogeneous graph. ,in, Represents a set of entity nodes. Represents the original set of edges in the interaction. and These correspond to the set of node types and the set of edge types, respectively.
3. The method for detecting large-scale public opinion events based on constraint structure entropy sampling extension according to claim 2, characterized in that: The specific process of S2 is as follows: S2.
1. Perform noise cleaning on the original heterogeneous graph; S2.2 Constructing a graph mathematical representation system (1) Construct the global adjacency matrix as follows , V ={ v 1, v 2,…, v N }, N This represents the total number of nodes. Represents all possible combinations of node pairs; i and j These are the row and column indices of the adjacency matrix, respectively. Adjacency matrix The Middle i Line number j The value of the column; (2) Based on edge type splitting of induced subgraphs, given an edge subset The induced edge set is , For the reason The set of edges induced by the specified edge type; Let be the starting node of the edge; Let be the endpoint node of the edge; A mapping function for edge types; for each edge type Generate the corresponding hierarchical induced subgraphs respectively. ; (3) Calculate the total volume of the entire public opinion map. , , This represents the total volume of the public opinion image. This is a public opinion map; To calculate nodes using the adjacency matrix The degree; (4) The original node feature matrix is processed by min-max normalization to obtain the normalized eigenvalues. ; S2.3 Multimodal Feature Standardization Coding With normalized characteristic matrix Based on this, a unified representation of text and images is achieved. The text is then encoded using n-gram hashing to output a fixed-dimensional vector. , For text feature vectors; for 3D real space; For text feature dimensions; The accompanying image uses a pre-trained ViT encoder to generate image feature vectors. , Image feature vector; for 3D real space; Image feature dimension; Text dimension vectors and image feature vectors have fixed dimensions and uniform format, forming multimodal features; S2.4, Generate user interaction time sequence Traverse all user nodes and organize all user interactions in ascending order of timestamps to construct a time-series sequence: in, Represents a user node; For users Interaction time sequence; For a moment User-interactive blog post entities; For the first n The timestamp of the next interaction; The time point at which the last interaction occurred; S2.5, Layered pruning at height nodes Set pruning coefficient , upper limit of degree Lower limit of degree Calculate the number of edges to retain for the target node: In the formula, Preserve the number of edges for the target; As a hub node; The original degree of the hub node; This is the median value of the original degree after exponential scaling; S2.6 Output Normalized Heterogeneity Graph: After processing in S2.1-S2.5, output the cleaned, normalized, and lightweight normalized heterogeneity graph H. std .
4. The method for detecting large-scale public opinion events based on constraint structure entropy sampling extension according to claim 3, characterized in that: The specific process of S3 is as follows: S3.1 Community Initialization Read the complete set of entity nodes in a standardized heterogeneous graph Each independent entity node in the graph is divided into an initial independent community, resulting in a complete set of initial communities. , For the community to gather; For each element within the community, the total number of communities across the entire network equals the total number of public opinion entities; S3.2 Calculate the combined entropy change Traverse all community pairings in the graph that have direct interaction edges. Perform entity uniqueness constraint determination, assuming the community to be merged. The internal entity set is ,Community The internal entity set is , The set of high-traffic hub entities across the entire network is defined by the following formula for determining the uniqueness of each entity: , and Independent community indexes within a community collection; For valid pairings, the change in structural entropy resulting from the merger of the two communities is calculated using the structural entropy formula. The calculation formula is as follows: In the formula, For the community Total weight of cross-community edge trimming; The sum of the degrees of nodes within the community. The total volume of the entire standardized heterogeneous public opinion map; and Community and community The cut edge weight; and Community and community Volume; and Community and community Each node inside; For nodes degree, For a node within the community, A temporary number for nodes within the community; This represents the new community formed after the merger of the two communities; S3.3, Constrained Greedy Merge Pre-configure the total number of target public opinion communities required. and the ratio of single iterations All valid communities, after being filtered by entity uniqueness constraints, are paired up according to entropy change. Sort the values in ascending order from smallest to largest; select the first few columns of the sorted list. The proportional community performed a merge operation; After the community merger is completed, the entire network community collection will be updated in real time. Update the entity set within each community Community edge weighting and community volume The updated parameters are directly used for the entropy change calculation in the next round of the loop, and the greedy merging process is executed repeatedly. S3.4 Forced Convergence Mechanism After each greedy merge, a convergence assessment is made: if the total number of communities still exceeds the preset target value... And no set satisfies When a valid pairing is achieved, the forced convergence mode is initiated: Based on the strength of interaction between communities, weakly connected communities are merged in descending order of strength, continuously reducing the number of communities until the total number of communities across the entire network reaches the preset target. ; S3.5, Output Community Mapping When the number of communities reaches the preset value Then, generate a mapping function that corresponds one-to-one between nodes and communities across the entire network. The mapping rules specify that for any entity node , It will output the unique public opinion community number to which the node belongs, and synchronously count and store the distribution of various entities within each community to form a complete global community topology prior file.
5. The method for detecting large-scale public opinion events based on constraint structure entropy sampling extension according to claim 4, characterized in that: The specific process of S4 is as follows: S4.1 Initial Batch Seed Sampling Using a random uniform sampling method, all entity nodes of the normalized heterogeneous graph obtained from S2 are... Select the basic seed node set ; S4.2 Community Location Matching Read mapping function For each node in the seed set ,use Will Match the complete public opinion community to determine the complete community scope corresponding to each seed node; S4.3, Adaptive Community Expansion Based on the hierarchical induced subgraph generated by S2.2, a restarted random walk is performed in each hierarchical induced subgraph to distinguish different node types, including users, blog posts, and topic tags, and the associated access frequency of each node is counted. Differentiated expansion rules are set based on community size: like To perform a full community expansion, all nodes in the entire community are added to the expansion set. The formula is: in, The threshold for community size; For the expanded set of backbone nodes; To expand the number of nodes added; like Then it will be carried out within the community. 'Second length is The random walk method counts the frequency of node visits, and structures with frequencies higher than the mean are added to the expanded backbone node set. The formula is: In the formula, Represents a node Average access frequency, This indicates that during a random walk within the community, the nodes... The set of all nodes reachable from the starting point. This indicates a node. Visiting nodes during a walk The number of times; To sum the variables, iterate through them; S4.4 Adaptive Sampling Resource Allocation Multi-Transformer feature aggregation encoder encoding: Configure the text Transformer encoder to use text feature vectors As input, a multi-head attention mechanism is used to mine the semantic associations between blog posts and keywords, and the corresponding text unimodal encoding is output. ; Configure the image Transformer encoder to use image feature vectors As input, the semantics of the image are abstracted, and the corresponding image unimodal code is output. ; Configure the user-time Transformer encoder to use time sequences Using this as input, we model the evolution of user interests over time, and the corresponding output is a single-modal time-series representation. ; Set dynamic computing power allocation rules to automatically allocate more sampling traversal times to high-value wandering paths that can uncover the correlation of public opinion from the same source. S4.5, Generate expanded training batches Set the initial seed node set The extended backbone node set obtained by hierarchical filtering By combining these elements, we obtain the final expanded training batch node set, using the following formula: To expand batch data.
6. The method for detecting large-scale public opinion events based on constraint structure entropy sampling extension according to claim 5, characterized in that: The dynamic computing power allocation rules are as follows: First, consider any path among all the walk paths generated in the first round of random walks of the hierarchical induced subgraph. Based on a weighted average of three-dimensional indicators—community connectivity, text-image semantics, and temporal interaction—the common origin value score is calculated. , This refers to the entity traversal path generated by a single restart random walk within a hierarchical induced subgraph. Indicates the starting node of the walk. Represents the public opinion entities traversed by the path; Indicates the maximum preset travel length of the path; Values range from [0, 1]. Then based on the baseline number of walks Maximum number of walks Magnification factor The number of basic traversals is calculated as follows: Introducing hub attenuation coefficient The corrected result is: In the formula, This represents the number of times the path has been traversed. This is a truncation function; Based on the comprehensive value of public opinion from the same source, the top 10% are divided into a high-value path pool, the top 10%-30% into a medium-value path pool, and the bottom 70% into a low-value path pool. 70%, 20%, and 10% of the total computing power resources are respectively allocated to the high, medium, and low-value path pools.
7. The method for detecting large-scale public opinion events based on constraint structure entropy sampling extension according to claim 5, characterized in that: The specific process of S5 is as follows: S5.1, Construction of Batch Higher-Order Affinity Matrix For input expanded batch data The total number of entities in a batch is recorded as Within the batch, perform multiple rounds of hierarchical restart random walk operations on all entities, traversing each walk path and counting nodes. At the start, node Co-occurrence frequency of visits ; A sparse high-order structure affinity matrix is constructed based on statistical results. The formula for determining and calculating matrix elements is as follows: in, '' is the row index of the node within the batch; '' is the column index of the node within the batch; and The first in each batch '' node and the first '' nodes; Represented by nodes Starting from the hierarchical induced subgraph constraint, the set of all entities reachable by random walks; For higher-order affinity matrix elements, represent the matrix No. '' line number The value of the column; S5.2, The higher-order affinity matrix constructed in S5.1 Input the topology GCN mapping layer, extract the neighborhood topology features of each node in the current batch, and compare them with... and The input is fed into a multi-head self-attention fusion layer, which adaptively balances the contribution weights of topology and graph-text semantics, and outputs a unified basic embedding for a single node. ; S5.3, Construction of Joint Contrast Loss S5.3.1, Higher-order structural losses Based on high-order affinity matrix Filter each node The corresponding set of topological positive samples Select the remaining irrelevant entities within the batch as the negative sample set. The multi-positive-sample InfoNCE loss is used to narrow the embedding distance of homologous nodes, and the higher-order structure loss is calculated. for: in, exist The calculation formula represents the anchor node for contrastive learning; exist The calculation formula is for anchor points. Positive sample nodes with long-range homology exist; Cosine similarity; This refers to temperature hyperparameters. and Anchor points and positive sample nodes Unified embedding; The index variable for negative samples; For specific nodes in the set of negative samples; For negative samples, use unified embedding; for higher-order structure loss. S5.3.2, Entity Content Comparison Loss For cold-start blog posts and newly registered users with no reposting or commenting interaction, align node embedding and , Using different entity image and text features from the same batch as negative samples, a dual-content InfoNCE loss is constructed and the average is taken. The formula for calculating the entity content comparison loss is as follows: In the formula, The loss value is used to compare entity content; The representative InfoNCE contrastive loss function; This is a set of negative image and text samples that are different from the current entity. This represents the expected or average value of all nodes within the batch. S5.3.3, User Temporal Behavior Loss Based on user interaction time series The objective is to construct a dual-branch time-series comparison, which is divided into the prediction loss of the next interaction behavior. Matching loss with long-term interests The two parts, the sum of the two types of losses, constitute the complete time series optimization objective. , The total loss due to user's temporal behavior; S5.3.4, Total Loss Fusion Formula High-order structure loss Entity content comparison loss Total loss of user time-series behavior The three types of losses are weighted and fused together to obtain the overall optimization loss of the module. ; S5.4 Network parameter backpropagation update To optimize losses as a whole As the overall optimization objective, chained gradient backpropagation is performed to synchronously update all learnable parameters within the structure-contrast learning module, including the parameter set. , respectively, correspond to the weights of the text Transformer encoder, image Transformer encoder, user temporal Transformer encoder, and topological GCN mapping layer; the gradients of various parameters are obtained by weighting the partial derivatives of the total loss with respect to the parameters, and the Adam adaptive optimizer is used to complete the parameter iterative update based on the gradient calculation formula. After completing one round of forward inference and backpropagation, the optimized node embeddings of this batch are output.
8. The method for detecting large-scale public opinion events based on constraint structure entropy sampling extension according to claim 7, characterized in that: The specific process of S6 is as follows: S6.1, Multi-threaded Parallel Joint Training S6.1.1 Training Architecture Design: The four sub-tasks of community-aware sampling extension, multi-Transformer feature aggregation encoding, joint contrastive loss construction and network parameter backpropagation update adopt a multi-threaded asynchronous execution mode, and a synchronous read-write lock is set for the hash shared table that only stores node and community mapping; S6.1.2, Construction of Training Comprehensive Loss: The total loss output in S5 The community consistency regularization term is superimposed on top, and the formula for calculating the regularization term is: Overall training loss of the model for: in, For community consistency regularization loss; Community affiliation criteria, representing nodes and nodes They belong to the same public opinion community; The hyperparameters for balancing the regularization term; S6.1.3 Training Termination Determination Mechanism: Set dual convergence conditions: reaching the preset maximum number of iterations. Or the difference in losses over multiple consecutive rounds When the model has converged, This is the threshold for loss fluctuation; S6.2, Global Batch Embedded Inference After the model converges, the batch random sampling process is closed, and the entire normalized heterogeneous graph H is processed. std All entities are subjected to gradient-free forward inference in batches; the node embeddings of the inference output are concatenated batch by batch to obtain the complete global embedding matrix. : in, To unify the embedding dimensions; S6.3 Public Opinion Event Clustering and Business Result Output With global embedding matrix As the input for clustering, the K-means unsupervised clustering algorithm is used, and the number of clusters matches the number of target communities. The clustering optimization objective is to minimize the squared error within each cluster, as shown in the formula: in, This is the set of public opinion cluster tags corresponding to all entities; For indexing public opinion clusters; For the first The set of embedding vectors of all nodes within a public opinion cluster; For a single node, the global embedding vector comes from... A row of the matrix; For the first The cluster center of a public opinion cluster; After clustering is completed, the core indicators of each public opinion event cluster are automatically counted, including quantitative information such as participating users within the cluster, related blog posts, topic tags, total interaction popularity, and dissemination time range. The complete large-scale public opinion event detection results are output, forming a closed loop of the entire technical process from raw interaction data to homogeneous public opinion clustering.
