A microblog network behavior detection method based on feature fusion and SVM

CN119202253BActive Publication Date: 2026-10-16NANJING UNIV OF INFORMATION SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411276231.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-12
Publication Date
2026-10-16
Estimated Expiration
2044-09-12

AI Technical Summary

Technical Problem

[0005]针对现有技术中存在的微博多网络行为类型检测精度低的问题,本申请提供了一种基于特征融合和SVM的微博网络行为检测方法,通过预训练的二分类SVM模型识别评论是否包含目标行为,进一步利用多分类SVM模型对包含目标行为的评论进行网络行为类型的多分类,判断评论区是否包含目标网络行为,提高了多网络行为的检测精度

Benefits of technology

[0020] Compared to existing technologies, the advantages of this application are:

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119202253B_ABST
    Figure CN119202253B_ABST
Patent Text Reader

Abstract

The application discloses a microblog network behavior detection method based on feature fusion and SVM, and relates to the field of artificial intelligence, which comprises the following steps: extracting features of comment data by using a TF-IDF algorithm to obtain a TF-IDF feature matrix reflecting the importance of words in documents; extracting features of the comment data by using a pre-trained BERT-Base-Chinese model to obtain a BERT feature matrix containing semantic information; splicing the TF-IDF dense feature matrix and the BERT feature matrix according to columns to form a fused comprehensive feature matrix; inputting the fused comprehensive feature matrix into a pre-trained binary SVM model; inputting the comprehensive feature matrix of the identified comment subset containing target behavior content into a pre-trained multi-class SVM model, performing multi-classification on each comment in the subset, and identifying the network behavior type contained in each comment; and improving the detection accuracy of multi-network behavior in view of the low detection accuracy of microblog multi-network behavior types in the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence, and more specifically, to a method for detecting Weibo network behavior based on feature fusion and SVM. Background Technology

[0002] Currently, Weibo network behavior detection mainly employs methods such as keyword matching. Keyword matching is prone to high rates of missed detections and false positives, making it difficult to accurately identify complex and ever-changing network behaviors. Furthermore, existing Weibo network behavior research mostly focuses on single types of violations, such as identifying spam comments, lacking systematic research and comprehensive detection of multiple network behaviors.

[0003] In recent years, the development of machine learning and natural language processing technologies has provided new ideas for Weibo network behavior detection. Some researchers have attempted to use machine learning models such as Support Vector Machines (SVM) and Convolutional Neural Networks (CNN) to classify Weibo comment content, achieving some results. However, most of these methods directly use the raw comment text as input, failing to fully mine the semantic information and structural features of the comment data, resulting in detection accuracy that needs improvement. Furthermore, existing methods struggle to comprehensively and finely identify the various types of network behaviors present in Weibo comment sections. Summary of the Invention

[0004] 1. Technical problems to be solved

[0005] To address the issue of low detection accuracy for multiple network behavior types on Weibo in existing technologies, this application provides a Weibo network behavior detection method based on feature fusion and SVM. It uses a pre-trained binary classification SVM model to identify whether comments contain target behaviors, and further utilizes a multi-classification SVM model to perform multi-classification of network behavior types for comments containing target behaviors, thereby determining whether the comment section contains target network behaviors and improving the detection accuracy of multiple network behaviors.

[0006] 2. Technical Solution

[0007] The purpose of this application is achieved through the following technical solution.

[0008] This specification provides a microblogging network behavior detection method based on feature fusion and SVM, including: acquiring comment data from the target comment section; extracting features from the comment data using the TF-IDF algorithm to obtain a TF-IDF feature matrix reflecting the importance of words in the document; extracting features from the comment data using a pre-trained BERT-Base-Chinese model to obtain a BERT feature matrix containing semantic information; converting the TF-IDF sparse feature matrix into a TF-IDF dense feature matrix; concatenating the TF-IDF dense feature matrix and the BERT feature matrix column-wise to form a fused comprehensive feature matrix; inputting the fused comprehensive feature matrix into a pre-trained binary classification SVM model to classify each comment in the matrix, determine whether the comment contains the target behavior content, and count the number of comments containing the target behavior content and its proportion in all comments; inputting the comprehensive feature matrix of the identified subset of comments containing the target behavior content into a pre-trained multi-classification SVM model to perform multi-classification on each comment in the subset and identify the network behavior type contained in each comment;

[0009] Furthermore, it also includes: based on the classification results, counting the number of comments for each network behavior type and its proportion in the subset of comments containing the target behavior content; comparing the number of comments for each network behavior type obtained from the statistics with a preset number threshold, and comparing the proportion of each network behavior type with a preset proportion threshold; when the number of at least one network behavior type exceeds the preset number threshold and the proportion exceeds the corresponding proportion threshold, it is determined that there is a corresponding target network behavior in the target comment area.

[0010] Furthermore, the process includes preprocessing the comment data: using the replace function to remove all spaces from the comment data, resulting in cleaned comment data; establishing a dictionary containing common punctuation marks, and removing punctuation marks from the cleaned comment data based on the dictionary; and using dynamic programming to search for the maximum probability path based on the punctuation-removed comment data to obtain the optimal word segmentation method, and outputting the obtained optimal word segmentation method as the preprocessed comment data.

[0011] Furthermore, the BERT feature matrix containing semantic information is obtained by: dividing the preprocessed comment data into multiple batches; within each batch, converting each line of comment text in the comment data into a corresponding numeric ID sequence; adjusting the length of all numeric ID sequences to a preset length through padding or cropping operations to obtain numeric ID sequences of uniform length; inputting the numeric ID sequences of uniform length into the pre-trained BERT-Base-Chinese model to output the feature array of the corresponding batch; and integrating the feature arrays of all batches into a BERT dense feature matrix.

[0012] Furthermore, the TF-IDF sparse feature matrix is ​​converted into a TF-IDF dense feature matrix, including: creating a zero-value array with the same dimension as the TF-IDF sparse feature matrix as the initial TF-IDF dense feature matrix; traversing the non-zero elements in the TF-IDF sparse feature matrix, obtaining the position index and corresponding value of each non-zero element, and adding the obtained non-zero element values ​​to the corresponding positions in the created TF-IDF dense feature matrix according to the position index of each non-zero element, thus obtaining a TF-IDF dense feature matrix filled with all non-zero elements.

[0013] Furthermore, the fused comprehensive feature matrix is ​​input into a pre-trained binary classification SVM model, including: training the binary classification SVM model on the COLDataset dataset; transforming the feature matrix in the COLDataset dataset using a linear kernel function to obtain the transformed feature matrix; constructing the objective function of the SVM model using the transformed feature matrix and the corresponding binary classification labels; finding the optimal classification hyperplane parameters by solving a convex quadratic programming problem, and training the binary classification SVM model; and using the trained binary classification SVM model to classify each comment in the fused feature matrix, including comments on target behaviors and comments on non-target behaviors.

[0014] Furthermore, using the transformed feature matrix and the corresponding binary classification labels, the objective function of the SVM model is constructed, including: using the hinge loss function as the loss function of the SVM model to measure the classification error of each sample; constructing the objective function of the SVM model, which consists of two parts: empirical risk and structural risk. The empirical risk is the average hinge loss of all samples (1 / n)*∑L_i, representing the classification error of the model on the training set; the structural risk is the L2 norm of the weight vector (1 / 2)*||w||^2, used to control the complexity and generalization ability of the model.

[0015] Objective function: min(1 / 2)*||w||^2+(1 / n)*∑L_i.

[0016] Furthermore, the hinge loss function is: L_i = max(0, 1 - y_i * f(x_i)), where L_i is the hinge loss of the i-th sample, y_i is the true class label of the sample, which takes the value of 1 or -1, and f(x_i) is the model's prediction value for the i-th sample.

[0017] Furthermore, the Sequence Minimum Optimization (SMO) algorithm is used to solve the convex quadratic programming problem.

[0018] Furthermore, each comment in the subset is classified into multiple categories to identify the network behavior type contained in each comment. This includes: transforming the feature matrix in the COLDataset dataset using a linear kernel function to obtain a transformed feature matrix; using the transformed feature matrix and the corresponding multi-class labels to construct the optimization objective of the SVM model; finding the optimal classification hyperplane parameters by solving a convex quadratic programming problem to train the multi-class SVM model; setting a tolerance less than a threshold to control convergence accuracy; setting no limit on the number of iterations to search for the global optimum; using the comprehensive features of the comment subset corresponding to the target behavior output by the binary SVM as input; using the trained multi-class SVM model to classify each comment in the comprehensive feature matrix of the target behavior comment subset; and based on the classification results, counting the number of comments of each type of network behavior and the proportion of the corresponding network behavior in the target behavior comment subset.

[0019] 3. Beneficial effects

[0020] Compared to existing technologies, the advantages of this application are:

[0021] This application integrates lexical features extracted by TF-IDF and semantic features extracted by BERT during the detection process, forming a comprehensive feature matrix. The TF-IDF feature matrix reflects the importance of words in the comment data, while the BERT feature matrix contains the semantic information of the comment data. The fusion of these two features makes the representation of the comment data more comprehensive and accurate, thereby improving the accuracy of subsequent network behavior detection.

[0022] This application employs a hierarchical classification approach, designing a two-tiered classifier consisting of a binary SVM model and a multi-class SVM model. First, the binary SVM model identifies comments containing the target network behavior from all comments, filtering out a large amount of irrelevant comment data. Then, the multi-class SVM model performs multi-classification of the selected subset of comments containing the target network behavior based on the network behavior type. This hierarchical classification reduces the amount of training data required for the multi-class SVM model, improves training efficiency, and achieves comprehensive recognition of multiple network behavior types.

[0023] In the feature extraction stage, this application densifies the TF-IDF sparse feature matrix, converting it into a TF-IDF dense feature matrix, thereby reducing storage space and improving computational efficiency. Furthermore, in the multi-classification stage, a subset of comments containing the target network behavior is pre-selected using a binary SVM model, reducing the amount of input data for the multi-classification SVM model, lowering computational complexity, and improving detection efficiency.

[0024] In this application, an L2 regularization term is introduced into the loss function when training the SVM model. This term controls the structural risk of the model, reduces the value of the weight parameters, lowers the model complexity, prevents overfitting, and enhances the generalization ability of the model, enabling the trained model to be better applied to new review data.

[0025] The detection method in this application outputs the number and percentage of comments for various online behaviors. By comparing these values ​​with preset thresholds, it determines whether a specific online behavior exists in the comment section. The output results are intuitive and easy to understand. When a certain online behavior is identified, the severity of the behavior can be understood based on the number and percentage of comments, facilitating targeted control in the future. Attached Figure Description

[0026] Figure 1 This is a flowchart of a microblog network behavior detection method based on feature fusion and SVM according to this application. Detailed Implementation

[0027] The present application will now be described in detail with reference to the accompanying drawings and specific embodiments.

[0028] Figure 1 This is a flowchart illustrating a Weibo network behavior detection method based on feature fusion and SVM, as described in this application. This application presents a Weibo network behavior detection system based on feature fusion and SVM. The introduction of feature fusion technology improves the accuracy of SVM. The system first obtains comment data from a specified comment section of Weibo using a web crawler targeting the Weibo platform. After saving the original comment content locally, data preprocessing is performed, including removing useless information (including punctuation marks and some special emojis) and word segmentation.

[0029] Next, feature extraction is performed on the preprocessed comment data. In this stage, the system uses TF-IDF and BERT to extract text features. TF-IDF focuses on the statistical features of the text. TF (Term Frequency) represents the frequency of each word unit (keyword) in a specific document; this number indicates the importance of the keyword in the document. The more frequently a word appears in a document, the higher its frequency, and the greater its contribution to the document content. IDF (Inverse Document Frequency) represents the general importance of a word, calculated based on the frequency of the word across all documents. If a word appears in many documents, its IDF value will be low because such a word is not very useful for distinguishing document content; conversely, if a word appears in only a few documents, its IDF value will be high because such a word is more discriminative.

[0030] Multiplying TF and IDF gives the importance score of a word in a document. A higher score indicates that the word is more representative of the document's content. After TF-IDF feature extraction, a sparse matrix is ​​output; the system then converts this into a dense matrix to prepare for subsequent feature fusion.

[0031] After TF-IDF feature extraction, a pre-trained BERT model is used to extract features from the preprocessed text data again. BERT feature extraction focuses on capturing deep semantic information of the text. This application selects the BERT model "BERT-Base-Chinese," a deep learning model specifically designed for Chinese, developed by Google in 2018. It is pre-trained on a large amount of text using the Transformer architecture. The core of the Transformer is the self-attention mechanism, where the model calculates the relation weights between each word and all other words in the sentence, and then updates the word representation based on these weights. After processing by the self-attention mechanism, the representation of each word is no longer isolated but incorporates information from the entire sentence. As the number of layers increases, the model can capture deeper semantic information, ultimately outputting a dense matrix where each element contains rich linguistic feature information.

[0032] After feature extraction using two methods, these two feature sets are fused. The system effectively integrates the high-level semantic features output by the BERT model with the statistical features obtained by the TF-IDF vectorizer. Since the result of TF-IDF feature extraction is a sparse matrix, while the result of BERT feature extraction is a dense matrix, the sparse matrix needs to be converted into a dense matrix first. After the conversion, the TF-IDF matrix and the BERT feature matrix are horizontally stacked to form a longer feature vector. This fused feature vector contains both word frequency information and deep semantic information from the original text.

[0033] The BERT model provides the contextual embeddings of each word in a text, capturing complex semantic relationships. The TF-IDF method, on the other hand, focuses on word frequency and inverse document frequency, highlighting the importance of keywords in the text. By merging these two feature vectors, the system constructs a more comprehensive text feature representation that includes not only semantic information but also word frequency statistics. This fusion strategy enables the classification model to analyze text from multiple dimensions, improving the accuracy of identifying network behavior.

[0034] After feature fusion, the system inputs the combined feature vector into a pre-trained SVM classification model to predict behavioral tendencies. Finally, through statistical analysis and visualization modules, the system presents the detection results in intuitive charts, enabling users to quickly grasp the severity of online behavior and the distribution of topics.

[0035] Regarding the determination of online behavior, in order to more scientifically formulate the system's judgment threshold, after collaborating with legal professionals, we tracked and investigated 46 events involving online behavior, selected the 20 most representative cases, and calculated the proportion of offensive remarks in the comment sections. Quantitative analysis revealed that the proportion of offensive remarks in most cyberbullying cases was around 0.22%. Further analysis of the proportion of offensive remarks in these 20 cases, after removing the two highest and two lowest values, yielded a mean of 0.2674 and a standard deviation of 0.0718. Subtracting the standard deviation from the mean yields a threshold of 0.1956. This threshold is used as the standard for determining cyberbullying; if the number of offensive remarks in a comment section exceeds 10 and the proportion of offensive remarks exceeds 0.1956, the system will determine that "online behavior exists."

[0036] Furthermore, the system uses a visualization module to present the detection results in intuitive charts, enabling users to quickly grasp the severity of online behavior and the distribution of topics. It can also categorize and store identified aggressive comments by topic, facilitating further analysis and research. The entire system design fully considers the scientific and practical aspects of the technology, aiming to provide effective technical support for the purification and supervision of the online environment.

[0037] Compared to using a single feature, fusing two features can improve the accuracy of SVM classifiers in recognizing offensive speech. TF-IDF helps identify keywords, while BERT provides a deeper semantic understanding; combining the two can reduce false positives and false negatives. Experimental results also show that the SVM classifier with feature fusion achieves better evaluation metrics on the specified test set.

[0038] The specific test results are shown in the table below:

[0039]

[0040]

[0041] The results show that, on the same test set, the feature fusion-based SVM performs best in the offensive speech classification task, with an accuracy of 0.8012 and an F1 score of 0.7968.

[0042] In the problem of network behavior detection, SVM is more interpretable than the currently widely used deep learning models, and can save running time and memory space.

[0043] Specifically, the advantages of SVM over deep learning models in terms of classification speed and memory usage mainly stem from its lower model complexity and number of parameters. SVM handles nonlinear problems through kernel tricks without explicitly calculating points in high-dimensional space, which greatly reduces computational cost.

[0044] Furthermore, the training process of SVM involves solving a convex optimization problem, stopping once the optimal solution is found. Deep learning models, on the other hand, require multiple iterations to optimize a large number of parameters, resulting in a longer training time. During the prediction phase, SVM uses less memory and predicts faster because it only needs to consider support vectors. In contrast, deep learning models need to store and process parameters from all layers, leading to higher memory consumption and relatively slower prediction speeds.

[0045] The foregoing illustrative description of the invention and its embodiments is not restrictive and can be implemented in other specific forms without departing from the spirit or essential characteristics of the invention. The accompanying drawings are only one embodiment of the invention, and the actual structure is not limited thereto. No reference numerals in the claims should limit the scope of the claims. Therefore, if a person skilled in the art, inspired by this description, designs a similar structure and embodiment without departing from the spirit of the invention, such design should fall within the scope of protection of this patent. Furthermore, the word "comprising" does not exclude other elements or steps, and the word "a" preceding an element does not exclude the inclusion of "a plurality" of that element. Multiple elements stated in the product claims can also be implemented by a single element through software or hardware. The terms "first," "second," etc., are used to indicate names and do not indicate any specific order.

Claims

1. A Weibo network behavior detection method based on feature fusion and SVM, comprising: Obtain comment data from the target comment section; The TF-IDF algorithm was used to extract features from the comment data, resulting in a TF-IDF feature matrix that reflects the importance of words in the document. The pre-trained BERT-Base-Chinese model is used to extract features from the comment data to obtain a BERT feature matrix containing semantic information; Transform the TF-IDF sparse feature matrix into a TF-IDF dense feature matrix; The TF-IDF dense feature matrix and the BERT feature matrix are concatenated column-wise to form a fused comprehensive feature matrix. The fused comprehensive feature matrix is ​​input into a pre-trained binary classification SVM model to classify each comment in the matrix, determine whether the comment contains the target behavior content, and count the number of comments containing the target behavior content and its proportion in all comments. The comprehensive feature matrix of the identified subset of comments containing the target behavior content is input into the pre-trained multi-class SVM model to perform multi-classification of each comment in the subset and identify the network behavior type contained in each comment; The BERT feature matrix containing semantic information is obtained, including: The preprocessed comment data is divided into multiple batches; Within each batch, each line of comment text in the comment data is converted into a corresponding sequence of numeric IDs; By using padding or cropping operations, the length of all numeric ID sequences is adjusted to a preset length, resulting in numeric ID sequences of uniform length. Input a sequence of numeric IDs of uniform length into a pre-trained BERT-Base-Chinese model, and output the feature array of the corresponding batch; The feature arrays of all batches are integrated into a BERT dense feature matrix; The process of converting the TF-IDF sparse feature matrix into a TF-IDF dense feature matrix includes: Create an array of zero values ​​with the same dimensions as the TF-IDF sparse feature matrix as the initial TF-IDF dense feature matrix; Iterate through the non-zero elements in the TF-IDF sparse feature matrix, obtain the position index and corresponding value of each non-zero element, and then use the position index of each non-zero element; The obtained non-zero element values ​​are added to the corresponding positions in the created TF-IDF dense feature matrix to obtain a TF-IDF dense feature matrix filled with all non-zero elements.

2. The microblog network behavior detection method based on feature fusion and SVM according to claim 1, characterized in that: Also includes: Based on the classification results, the number of comments for each type of online behavior and its proportion in the subset of comments containing the target behavior content are statistically analyzed. By comparing the number of comments for each type of online behavior with a preset threshold, and the percentage of each type of online behavior with a preset percentage threshold, if the number of at least one type of online behavior exceeds the preset threshold and the percentage exceeds the corresponding percentage threshold, it is determined that there is a corresponding target online behavior in the target comment section.

3. The microblog network behavior detection method based on feature fusion and SVM according to claim 2, characterized in that: Before using the TF-IDF algorithm for feature extraction, preprocessing of the comment data is also required: The replace function is used to remove all spaces from the comment data, resulting in cleaned comment data; Create a dictionary containing common punctuation marks, and remove punctuation marks from the cleaned comment data based on the dictionary. Based on the comment data after removing punctuation, the optimal word segmentation method is obtained by searching for the path with the highest probability through dynamic programming. The obtained optimal word segmentation method is then used as the output of the preprocessed comment data.

4. The microblog network behavior detection method based on feature fusion and SVM according to claim 1, characterized in that: The fused comprehensive feature matrix is ​​input into the pre-trained binary classification SVM model, including: Train a binary classification SVM model on the COLDataset dataset; The feature matrices in the COLDataset dataset are transformed using a linear kernel function to obtain the transformed feature matrices; The objective function of the SVM model is constructed using the transformed feature matrix and the corresponding binary classification labels. By solving the convex quadratic programming problem, the optimal parameters of the classification hyperplane are found, and the binary classification SVM model is trained. The trained binary classification SVM model is used to classify each comment in the fused feature matrix, including comments on target behaviors and comments on non-target behaviors.

5. The microblog network behavior detection method based on feature fusion and SVM according to claim 4, characterized in that: Using the transformed feature matrix and the corresponding binary classification labels, construct the objective function of the SVM model, including: The hinge loss function is used as the loss function of the SVM model to measure the classification error of each sample; The objective function for constructing the SVM model consists of two parts: empirical risk and structural risk. Empirical risk is the average hinge loss across all samples. , representing the classification error of the model on the training set; Structural risk is assessed using the L2 norm of the weight vector. This is used to control the complexity and generalization ability of the model; Objective function: .

6. The microblog network behavior detection method based on feature fusion and SVM according to claim 5, characterized in that: The hinge loss function is: in, Let the hinge loss be for the i-th sample. This is the true class label of the sample, with a value of 1 or -1. Let be the model's predicted value for the i-th sample.

7. The microblog network behavior detection method based on feature fusion and SVM according to claim 5, characterized in that: The Sequence Minimum Optimization (SMO) algorithm is used to solve the convex quadratic programming problem.

8. The microblog network behavior detection method based on feature fusion and SVM according to claim 7, characterized in that: The comprehensive feature matrix of the identified subset of comments containing the target behavior content is input into a pre-trained multi-class SVM model. Each comment in the subset is then classified into multiple categories to identify the network behavior type contained in each comment, including: The feature matrices in the COLDataset dataset are transformed using a linear kernel function to obtain the transformed feature matrices. The optimization objective of the SVM model is constructed using the transformed feature matrix and the corresponding multi-class labels. By solving a convex quadratic programming problem, the optimal parameters of the classification hyperplane are found, and a multi-class SVM model is trained. A tolerance of less than a threshold is set to control convergence accuracy; the number of iterations is unlimited to search for the global optimum. The comprehensive features of the comment subset corresponding to the target behavior output by the binary classification SVM are used as input; Using the trained multi-class SVM model, each comment in the comprehensive feature matrix of the target behavior comment subset is classified into multiple categories; Based on the classification results, the number of comments on various types of online behaviors and the proportion of the corresponding online behaviors in the target behavior comment subset are counted.