A reading-induced electroencephalogram reinforcement learning sentiment analysis method and device

By using the reinforcement learning sentiment analysis method induced by reading EEG, emotional features are directly extracted from EEG signals, which solves the problems of low accuracy and high computational complexity in existing technologies and realizes efficient and accurate emotion recognition and emotion classification.

CN119884827BActive Publication Date: 2025-10-21HARBIN INSTITUTE OF TECHNOLOGY (SHENZHEN) (INSTITUTE OF SCIENCE AND TECHNOLOGY INNOVATION HARBIN INSTITUTE OF TECHNOLOGY SHENZHEN)
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411992425.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-10-21
Estimated Expiration
2044-12-31

AI Technical Summary

Technical Problem

Existing technologies have problems with low accuracy and high computational complexity in emotion recognition based on naturally read text, especially the lack of an end-to-end emotion recognition system. Traditional methods indirectly generate text, resulting in low efficiency and insufficient accuracy in emotion recognition.

Method used

A reinforcement learning sentiment analysis method based on reading-evoked EEG is adopted. The EEG word segmenter is trained by obtaining EEG signal training samples, and the EEG signal data is divided into blocks, encoded and quantized. The features are quantized into discrete vectors using the quantizer module. Combined with the agent selection strategy of reinforcement learning, the keyword set is extracted and input into the sentiment classification module for sentiment analysis.

Benefits of technology

Extracting emotion-related features directly from EEG signals and discarding the intermediate text generation step improves the accuracy and efficiency of emotion recognition, enhances the understanding of brain activity, reduces computing resource consumption, and improves the robustness of signal processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119884827B_ABST
    Figure CN119884827B_ABST
Patent Text Reader

Abstract

The application discloses a reading-induced electroencephalogram reinforcement learning emotion analysis method and device, and relates to the technical field of natural language understanding and cognitive neuroscience. The method comprises the following steps: obtaining an induced electroencephalogram segment corresponding to text segmentation based on reading eye movement information; inputting the electroencephalogram segment into an electroencephalogram segmenter, a quantizer and an encoder in the unit of a complete semantic sentence, pre-training the above modules through a self-supervised reconstruction paradigm; activating an intelligent agent by using the discrete electroencephalogram vector of the quantizer, screening a key electroencephalogram vector set, and inferring emotion classification based on the set; and constructing a reinforcement electroencephalogram vector set class, diversity and representative reward function, and optimizing the selection strategy of the intelligent agent. The application can provide a new paradigm for emotion recognition of a natural reading brain-computer interface.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical fields of natural language understanding and cognitive neuroscience, and in particular to a method and device for sentiment analysis based on reinforcement learning of reading-induced EEG. Background Art

[0002] With the development of human-computer interaction technology, technologies for understanding and recognizing human emotional states have received widespread attention. Affective computing is a key branch of this field, aiming to perceive, understand, and express human emotions through computer technology. Among the many emotion recognition methods, electroencephalography (EEG) has become a research hotspot in recent years due to its direct reflection of brain neural activity. Compared to traditional emotion recognition methods such as facial expressions and speech, EEG signals offer advantages in being resistant to spoofing and capable of real-time processing. However, due to the complexity and strong noise characteristics of EEG signals, accurate analysis and decoding of EEG signals present numerous challenges.

[0003] Currently, most research on EEG emotion recognition focuses on emotion classification using EEG signals obtained through video stimulation. Video stimulation has become a common choice in emotion recognition research because it can provide rich multimodal information, such as visual, auditory, and emotional color. However, this approach focuses primarily on video stimulation, resulting in a significant gap in emotion recognition research based on naturally read text, particularly the lack of end-to-end emotion recognition systems. In the existing technology, although some studies have attempted to combine EEG signals with natural text, some key issues remain unresolved.

[0004] Currently, some research is exploring the use of EEG-generated text in emotion recognition. This involves generating intermediate text from EEG signals and then performing emotion classification based on the generated text. The idea behind these approaches is to decode EEG signals into text and then use text classification techniques to perform emotion analysis. However, a limitation of this approach is that there is a significant semantic and structural gap between the generated text and the actual input text, resulting in the generated text failing to truly reflect the emotional information of the textual stimulus. This gap directly impacts the accuracy of emotion recognition, resulting in poor performance of emotion recognition methods based on generated text in practical applications.

[0005] Furthermore, existing emotion recognition models often rely on an indirect text generation step rather than directly extracting emotional features from EEG signals, resulting in inefficient and inaccurate emotion recognition. This indirect text generation method adds additional computational complexity and makes the training of emotion recognition models more cumbersome. In many cases, the generated text is weakly correlated with the emotion categories, which impacts the overall performance of the emotion recognition model. Summary of the Invention

[0006] To address the technical issues of low accuracy and high computational complexity in existing emotion recognition technologies, the present invention provides a method and device for emotion analysis based on reinforcement learning of reading-induced EEG. The technical solution is as follows:

[0007] On the one hand, a method for sentiment analysis based on reinforcement learning of reading-induced EEG is provided. The method is implemented by a device for sentiment analysis based on reinforcement learning of reading-induced EEG, and the method includes:

[0008] S1. Obtain EEG signal training samples, and train the initial EEG word segmenter based on the EEG signal training samples and the EEG signal decoder to obtain a trained EEG word segmenter;

[0009] S2. Acquire two-dimensional EEG signal data, where the EEG signal data includes an EEG signal and corresponding text data;

[0010] S3, dividing the EEG signal data into blocks to obtain a plurality of EEG signal segments; wherein each EEG signal segment includes an EEG signal block and a corresponding text word;

[0011] S4, inputting the multiple EEG signal segments into the trained EEG word segmenter for encoding to obtain multiple EEG encoding features;

[0012] S5, quantizing the multiple EEG encoding features into discrete EEG vectors through a quantizer module;

[0013] S6. Extract key features from discrete EEG vectors to obtain the importance score of word embedding;

[0014] S7, inputting the importance scores of the word embeddings into the intelligent agent, and performing action-selection-based sampling on the multiple EEG signal segments through a selection strategy optimized by the intelligent agent's reward function to obtain a keyword set;

[0015] S8. Input the keyword set into the emotion classification module to obtain the emotion classification corresponding to the EEG signal data.

[0016] On the other hand, a device for analyzing sentiment through reinforcement learning of reading-induced EEG is provided. The device is applied to a method for analyzing sentiment through reinforcement learning of reading-induced EEG, and the device comprises:

[0017] A training unit is used to obtain EEG signal training samples, and train the initial EEG word segmenter based on the EEG signal training samples and the EEG signal decoder to obtain a trained EEG word segmenter;

[0018] An acquisition unit, configured to acquire two-dimensional EEG signal data, wherein the EEG signal data includes an EEG signal and corresponding text data;

[0019] A block division unit is used to divide the EEG signal data into blocks to obtain a plurality of EEG signal segments; wherein each EEG signal segment includes an EEG signal block and a corresponding text word;

[0020] An encoding unit, configured to input multiple EEG signal segments into a trained EEG word segmenter for encoding to obtain multiple EEG encoding features;

[0021] a quantization unit, configured to quantize a plurality of EEG encoding features into discrete EEG vectors through a quantizer module;

[0022] Feature extraction unit, used to extract key features from discrete EEG vectors and obtain the importance score of word embedding;

[0023] A selection unit is configured to input the importance scores of the word embeddings into the intelligent agent, and perform action-selection-based sampling on the multiple EEG signal segments through a selection strategy optimized by the intelligent agent's reward function to obtain a keyword set;

[0024] The analysis unit is used to input the keyword set into the emotion classification module to obtain the emotion classification corresponding to the EEG signal data.

[0025] On the other hand, a device for reinforcement learning emotion analysis of reading-induced EEG is provided, and the device comprises: a processor; a memory, wherein computer-readable instructions are stored on the memory, and when the computer-readable instructions are executed by the processor, any one of the above-mentioned methods for reinforcement learning emotion analysis of reading-induced EEG is implemented.

[0026] On the other hand, a computer-readable storage medium is provided, wherein the storage medium stores at least one instruction, and the at least one instruction is loaded and executed by a processor to implement any one of the above-mentioned methods for reinforcement learning emotion analysis of reading-induced EEG.

[0027] The beneficial effects brought about by the technical solution provided by the embodiment of the present invention include at least:

[0028] This method directly extracts emotion-related features from EEG signals, eliminating the intermediate text generation step used in traditional methods. This innovative end-to-end framework enables more efficient and accurate emotion recognition, overcoming the limitations of existing technologies and improving both the effectiveness and robustness of emotion recognition.

[0029] The accuracy and efficiency of EEG signal analysis have been significantly improved through multi-layered techniques such as signal segmentation, feature encoding, quantization, and reinforcement learning. By introducing temporal and spatial embedding, the model can comprehensively capture the spatiotemporal dependencies of EEG signals, enhancing understanding of brain activity. It excels in tasks such as emotion recognition and mood monitoring. Furthermore, quantization converts EEG signals into discrete vectors, reducing computational resource consumption while improving the robustness of signal processing. The reinforcement learning module further optimizes the feature extraction process, enabling more precise keyword selection and thus improving the accuracy of sentiment classification and emotion recognition. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0031] Figure 1 This is a flow chart of a method for sentiment analysis based on reinforcement learning of reading-induced EEG provided by an embodiment of the present invention;

[0032] Figure 2 This is a flowchart of a method for sentiment analysis based on reinforcement learning of reading-induced EEG provided by an embodiment of the present invention;

[0033] Figure 3 This is a block diagram of a device for emotion analysis based on reinforcement learning of reading-induced EEG provided by an embodiment of the present invention;

[0034] Figure 4 This is a structural diagram of a device for reinforcing learning and sentiment analysis based on reading-induced EEG provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0035] The technical solution of the present invention is described below in conjunction with the accompanying drawings.

[0036] In the embodiments of the present invention, words such as "exemplarily" and "for example" are used to indicate examples, illustrations, or explanations. Any embodiment or design described as an "exemplary" in the present invention should not be interpreted as being preferred or advantageous over other embodiments or designs. Rather, the use of the word "exemplary" is intended to present concepts in a concrete manner. Furthermore, in the embodiments of the present invention, "and / or" can mean both or either of the two.

[0037] In the embodiments of the present invention, the terms "image" and "picture" may be used interchangeably. It should be noted that, when the distinction between them is not emphasized, their intended meanings are the same. The terms "of," "corresponding," and "corresponding" may be used interchangeably. It should be noted that, when the distinction between them is not emphasized, their intended meanings are the same.

[0038] In the embodiments of the present invention, sometimes a subscript such as W1 may be written as a non-subscript such as W1. When the difference is not emphasized, the meanings to be expressed are the same.

[0039] In order to make the technical problems, technical solutions and advantages to be solved by the present invention clearer, a detailed description will be given below with reference to the accompanying drawings and specific embodiments.

[0040] The embodiment of the present invention provides a method for reinforcement learning emotion analysis of reading-induced EEG, which can be implemented by a device for reinforcement learning emotion analysis of reading-induced EEG, which can be a terminal or a server. Figure 1 The flowchart of the reinforcement learning sentiment analysis method for reading evoked EEG is shown in Figure 2 The flowchart of the method for sentiment analysis based on reinforcement learning of reading-induced EEG is shown. The processing flow of the method may include the following steps:

[0041] S1. Obtain EEG signal training samples, and train an initial EEG word segmenter based on the EEG signal training samples and an EEG signal decoder to obtain a trained EEG word segmenter.

[0042] In one feasible implementation, unlike images with high signal-to-noise ratios, EEG signals have a low signal-to-noise ratio and exhibit significant randomness, non-stationarity, and nonlinearity, making it difficult to reconstruct the original signal. Directly reconstructing the original EEG signal is difficult to achieve convergence. This embodiment of the present invention reconstructs amplitude and phase from discrete neural markers to train an EEG word segmenter.

[0043] Optionally, the training process of S1 may include S11-S17:

[0044] S11, obtaining an EEG signal training sample, where the EEG signal training sample includes EEG signal training data, amplitude truth value, phase truth value, and EEG feature truth value;

[0045] S12, dividing the EEG signal training data into blocks to obtain multiple EEG signal training segments;

[0046] S13, inputting the multiple EEG signal training segments into the initial EEG word segmenter for encoding to obtain multiple predicted EEG encoding features;

[0047] S14, quantizing the plurality of predicted EEG coding features into discrete predicted EEG vectors through a quantizer module;

[0048] In a feasible implementation, for an EEG sample x containing c channels and an EEG block x with sampling point t, c,k , apply Discrete Fourier Transform (DFT):

[0049]

[0050] Where m∈[1,N], j is the imaginary unit. According to Euler's formula, we can get Amplitude A m and phase φ m :

[0051]

[0052] where Re and Im represent the real and imaginary parts of the complex number.

[0053] S15. Input the discrete predicted EEG vector into the EEG signal decoder to obtain the predicted amplitude and predicted phase.

[0054] In one possible implementation, after being quantized by a quantizer, the normalized discrete EEG embedding is fed into a neural decoder consisting of multiple Transformer blocks. The decoder output passes through an average pooling layer and two prediction heads to regress and predict the spectral amplitude and phase, respectively.

[0055] S16. Calculate the mean square error loss function based on the predicted EEG coding features, the true value of the EEG features, the predicted amplitude, the true value of the amplitude, the predicted phase, the true value of the phase, and the following formula (1):

[0056]

[0057]

[0058] Where D is the total EEG signal training data, sg indicates the stopping point for gradient calculation, the first two terms are the error between the predicted amplitude and the actual amplitude, and the error between the predicted phase and the actual phase, and the last two terms are the error between the EEG codebook and the encoded features. Because the conversion between EEG embedding and the EEG codebook is discrete, the gradient cannot be backpropagated between the EEG codebook and the encoded features. Therefore, this part of the backpropagation process is only forward propagated, and the gradient is 0 in the reverse process.

[0059] S17. Perform iterative training of forward propagation feedback according to the mean square error loss function. When the number of iterations reaches a preset threshold, stop training to obtain a trained EEG word segmenter.

[0060] S2. Acquire two-dimensional EEG signal data, where the EEG signal data includes EEG signals and corresponding text data.

[0061] In one feasible implementation, EEG data is acquired by using a multi-channel EEG device, where each channel records the electrical activity of a different area of ​​the brain. The acquired EEG signal is defined as a two-dimensional data representation, denoted as Where C is the number of EEG channels and T is the number of time frames. This representation can effectively capture the dynamic changes of EEG signals over time and the spatial information between different electrode channels.

[0062] S3. Block the EEG signal data to obtain multiple EEG signal segments, wherein each EEG signal segment includes an EEG signal block and a corresponding text word.

[0063] Optionally, the specific operation steps of S3 may be as follows:

[0064] The EEG signal E is divided into multiple time windows of fixed size, and each EEG signal data is divided into segments, where each time window is regarded as an EEG segment containing several time frames, expressed as Where t is the length of the time window, there is no overlap between time windows, and the stride is s, that is, the starting position of each time window is the offset of the previous time window;

[0065] The segmented EEG signal segments are expressed as follows (2):

[0066]

[0067] in, represents the signal segment of the jth electrode channel in the kth time window, and w is the length of each time window.

[0068] In a feasible implementation, the EEG signal is usually a long time series with a huge amount of data and rich information. However, directly inputting the entire time series into the model may result in excessive computation, so block processing is a commonly used signal processing technique. Inspired by the image patch embedding method, this embodiment regards the EEG signal as two-dimensional data, and the local features in the EEG signal can be better captured through block processing. Specifically, the EEG signal E is divided into multiple time windows of fixed size. Each time window can be regarded as an EEG segment containing several time frames, expressed as Where t is the length of the time window (e.g. 100ms, 200ms, etc.). In order to effectively capture the dynamic changes in the signal, the time windows are usually non-overlapping, with a stride of s, which is the offset of the starting position of each time window relative to the previous time window. Through this block method, each EEG sample will be divided into The segmented EEG segments are expressed as above formula (2). Each time window captures the local changes of the EEG signal at a certain moment, which helps to capture the brain activity pattern in a short time.

[0069] S4. Input the multiple EEG signal segments into the trained EEG word segmenter for encoding to obtain multiple EEG encoding features.

[0070] Optionally, the EEG word segmenter may include a temporal encoder module, a temporal and spatial embedding module, and an improved Transformer encoder module;

[0071] The specific operation steps of S4 may include S41-S43:

[0072] S41, inputting multiple EEG signal segments into a temporal encoder module to obtain corresponding temporal coding features for each segment;

[0073] S42, optimizing the time embedding list according to the temporal coding feature, adding the optimized time embedding list, the initialized spatial embedding list, and the EEG signal segment to obtain an embedding sequence;

[0074] S43. Input the embedded sequence into the improved Transformer encoder module to obtain multiple EEG encoding features.

[0075] Optionally, S43 inputs the embedded sequence into the improved Transformer encoder module to obtain multiple EEG encoding features, including:

[0076] S431, input the embedded sequence into the improved Transformer encoder module, and obtain the query vector Q, key vector K and value vector V by linearly transforming the embedded sequence;

[0077] S432: perform layer normalization on the query vector Q and the key vector K, and omit the bias term in the QKV calculation;

[0078] S433. Transpose the normalized key vector K, perform dot product on the normalized query vector Q and the transposed key vector K to obtain the correlation between Q and K, scale the dot product result, apply the softmax function to convert the scaled correlation into a probability distribution to obtain weights, apply the weights to the numerical vector V, obtain a weighted summation result, and then obtain multiple EEG coding features.

[0079] In one feasible implementation, the temporal encoder consists of multiple temporal convolutional blocks, each consisting of a one-dimensional convolutional layer, a group normalization layer, and a GELU activation function. This architecture can capture the local characteristics of EEG signals in the temporal dimension. For each block, the corresponding temporal coding feature is obtained:

[0080]

[0081] Furthermore, in order to enable the model to fully understand the temporal and spatial information of the block embedding, this embodiment initializes two learnable embedding lists: the temporal embedding list and the spatial embedding list S E =se1,se2,...,se |C| , the embedding vectors of these two lists are both d-dimensional, and d is 512 in this embodiment. max represents the maximum number of time blocks, which is a hyperparameter and needs to satisfy The spatial embedding list is used to represent the spatial position of each EEG electrode channel. C is the number of electrode channels, which is 105 in this embodiment. After adding the embedding, the EEG feature is expressed as:

[0082]

[0083] Time Embedded k Able to provide the model with representation of temporal information, spatial embedding It provides the spatial information of the electrode position, embedding the two items and the features obtained in the previous step Add them together to get e emb These embeddings are optimized as learnable parameters during training, enabling the model to gradually learn temporal and spatial correlations and effectively incorporate them into the patch embedding representation.

[0084] Furthermore, the embedding sequence will be directly input into the Transformer encoder. In order to make the training of Transformer more stable and efficient, appropriate modifications are made on its basis. First, layer normalization is added to the query and key before the dot product attention mechanism, which avoids the attention logic value from being too large, where dhead is the dimension of one head in the multi-head attention, and LN represents layerNorm. Next, the bias term in the QKV calculation is omitted, which can speed up training without reducing performance. For downstream tasks, average pooling is used on the output embedding, and then a task-specific prediction head is used. The calculation process is as follows:

[0085]

[0086] First, the query matrix Q and the key matrix K are dot-producted to obtain the correlation between them. The dot product result is then scaled to stabilize the computation. Next, a softmax function is applied to convert the correlation into a probability distribution representing the importance of each position. Finally, these weights are applied to the value matrix V to obtain a weighted sum, generating a new representation for each position. This process enables the model to capture dependencies between different input positions.

[0087] S5. quantize multiple EEG encoding features into discrete EEG vectors through a quantizer module.

[0088] Optionally, S5 quantizes multiple EEG encoding features into discrete EEG vectors through a quantizer module, including:

[0089] Define a neural codebook V′={v i |i=1,...,K}∈R KD , where K is the number of discrete EEG vectors and D is the dimension of each vector;

[0090] The nearest vector of each EEG coding feature pi is found in the neural codebook V′ as the potential discrete representation of the EEG coding feature. This process is expressed as the following formula (3):

[0091]

[0092] Among them, l2 represents e2 normalization, z i is the discretized EEG vector after the quantizer.

[0093] S6. Extract key features from discrete EEG vectors to obtain the importance score of word embedding.

[0094] In one feasible implementation, reinforcement learning is used to extract key features from the discrete EEG vectors obtained in step S5. The agent learns the importance score P of each word embedding in emotion recognition through a multi-layer Transformer network:

[0095] P={p t ∣p t ∈(0,1),t=1,...,T}

[0096] Where T represents the total number of words in the text, p t Represents the importance score of the t-th word.

[0097] S7. Input the importance score of the word embedding into the intelligent agent, and perform action selection-based sampling on multiple EEG signal segments through the selection strategy optimized by the intelligent agent's reward function to obtain a keyword set.

[0098] In one feasible implementation, rewards are provided to the agent based on the selected keyword set, incentivizing it to select more representative keywords. The specific reward mechanism can be designed based on the sentiment intensity and relevance of the keywords, thereby guiding the agent to continuously optimize its selection strategy in subsequent iterations. The reward function incorporates reinforcement rewards, discrete rewards, and representative rewards. By using a reinforcement learning mechanism to select key features for emotion recognition and designing reinforcement rewards, discrete reward functions, and representative rewards, the accuracy and robustness of emotion classification are improved.

[0099] Optionally, the reward function includes an enhanced reward, a discrete reward, and a representative reward. The following describes the three reward functions separately:

[0100] 1) Enhanced reward calculation method, including:

[0101] According to the following formula (4), the contribution of the selected keyword set to sentiment classification is measured by comparing the prediction probability at the sentence level:

[0102]

[0103] Among them, c is the true label of the word, p c Represents the probability of predicting a word set as class c. 0 Represents the sentence-level prediction of all words. The calculation process is to calculate the accuracy of the average EEG prediction of all word levels, p 1 The sentence-level prediction of the keyword set is to calculate the prediction accuracy of each word-level EEG after taking action. is the feature vector of the t-th word, a t Indicates whether the agent chooses a word at time t, a t =1 means selection, a t =0 means not selected.

[0104] In one feasible implementation, when the enhancement reward r ren A positive value indicates that the selected keyword set contributes positively to the accuracy of sentiment classification; a negative value indicates a negative contribution. Specifically, if the predicted action switches from an incorrect label to a correct label, the agent is given a positive reward r = Ω; otherwise, it is penalized r = -Ω. In this embodiment, Ω is set to 10 as the scale for positive and negative rewards.

[0105] 2) Calculation method for discrete rewards, including:

[0106] To ensure that the selected keyword set is uniform, the embodiment of the present invention uses a dispersion reward function to achieve better selection results. First, a standard function that reflects the distance between the intra-class and inter-class is constructed. Then, based on the clustering results, a set with a smaller intra-class distance and a larger inter-class distance (i.e., the classification results should have a higher degree of discrimination) is selected. The distribution with a higher dispersion reward shows significantly better clustering than the one with a lower dispersion reward.

[0107] The intra-class deviation matrix is ​​generated by calculating the distance between each sample point and the cluster center according to the following formula (5):

[0108]

[0109] in, is the sample mean vector of class w, n s represents the number of samples of class w, c represents the number of categories, Represents the i-th data sample in the j-th class. The formula is to calculate the intra-class covariance matrix of the j-th class By calculating the deviation of each sample from the corresponding class mean (i.e. ) and average all samples to get

[0110] The inter-class distance criterion function generates the inter-class deviation matrix S B , defined as follows (6):

[0111]

[0112] Among them, c represents the number of classes to be classified, is the mean vector of all samples to be classified, represents the number of samples of class w, represents the total number of samples, Represents the class center of each class, by the mean vector of each class j and the global mean The difference between them is taken as the outer product and weighted summation to get S B ;

[0113] Discrete reward R based on intra-class distance criterion function and inter-class distance criterion function dis , defined as follows (7):

[0114]

[0115] Where Tr[**] is the trace of the computation matrix.

[0116] 3) Calculation method for representative rewards, including:

[0117] Representative reward R repIt measures the extent to which the selected keyword set S can represent the characteristics of the original sentence. By maximizing Rrep, the agent is encouraged to select keywords close to the cluster center of the feature space.

[0118] According to the following formula (8), the extent to which the selected keyword set represents the characteristics of the original sentence is measured:

[0119]

[0120] Among them, x t Represents the features of the tth word in the sentence, T represents the number of words in the entire sentence, Y represents the index set of the keyword set, min t′∈Y This formula calculates the Euclidean distance between the original sentence features and the selected keyword features to ensure that the selected keyword can accurately represent the sentence semantics.

[0121] In one feasible implementation, after determining the reward function, it generates a reward value by evaluating the performance of the keyword set S, which is filtered out by the action set, in the sentiment classification task. The reward value consists of two parts: an enhancement reward and a discrete reward. The generated reward value serves as a feedback signal, and the Transformer network is trained through a backpropagation mechanism to optimize the importance score p. This process improves the subsequent action selection strategy, thereby gradually improving the accuracy and efficiency of keyword screening. The agent samples according to the importance score P, generating an action set A:

[0122] A={a t ∣a t ∈{0,1},t=1,…,T}

[0123] These actions are applied to word embeddings to filter out the set of keywords S:

[0124]

[0125] After obtaining the keyword set, it will be used as new input for sentiment classification.

[0126] S8. Input the keyword set into the emotion classification module to obtain the emotion classification corresponding to the EEG signal data.

[0127] In one feasible implementation, the sentiment classification module can be a fully connected (FC) layer followed by an activation function (such as ReLU or Softmax). In this module, the keyword set is processed by the fully connected layer and nonlinearly transformed by the activation function to achieve sentiment classification of the EEG signal data. The sentiment classification module can output the corresponding sentiment classification result based on the features in the keyword set.

[0128] The following describes the performance verification:

[0129] The performance of the embodiment of the present invention was verified on the public EEG text dataset ZuCo, which contains 309 data points. The end-to-end EEG emotion classification results achieved a precision of 46.94%, a recall of 41.69%, an F1 score of 44.19%, and an accuracy of 42.60%. Using reinforcement learning for key segment extraction, the precision achieved was 45.63%, a recall of 43.24%, an F1 score of 44.87%, and an accuracy of 43.38%. This embodiment has broad application prospects in fields such as brain-computer interfaces, intelligent health monitoring, sentiment analysis, and neuroscience research. The reward function evaluates the performance of a keyword set (SSS) filtered from an action set in a sentiment classification task, specifically calculating the degree of match between the sentiment classification result and the target sentiment label. The reward value serves as a feedback signal, adjusting the parameters of the Bernoulli distribution to optimize subsequent action selection strategies and gradually improve the accuracy and effectiveness of keyword screening. This has broad application prospects and can promote technological innovation and development in related industries.

[0130] This method directly extracts emotion-related features from EEG signals, eliminating the intermediate text generation step used in traditional methods. This innovative end-to-end framework enables more efficient and accurate emotion recognition, overcoming the limitations of existing technologies and improving both the effectiveness and robustness of emotion recognition.

[0131] The accuracy and efficiency of EEG signal analysis have been significantly improved through multi-layered techniques such as signal segmentation, feature encoding, quantization, and reinforcement learning. By introducing temporal and spatial embedding, the model can comprehensively capture the spatiotemporal dependencies of EEG signals, enhancing understanding of brain activity. It excels in tasks such as emotion recognition and mood monitoring. Furthermore, quantization converts EEG signals into discrete vectors, reducing computational resource consumption while improving the robustness of signal processing. The reinforcement learning module further optimizes the feature extraction process, enabling more precise keyword selection and thus improving the accuracy of sentiment classification and emotion recognition.

[0132] Figure 3 This is a block diagram of a device for analyzing the emotion of reading-induced EEG through reinforcement learning according to an exemplary embodiment. The device is used for a method for analyzing the emotion of reading-induced EEG through reinforcement learning. Figure 3 The apparatus includes a training unit 310, an acquisition unit 320, a block unit 330, an encoding unit 340, a quantization unit 350, a feature extraction unit 360, a selection unit 370, and an analysis unit 380.

[0133] The training unit 310 is used to obtain EEG signal training samples, and train the initial EEG word segmenter based on the EEG signal training samples and the EEG signal decoder to obtain a trained EEG word segmenter;

[0134] An acquisition unit 320 is configured to acquire two-dimensional EEG signal data, wherein the EEG signal data includes an EEG signal and corresponding text data;

[0135] A block division unit 330 is used to divide the EEG signal data into blocks to obtain a plurality of EEG signal segments; wherein each EEG signal segment includes an EEG signal block and a corresponding text word;

[0136] The encoding unit 340 is used to input multiple EEG signal segments into the trained EEG word segmenter for encoding to obtain multiple EEG encoding features;

[0137] a quantization unit 350 for quantizing the plurality of EEG coding features into discrete EEG vectors through a quantizer module;

[0138] A feature extraction unit 360 is used to extract key features from discrete EEG vectors to obtain importance scores of word embeddings;

[0139] A selection unit 370 is configured to input the importance scores of the word embeddings into the agent, and perform action-selection-based sampling on the multiple EEG signal segments through a selection strategy optimized by the agent's reward function to obtain a keyword set;

[0140] The analysis unit 380 is used to input the keyword set into the emotion classification module to obtain the emotion classification corresponding to the EEG signal data.

[0141] Optionally, the training unit 310 is configured to:

[0142] S11, obtaining an EEG signal training sample, wherein the EEG signal training sample includes EEG signal training data, amplitude true value, phase true value, and EEG feature true value;

[0143] S12, dividing the EEG signal training data into blocks to obtain multiple EEG signal training segments;

[0144] S13, inputting the multiple EEG signal training segments into the initial EEG word segmenter for encoding to obtain multiple predicted EEG encoding features;

[0145] S14, quantizing the plurality of predicted EEG coding features into discrete predicted EEG vectors through a quantizer module;

[0146] S15, inputting the discrete predicted EEG vector into an EEG signal decoder to obtain a predicted amplitude and a predicted phase;

[0147] S16. Calculate the mean square error loss function based on the predicted EEG coding features, the true value of the EEG features, the predicted amplitude, the true value of the amplitude, the predicted phase, the true value of the phase, and the following formula (1):

[0148]

[0149] in,

[0150]

[0151] S17. Perform iterative training of forward propagation feedback according to the mean square error loss function. When the number of iterations reaches a preset threshold, stop training to obtain a trained EEG word segmenter.

[0152] Optionally, the blocking unit 330 is configured to:

[0153] The EEG signal E is divided into multiple time windows of fixed size, and each EEG signal data is divided into segments, where each time window is regarded as an EEG segment containing several time frames, expressed as Where t is the length of the time window, there is no overlap between time windows, and the stride is s, that is, the starting position of each time window is the offset of the previous time window;

[0154] The segmented EEG signal segments are expressed as follows (2):

[0155]

[0156] in, represents the signal segment of the jth electrode channel in the kth time window, and w is the length of each time window.

[0157] Optionally, the EEG word segmenter includes a time encoder module, a time and space embedding module and an improved Transformer encoder module;

[0158] The encoding unit 340 is configured to:

[0159] S41, inputting multiple EEG signal segments into a temporal encoder module to obtain corresponding temporal coding features for each segment;

[0160] S42, optimizing the time embedding list according to the temporal coding feature, adding the optimized time embedding list, the initialized spatial embedding list, and the EEG signal segment to obtain an embedding sequence;

[0161] S43. Input the embedded sequence into the improved Transformer encoder module to obtain multiple EEG encoding features.

[0162] Optionally, the encoding unit 240 is configured to:

[0163] S431, input the embedded sequence into the improved Transformer encoder module, and obtain the query vector Q, key vector K and value vector V by linearly transforming the embedded sequence;

[0164] S432: perform layer normalization on the query vector Q and the key vector K, and omit the bias term in the QKV calculation;

[0165] S433. Transpose the normalized key vector K, perform dot product on the normalized query vector Q and the transposed key vector K to obtain the correlation between Q and K, scale the dot product result, apply the softmax function to convert the scaled correlation into a probability distribution to obtain weights, apply the weights to the numerical vector V, obtain a weighted summation result, and then obtain multiple EEG coding features.

[0166] Optionally, the quantization unit 350 is configured to:

[0167] Define a neural codebook V′={v i |i=1,...,K}∈R KD , where K is the number of discrete EEG vectors and D is the dimension of each vector;

[0168] The nearest vector of each EEG coding feature p is found in the neural codebook V′ as the potential discrete representation of the EEG coding feature. This process is expressed as the following formula (3):

[0169] Among them, e2 represents e2 normalization, z i is the discretized EEG vector after the quantizer.

[0170] Optionally, the reward function includes an enhanced reward and a discrete reward;

[0171] The calculation method of the enhancement reward includes:

[0172] According to the following formula (4), the contribution of the selected keyword set to sentiment classification is measured by comparing the prediction probability at the sentence level:

[0173]

[0174] Among them, c is the true label of the word, p c Represents the probability of predicting a word set as class c. 0 Represents the sentence-level prediction of all words. The calculation process is to calculate the accuracy of the average EEG prediction of all word levels, p 1The sentence-level prediction of the keyword set is to calculate the prediction accuracy of each word-level EEG after taking action. is the feature vector of the t-th word, a t Indicates whether the agent chooses a word at time t, a t =1 means selection, a t =0 means no selection;

[0175] The calculation method of the discrete reward includes:

[0176] The intra-class deviation matrix is ​​generated by calculating the distance between each sample point and the cluster center according to the following formula (5):

[0177]

[0178] in, is the sample mean vector of class w, n s represents the number of samples of class w, c represents the number of categories, Represents the i-th data sample in the j-th class. The formula is to calculate the intra-class covariance matrix of the j-th class By calculating the deviation of each sample from the corresponding class mean (i.e. ) and average all samples to get

[0179] The inter-class distance criterion function generates the inter-class deviation matrix S B , defined as follows (6):

[0180]

[0181] Among them, c represents the number of classes to be classified, is the mean vector of all samples to be classified, represents the number of samples of class w, represents the total number of samples, Represents the class center of each class, by the mean vector of each class j and the global mean The difference between them is taken as the outer product and weighted summation to get S B ;

[0182] Discrete reward R based on intra-class distance criterion function and inter-class distance criterion function dis , defined as follows (7):

[0183]

[0184] Where Tr[**] is the trace of the calculation matrix;

[0185] The calculation method of the representative reward includes:

[0186] According to the following formula (8), the extent to which the selected keyword set represents the characteristics of the original sentence is measured:

[0187]

[0188] Among them, x t Represents the features of the tth word in the sentence, T represents the number of words in the entire sentence, Y represents the index set of the keyword set, min t′∈Y Indicates selecting the feature that is most similar to the current word from the selected keywords.

[0189] This method directly extracts emotion-related features from EEG signals, eliminating the intermediate text generation step used in traditional methods. This innovative end-to-end framework enables more efficient and accurate emotion recognition, overcoming the limitations of existing technologies and improving both the effectiveness and robustness of emotion recognition.

[0190] The accuracy and efficiency of EEG signal analysis have been significantly improved through multi-layered techniques such as signal segmentation, feature encoding, quantization, and reinforcement learning. By introducing temporal and spatial embedding, the model can comprehensively capture the spatiotemporal dependencies of EEG signals, enhancing understanding of brain activity. It excels in tasks such as emotion recognition and mood monitoring. Furthermore, quantization converts EEG signals into discrete vectors, reducing computational resource consumption while improving the robustness of signal processing. The reinforcement learning module further optimizes the feature extraction process, enabling more precise keyword selection and thus improving the accuracy of sentiment classification and emotion recognition.

[0191] Figure 4 is a structural diagram of a device for reinforcing learning and sentiment analysis of reading-induced EEG provided by an embodiment of the present invention, such as Figure 4 As shown, the reading-induced EEG reinforcement learning emotion analysis device may include the above Figure 3 The device for analyzing the emotion through reinforcement learning induced by reading EEG is shown. Optionally, the device for analyzing the emotion through reinforcement learning induced by reading EEG 410 may include a first processor 2001 .

[0192] Optionally, the reading-induced EEG reinforcement learning emotion analysis device 410 may further include a memory 2002 and a transceiver 2003 .

[0193] The first processor 2001, the memory 2002 and the transceiver 2003 may be connected via a communication bus.

[0194] The following combination Figure 4 The components of the reading-induced EEG reinforcement learning emotion analysis device 410 are described in detail:

[0195] The first processor 2001 is the control center of the device 410 for analyzing sentiment through reinforcement learning of reading-evoked EEG. It can be a single processor or a collective term for multiple processing elements. For example, the first processor 2001 can be one or more central processing units (CPUs), or application-specific integrated circuits (ASICs), or one or more integrated circuits configured to implement embodiments of the present invention, such as one or more microprocessors (digital signal processors, DSPs) or one or more field programmable gate arrays (FPGAs).

[0196] Optionally, the first processor 2001 can perform various functions of the reading induced EEG reinforcement learning emotion analysis device 410 by running or executing a software program stored in the memory 2002 and calling data stored in the memory 2002.

[0197] In a specific implementation, as an embodiment, the first processor 2001 may include one or more CPUs, such as Figure 4 CPU0 and CPU1 are shown in FIG.

[0198] In a specific implementation, as an embodiment, the reading-induced EEG reinforcement learning emotion analysis device 410 may also include multiple processors, such as Figure 4 1 and 2. The first processor 2001 and the second processor 2004 are shown in FIG. Each of these processors can be a single-core processor (single-CPU) or a multi-core processor (multi-CPU). A processor herein can refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).

[0199] The memory 2002 is used to store the software program for executing the solution of the present invention, and is controlled by the first processor 2001 for execution. The specific implementation method can refer to the above method embodiment and will not be repeated here.

[0200] Optionally, the memory 2002 can be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 2002 can be integrated with the first processor 2001, or it can exist independently and be read through the interface circuit ( Figure 4 (not shown) is coupled to the first processor 2001, which is not specifically limited in this embodiment of the present invention.

[0201] The transceiver 2003 is used to communicate with a network device or a terminal device.

[0202] Optionally, the transceiver 2003 may include a receiver and a transmitter ( Figure 4 (not shown separately in the figure). The receiver is used to implement a receiving function, and the transmitter is used to implement a sending function.

[0203] Optionally, the transceiver 2003 can be integrated with the first processor 2001 or can exist independently and can be used to read the interface circuit ( Figure 4 (not shown) is coupled to the first processor 2001, which is not specifically limited in this embodiment of the present invention.

[0204] It should be noted that Figure 4 The structure of the reading-induced EEG reinforcement learning emotion analysis device 410 shown in the figure does not constitute a limitation on the router. The actual knowledge structure recognition device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0205] In addition, the technical effects of the reading-induced EEG reinforcement learning emotion analysis device 410 can refer to the technical effects of the reading-induced EEG reinforcement learning emotion analysis method described in the above method embodiment, and will not be repeated here.

[0206] It should be understood that the first processor 2001 in the embodiment of the present invention may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc.

[0207] It should also be understood that the memory in the embodiments of the present invention may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of random access memory (RAM) are available, such as static RAM (SRAM), dynamic random access memory (DRAM), synchronous DRAM (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link DRAM (SLDRAM), and direct rambus RAM (DR RAM).

[0208] The above embodiments can be implemented in whole or in part through software, hardware (such as circuits), firmware, or any other combination. When implemented using software, the above embodiments can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer program are loaded or executed on a computer, the processes or functions described in accordance with the embodiments of the present invention are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired method (such as infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that contains a collection of one or more available media. The available medium can be a magnetic medium (such as a floppy disk, hard disk, or magnetic tape), an optical medium (such as a DVD), or a semiconductor medium. The semiconductor medium can be a solid-state drive.

[0209] It should be understood that the term "and / or" as used herein simply describes a relationship between associated objects, indicating that three possible relationships exist. For example, "A and / or B" can represent: A alone, A and B together, or B alone. A and B can be singular or plural. Furthermore, the character " / " as used herein generally indicates an "or" relationship between the associated objects, but it may also indicate an "and / or" relationship. For specific understanding, please refer to the context.

[0210] In this disclosure, "at least one" means one or more, and "plurality" means two or more. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, "at least one of a, b, or c" can mean: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or plural.

[0211] It should be understood that in various embodiments of the present invention, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0212] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present invention.

[0213] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described equipment, devices and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0214] In the several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interface, indirect coupling or communication connection of the device or unit, which can be electrical, mechanical or other forms.

[0215] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0216] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0217] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0218] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any modifications or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in the present invention should be included in the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be based on the scope of protection of the claims.

Claims

1. A method for sentiment analysis based on reinforcement learning of reading-induced EEG, characterized in that: The method comprises: S1. Obtain EEG signal training samples, and train the initial EEG word segmenter based on the EEG signal training samples and the EEG signal decoder to obtain a trained EEG word segmenter; S2. Acquire two-dimensional EEG signal data, where the EEG signal data includes an EEG signal and corresponding text data; S3, dividing the EEG signal data into blocks to obtain a plurality of EEG signal segments; wherein each EEG signal segment includes an EEG signal block and a corresponding text word; S4, inputting the multiple EEG signal segments into the trained EEG word segmenter for encoding to obtain multiple EEG encoding features; S5, quantizing the multiple EEG encoding features into discrete EEG vectors through a quantizer module; S6. Extract key features from discrete EEG vectors to obtain the importance score of word embedding; S7, inputting the importance scores of the word embeddings into the intelligent agent, and performing action-selection-based sampling on the multiple EEG signal segments through a selection strategy optimized by the intelligent agent's reward function to obtain a keyword set; S8. Input the keyword set into the emotion classification module to obtain the emotion classification corresponding to the EEG signal data.

2. The method for reinforcement learning of emotion analysis based on reading-induced EEG according to claim 1, characterized in that: The step S1 of obtaining an EEG signal training sample and training an initial EEG word segmenter based on the EEG signal training sample and an EEG signal decoder to obtain a trained EEG word segmenter includes: S11, obtaining an EEG signal training sample, wherein the EEG signal training sample includes EEG signal training data, amplitude true value, phase true value, and EEG feature true value; S12, dividing the EEG signal training data into blocks to obtain multiple EEG signal training segments; S13, inputting the multiple EEG signal training segments into the initial EEG word segmenter for encoding to obtain multiple predicted EEG encoding features; S14, quantizing the plurality of predicted EEG coding features into discrete predicted EEG vectors through a quantizer module; S15, inputting the discrete predicted EEG vector into an EEG signal decoder to obtain a predicted amplitude and a predicted phase; S16. Calculate the mean square error loss function based on the predicted EEG coding features, the true value of the EEG features, the predicted amplitude, the true value of the amplitude, the predicted phase, and the true value of the phase; S17. Perform iterative training of forward propagation feedback according to the mean square error loss function. When the number of iterations reaches a preset threshold, stop training to obtain a trained EEG word segmenter.

3. The method for reinforcement learning emotion analysis of reading-induced EEG according to claim 1, characterized in that: The step S3 divides the EEG signal data into blocks to obtain multiple EEG signal segments, including: EEG signals It is divided into multiple fixed-size time windows, and each EEG signal data is divided into segments, where each time window is regarded as an EEG segment containing several time frames, expressed as ,in is the length of the time window, there is no overlap between time windows, and the stride is , that is, the starting position of each time window is the offset of the previous time window, is the number of EEG channels, is the number of time frames.

4. The method for reinforcement learning of emotion analysis based on reading-induced EEG according to claim 1, characterized in that: The EEG word segmenter includes a time encoder module, a time and space embedding module and an improved Transformer encoder module; The step S4 inputs the multiple EEG signal segments into the trained EEG word segmenter for encoding, thereby obtaining multiple EEG encoding features, including: S41, inputting multiple EEG signal segments into a temporal encoder module to obtain corresponding temporal coding features for each segment; S42, optimizing the time embedding list according to the temporal coding feature, adding the optimized time embedding list, the initialized spatial embedding list, and the EEG signal segment to obtain an embedding sequence; S43. Input the embedded sequence into the improved Transformer encoder module to obtain multiple EEG encoding features.

5. The method for reinforcement learning of emotion analysis based on reading-induced EEG according to claim 4, characterized in that: The S43 inputs the embedded sequence into the improved Transformer encoder module to obtain multiple EEG encoding features, including: S431, input the embedded sequence into the improved Transformer encoder module, and obtain the query vector Q, key vector K and value vector V by linearly transforming the embedded sequence; S432, perform layer normalization on the query vector Q and the key vector K respectively, and omit the bias term in the QKV calculation; S433. Transpose the normalized key vector K, perform dot product on the normalized query vector Q and the transposed key vector K to obtain the correlation between Q and K, scale the dot product result, apply the softmax function to convert the scaled correlation into a probability distribution to obtain weights, apply the weights to the numerical vector V, obtain a weighted summation result, and then obtain multiple EEG coding features.

6. The method for reinforcement learning of emotion analysis based on reading-induced EEG according to claim 1, characterized in that: The S5 quantizes multiple EEG encoding features into discrete EEG vectors through the quantizer module, including: Define a neural codebook ,in is the number of discrete EEG vectors, is the dimension of each vector; In the neural codebook Find each EEG encoding feature in The nearest vector of is used as the potential discrete representation of EEG encoding features.

7. The method for analyzing emotion through reinforcement learning of reading-induced EEG according to claim 1, characterized in that: The reward function includes an enhanced reward, a discrete reward, and a representative reward; The calculation method of the enhancement reward includes: The contribution of the selected keyword set to sentiment classification is measured by comparing the predicted probabilities at the sentence level: (4) in, is the true label of the word, Indicates that the word set is predicted as class probability; Represents the sentence-level prediction of all words. The calculation process is to calculate the accuracy of the average EEG prediction of all word levels. The sentence-level prediction of the keyword set is to calculate the prediction accuracy of each word-level EEG after taking action. It is The feature vector of each word, Represents the agent at time Whether to select a word, Indicates choice, Indicates no choice; The calculation method of the discrete reward includes: The intra-class deviation matrix is ​​generated by calculating the distance between each sample point and the cluster center according to the following formula (5): (5) in, yes The sample mean vector of the class, express The number of samples of the class, Indicates the number of categories for classification, Indicates the The first in the category data samples, the formula is to calculate the The within-class covariance matrix of the class , by calculating the deviation of each sample from the corresponding class mean, i.e. , perform the outer product, and average all samples to get ; The inter-class distance criterion function generates an inter-class deviation matrix , defined as follows (6): (6) in, represents the number of classes to be classified, is the mean vector of all samples to be classified, express The number of samples of the class, Represents the total number of samples, by The mean vector of and the mean vector of all samples to be classified The difference between them is taken as the outer product and weighted summation to get .

8. A device for analyzing emotion through reinforcement learning induced by reading EEG, wherein the device is used to implement the method for analyzing emotion through reinforcement learning induced by reading EEG as claimed in any one of claims 1 to 7, characterized in that: The device comprises: A training unit is used to obtain EEG signal training samples, and train the initial EEG word segmenter based on the EEG signal training samples and the EEG signal decoder to obtain a trained EEG word segmenter; An acquisition unit, configured to acquire two-dimensional EEG signal data, wherein the EEG signal data includes an EEG signal and corresponding text data; A block division unit is used to divide the EEG signal data into blocks to obtain a plurality of EEG signal segments; wherein each EEG signal segment includes an EEG signal block and a corresponding text word; An encoding unit, configured to input multiple EEG signal segments into a trained EEG word segmenter for encoding to obtain multiple EEG encoding features; a quantization unit, configured to quantize a plurality of EEG encoding features into discrete EEG vectors through a quantizer module; Feature extraction unit, used to extract key features from discrete EEG vectors and obtain the importance score of word embedding; A selection unit is configured to input the importance scores of the word embeddings into the intelligent agent, and perform action-selection-based sampling on the multiple EEG signal segments through a selection strategy optimized by the intelligent agent's reward function to obtain a keyword set; The analysis unit is used to input the keyword set into the emotion classification module to obtain the emotion classification corresponding to the EEG signal data.

9. A device for reinforcement learning and sentiment analysis based on reading-induced EEG, characterized in that: The reading-induced EEG reinforcement learning emotion analysis device includes: processor; A memory having computer-readable instructions stored thereon, wherein when the computer-readable instructions are executed by the processor, the method according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program code, which can be called by a processor to execute the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Emotion electroencephalogram signal classification method based on cross-connection type convolutional neural network

    CN110781751A

  • Method and system for training electroencephalogram model for learning electroencephalogram general characterization

    CN118296379A