Multi-Head Attention Sentiment Classification Method
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing sentiment analysis methods struggle with accurate discrimination between sentiment polarities in texts involving multiple aspects, leading to errors in sentiment classification, as they fail to consider the interdependence between sentences and aspect terms, and do not generate vector representations that incorporate semantic information of the whole sentence.
Innovation Solution
The method involves acquiring pending word vectors and multi-head attention vectors, which include representations of both the sentence and target word, to generate hidden semantic representations and a classification feature vector, enabling improved sentiment polarity categorization.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Measurement precision
If traditional sentiment analysis methods are used, then the processing speed is fast, but the accuracy of sentiment classification in texts involving multiple aspects deteriorates
Solution Approach 1:
The patent segments the sentiment analysis task into multiple independent attention heads, each focusing on different aspects or dimensions of the text. The multi-head attention mechanism divides the feature extraction process into parallel streams, where each head learns to attend to different semantic relationships between aspect terms and sentiment expressions, thereby improving classification accuracy while maintaining computational efficiency through parallel processing.
Solution Approach 2:
The patent introduces a new dimensional perspective by incorporating aspect term information as a separate input dimension alongside the main text. The model processes both the text sequence and aspect terms through the attention mechanism, creating a multi-dimensional feature space that captures the relationship between aspects and sentiments. This dimensional expansion enables the model to distinguish multiple sentiments in complex texts without proportionally increasing overall complexity.
2Measurement precision
If multi-head attention mechanism is introduced to improve sentiment discrimination, then the sentiment classification accuracy improves, but the computational complexity increases
Solution Approach 1:
The patent applies partial action by implementing a selective attention mechanism where not all attention heads process all input tokens equally. Instead, the attention mechanism dynamically identifies and focuses computational resources on the most relevant aspect-term-sentiment triplets in the text. This partial processing approach maintains high discrimination accuracy by concentrating computational effort where it is most needed, rather than uniformly processing all possible combinations.
3Measurement precision
If vector representations incorporating whole sentence semantic information are generated, then the sentiment classification accuracy improves, but the processing time increases
Solution Approach 1:
The patent performs preliminary action by pre-computing and caching the semantic representations of aspect terms and their contextual embeddings before the main sentiment classification process. The model prepares attention weight matrices and feature vectors in advance, storing them for efficient retrieval during inference. This preliminary processing reduces the computational burden during actual sentiment analysis, thereby decreasing processing time while maintaining the benefit of comprehensive semantic information.
Data Source
AI summary
Provided are a data processing method, an electronic device and a storage medium. The method include: acquiring pending word vectors; acquiring multi-head attention vectors based on the pending word vectors, the multi-head attention vectors including first and second multi-head attention vectors; acquiring, based on the first multi-head attention vector, a first hidden semantic representation corresponding to the sentence; acquiring, based on the second multi-head attention vector, a second hidden semantic representation corresponding to the target word; acquiring a classification feature vector, based on the first and second hidden semantic representations; and acquiring, based on the classification feature vector, a sentiment polarity category of the sentence, and performing a sentiment classification on the sentence.


