Multi-label sentiment analysis method based on information particles and drift learning
By combining information particle and drift learning technology, the shortcomings of multi-label data processing and emotional dynamic capture in the existing technology are solved, and a multi-label emotion classification method with high accuracy and real-time performance is achieved.
Patent Information
- Application Number
- CN202510074283.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-17
- Publication Date
- 2025-04-25
AI Technical Summary
The prior art is difficult to effectively process multi-label data and capture emotional dynamics, especially in monitoring real-time changes in emotions.
Using a multi-label emotion classification method based on information particle and drift learning technology, deep features and high-dimensional vector representation are extracted through image and text data preprocessing, and combined with neighborhood analysis and drift detection, emotion label combination and real-time emotion change monitoring are realized.
It improves the accuracy and real-timeness of multi-label classification, can effectively capture emotional dynamics, and provide timely adjustments and monitoring in actual applications.
Smart Images

Figure CN119884885A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of sentiment analysis in natural language processing, and in particular to a multi-label classification method combining information granules and drift detection. Background Art
[0002] Sentiment analysis is an important research direction in the field of natural language processing. It uses computational technology to identify and extract emotional tendencies and emotional states in texts. This technology can reveal human emotional colors from a large amount of unstructured data. Although it needs to deal with complex language phenomena, it provides a quantitative method for understanding human communication. Taking social media text as an example, emotional expressions can be divided into three categories: positive, negative, and neutral. These categories not only reflect the public's attitude towards specific topics, products or events, but can also be further subdivided into more specific emotions such as joy, surprise, fear, and sadness. By accurately capturing the emotions of texts, managers can gain insight into changes in public attitudes and make timely strategic adjustments based on this. Therefore, the research on sentiment analysis technology not only has far-reaching academic value, but also has significant practical significance. Since texts expressing similar emotions have commonalities in the use of vocabulary, we can deeply analyze text features and extract information granules for each emotion. When new public opinion information appears, by monitoring the changes in these information granules, we can predict the emotional tendency of the new text. This method provides a solid technical foundation for sentiment classification, trend analysis, and even public opinion monitoring.
[0003] Information granulation is a data analysis method that simplifies the structure of complex data by clustering similar items in a dataset into more manageable and analyzable units. The core of this method is to identify patterns and associations in the data and combine them into "granules" with more concentrated information. These granules can be regarded as high-level representations of the data. They retain the key features of the original data while reducing the dimensionality and complexity of the data. Multi-label classification is an advanced technology in the field of machine learning. It breaks through the limitations of traditional single-label classification and allows the model to assign multiple category labels to each sample, which more accurately reflects the complexity of the real world, especially in the field of sentiment analysis, where human emotions are often diverse and intertwined. However, traditional classification algorithms, such as KNN and SVM, are not sufficient to cope with the challenges of multi-label data. In addition, although the MLKNN algorithm has been applied in multi-label scenarios, it still has shortcomings in monitoring the real-time changes of emotions. Therefore, developing new algorithms that can effectively process multi-label data and capture emotional dynamics is crucial to improving the accuracy and real-time performance of sentiment analysis. Summary of the invention
[0004] To address the above-mentioned defects in the prior art, the present invention proposes an innovative multi-label classification algorithm based on information granules and drift learning technology for analyzing changes in human emotions. By processing incoming text or image data in real time, the algorithm can accurately classify emotions and predict the direction of emotional changes. The application of this technology is of great significance for monitoring and analyzing changes in public opinion, helping to better understand and respond to fluctuations in social emotions and make corresponding adjustments.
[0005] According to a first aspect of the present invention, a multi-label sentiment classification method based on information granules and drift learning technology is provided, comprising:
[0006] Step 1: Sentiment analysis mainly relies on image and text data. These raw data are processed through a series of techniques and converted into data types suitable for machine learning models.
[0007] Images, which are visual information composed of pixels, can be converted into numerical matrices that can be accepted by the model input layer through a series of image processing techniques, such as scaling, normalization, and color space conversion. In addition, feature extraction methods in deep learning models, such as using pre-trained networks such as VGG or ResNet, can extract deep features of images and provide strong support for subsequent classification tasks.
[0008] As for text data, as the main form of human communication, its processing relies on natural language processing technology. Text preprocessing usually starts with word segmentation, which divides continuous text into discrete vocabulary units to lay the foundation for further analysis. Vectorization is a key step in converting text into numerical vectors, among which bag-of-words model and TF-IDF are common methods for converting text data into points in a high-dimensional space that can be processed by machine learning models. In addition, word embedding technologies such as Word2Vec and GloVe further enhance the expressiveness of text data by mapping vocabulary to dense vector space.
[0009] After preprocessing, we can get the training data set U = {x1, x2, ..., x n}, consisting of n input samples, each sample x i Contains m features {x i1 ,x i2 ,…,x im}. Emotion label set L = {l1,l2,…,l q} contains q emotion labels, and the label space Y = {y1,y2,…,y n}, where y i ={y i1 ,y i2 ,…,y iq}∈{0,1} q,y ij =0 represents sample x i No emotions j ,y ij =1 represents sample x i Have emotions j .
[0010] Step 2: When performing multi-label sentiment classification, it is necessary to consider the relationship between each sentiment label and their mutual connection in the feature space. Neighborhood analysis is an effective method to explore the local structure of data, which is crucial for multi-label sentiment classification tasks. By setting a suitable neighborhood radius, the relationship between labels in the feature space can be captured. The following is the specific search process:
[0011] Step 2.1: Given a neighborhood radius δ, calculate for each sample x i The neighborhood N(x i ), and calculate the sentiment label l in each neighborhood j Coverage Label coverage j (x i ) reflects the i The neighborhood of j proportion.
[0012] Step 2.2: Set the threshold parameter α. When the label coverage reaches α, the neighborhood is considered to be a representative neighborhood of the label. The combination of labels in each neighborhood that meet the label coverage condition of α is recorded as a new label set. gather It is a combination of several emotion labels, which means that these emotion labels appear simultaneously in a neighborhood, so it is believed that these emotions are related to each other. k All label combinations that satisfy coverage α are but At this time, the neighborhood N(x k ) is a subset of labels A representative neighborhood of k Is a subset of tags A representative element.
[0013] Step 2.3: Traverse all samples and get a set of label subsets This set of label subsets contains all possible combinations of related labels, which is consistent with the expression characteristics of complex human emotions. These label combinations are considered as a new label for subsequent tasks.
[0014] Step 3: In the new tab set Each new tag Each of them corresponds to a specific representative neighborhood. The number of these representative neighborhoods reflects the frequency of the new label in the current training sample set. The more representative neighborhoods there are, the higher the frequency of the new label in the training sample, which means that the sentiment characteristics of the current group are closer to the new label. Therefore, the top 5% of new labels are selected as the final decision attribute set based on the number of representative neighborhoods.
[0015] In order to simplify the subsequent test calculations, the test task determines whether the newly input data is consistent with the original decision attributes, and records each decision attribute. The representative element set The final representative set is recorded as
[0016] Step 4: For the newly-incoming data, substitute it into step 1 and perform the same data preprocessing to obtain the test data set It contains n1 test samples.
[0017] Step 5: Calculate for each test sample x i′ With each decision attribute The minimum distance d of the representative element set j (x i′ ), and its calculation formula is For each test sample, calculate its distance to the representative element set of each decision attribute, and record the final result as a matrix where d ij =d j (x i′ ).
[0018] Step 6: In order to detect whether the emotion expressed by the newly-incoming data is consistent with the original emotion, the following drift detection rules are introduced:
[0019] Step 6.1: Calculate the discriminant matrix When ij When ≤1.5δ, a ij =1, indicating that sample x i ′ belongs to the decision attribute When ij When >1.5δ, a ij =0, indicating that sample x i ′ is not a decision attribute
[0020] Step 6.2: Sum the rows of the discriminant matrix to determine whether each test sample belongs to the redefined decision attribute. If the number of elements in is greater than n1 / 2, it is considered that a change in sentiment (drift) has occurred. If drift has occurred, proceed to step 7; otherwise, continue to input the next round of data sets and proceed to step 4.
[0021] Step 7: Make a decision (whether to make corresponding adjustments to the change in emotion). Randomly remove n1 samples from the original training samples (preferentially remove the selected representative elements), put the input samples into the training samples, and return to step 2 to retrain the model.
[0022] According to a second aspect of the present invention, there is provided a computer device, characterized in that it comprises:
[0023] a memory for storing instructions; and
[0024] The processor is used to call the instructions stored in the memory to execute the multi-label sentiment analysis method based on information granules and drift learning in the first aspect.
[0025] According to a third aspect of the present invention, a computer-readable storage medium is provided, characterized in that instructions are stored therein, and when the instructions are executed by a processor, the multi-label sentiment analysis method based on information granules and drift learning of the first aspect is executed.
[0026] Compared with the prior art, the above technical solution conceived by the present invention has at least the following beneficial effects:
[0027] (1) The sentiment label combination method can simultaneously consider the relationships between multiple sentiment labels and use neighborhood relationships to accurately reflect the local structure of these labels in the feature space.
[0028] (2) The new label obtained through learning is a complex of multiple emotional labels, which is consistent with the characteristics of complex human emotions and conforms to the complexity of human emotions.
[0029] (3) During the training process, this method only retains the key information, that is, the set of representative elements of the new label. For the newly incoming data, it is only necessary to calculate the distance between the test sample and the retained representative element to analyze the emotion reflected by the newly incoming data, which effectively saves storage space and computing time.
[0030] (4) This method improves the accuracy of multi-label classification and further improves the quality of classification results.
[0031] (5) It is able to monitor changes in emotions in real time, making it possible to make corresponding adjustments in a timely manner.
[0032] (6) In real life, this method has broad application prospects, such as public opinion analysis, automated customer service systems, media monitoring, etc.
[0033] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0035] Figure 1 It is a flowchart of a multi-label sentiment analysis method based on information granules and drift learning according to an exemplary embodiment. DETAILED DESCRIPTION
[0036] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0037] Take the CLARIN-Emo dataset in Hugging Face as an example. This is a collection of consumer reviews, including reviews of hotels, pharmaceuticals, products, and universities. To demonstrate the effect of the present invention, the first 500 reviews are used as a training set, and the multi-label sentiment analysis method based on information granules and drift detection of the present invention is used for analysis. The original review information (Polish is translated into Chinese using the existing technology) is as follows: Figure 1 As shown in the figure. After exploring the neighborhood of the comments in the training set, we can learn and identify the main emotions expressed by the current evaluation. Then, we will save the representative element set representing the current main emotion, so that we can quickly judge whether the emotional tendency of the comment has changed in the future.
[0038] The training data set contains 500 comments (training samples), and there are 11 emotional labels, namely: Joy, Trust, Anticipation, Surprise, Fear, Sadness, Disgust, Anger, Positive, Negative, Neutral. Part of the training data set is shown in the following table.
[0039]
[0040]
[0041] The specific implementation steps of the embodiment are as follows:
[0042] Step 1: Sentiment analysis mainly relies on image and text data. These raw data are processed through a series of techniques and converted into data types suitable for machine learning models.
[0043] Images, which are visual information composed of pixels, can be converted into numerical matrices that can be accepted by the model input layer through a series of image processing techniques, such as scaling, normalization, and color space conversion. In addition, feature extraction methods in deep learning models, such as using pre-trained networks such as VGG or ResNet, can extract deep features of images and provide strong support for subsequent classification tasks.
[0044] As for text data, as the main form of human communication, its processing relies on natural language processing technology. Text preprocessing usually starts with word segmentation, which divides continuous text into discrete vocabulary units to lay the foundation for further analysis. Vectorization is a key step in converting text into numerical vectors, among which bag-of-words model and TF-IDF are common methods for converting text data into points in a high-dimensional space that can be processed by machine learning models. In addition, word embedding technologies such as Word2Vec and GloVe further enhance the expressiveness of text data by mapping vocabulary to dense vector space.
[0045] After preprocessing, we can get the training data set U = {x1, x2, ..., x n}, consisting of n input samples, each sample x i Contains m features {x i1 ,x i2 ,…,x im}. Emotion label set L = {l1,l2,…,l q} contains q emotion labels, and the label space Y = {y1,y2,…,y n}, where y i ={y i1 ,y i2 ,…,y iq}∈{0,1} q ,y ij =0 represents sample x i No emotions j ,y ij =1 represents sample x i Have emotions j .
[0046] In this example, the CountVectorizer model in Python is used to train text data. For ease of understanding, word frequency information is not considered. The feature space of the training sample finally obtained is recorded as X = (x ij ) 500×1224 ∈{0,1} 500×1224, the sentiment label set is L = {l1,l2,…,l 11}, corresponding to {Joy, Trust, Anticipation, Surprise, Fear, Sadness, Disgust, Anger, Positive, Negative, Neutral} respectively, and the label space is denoted as Y = (y ij ) 500×11 ∈{0,1} 500×11 .
[0047] Step 2: When performing multi-label sentiment classification, it is necessary to consider the relationship between each sentiment label and their mutual connection in the feature space. Neighborhood analysis is an effective method to explore the local structure of data, which is crucial for multi-label sentiment classification tasks. By setting a suitable neighborhood radius, the relationship between labels in the feature space can be captured. The following is the specific search process:
[0048] Step 2.1: Given a neighborhood radius r, calculate each sample x i The neighborhood N(x i ), and calculate the sentiment label l in each neighborhood j Coverage Label coverage j (x i ) reflects the i The neighborhood of j proportion.
[0049] Step 2.2: Set the threshold parameter α. When the label coverage reaches α, the neighborhood is considered to be a representative neighborhood of the label. The combination of labels in each neighborhood that meet the label coverage condition of α is recorded as a new label set. gather It is a combination of several emotion labels, which means that these emotion labels appear simultaneously in a neighborhood, so it is believed that these emotions are related to each other. k All label combinations that satisfy coverage α are but At this time, the neighborhood N(x k ) is a subset of labels A representative neighborhood of k Is a subset of tags A representative element.
[0050] Step 2.3: Traverse all samples and get a set of label subsets This set of label subsets contains all possible combinations of related labels, which is consistent with the expression characteristics of complex human emotions. These label combinations are considered as a new label for subsequent tasks.
[0051] In this example, the neighborhood radius is set to r = 4, and the distance metric between samples is chosen to be the Euclidean distance metric, that is, given a sample x i ,x j ∈U, their distance can be calculated as Sample x i The neighborhood of can be defined as: N(x i )={x j ∣d(x i ,x j )≤r,x k ∈U}. The final set obtained by calculating the coverage of sentiment labels is A combination of 29 emotional labels.
[0052] Step 3: In the new tab set Each new tag Each of them corresponds to a specific representative neighborhood. The number of these representative neighborhoods reflects the frequency of the new label in the current training sample set. The more representative neighborhoods there are, the higher the frequency of the new label in the training sample, which means that the sentiment characteristics of the current group are closer to the new label. Therefore, the top 5% of new labels are selected as the final decision attribute set based on the number of representative neighborhoods.
[0053] In order to simplify the subsequent test calculations, the test task determines whether the newly input data is consistent with the original decision attributes, and records each decision attribute. The representative element set The final representative set is recorded as The final decision attribute set obtained in this example Representative Set in
[0054] As shown below:
[0055]
[0056] Step 4: For the newly-incoming data, substitute it into step 1 and perform the same data preprocessing to obtain the test data set There are n1 test samples in it. In order to observe the results conveniently, 20 test samples are selected in this example, where n1 = 20.
[0057] Step 5: Calculate for each test sample x i ′ and each decision attribute The minimum distance d of the representative element set j (x i ′), and its calculation formula is For each test sample, calculate its distance to the representative element set of each decision attribute, and record the final result as a matrix where d ij =d j (x i ′). In this example, a 20×2 matrix D is obtained:
[0058]
[0059] Step 6: In order to detect whether the emotion expressed by the newly-incoming data is consistent with the original emotion, the following drift detection rules are introduced:
[0060] Step 6.1: Calculate the discriminant matrix When ij When ≤1.5δ, a ij =1, indicating that sample x i ′ belongs to the decision attribute When ij When >1.5δ, a ij =0, indicating that sample x i ′ is not a decision attribute
[0061] Step 6.2: Sum the rows of the discriminant matrix to determine whether each test sample belongs to the redefined decision attribute. If the number of elements in is greater than n1 / 2, it is considered that a change in sentiment (drift) has occurred. If drift has occurred, proceed to step 7; otherwise, continue to input the next round of data sets and proceed to step 4.
[0062] In this example, 1.5δ=6, and the emotional expression of most test samples is consistent with the original training set, so it is considered that no drift has occurred, and the next round of data is input. And from their label information, we can also get the emotional expression of most of them. Be consistent.
[0063] Step 7: Make a decision (whether to make corresponding adjustments to the change in emotion). Randomly remove n1 samples from the original training samples (preferentially remove the selected representative elements), put the input samples into the training samples, and return to step 2 to retrain the model.
[0064] In summary, the present invention can explore the emotional expression of the original data set, and the formed emotional label combination is very consistent with the complex emotional expression of humans, and can quickly perform drift detection (emotional fluctuations) on the newly incoming data.
[0065] Other embodiments of the present invention will be readily apparent to those skilled in the art after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses or adaptations of the present invention that follow the general principles of the present invention and include common knowledge or customary techniques in the art that are not disclosed in this disclosure. The specification and examples are to be considered exemplary only, and the true scope and spirit of the present invention are indicated by the following claims.
[0066] It should be understood that the present invention is not limited to the exact construction that has been described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.
Claims
1. A multi-label sentiment analysis method based on information granules and drift learning, characterized in that: include: Step 1: Sentiment analysis mainly relies on image and text data. These raw data are processed through a series of techniques and converted into data types suitable for machine learning models. Images, which are visual information composed of pixels, can be converted into numerical matrices that can be accepted by the model input layer through a series of image processing techniques, such as scaling, normalization, and color space conversion. In addition, feature extraction methods in deep learning models, such as using pre-trained networks such as VGG or ResNet, can extract deep features of images and provide strong support for subsequent classification tasks. As for text data, as the main form of human communication, its processing relies on natural language processing technology. Text preprocessing usually starts with word segmentation, which divides continuous text into discrete vocabulary units to lay the foundation for further analysis. Vectorization is a key step in converting text into numerical vectors, among which bag-of-words model and TF-IDF are common methods for converting text data into points in a high-dimensional space that can be processed by machine learning models. In addition, word embedding technologies such as Word2Vec and GloVe further enhance the expressiveness of text data by mapping vocabulary to dense vector space. After preprocessing, we can get the training data set U = {x1, x2, ..., x n }, consisting of n input samples, each sample x i Contains m features {x i1 ,x i2 ,…,x im }. Emotion label set L = {l1,l2,…,l q } contains q emotion labels, and the label space Y = {y1,y2,…,y n }, where y i ={y i1 ,y i2 ,…,y iq }∈{0,1} q ,y ij =0 represents sample x i No emotions j ,y ij =1 represents sample x i Have emotions j . Step 2: When performing multi-label sentiment classification, it is necessary to consider the relationship between each sentiment label and their mutual connection in the feature space. Neighborhood analysis is an effective method to explore the local structure of data, which is crucial for multi-label sentiment classification tasks. By setting a suitable neighborhood radius, the relationship between labels in the feature space can be captured. The following is the specific search process: Step 2.1: Given a neighborhood radius δ, calculate for each sample x i The neighborhood N(x i ), and calculate the sentiment label l in each neighborhood j Coverage Label coverage j (x i ) reflects the i The neighborhood of j proportion. Step 2.2: Set the threshold parameter α. When the label coverage reaches α, the neighborhood is considered to be a representative neighborhood of the label. The combination of labels in each neighborhood that meet the label coverage condition of α is recorded as a new label set. gather It is a combination of several emotion labels, which means that these emotion labels appear simultaneously in a neighborhood, so it is believed that these emotions are related to each other. k All label combinations that satisfy coverage α are but At this time, the neighborhood N(x k ) is a subset of labels A representative neighborhood of k Is a subset of tags A representative element. Step 2.3: Traverse all samples and get a set of label subsets This set of label subsets contains all possible combinations of related labels, which is consistent with the expression characteristics of complex human emotions. These label combinations are considered as a new label for subsequent tasks. Step 3: In the new tab set Each new tag Each of them corresponds to a specific representative neighborhood. The number of these representative neighborhoods reflects the frequency of the new label in the current training sample set. The more representative neighborhoods there are, the higher the frequency of the new label in the training sample, which means that the sentiment characteristics of the current group are closer to the new label. Therefore, the top 10% of the new labels are selected as the final decision attribute set based on the number of representative neighborhoods. In order to simplify the subsequent test calculations, the test task determines whether the newly input data is consistent with the original decision attributes, and records each decision attribute. The representative element set The final representative set is recorded as Step 4: For the newly-incoming data, substitute it into step 1 and perform the same data preprocessing to obtain the test data set It contains n1 test samples. Step 5: Calculate for each test sample x i ′ and each decision attribute The minimum distance d of the representative element set j (x i ′), and its calculation formula is For each test sample, calculate its distance to the representative element set of each decision attribute, and record the final result as a matrix where d ij =d j (x i ′). Step 6: In order to detect whether the emotion expressed by the newly-incoming data is consistent with the original emotion, the following drift detection rules are introduced: Step 6.1: Calculate the discriminant matrix When ij When ≤1.5δ, a ij =1, indicating that sample x i ′ belongs to the decision attribute When ij When >1.5δ, a ij =0, indicating that sample x i ′ is not a decision attribute Step 6.2: Sum the rows of the discriminant matrix to determine whether each test sample belongs to the redefined decision attribute. If the number of elements in is greater than n1 / 2, it is considered that a change in sentiment (drift) has occurred. If drift has occurred, proceed to step 7; otherwise, continue to input the next round of data sets and proceed to step 4. Step 7: Make a decision (whether to make corresponding adjustments to the change in emotion). Randomly remove n1 samples (the representative elements selected first) from the original training samples, put the input samples into the training samples, and return to step 2 to retrain the model.
2. The multi-label sentiment analysis method based on information granules and drift learning according to claim 1 is characterized in that: Also includes: The value of the neighborhood radius δ is The threshold α of label coverage is set to 0.
9.
3. A computer device, characterized in that: include: A memory for storing instructions; as well as A processor, configured to call the instructions stored in the memory to execute the multi-label sentiment analysis method based on information granules and drift learning as described in any one of claims 1-2.
4. A computer-readable storage medium, characterized in that: Instructions are stored, and when the instructions are executed by the processor, the multi-label sentiment analysis method based on information granules and drift learning as described in any one of claims 1-2 is executed.