Syntax-based quantum long short-term memory model and drug interaction extraction method
Through the syntax quantum long short-term memory model, quantum circuits are used to replace traditional operations and attention mechanisms, solving the problems of high computing resources and long training time in the existing technology, achieving fast and accurate drug interaction information extraction, and providing rapid learning and high-speed processing capabilities to support rational drug use monitoring systems.
Patent Information
- Application Number
- CN202110045922.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-14
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2041-01-14
AI Technical Summary
Existing models based on syntax convolutional neural network (SCNN) and long short-term memory network (LSTM) have high computing resources and long training time in drug interaction extraction, making it difficult to quickly and accurately understand the interaction information between multiple drugs, leading to adverse effects. Interactions may pose serious health risks.
The syntactic quantum long short-term memory model (SQLSTM) is adopted, including the input layer, vector embedding layer, syntactic quantum LSTM layer and classification output layer. Six variational quantum circuits VQC stacking is used to replace traditional operations, combined with the attention mechanism, to quickly extract drug interactions. Functional characteristics enable fast learning and high-speed processing.
It achieves rapid learning and high-speed processing of drug interaction information. The network model converges quickly, and can quickly and accurately understand the interaction information between drugs, providing technical support for the rational drug use monitoring system.
Smart Images

Figure CN112712901B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of pattern recognition and bioinformatics, and in particular relates to a grammar-based quantum long-short term memory model and a drug interaction extraction method. Background Art
[0002] As we all know, many patients, especially elderly patients, take multiple drugs every day during drug treatment, and the mixed use of multiple drugs may cause drug-drug interactions (DDIs). Adverse DDIs may cause vomiting, dizziness, blurred vision, itching, tinnitus, allergies, etc. in patients. Severe adverse DDIs may lead to worsening of the disease, shock, and even death. For example, taking aspirin and blood thinners such as warfarin at the same time can cause heavy bleeding. Adverse DDIs seriously endanger human health. How to help medical staff and patients quickly and accurately understand the DDIs information between the multiple drugs they use has become an important research direction in the current field of artificial intelligence and bioinformatics. Although the DDI extraction methods based on syntax convolutional neural networks (SCNN) and long short-term memory networks (LSTM) have achieved good results, the SCNN and LSTM models have the disadvantages of high computing power requirements and long training time. Summary of the invention
[0003] In order to solve the problems in the prior art, the present invention provides a grammatical quantum long short-term memory model and a drug interaction extraction method, which has the ability to quickly learn and process DDI information at high speed. The network model converges quickly, enabling medical staff and patients to quickly and accurately understand the DDIs information between the drugs used.
[0004] In order to achieve the above purpose, the present invention provides a grammatical quantum long short-term memory model, including an input layer, a vector embedding layer, a grammatical quantum LSTM layer, an attention layer and a classification output layer, wherein the input layer is used to obtain corpus from a database and perform data preprocessing; the vector embedding layer is used to perform vector embedding, and each word obtained and preprocessed by the input layer is mapped into a word vector, an entity type vector and a part-of-speech vector, and spliced into a vector; the grammatical quantum LSTM layer is used to extract high-level features from the vector obtained by the vector embedding layer using a SQLSTM unit, and the SQLSTM unit includes 6 variational quantum circuits VQC stacked together, each variational quantum circuit VQC is a basic unit of the SQLSTM unit, the input of the SQLSTM unit is the connection between the hidden state of the previous time step and the current input vector, and the output is four vectors measured at the end of each VQC, and the measured value is the Pauli-Z expectation value of each quantum bit, a quantum bit is operated by Pauli-Z, and then two nonlinear activation functions are performed. and tanh gives, and tanh are sigmoid and hyperbolic tangent functions respectively; the attention layer is used to generate a weight vector, multiply the word-level features of each time step in the high-level features obtained by the grammar quantum LSTM layer by the weight vector, and merge them into a sentence-level feature vector; the classification output layer is used to input the sentence-level feature vector obtained by the attention layer into the classifier Softmax for DDIs classification and identification.
[0005] Furthermore, the preprocessing of the input layer includes negative example filtering, entity replacement and word segmentation.
[0006] Furthermore, the preprocessing includes: firstly, pre-classifying the instances in the database according to grammar, semantics and part-of-speech rules, excluding negative examples in the pre-classification results, and balancing the positive and negative ratios of the database used in the training process; then uniformly replacing specific words with special category words; finally, segmenting the text sentences in the database through the text information tagging tool GENIA tagger, inputting the documents into the text information tagging tool GENIA tagger, and obtaining the basic form, part-of-speech tag, block tag and named entity tag of each word in the sentence.
[0007] Further, the vector embedding includes:
[0008] S1: Use the word vector calculation tool word2vec to represent each word in the sentence as a word vector, and then concatenate them to obtain a word-level sentence vector representation, where the word vector is obtained by looking up the word vector table;
[0009] S2: The entity type vector is mapped to a real-valued matrix with the same length as the sentence. The entity type vector table is randomly initialized by counting the number of entity types, and then the entity type vector of each word in the sentence is searched from the entity type vector table.
[0010] S3: The part-of-speech vector is mapped to a real-valued matrix that is consistent with the length of the sentence. The natural language processing toolkit Stanford CoreNLP is used to identify the part-of-speech of each word in the sentence. The number of part-of-speech types is counted, and the part-of-speech tags of the words are marked as part-of-speech types. A part-of-speech type vector table is constructed, and the part-of-speech type vector table is searched to obtain the part-of-speech vector of each word in the sentence.
[0011] S4: Concatenate the word vectors, entity type vectors, and part-of-speech vectors obtained in steps S1, S2, and S3, respectively, to obtain the input of the SQLSTM unit.
[0012] Furthermore, the data processing process of the SQLSTM unit includes:
[0013] S1: Encode the feature data of the vector obtained from the vector embedding layer into N -Quantum states;
[0014] S2: unitary quantum operation is performed on the encoded characteristic data;
[0015] S3: At the end of each variational quantum circuit VQC is a quantum measurement layer that considers the expected value of each qubit through computationally based measurements.
[0016] Furthermore, the N -The quantum state is represented by:
[0017]
[0018] in, For each ground state and each quantum The complex amplitude of The square of the measured state The measurement probability of ; The initial state Convert to the unbiased state:
[0019] ,in, is the decimal number corresponding to the bit string of the tag.
[0020] Furthermore, the unitary quantum operation includes a plurality of CNOT gates and a single-qubit rotation gate, wherein the CNOT gate is applied to each pair of fixed adjacent qubits 1 and 2 to generate multi-qubit entanglement; the single-qubit rotation gate Along and 3 rotation angles in the axis direction It is not fixed in advance and is updated during an iterative optimization process based on the gradient descent method.
[0021] Further, in the SQLSTM unit, is the hidden state of the previous SQLSTM unit Input vector exist t The output at the moment, the formal mathematical expression of a SQLSTM unit is as follows:
[0022] .
[0023] Furthermore, in the attention layer, H is the output vector of the SQLSTM unit The matrix composed of n is the length of the sentence, then the weighted feature of the sentence is expressed as ,in , , is the dimension of the vector, w is the training parameter, w、a and r The dimensions of , n and ; The resulting classification feature vector is .
[0024] The present invention also provides a method for extracting drug interactions based on the above-mentioned grammatical quantum long-short-term memory model, comprising the following steps:
[0025] Step 1: Obtain medical corpus from the database at the input layer and perform data preprocessing;
[0026] Step 2: In the vector embedding layer, each word is mapped into a word vector, an entity type vector, and a part-of-speech vector, and concatenated into a vector;
[0027] Step 3: In the syntax quantum LSTM layer, use the SQLSTM unit to extract high-level features from the vector obtained in step 2;
[0028] Step 4: Use the attention layer to generate a weight vector, multiply the word-level features of each time step by the weight vector, and merge them into a sentence-level feature vector;
[0029] Step 5: In the classification output layer, the sentence-level feature vector obtained in step 4 is input into the classifier Softmax for DDIs classification and identification.
[0030] Compared with the prior art, the present invention includes data preprocessing, vector embedding, feature extraction and classification processes. Among them, the feature extraction process is implemented by the Syntax Quantum Long Short-Term Memory model (SQLSTM) and the attention mechanism. The SQLSTM model uses 6 quantum circuits VQC with adjustable parameters and iterative optimization to replace the traditional operations in the long short-term memory model. The model uses quantum computing to replace traditional numerical calculations. The model is more stable and faster to train than the classical long short-term memory model, and is combined with the attention mechanism to extract drug interaction features, which can quickly learn more drug interaction information. Compared with the SCNN-based and LSTM-based DDI extraction methods, the present invention is characterized by: it has the ability to quickly learn and process DDI information at high speed, the network model converges quickly, and can enable medical staff and patients to quickly and accurately understand the DDIs information between the drugs used. The present invention provides a powerful and reliable technical solution for more accurately obtaining drug interaction information from medical literature and provides technical support for the rational drug use monitoring system. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 It is a flow chart of the extraction method of the present invention;
[0032] Figure 2 It is the SQLSTM unit structure diagram of the present invention. DETAILED DESCRIPTION
[0033] The present invention is further explained below in conjunction with the drawings and specific embodiments of the specification. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present application.
[0034] On the one hand, the present invention proposes a grammatical quantum long short-term memory model, including an input layer, a vector embedding layer, a grammatical quantum LSTM layer, an attention layer and a classification output layer. The input layer is used to obtain corpus from a database and perform data preprocessing; the vector embedding layer is used to perform vector embedding, mapping each word obtained and preprocessed by the input layer into a word vector, an entity type vector and a part-of-speech vector, and splicing them into a vector; the grammatical quantum LSTM layer is used to extract high-level features from the vector obtained by the vector embedding layer using a SQLSTM unit, see Figure 2The SQLSTM unit consists of 6 stacked variational quantum circuits VQC. Each variational quantum circuit VQC is the basic unit of the SQLSTM unit. The input of the SQLSTM unit is the connection between the hidden state of the previous time step and the current input vector. The output is the four vectors measured at the end of each VQC. The measured value is the Pauli-Z expectation value of each qubit. After the Pauli-Z operation, a qubit is processed and then two nonlinear activation functions are performed. and tanh gives, and tanh are sigmoid and hyperbolic tangent functions respectively, It's in time Input, is the hidden state, is the cell state, is the output, ⊗ and They represent the multiplication and addition of data elements respectively; the attention layer is used to generate a weight vector, multiplying the word-level features of each time step in the high-level features obtained by the grammar quantum LSTM layer by the weight vector, and merging them into a sentence-level feature vector; the classification output layer is used to input the sentence-level feature vector obtained by the attention layer into the classifier for classification and recognition.
[0035] The preprocessing of the input layer includes negative example filtering, entity replacement and word segmentation. The preprocessing specifically includes: first, pre-classify the instances in the database according to grammatical, semantic and part-of-speech rules, exclude negative examples in the pre-classification results, and balance the positive and negative ratio of the database used in the training process; then replace the specific words with special category words; finally, segment the text sentences in the database through the text information tagging tool GENIA tagger, input the documents into the text information tagging tool GENIA tagger, and obtain the basic form, part-of-speech tag, block tag and named entity tag of each word in the sentence.
[0036] Vector embedding specifically includes:
[0037] S1: Use the word vector calculation tool word2vec to represent each word in the sentence as a word vector, and then concatenate them to obtain a word-level sentence vector representation, where the word vector is obtained by looking up the word vector table;
[0038] S2: The entity type vector is mapped to a real-valued matrix with the same length as the sentence. The entity type vector table is randomly initialized by counting the number of entity types, and then the entity type vector of each word in the sentence is searched from the entity type vector table.
[0039] S3: The part-of-speech vector is mapped to a real-valued matrix that is consistent with the length of the sentence. The natural language processing toolkit Stanford CoreNLP is used to identify the part-of-speech of each word in the sentence. The number of part-of-speech types is counted, and the part-of-speech tags of the words are marked as part-of-speech types. A part-of-speech type vector table is constructed, and the part-of-speech type vector table is searched to obtain the part-of-speech vector of each word in the sentence.
[0040] S4: Concatenate the word vector, entity type vector, and part-of-speech vector obtained in steps S1, S2, and S3 respectively to obtain the input of the SQLSTM unit.
[0041] The data processing process of the SQLSTM unit includes:
[0042] S1: Encode the feature data of the vector obtained from the vector embedding layer into N -Quantum states;
[0043] N -The quantum state is represented by:
[0044]
[0045] in, For each ground state and each quantum The complex amplitude of The square of the measured state The measurement probability of ; The initial state Convert to the unbiased state:
[0046] ,in, is the decimal number corresponding to the bit string of the tag;
[0047] S2: unitary quantum operation is performed on the encoded characteristic data;
[0048] Unitary quantum operations include multiple CNOT gates and single-qubit rotation gates. The CNOT gate is applied to each pair of fixed adjacent qubits 1 and 2 to generate multi-qubit entanglement; the single-qubit rotation gate Along and 3 rotation angles in the axis direction It is not fixed in advance, but updated during the iterative optimization process based on the gradient descent method;
[0049] S3: Each variational quantum circuit VQC ends with a quantum measurement layer that considers the expected value of each qubit through computationally based measurements. is the hidden state of the previous SQLSTM unit Input vector exist tThe output at the moment, the formal mathematical expression of a SQLSTM unit is as follows:
[0050] .
[0051] In the attention layer, H is the output vector of the SQLSTM unit The matrix composed of n is the length of the sentence, then the weighted feature of the sentence is expressed as ,in , , is the dimension of the vector, w is the training parameter, w、a and r The dimensions of , n and ; The resulting classification feature vector is .
[0052] Another aspect of the present invention provides a method for extracting drug interactions based on the above-mentioned grammatical quantum long-short-term memory model, see Figure 1 , including the following steps: S1: data preprocessing process, including negative example filtering, entity replacement and word segmentation; S2: vector embedding process, including word vector embedding, entity type vector embedding and part-of-speech vector embedding; S3: feature extraction process, combining the syntax quantum long short-term memory model (SQLSTM) and the attention mechanism to extract the high-level classification features of the sentence; S4 uses the Softmax classifier to identify the drug interaction type.
[0053] The specific steps include:
[0054] Step 1: At the input layer, medical corpus is obtained from the database and data preprocessing is performed. The data preprocessing process includes negative example filtering, entity replacement and word segmentation. First, a filtering algorithm is used to pre-classify the instances in the data set according to some obvious grammatical, semantic and part-of-speech rules, exclude negative examples in the pre-classification results, balance the positive and negative ratio of the data set used in the training process, and then replace specific drug words with several special categories of words. Then, the text sentences in the data set are segmented through the text information annotation tool GENIA tagger in the biomedical field. The biomedical literature is input into GENIA tagger to obtain the basic form, part-of-speech tag, block tag and named entity tag of each word in the sentence.
[0055] Step 2: In the vector embedding layer, each word is mapped into a word vector, an entity type vector, and a part-of-speech vector, and concatenated into a vector. Specifically, the following steps are included:
[0056] Step 2.1: Use the word vector calculation tool word2vec to represent each word in the sentence as a word vector, and then concatenate them to obtain a word-level sentence vector representation. The word vector is obtained by looking up the word vector table.
[0057] Step 2.2: The entity type vector is mapped to a real-valued matrix of the same length as the sentence. By counting the number of entity types, the entity type vector table is randomly initialized, and then the entity type vector of each word in the sentence is found from the table.
[0058] Step 2.3: The part-of-speech vector is mapped to a real-valued matrix that is consistent with the length of the sentence. The natural language processing toolkit Stanford CoreNLP is used to identify the part-of-speech of each word in the sentence, and then the number of part-of-speech types is counted, and the part-of-speech tags of the words are marked as part-of-speech types. A part-of-speech type vector table is constructed, and the table is searched to obtain the part-of-speech vector of each word in the sentence.
[0059] Step 2.4: Concatenate the word vector, entity type vector, and part-of-speech vector obtained in steps 2.1, 2.2, and 2.3 respectively to obtain the input of SQLSTM.
[0060] Step 3: In feature extraction, the syntax quantum LSTM layer uses SQLSTM to extract high-level features from the vector obtained in step 2. Figure 2 SQLSTM is similar to LSTM. SQLSTM is composed of 6 VQC stacks. VQC is the basic unit of SQLSTM. i VQC is expressed as The input is the concatenation of the hidden state of the previous time step and the current input vector, and the output is the four vectors obtained by measurement at the end of each VQC. The measured value is the Pauli-Z expectation value of each qubit, and the Pauli-Z operation is one qubit. Then it passes through the nonlinear activation function and tanh. The data processing process of SQLSTM specifically includes the following steps:
[0061] Step 3.1: Encode the characteristic data extracted in step 2.4 into the quantum state. N -The quantum state is represented by: ,in For each ground state and each quantum The complex amplitude of The square of the measured state The measurement probability of .
[0062] The initial state Convert to the unbiased state:
[0063]
[0064] in, is the decimal number corresponding to the bit string marking the basis of the calculation.
[0065] Step 3.2: The encoded data is now a quantum state, which is then subjected to a series of unitary quantum operations. These quantum operations consist of several CNOT gates and single-qubit rotation gates. The CNOT gate is applied to each pair of qubits that are fixed adjacent to 1 and 2 to produce multi-qubit entanglement. Single-qubit rotation gate On 3 sides and Rotation angle of the axis It is not fixed in advance but updated during an iterative optimization process based on the gradient descent method.
[0066] Step 3.3: At the end of each variational quantum circuit (VQC) block is a quantum measurement layer. The expected value of each qubit is considered by measurement. In the proposed SQLSTM, the measurement value from each VQC will be processed in one SQLSTM cell.
[0067] set up is the hidden state of the previous SQLSTM unit Input vector The output of a SQLSTM unit is as follows:
[0068] .
[0069] Step 4: Use the attention layer to generate a weight vector, multiply the word-level features of each time step by the weight vector, and merge them into a sentence-level feature vector. H is the output vector of SQLSTM The matrix composed of n is the length of the sentence, then the weighted feature of the sentence is expressed as ,in , , is the dimension of the vector, w is the training parameter, w、a and r The dimensions of , n and .
[0070] The resulting classification feature vector is .
[0071] Step 5: In the classification output layer, the sentence-level feature vector obtained in step 4 is input into the classifier Softmax to classify DDIs.
[0072] The SQLSTM model of the present invention utilizes 6 quantum circuits VQC with adjustable parameters and iterative optimization to replace the traditional operations in the long short-term memory model. Compared with the DDI extraction methods based on SCNN and LSTM, it has the ability to quickly learn and process DDI information at high speed, and the network model converges quickly. It is combined with the attention mechanism to extract drug interaction features, which enables medical staff and patients to quickly and accurately understand the DDIs information between the drugs used, providing a powerful and reliable technical solution for more accurately obtaining drug interaction information from medical literature, and providing technical support for the rational drug use monitoring system.
[0073] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for constructing a grammar quantum long short-term memory model, characterized in that: The invention comprises an input layer, a vector embedding layer, a grammar quantum LSTM layer, an attention layer and a classification output layer, wherein the input layer is used to obtain corpus from a database and perform data preprocessing; the vector embedding layer is used to perform vector embedding, and each word obtained and preprocessed by the input layer is mapped into a word vector, an entity type vector and a part-of-speech vector, and the two are concatenated into a vector; the grammar quantum LSTM layer is used to extract high-level features from the vector obtained by the vector embedding layer using a SQLSTM unit, and the SQLSTM unit comprises 6 variational quantum circuits VQC stacked together, each variational quantum circuit VQC is a basic unit of the SQLSTM unit, and the input of the SQLSTM unit is the previous The hidden state of each time step is connected with the current input vector, and the output is four vectors measured at the end of each VQC. The measured value is the Pauli-Z expectation value of each quantum bit, which is obtained by Pauli-Z operation on one quantum bit and then passing through two nonlinear activation functions σ and tanh, where σ and tanh are sigmoid and hyperbolic tangent functions respectively; the attention layer is used to generate a weight vector, and the word-level features of each time step in the high-level features obtained by the grammar quantum LSTM layer are multiplied by the weight vector to merge into a sentence-level feature vector; the classification output layer is used to input the sentence-level feature vector obtained by the attention layer into the classifier Softmax for DDIs classification and identification; The data processing process of the SQLSTM unit includes: S1: Encode the feature data of the vector obtained from the vector embedding layer into N-quantum states; The N-quantum state is represented by: in, For each ground state and each quantum q i ∈{0,1} complex amplitude; The square of the measured state The measurement probability of The initial state Convert to the unbiased state: Where i is the decimal number corresponding to the bit string of the mark; S2: unitary quantum operation is performed on the encoded characteristic data; Unitary quantum operations include multiple CNOT gates and single-qubit rotation gates. The CNOT gate is applied to each pair of adjacent qubits 1 and 2 to generate multi-qubit entanglement; the single-qubit rotation gate {R i =R(α i ,β i ,γ i )} at three rotation angles {α i ,β i ,γ i }It is not fixed in advance, but updated during the iterative optimization process based on the gradient descent method; S3: Each variational quantum circuit VQC ends with a quantum measurement layer, which considers the expected value of each qubit through the measurement based on the calculation; let v t is the hidden state h of the previous SQLSTM unit t-1 The input vector x t The output at time t, the formal mathematical expression of a SQLSTM unit is as follows: In the attention layer, let H be the output vector [h1,h2,...,h n ], where n is the length of the sentence, then the weighted feature of the sentence is expressed as r = Ha T , where a = softmax(w T M), M=tanh(H), d w is the dimension of the vector, w is the training parameter, and the dimensions of w, a and r are d w , n and d w ; Then the obtained classification feature vector is h * =tanh(r).
2. The method for constructing a grammar quantum long short-term memory model according to claim 1, characterized in that: The preprocessing of the input layer includes negative example filtering, entity replacement and word segmentation.
3. The method for constructing a grammar quantum long short-term memory model according to claim 2, characterized in that: The preprocessing includes: firstly, pre-classifying the instances in the database according to grammar, semantics and part-of-speech rules, excluding negative examples in the pre-classification results, and balancing the positive and negative ratios of the database used in the training process; then, uniformly replacing specific words with special category words; finally, segmenting the text sentences in the database through the text information tagging tool GENIA tagger, inputting the documents into the text information tagging tool GENIA tagger, and obtaining the basic form, part-of-speech tag, block tag and named entity tag of each word in the sentence.
4. The method for constructing a grammar quantum long short-term memory model according to claim 1, characterized in that: The vector embedding includes: S1: Use the word vector calculation tool word2vec to represent each word in the sentence as a word vector, and then concatenate them to obtain a word-level sentence vector representation, where the word vector is obtained by looking up the word vector table; S2: The entity type vector is mapped to a real-valued matrix with the same length as the sentence. The entity type vector table is randomly initialized by counting the number of entity types, and then the entity type vector of each word in the sentence is searched from the entity type vector table. S3: The part-of-speech vector is mapped to a real-valued matrix that is consistent with the length of the sentence. The natural language processing toolkit Stanford CoreNLP is used to identify the part-of-speech of each word in the sentence. The number of part-of-speech types is counted, and the part-of-speech tags of the words are marked as part-of-speech types. A part-of-speech type vector table is constructed, and the part-of-speech type vector table is searched to obtain the part-of-speech vector of each word in the sentence. S4: Concatenate the word vectors, entity type vectors, and part-of-speech vectors obtained in steps S1, S2, and S3, respectively, to obtain the input of the SQLSTM unit.
5. A method for extracting drug interactions based on a grammatical quantum long-short-term memory model constructed by any one of the construction methods of claims 1 to 4, characterized in that: The following steps are involved: Step 1: Obtain medical corpus from the database at the input layer and perform data preprocessing; Step 2: In the vector embedding layer, each word is mapped into a word vector, an entity type vector, and a part-of-speech vector, and concatenated into a vector; Step 3: In the syntax quantum LSTM layer, use the SQLSTM unit to extract high-level features from the vector obtained in step 2; Step 4: Use the attention layer to generate a weight vector, multiply the word-level features of each time step by the weight vector, and merge them into a sentence-level feature vector; Step 5: In the classification output layer, the sentence-level feature vector obtained in step 4 is input into the classifier Softmax for DDIs classification and identification.
