A text sentiment analysis method based on class imbalance data

By generating pseudo-samples and adjusting the boundaries using a pre-trained classifier on an imbalanced dataset, the problem of model overfitting is solved, achieving higher classification accuracy and generalization ability, especially in effectively extracting features in Internet text sentiment analysis.

CN117093671BActive Publication Date: 2025-11-25SHENZHEN MSU-BIT UNIVERSITY
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310918190.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-25
Publication Date
2025-11-25
Estimated Expiration
2043-07-25

AI Technical Summary

Technical Problem

When faced with imbalanced datasets, especially internet text data, existing technologies are prone to overfitting and struggle to effectively distinguish minority class features. Existing oversampling and undersampling methods also perform poorly in sentiment analysis.

Method used

By using a pre-trained classifier to extract semantic information from the text, generating pseudo-samples, and adjusting the classification boundary through a rejection function, and combining majority class feature information for oversampling, the classification boundary of the classifier is dynamically adjusted to achieve data class balance.

Benefits of technology

It improves the model's classification accuracy and generalization ability on imbalanced datasets, avoids overfitting, makes full use of majority class features, and enhances the accuracy of sentiment analysis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117093671B_ABST
    Figure CN117093671B_ABST
Patent Text Reader

Abstract

The application discloses a text sentiment analysis method based on class imbalance data. The method comprises the following steps: extracting semantic information of text by using a pre-trained classifier for a first data set, and then obtaining a sentiment classification boundary corresponding to each text, wherein the sentiment classification boundary is used to define a majority class and a minority class in the first data set; based on the classification boundary, generating pseudo samples of the minority class by using feature information in the majority class, and iteratively adjusting the classification boundary of the classifier by taking a set rejection function as an optimization target, wherein the rejection function is used to measure the quality of the generated pseudo samples; adding the generated pseudo samples to the first data set to form a second data set, and continuing to train the classifier by using the second data set. The application obtains hidden information of classification from data of the majority class, and performs oversampling on the minority class data according to the obtained classifier, so that a data class balancing strategy is realized.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer, more particularly, to a text sentiment analysis method based on class imbalance data. BACKGROUND

[0002] In recent years, people have tried to use deep learning related methods in the field of sentiment analysis and have made great progress. However, the success of deep learning models is usually based on a large amount of high-quality data, so the lack of high-quality data makes related sentiment analysis research frequently fall into a bottleneck.

[0003] In many cases, real data sets have different degrees of data class imbalance problems. This class imbalance of data on the one hand leads to the fact that the classifier trained on these data sets relies heavily on the sample distribution of the original data set and cannot truly distinguish between different classes. Under the influence of unbalanced data, the model will converge to a point that is strongly biased towards the class with the majority label, which actually creates a difference between the training and testing processes. On the other hand, simple majority class samples have too much influence on the model: a large number of majority class samples means that the number of simple majority class samples is large, and a large number of simple majority class samples make up most of the loss in the training process and thus dominate the gradient, which makes the model unable to fully learn how to distinguish between minority class samples and difficult majority class samples.

[0004] Text classification system refers to a system for automatically classifying text information by robots, aiming to enable robots to understand human language and produce intelligent classification. With the development of deep neural network research, text classification systems on balanced data sets have high accuracy. However, text classification research on data sets with class imbalance is still in its infancy.

[0005] At present, with the gradual development and maturity of Internet technology, more and more people are accustomed to communicating on the network. For example, there are a large amount of various forms of text data on network platforms such as twitter, microblog, Taobao and facebook, and due to their wide availability and language novelty, the use of these data has received great attention in sentiment analysis related research. However, due to the disordered and open nature of the Internet, the data therein inevitably has a class imbalance problem, which greatly hinders the further development of related research.

[0006] A common solution to the data class imbalance is the rebalancing method, such as under-sampling the majority class and over-sampling the minority class. However, experiments prove that the rebalancing method damages feature learning to some extent. The most classic under-sampling methods include random under-sampling, EasyEnsemble algorithm and BalanceCascade algorithm. The basic idea of these methods is to select samples from the majority class according to a certain strategy, and the number of the selected samples is equivalent to that of the minority class, and then the selected samples and the minority class samples form a new data set. However, the number of samples of these under-sampling methods depends on the number of the original minority class samples, and when the number of the majority class samples and the number of the minority class samples are very different and the number of the minority class samples is relatively small, it is very likely to cause the loss of important feature information.

[0007] In the prior art, the more commonly used data-level method for processing unbalanced data is the over-sampling method. For example, random over-sampling and SMOTE method. The common idea of these methods is to directly duplicate or generate new pseudo samples according to the features of the minority class samples to make the number of majority class samples and minority class samples close to reduce the influence of the sample distribution of the data set. However, such information is insufficient, and simply extracting features from minority class samples to generate samples will make the rules learned during the learning period too specific, which is prone to overfitting.

[0008] Through analysis, the current over-sampling method usually extracts the features of the minority class first, projects the features to a high-dimensional space, and then trains a neural network model, or generates some pseudo samples based on the extracted features of the minority class and adds them to the original data set, that is, the data is over-sampled, and finally the data set is expanded and balanced. Such a method has been proven to effectively alleviate the problem of data class imbalance in computer vision and traditional machine learning. However, in the field of sentiment analysis, especially when facing data on the Internet, there are often cases where there are fewer labeled instances and more sentiment categories in a certain data set. In this case, the instances of a certain minority class are undoubtedly not representative and generalizable, and if the existing method is followed, it is easy to cause model overfitting, and even hidden features in the minority class cannot be extracted, and the expansion of the minority class samples will increase the complexity of model training. SUMMARY

[0009] The purpose of the present application is to overcome the defects of the prior art, and provide a text sentiment analysis method based on class imbalance data. The method comprises:

[0010] For the first data set, the semantic information of the text is extracted by using a pre-trained classifier, and then the sentiment classification boundary corresponding to each text is obtained, and the sentiment classification boundary is used to define the majority class and the minority class in the first data set;

[0011] Based on the classification boundary, the feature information in the majority class is used to generate pseudo samples of the minority class, and a set of rejection functions is used as an optimization target to iteratively adjust the classification boundary of the classifier, wherein the rejection function is used to measure the quality of the generated pseudo samples;

[0012] The generated pseudo samples are added to the first data set to form a second data set, and the second data is used to continue training the classifier.

[0013] Compared with the prior art, the advantage of the present application is that the hidden information of classification is obtained from the data of the majority class, and the data of the minority class is oversampled according to the obtained classifier, so as to achieve the strategy of balancing the data categories. In this way, the high-dimensional information hidden in the majority class can be more fully utilized, and the adverse effects caused by the lack of labeled instances in some classes can also be effectively alleviated. The present application can effectively extract classification information from a large-scale class-imbalance data set to help the model accurately perform sentiment analysis.

[0014] Other features and advantages of the present application will become apparent from the following detailed description of exemplary embodiments thereof, taken in conjunction with the accompanying drawings. BRIEF DESCRIPTION OF DRAWINGS

[0015] The accompanying drawings incorporated in and forming a part of the specification, illustrate embodiments of the present application and, together with the description, serve to explain the principles of the application.

[0016] Figure 1 is a flowchart of a text sentiment analysis method based on class-imbalance data according to an embodiment of the present application;

[0017] Figure 2 is a schematic diagram of a text sentiment classifier according to an embodiment of the present application. DETAILED DESCRIPTION

[0018] Various exemplary embodiments of the present application will now be described in detail with reference to the accompanying drawings. It should be noted that the relative arrangement, numerical expressions, and values of the components and steps set forth in these embodiments do not limit the scope of the present application unless otherwise specifically stated.

[0019] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way limiting to the scope of the application or its applications or uses.

[0020] Techniques, methods, and devices known to those of ordinary skill in the relevant art can not be discussed in detail herein, but should be considered as part of the specification, where appropriate.

[0021] In all of the examples shown and discussed herein, any specific values should be interpreted as merely exemplary and not limiting. Thus, other examples of the example embodiments can have different values.

[0022] It should be noted that like reference numerals and letters refer to like items throughout the attached drawings, and once an item is defined in one drawing, it is not necessary that it be further discussed in subsequent drawings.

[0023] In order to overcome the influence of data class imbalance problem, the traditional method uses the feature information of the minority samples to generate pseudo samples. Due to the insufficient information contained in the case of too few samples, simply extracting features from the minority class samples to generate samples will make the rules learned by the learning period too specific, and the problem of overfitting phenomenon is easy to appear. The present application proposes to use the feature information of the majority class to dynamically adjust the classification boundary to solve the data imbalance problem. In the description herein, the unbalanced data set refers to the imbalance between the classes in the data set, that is, there is a large difference between the number of instances (samples or data points) belonging to each class. The class with relatively fewer samples is called the minority class, and the class with relatively more samples is called the majority class.

[0024] Referring to Figure 1 The provided text sentiment analysis method based on class imbalance data includes the following steps:

[0025] Step S110, an initial classifier is constructed for extracting semantic information of the text to obtain a classification boundary.

[0026] In one embodiment, a bidirectional attention long short-term memory network (LSTM) is constructed for extracting semantic information of the text as an initial classifier. The role of the initial classifier is to obtain a classification boundary, which will be further adjusted in the subsequent imbalance processing process, so as to achieve more accurate classification effect.

[0027] Figure 2 is an example of the initial classifier (or text sentiment analysis model), and the arrow represents the specific data flow. The overall model framework includes an embedding layer, a bidirectional LSTM layer and a deep attention layer. The role of the embedding layer is to convert the original text input through the layer into a corresponding formal word vector by using a text representation model, for example, the text representation model is a Word2Vec model. The obtained word vector is respectively input to the bidirectional LSTM layer in the order of semantics to further extract the hidden features therein. The bidirectional LSTM layer takes a series of word vectors as input and generates word annotations h1, h2,..., h i ,...,h N , where h iis the hidden layer information of LSTM at time sequence i, which carries the hidden features in the above data sequence and is used to summarize the hidden information contained in the sentence.

[0028] The bidirectional LSTM layer in the model contains two LSTMs, one forward LSTM is used to represent the analysis according to the language order of the data itself, and obtain the hidden layer information of each word vector in the forward direction The other is a reverse LSTM is used to obtain the reverse hidden layer information of the corresponding word vector Then, the hidden layers of the bidirectional LSTM are spliced, and the process can be represented as:

[0029]

[0030] where || represents the concatenation operation, and L represents the size of each LSTM. The spliced hidden layer features contain hidden information of the context.

[0031] It should be noted that the bidirectional LSTM layer can also be replaced by other recurrent neural network layers, such as bidirectional GRU (Gated Recurrent Unit), LSTM variants or GRU variants, etc.

[0032] The deep attention layer is used to determine the representation weight corresponding to each word vector, and determine the feature vector passed to the output layer according to the obtained weight. Finally, the output layer gives the sentiment classification result (such as happy, sad or surprised, etc. sentiment categories) based on the feature vector.

[0033] In one embodiment, a multilayer perceptron (MLP) is used instead of the general attention weight part as the deep attention layer, where the MLP is composed of l layers with a nonlinear activation function (tanh). In this paper, the MLP is used to learn the attention function g, and on this basis, the attention weight a i of each hidden state h i is calculated. Then, the attention weight a i is regarded as a probability distribution over the hidden state h i , and the final feature representation r is obtained by weighted summation of the hidden state h i through the weight a i . The specific calculation process is represented as:

[0034] e i =g(h i ) (3)

[0035]

[0036]

[0037] where r is the feature representation of the multi-layer perceptron, h i is the hidden state of the bidirectional LSTM layer at time series i, a i is the attention weight of time series i, and g is the attention function.

[0038] Step S120, based on the classification boundary, using the feature information in the majority class to generate pseudo samples of the minority class, while using the set rejection function to accurately ensure the quality of the pseudo samples, and then using the generated samples to construct a new data set balanced in class.

[0039] This step S120 is an imbalance processing process, using the more abundant feature information in the majority class, generating pseudo samples of the minority class according to the classification boundary obtained by the initial classifier, while using a rejection function to accurately ensure the quality of the pseudo samples, and then iteratively adjusting the classification boundary of the classifier to achieve better classification effect.

[0040] Overall, the present application uses a pre-trained sentiment analysis model g, which is likely to have no strong generalization ability on balanced data sets, but can achieve better results on imbalanced test data. Then, the hidden information in the majority samples is obtained by analyzing the decision boundary of g, and the minority samples are generated by using the diversity of the majority samples. On the other hand, f aims to train the target network to perform well on balanced data sets. In the training process of f, the imbalance processing module generates new minority samples using the given g, and adds the generated samples to D to dynamically construct D bal , and finally, the constructed D bal is used to train the model f for the final training, so the most critical is the algorithm for generating D bal .

[0041] Specifically, step S120 includes:

[0042] Step S121, obtaining a data set wherein x i represents the word vector obtained by inputting the embedding layer, y irepresents the sentiment category label corresponding to the input. A classifier f to be trained, a pre-trained classifier g. Then set the hyperparameters λ, γ, η, T > 0, where λ represents the degree of limiting the final classifier to the original class confidence, γ represents the acceptance threshold of whether the generated pseudo sample is effective, η represents the learning rate in the process of generating pseudo samples, and T represents the number of steps of gradient descent in the process of generating pseudo samples. At the same time, β ∈ [0, 1) is set to represent the proportion of rejecting generated samples. Finally, the output of the class-balanced data set adjusted by oversampling is marked as D bal .

[0043] Step S122, generating a generated sample of the minority class k from the majority class k0 by using the pre-trained classifier g. First, a sample is randomly extracted from the majority class as a seed, and a generated pseudo sample can be obtained by descending the gradient of the objective function T times according to the learning rate η.

[0044] Step S123, for the converted majority class and minority class, the quality of the generated sample is controlled by setting the rejection function. A series of pseudo samples are generated by repeating the above step S122, and then a part of the samples that do not meet the requirements are screened out by setting the rejection function to control the quality of the generated data set.

[0045] In one embodiment, the process of generating a generated sample x * of the minority class k from the majority class k0 is represented as:

[0046]

[0047] Where L represents the cross-entropy loss function, and λ is a hyperparameter. By adding a regularization term to limit the target model f to have a lower confidence in the original class k0. By calculating the gradient of x * to and decreasing it according to the learning rate η, a newly generated minority class sample can be obtained, where δ represents a small noise added to improve the generalization ability of the target model f, and x0 represents a random sample in the original class k0 as an initial value.

[0048] In the embodiment of the present application, an important factor affecting the quality of the synthesized minority sample is the quality of g, especially the feature extraction and judgment ability of the initial classifier g for the majority class k0: a better g will more effectively "eliminate" the important features of the originally majority class samples in the conversion process, so that the resulting minority sample is more reliable. However, in practical applications, g is not perfect: the synthesized sample still contains some discriminative features of the original class k0, which can even harm the performance of f. When the number of samples in the selected majority class is not large enough, this risk becomes more serious. In order to alleviate this risk, a rejection function is designed, denoted as:

[0049]

[0050] wherein, and N k respectively represent the total number of samples of the majority class and the minority class for conversion, and β is a hyperparameter for controlling the proportion of rejection, for example, β∈[0,1).

[0051] In step S130, the new data set is used to continue training the classifier for actual sentiment analysis.

[0052] After obtaining the new data set balanced in categories, the classifier f can be further trained until the set model optimization target is met, and then the target text obtained in real time is input into the trained classifier, so that the corresponding text sentiment classification result can be obtained.

[0053] Further, in order to verify the effect of the present application, for the proposed text sentiment analysis method based on unbalanced data in categories, a large number of experiments are carried out on the widely used sentiment analysis data set SemEval-2018 Task1Dadaset and the aclimdb movie review data set processed by exacerbating imbalance, and compared with the current more advanced unbalanced text sentiment model. The experiment adopts automatic evaluation indicators (Average Accuracy, Average F1 Score). The experimental results show that the automatic evaluation indicators of the present application are superior to the current more advanced unbalanced text sentiment model.

[0054] In summary, compared with the prior art, the present application has the following advantages:

[0055] 1) Firstly, the diversity of the majority class samples is used to help the class imbalance training, that is, the corresponding pseudo samples are generated and the classification boundary is adjusted by using the pre-trained classifier. This method can extract more feature knowledge, effectively improve the accuracy and generalization ability of the model classification, prevent excessive dependence on data distribution, and avoid model overfitting. The classifier can effectively distinguish the sentiment categories after training on the text sentiment dataset with extremely unbalanced number of majority class samples and minority class samples, and obtain high classification accuracy.

[0056] 2) The rejection function is designed to accurately control the quality of the generated pseudo samples, which can reduce the cost of model training and improve the final classification ability of the model.

[0057] 3) The imbalance data processing module proposed in the present application is an imbalance data processing method using majority class feature information, which is not limited to the field of text sentiment analysis. When dealing with imbalance data in other fields, the classifier can be designed according to different classification tasks and data sets, and then the module can be simply modified and applied to different fields to eliminate the influence of data imbalance, so it has strong application prospect.

[0058] 4) The existing technology is prone to model overfitting when there are too few minority class samples, and even hidden features in the minority class cannot be extracted. The present application makes full use of the rich information in the majority class and can be applied to a wider range of data sets. Compared with the existing oversampling method, the present application has lower requirements for the data set, uses more abundant feature information, and through iterative training and accurate control of the rejection function, the accuracy and generalization of the final classification model are greatly improved.

[0059] 5) The present application uses the hidden information in the majority class data to obtain classification, and according to the obtained classifier, the minority class data is oversampled to achieve data class balance. In this way, the high-dimensional information hidden in the majority class can be more fully utilized, and the adverse effects caused by the lack of labeled instances in some classes can also be effectively alleviated. Classification information can be effectively extracted from large-scale class imbalance data sets to help the model accurately perform sentiment analysis.

[0060] The present application can be a system, a method and / or a computer program product. The computer program product can include a computer readable storage medium having computer readable program instructions loaded thereon for causing a processor to implement various aspects of the present application.

[0061] Computer readable storage media can be tangible storage media which can retain and store instructions for use by an instruction execution device. Computer readable storage media can be, for example, but is not limited to, an electronic storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of computer readable storage media include the following: a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanically encoded device such as punch-cards or raised structures in a groove having instructions recorded thereon, and any suitable combination of the foregoing. A computer readable storage medium, as used herein, is not to be construed as being transitory signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission media (e.g., light pulses passing through a fiber-optic cable), or electrical signals transmitted through a wire.

[0062] Computer readable program instructions described herein can be downloaded to respective computing / processing devices from a computer readable storage medium or to an external computer or external storage device via a network, for example, the Internet, a local area network, a wide area network and / or a wireless network. The network can comprise copper transmission cables, optical transmission fibers, wireless transmission, routers, firewalls, switches, gateway computers and / or edge servers. A network adapter card or network interface in each computing / processing device receives computer readable program instructions from the network and forwards the computer readable program instructions for storage in a computer readable storage medium within the respective computing / processing device.

[0063] Computer readable program instructions for carrying out operations of the present application can be assembler instructions, instruction-set-architecture (ISA) instructions, machine instructions, machine dependent instructions, microcode, firmware instructions, state-setting data, or either source code or object code written in any combination of one or more programming languages, including an object oriented programming language such as Smalltalk, C++ or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The computer readable program instructions can execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider). In some embodiments, electronic circuitry including, for example, programmable logic circuitry, field-programmable gate array (FPGA), or programmable logic array (PLA) can execute the computer readable program instructions by utilizing state information of the computer readable program instructions to personalize the electronic circuitry, in order to perform aspects of the present application.

[0064] The computer readable program instructions can also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable apparatus or other device to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide processes for implementing the functions / acts specified in the flowchart and / or block diagram block or blocks.

[0065] These computer readable program instructions can be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions / acts specified in the flowchart and / or block diagram block or blocks. These computer readable program instructions can also be stored in a computer readable storage medium that can include random access memory (RAM), read only memory (ROM), electrically erasable programmable read only memory (EEPROM), flash memory or nonvolatile memory, or a suitable combination of the different types of computer readable storage media. The computer readable program instructions can also be downloaded to a computer, other programmable data processing apparatus, or other device from a computer readable storage medium or to an external computer or external storage device via a data signal that can be transmitted for example via a wired medium or a wireless medium such as the Internet or Wireless Application Protocol (WAP) signaling.

[0066] The computer readable program instructions can also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus or other device to produce a computer implemented process such that the instructions which execute on the computer, other programmable data processing apparatus, or other device implement the functions / acts specified in the flowchart and / or block diagram block or blocks.

[0067] The computer readable program instructions can also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus or other device to produce a computer implemented process such that the instructions which execute on the computer, other programmable data processing apparatus, or other device implement the functions / acts specified in the flowchart and / or block diagram block or blocks.

[0068] Embodiments of the present application have been described above, and the description is intended to be illustrative, and not restrictive, of the disclosed embodiments. Many modifications and variations of the disclosed embodiments are possible in light of the above teachings. It is therefore to be understood that within the scope of the disclosed embodiments, modifications and variations of the disclosed embodiments can be practiced. It is also to be understood that the specific order or hierarchy of steps in the processes disclosed is an illustration of exemplary processes. Based upon the description and illustrations provided herein, those skilled in the art will understand that changes can be made to the order of steps in the processes and that many of the individual steps can be modified or eliminated. Additionally, the description and illustrations provided herein are not meant to limit the scope of the disclosed embodiments. The scope of the disclosed embodiments is limited only by the claims.

Claims

1. A method for text sentiment analysis based on class imbalance data, comprising the following steps: extracting semantic information of the text by using a pre-trained classifier for a first data set, and obtaining a sentiment classification boundary corresponding to each text, the sentiment classification boundary being used to define a majority class and a minority class in the first data set; generating pseudo samples of the minority class by using feature information in the majority class based on the classification boundary, and iteratively adjusting the classification boundary of the classifier with a set rejection function as an optimization objective, wherein the rejection function is used to measure the quality of the generated pseudo samples; adding the generated pseudo samples to the first data set to form a second data set, and using the second data to continue training the classifier; wherein the process of generating pseudo samples of the minority class by using feature information in the majority class based on the classification boundary is represented as: wherein, denotes the generated pseudo sample, denotes the cross-entropy loss function, is a hyperparameter, is a regularization term for limiting the target model to classes with a low confidence, denotes the majority class, denotes the minority class, denotes the perturbation, denotes the adoption of a random sample from the class as an initial value, is a pre-trained classifier.

2. The method of claim 1, wherein, the classifier comprises an embedding layer, a recurrent neural network layer, a deep attention layer and an output layer, the embedding layer is used to convert the input text into a corresponding formalized word vector, and pass it to the recurrent neural network layer in a semantic order; the recurrent neural network layer is used to extract hidden layer features from the word vector, the hidden layer features comprising hidden information of the text context; the deep attention layer is used to determine the representation weight corresponding to the word vector, and calculate a feature vector based on the weight; the output layer is used to output a sentiment classification result based on the feature vector as the classification boundary.

3. The method of claim 2, wherein, the recurrent neural network layer is a bidirectional LSTM layer.

4. The method of claim 3, wherein, The deep attention layer is a multilayer perceptron used to learn the attention function. And calculate the hidden state of each hidden layer of the bidirectional LSTM layer. Attention weights And thus the hidden layer state Through weights Weighted summation yields the feature representation , is represented as: wherein, is a feature representation obtained by a multi-layer perceptron, is a hidden state of a bidirectional LSTM layer at a time step of a time series, is an attention weight for a time step of a time series, is an attention function.

5. The method of claim 2, wherein, the embedding layer converts the input text into a corresponding formalized word vector by using a text representation model Word2Vec.

6. The method of claim 5, wherein, the rejection function is represented as: wherein, with respectively represent the total number of majority and minority class samples that are converted, is a hyperparameter that controls the proportion of rejections. 7.A method for text sentiment analysis, comprising the following steps: obtaining a target text in real time; inputting the target text into a classifier trained according to the method of any one of claims 1 to 6 to obtain a text sentiment classification result.

8. A computer readable storage medium having stored thereon a computer program, wherein, The computer program is executed by a processor to implement the steps of the method according to any one of claims 1 to 7.

9. A computer device comprising a memory and a processor, having stored on the memory a computer program capable of running on the processor, characterized in that, The processor executes the computer program to implement the steps of the method according to any one of claims 1 to 7. The processor executes the computer program to implement the steps of the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Multi-set unbalanced data classification method and device based on data distribution

    CN116432122A