Machine learning program, machine learning method and machine learning apparatus
By integrating word and graph embeddings to represent causal relationships, the machine learning method improves the accuracy of causal relationship extraction in text analysis.
Patent Information
- Application Number
- JP2023046120
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2023-03-23
- Publication Date
- 2024-10-04
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Conventional word embeddings do not represent the characteristics of causal relationships between words, leading to inaccurate extraction of causal relationships in text.
A machine learning approach that utilizes word embedding and graph embedding to associate words with vectors based on causal relationships, generating a knowledge graph to improve the training of a causal relationship extraction model.
Enhances the prediction accuracy of causal relationships by incorporating causal relationship features into the model, leveraging pre-trained language models for improved performance with limited training data.
Smart Images

Figure 2024135440000001_ABST
Abstract
Description
[Technical field]
[0001] The present invention relates to machine learning. [Background technology]
[0002] In the field of natural language processing, there is a technique for predicting the presence or absence of a causal relationship from text (Causal Relation Extraction). As an example of a causal relationship extraction method, a technique for predicting the presence or absence of a causal relationship between two words (hereinafter sometimes referred to as a "word pair") included in a text has been proposed. A word pair having a causal relationship is, for example, a pair of words in which the thing indicated by one word is the cause of the thing indicated by the other word, and the thing indicated by the other word is the result based on the thing indicated by the one word. An example of a word pair having a causal relationship is "smoking" and "lung cancer" in the text "Smoking causes lung cancer." Causal relationship extraction is used to discover important causal relationships from huge amounts of data, for example, in the fields of drug discovery and material development.
[0003] As a conventional technique for causal relationship extraction, a technique has been proposed for generating a machine learning model for causal relationship extraction (hereinafter, sometimes referred to as a "causal relationship extraction model") by machine learning. For example, the causal relationship extraction model is generated by supervised learning using labeled text as training data. As an example, a label is assigned based on the presence or absence of a causal relationship between words included in the text. The text of the training data is converted into a distributed representation for each word included in the text and then input to the causal relationship extraction model, and training is performed so as to reduce the error between the output of the causal relationship extraction model and the labels.
[0004] Distributed representations refer to vectors when words are represented as vectors. Distributed representations are obtained by word embedding. Word embedding is a technique that learns the meaning of words from the context and the context of the words in a sentence and represents the words as vectors. Word embedding can represent words as lower-dimensional vectors compared to the vectors obtained through one-hot encoding, and is one of the techniques used when inputting text into a neural network. [Prior art documents] [Patent documents]
[0005] [Patent Document 1] JP 2015-200961 A [Patent Document 2] JP 2018-060364 A [Patent Document 3] US Patent Application Publication No. 2021 / 0117509 [Patent Document 4] US Patent Application Publication No. 2019 / 0197104 Summary of the Invention [Problem to be solved by the invention]
[0006] Word embedding is a technique that incorporates various features of words, positions the words in a vector space, and expresses the similarities and relationships between words in a distributed representation (hereinafter sometimes referred to as "vector" or "vector representation"). However, word embedding does not express the features of causal relationships between words in the distributed representation.
[0007] In conventional techniques, the distributed representations input to the causal relationship extraction model do not include causal relationships, so the model is trained based on the context of the text and the context of words. Therefore, in conventional techniques, causal relationships may not be extracted depending on the word order of the text to be predicted.
[0008] In one aspect, the present invention aims to provide a machine learning program, a machine learning method, and a machine learning device that are capable of inputting characteristics of causal relationships between words into a causal relationship extraction model and performing machine learning. [Means for solving the problem]
[0009] In one aspect, a machine learning program is provided that causes a computer to execute a process of acquiring third correspondence information generated based on first correspondence information in which words and vectors are associated with each other based on word embedding for each word included in a first text, and second correspondence information in which words and vectors are associated with each other based on a word pair relationship between a first word indicating a cause and a second word indicating a result based on the cause indicated by the first word, and using the acquired third correspondence information, a machine learning program is provided that causes a computer to execute a process of training a neural network that performs natural language processing.
[0010] In one aspect, a machine learning method is provided in which a computer executes a process similar to the process based on the machine learning program described above.
[0011] In one aspect, a machine learning device is provided that executes processing similar to the processing based on the above machine learning program. Effect of the Invention
[0012] In one aspect, the features of the causal relationships between words can be input into a causal relationship extraction model to perform machine learning. [Brief description of the drawings]
[0013] [Figure 1] FIG. 1 is a diagram illustrating a learning device and an inference device according to a first embodiment. [Diagram 2] FIG. 2 is a diagram illustrating an example of a knowledge graph representing causal relationships. [Diagram 3] FIG. 3 is a functional block diagram of an example of a functional configuration of the learning device according to the first embodiment. [Figure 4]FIG. 4 is a diagram illustrating an example of information stored in the keyword DB. [Diagram 5] FIG. 5 is a diagram for explaining an example of a marking process. [Figure 6] FIG. 6 is a diagram illustrating an example of a process for extracting a sentence including a keyword. [Figure 7] FIG. 7 is a diagram illustrating an example of a process for generating word pairs for KG generation. [Figure 8] FIG. 8 is a diagram illustrating an example of a method for calculating the causal relationship score. [Figure 9] FIG. 9 is a diagram for explaining an example of a process for combining vectors (stacking). [Figure 10] FIG. 10 is a functional block diagram of an example of a functional configuration of the inference device according to the first embodiment. [Figure 11] FIG. 11 is a flowchart of the graph embedding process according to the first embodiment. [Figure 12] FIG. 12 is a flowchart of the learning process according to the first embodiment. [Figure 13] FIG. 13 is a flowchart of the inference process according to the first embodiment. [Figure 14] FIG. 14 is a diagram illustrating an example of a hardware configuration of the learning device according to the first embodiment. [Figure 15] FIG. 15 is a diagram illustrating an example of a hardware configuration of the inference device according to the first embodiment. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0014] Hereinafter, examples of the machine learning program, the machine learning method, and the machine learning device according to the present invention will be described in detail with reference to the drawings. Note that these examples are merely examples for implementing the present invention, and do not limit the present invention. In addition, in the following examples, an embodiment targeted at English texts and documents is described, but the target language is not limited to English. The examples may be applied to Japanese texts and documents, for example. EXAMPLES
[0015] [Explanation of the learning device 10 and the inference device 20] 1 is a diagram illustrating a learning device and an inference device according to Example 1. A learning device 10 and an inference device 20 according to Example 1 will be described with reference to FIG.
[0016] The learning device 10 is a machine learning device that executes training of a causal relationship extraction model. The causal relationship extraction model is a machine learning model that predicts the presence or absence of a causal relationship between word pairs included in text. In this embodiment, supervised learning is executed using labeled text as training data 135. In this embodiment, the machine learning model is a neural network.
[0017] The learning device 10 converts each word included in the text of the training data 135 into a vector of a distributed representation. The learning device 10 converts each word into a vector using correspondence information in which words and vectors are associated with each other. The correspondence information in which words and vectors are associated with each other is obtained by word embedding, for example. The learning device 10 converts each word into a vector using correspondence information in which words and vectors are associated with each other based on the characteristics of the causal relationship between words. The correspondence information in which words and vectors are associated with each other based on the characteristics of the causal relationship between words is obtained by graph embedding, for example. In this way, the learning device 10 converts each word into a vector based on word embedding and graph embedding. The learning device 10 inputs the vectors acquired based on the word embedding and graph embedding to the causal relationship extraction model in an integrated data format, and executes training of the causal relationship extraction model. For the graph embedding, a knowledge graph (KG) representing the causal relationship between words is used. The learning device 10 generates a knowledge graph representing the causal relationship from the text 131.
[0018] The inference device 20 uses the trained causal relationship extraction model generated by the learning device 10 to execute inference to predict the presence or absence of a causal relationship between word pairs included in the text of the prediction target data 235. The inference device 20 converts each word included in the prediction target data 235 into a vector based on word embedding and graph embedding. The inference device 20 puts the vectors acquired based on the word embedding and graph embedding into an integrated data format, inputs the vectors into the trained causal relationship extraction model, and executes inference.
[0019] Word embedding is a method of incorporating various features of words into a vector space and expressing words as vectors. During the machine learning process of a task using text as training data, word embedding reflects features such as the meaning of a word from the context and the context of the word in the vector. Therefore, while word embedding can ultimately express the similarity and relationship between words as vectors, it does not reflect information or features of causal relationships between words in the vector.
[0020] Graph embedding is a technique for expressing words as vectors based on graph data. Graph data is data represented in a graph structure, and for example, a knowledge graph is a representation of various knowledge in a graph structure. A graph structure is an abstract data type that includes nodes and edges that connect the nodes. In a knowledge graph that represents knowledge, nodes represent entities, and edges represent relationships between the entities. In a knowledge graph that represents causal relationships between words, nodes correspond to words, and edges represent causal relationships between words. Graph embedding reflects the associations related to the causal relationships between words in vectors by reducing a knowledge graph that represents the causal relationships between words into a vector space.
[0021] An example of a knowledge graph representing a causal relationship between words (hereinafter, may be referred to as a "knowledge graph representing a causal relationship" or a "knowledge graph") will be described with reference to FIG. 2. FIG. 2 is a diagram for explaining an example of a knowledge graph representing a causal relationship. Words correspond to nodes, and words having a causal relationship are connected by edges. In a knowledge graph 30, the word "mutation" at node 31 and the word "Parkinson Disease" at node 32 are connected by edge 33, indicating that there is a causal relationship between the word "mutation" and the word "Parkinson Disease". In addition, the weight of an edge indicates the strength of the causal relationship between the words (nodes) at both ends of the edge. The strength of the causal relationship is a weight indicating whether there is a causal relationship between words, and the larger the value, the stronger the causal relationship, that is, the higher the probability that there is a causal relationship between the words. In the knowledge graph 30, the edge weight "0.16" represented by the numerical value 34 indicates the strength of the causal relationship between the word "mutation" and the word "Parkinson Disease". When a word has a causal relationship with multiple words, the word may be connected to multiple words by edges. The knowledge graph 30 representing the causal relationship may be a directed graph using arrows as lines representing edges.
[0022] The learning device 10 can input a vector including features of causal relationships between words to the causal relationship extraction model and train the causal relationship extraction model, thereby enabling the learning device 10 to improve the prediction accuracy of the causal relationship extraction model.
[0023] [Function configuration] A functional configuration of the learning device according to the first embodiment will be described with reference to Fig. 3. Fig. 3 is a functional block diagram illustrating an example of the functional configuration of the learning device according to the first embodiment. The learning device 10 includes a communication unit 11, a control unit 12, and a storage unit 13.
[0024] The communication unit 11 controls communication with an external device. The communication unit 11 is realized by a communication interface such as a network interface card (NIC). For example, text 131, a keyword database (keyword DB) 132, word embedding correspondence information 133, graph embedding correspondence information 134, training data 135, and a causal relationship extraction model 136 may be input and output via the communication unit 11.
[0025] The storage unit 13 stores various programs executed by the control unit 12 and data used to execute the various programs. The storage unit 13 is realized by a main storage device such as a random access memory (RAM) or an auxiliary storage device such as a hard disk drive (HDD). The data stored in the storage unit 13 includes, for example, text 131, a keyword DB 132, word embedding correspondence information 133, graph embedding correspondence information 134, training data 135, and a causal relationship extraction model 136.
[0026] The text 131 is data used when the graph embedding unit 121 generates a knowledge graph that represents causal relationships. The text 131 is, for example, text included in an academic paper or a document in a specialized field, or text archived on the web. The text 131 may be generated from multiple documents or media. The text 131 may include multiple texts. The text included in the text 131 may include multiple sentences.
[0027] The keyword DB132 is a database that stores keywords (hereinafter, may be referred to as "keywords") indicating causal relationships used when the graph embedding unit 121 generates a knowledge graph representing causal relationships. A keyword indicating a causal relationship is a word that is inferred to have a causal relationship with a pair of nouns near that word. FIG. 4 is a diagram for explaining an example of information stored in the keyword DB. As an example, the keyword DB132 stores "cause", "causes", "as a result", and the like as keywords indicating causal relationships. In the case of verbs, the keywords indicating causal relationships may include inflected forms depending on tense, etc. The keywords indicating causal relationships may be phrases including multiple words. The keywords indicating causal relationships may be manually selected and stored in the keyword DB132.
[0028] The word embedding correspondence information 133 is information in which words and vectors are associated with each other, and is obtained by word embedding, for example. The word embedding correspondence information 133 is used when the learning processing unit 122 converts words included in the training data 135 into vectors. For word embedding, a method of acquiring distributed representations by machine learning using an n-gram language model, for example, may be used. For word embedding, Word2Vec or BERT, which are pre-trained language models, may be used. The word embedding correspondence information 133 is an example of first correspondence information.
[0029] The graph embedding correspondence information 134 is information in which words and vectors are associated with each other based on the characteristics of the causal relationships between the words, and is obtained by graph embedding, for example. The graph embedding correspondence information 134 is used when the learning processing unit 122 converts words included in the training data 135 into vectors. The graph embedding correspondence information 134 may be generated by the graph embedding unit 121. The graph embedding correspondence information 134 is an example of second correspondence information.
[0030] The training data 135 is data used for training the causal relationship extraction model 136. The training data 135 may be generated, for example, from text included in academic papers or documents in specialized fields, or from text archived on the web. The training data 135 may include multiple texts. The text included in the training data 135 may include multiple sentences. The texts included in the training data 135 are each labeled. The labels are assigned based on the presence or absence of a causal relationship between word pairs included in each text. As an example, the labels may be defined as "causal relationship: 1, no causal relationship: 0".
[0031] Marking is applied to the word pairs that are the basis of the label to be attached to each text. As an example, the marking process will be described with reference to FIG. 5. FIG. 5 is a diagram for explaining an example of the marking process. For example, assume that the text contains a word pair of "smoking" and "lung cancer" that have a causal relationship. In this case, since "smoking" and "lung cancer" have a causal relationship, the label is "1", and both words are marked with the symbols "$" and "@". The symbols are added before and after the words. For example, "smoking" becomes "$smoking@" when marked, and "lung cancer" becomes "$lung cancer@" when marked. The symbols used for marking may be selected arbitrarily, but it is preferable to avoid symbols that are integrated with the character string of a word and affect the meaning of the word.
[0032] In this way, each of the texts included in the training data 135 is labeled, and the word pairs that are the basis of the labels included in the text are marked. The text included in the text 131 may be used for the training data 135. When a single text contains multiple word pairs, the text may be duplicated for the number of word pairs, and a label and marking may be applied to each text containing each word pair. The label and marking may be applied to each sentence included in the text. When a single sentence contains multiple word pairs, the sentence may be duplicated for the number of word pairs, and a label and marking may be applied to each sentence containing each word pair.
[0033] The labels and markings may be added by the learning device 10 in response to an input from a user. The process of adding labels and markings to text may be performed by an external device other than the learning device 10. The learning device 10 may acquire training data 135 to which labels and markings have been added from an external device via the communication unit 11. The training data 135 may not be marked if the labels are added from the perspective of whether or not the text contains information on causal relationships, for example.
[0034] The causal relationship extraction model 136 is a machine learning model generated by the learning processing unit 122. The causal relationship extraction model 136 is a neural network, and may be, for example, a feedforward neural network (FNN) such as a Recurrent Neural Network (RNN) or a Convolutional Neural Network (CNN). The causal relationship extraction model 136 includes various parameters such as feature amounts obtained by machine learning.
[0035] Next, the control unit 12 will be described. The control unit 12 controls the overall processing of the learning device 10. The control unit 12 is realized by a processor such as a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), or a Digital Signal Processor (DSP) reading a program stored in a storage device, expanding the program in a main storage device such as a RAM, and executing the program. The control unit 12 may be realized by including an integrated circuit such as an Application Specific Integrated Circuit (ASIC) or a Field Programmable Gate Array (FPGA). The control unit 12 includes a graph embedding unit 121 and a learning processing unit 122.
[0036] The graph embedding unit 121 generates a knowledge graph representing a causal relationship by using the text 131, and generates graph embedding correspondence information 134. The knowledge graph representing the causal relationship is a graph structure representing information on the causal relationship between words included in the text 131. An example of a process for generating a knowledge graph representing a causal relationship will be described with reference to Figs. 6 to 8.
[0037] Fig. 6 is a diagram for explaining an example of processing for extracting a sentence including a keyword. As shown in Fig. 6, when the graph embedding unit 121 acquires the text 131, the graph embedding unit 121 extracts the sentence 40 including a keyword indicating a causal relationship from the text 131. The keyword indicating a causal relationship is, for example, the keyword 41 "cause", the keyword 42 "causes", and the keyword 43 "As a result" included in the text 131. The graph embedding unit 121 may acquire the keyword indicating a causal relationship from the keyword DB 132 and compare it with each text included in the text 131 to extract the sentence 40 including the keyword indicating a causal relationship.
[0038] Fig. 7 is a diagram for explaining an example of a process for generating word pairs for KG generation (hereinafter, may be referred to as "word pairs for KG generation"). Sentence 50 is an example of a sentence included in sentence 40 including the keyword indicating the causal relationship extracted in Fig. 6. As shown in Fig. 7, graph embedding unit 121 divides sentence 50 into a cause part 51 and an effect part 52 before and after the keyword indicating the causal relationship. In each sentence, the word string before the keyword indicating the causal relationship is the cause part, and the word string after the keyword is the effect part.
[0039] The graph embedding unit 121 extracts words whose part of speech is a noun (hereinafter, may be referred to as a "noun") from the word strings in the cause part 51 and the result part 52. As an example, a cause noun 53 is a result of extracting a noun from the cause part 51, and a result noun 54 is a result of extracting a noun from the result part 52. Morphological analysis may be used to extract the nouns.
[0040] The graph embedding unit 121 generates a KG generation word pair 55 by combining the extracted cause noun 53 and result noun 54. As an example, when three nouns, "mutation," "UCH-L1," and "gene," are extracted from the cause part 51, and two nouns, "Parkinson Disease" and "human," are extracted from the result part 52, the graph embedding unit 121 generates up to six KG generation word pairs by combining each noun. In this way, the graph embedding unit 121 generates a KG generation word pair from each sentence including a keyword indicating a causal relationship. The graph embedding unit 121 may use all the generated KG generation word pairs for generating a knowledge graph, or may use only some of the KG generation word pairs.
[0041] The graph embedding unit 121 may generate a word pair for generating a KG by other methods. For example, the graph embedding unit 121 may set the front of a keyword indicating a causal relationship as the result part and the rear of the keyword indicating a causal relationship as the cause part. In addition, the graph embedding unit 121 may generate a word pair for generating a KG regardless of the position of the keyword indicating a causal relationship. For example, if the text is "Smoking causes lung cancer," the graph embedding unit 121 may create a word pair for generating a KG by using the nouns "smoking" and "lung cancer" that are located in front of the keyword "cause" that indicates a causal relationship. In addition, if the text is "There is a possibility of lung cancer because you have a smoking habit," the causally related words "lung cancer" and "smoking" are included in different sentences. In such a case, the graph embedding unit 121 may create a word pair for generating a KG from different sentences included in the text.
[0042] The graph embedding unit 121 calculates a causal score indicating the strength of the causal relationship between the generated KG generating word pairs. As an example, the causal score may be calculated by the following formula (1). TIFF2024135440000002.tif14138
[0043] Formula (1) will be explained. x i (i is any integer greater than or equal to 0) is a noun included in the cause, y j (j is any integer greater than or equal to 0) is a noun included in the result. freq(x i , y i ) is x i andy i The number of KG generating word pairs including and were generated from the text 131 by the techniques of FIG. 6 and FIG. 7. That is, freq(x i , y i ) is x i andy i This shows the frequency with which KG-generating word pairs containing the above appear near keywords indicating causal relationships in text 131.
[0044] As an example, a method for calculating a causal relationship score will be described with reference to FIG. 8. FIG. 8 is a diagram for explaining an example of a method for calculating a causal relationship score. As an example, text 131 includes texts 1 to 4. In texts 1 to 4 in FIG. 8, only word pairs for KG generation generated from each text based on keywords are described as an example. For example, x i is the word "UCH-L1", y i is the word "Parkinson Disease". In text 131, if the number of KG generation word pairs generated between "UCH-L1" and "Parkinson Disease" is 2 in text 1 and 1 in text 2, freq(UCH-L1,Parkinson Disease) is 3. N is the total number of types of KG generation word pairs. If multiple KG generation word pairs with the same word combination are generated, the type of KG generation word pair is counted as 1. As an example, in FIG. 8, there are 12 types of KG generation word pairs in texts 1 to 4, so N is 12. Therefore, the causality score of the KG generation word pair between "UCH-L1" and "Parkinson Disease" is "0.25".
[0045] In this way, the causal relationship score according to formula (1) has a parameter for the frequency with which the KG generation word pair appears together with the keyword, and represents the strength of the causal relationship for each KG generation word pair. A KG generation word pair with a strong causal relationship appears frequently together with the keyword in the text, and therefore has a large causal relationship score value. If a KG generation word pair with a weak causal relationship is generated, the KG generation word pair with a weak causal relationship appears less frequently together with the keyword in the text, and therefore has a small causal relationship score value. Thus, the causal relationship score according to formula (1) reflects the strength of the causal relationship for each KG generation word pair in a numerical value.
[0046] The graph embedding unit 121 generates the knowledge graph 30 based on the generated KG generation word pairs 55 and the causal relationship scores 56 corresponding to each of the KG generation word pairs 55. Each word of the KG generation word pairs 55 corresponds to a node of the knowledge graph 30, and each word (node) of the KG generation word pairs 55 is connected by an edge. The causal relationship scores 56 become the weight of the edge of the knowledge graph 30. The edge weight indicates the strength of the causal relationship between the words (nodes) at both ends of the edge, and the larger the value, the stronger the causal relationship between the words, i.e., the higher the possibility that there is a causal relationship between the words. In this way, the graph embedding unit 121 generates the knowledge graph 30 that represents the characteristics of the causal relationships between words included in the text 131.
[0047] The graph embedding unit 121 generates graph embedding correspondence information 134 by graph embedding using the generated knowledge graph 30. Graph embedding is a method of embedding a graph structure including nodes and edges in a vector space to obtain a distributed representation of the nodes. The graph embedding unit 121 embeds the knowledge graph 30 in a vector space by graph embedding to obtain graph embedding correspondence information 134, which is a distributed representation of words. For example, TransE or ComplEx may be used for graph embedding. For example, a method of expressing the knowledge graph 30 as an adjacency matrix to obtain a distributed representation of words may be used for graph embedding. In this case, the weight of the edge may be an element of the adjacency matrix. In this way, the graph embedding unit 121 generates a vector corresponding to a word based on the characteristics of the causal relationship between words.
[0048] The graph embedding unit 121 may be provided in an external device other than the learning device 10. The learning device 10 may acquire the graph embedding correspondence information 134 generated by the external device via the communication unit 11 or the like, and store it in the storage unit 13. The learning device 10 may acquire a knowledge graph representing a causal relationship generated by an external device via the communication unit 11 or the like, and generate the graph embedding correspondence information 134. In addition, the method of creating the graph embedding correspondence information 134 is not limited to graph embedding using a knowledge graph. The graph embedding unit 121 does not necessarily have to generate a knowledge graph. The graph embedding unit 121 does not necessarily have to generate the graph embedding correspondence information 134 using graph embedding. For example, the graph embedding unit 121 may generate the graph embedding correspondence information 134 based on an adjacency matrix generated from the KG generation word pairs 55 and the causal relationship scores 56.
[0049] Next, a description will be given of the learning processing unit 122. The learning processing unit 122 is a processing unit that executes training of the causal relationship extraction model 136.
[0050] When the learning processing unit 122 acquires the training data 135, the learning processing unit 122 converts each word in a word sequence included in the training data 135 into a vector based on the word embedding correspondence information 133 and the graph embedding correspondence information 134.
[0051] The learning processing unit 122 integrates the vector obtained from the word embedding correspondence information 133 and the vector obtained from the graph embedding correspondence information 134. In other words, the learning processing unit 122 combines the vector obtained from the word embedding correspondence information 133 and the vector obtained from the graph embedding correspondence information 134. The combination method is, for example, stacking, concatenation, or summation.
[0052] With reference to FIG. 9, an example of a process of converting words into vectors and combining the converted vectors will be described. FIG. 9 is a diagram for explaining an example of a process of combining vectors (stacking). For example, when a word string of the training data 60 "The mutation of $UCH-L1@" included in the training data 135 is input to the learning processing unit 122, the learning processing unit 122 converts each word into a vector with reference to the word embedding correspondence information 133 and the graph embedding correspondence information 134. FIG. 9 shows, as an example, information related to the words included in the training data 60, excerpted from the word embedding correspondence information 133 and the graph embedding correspondence information 134. When there is no vector expression corresponding to a word included in the word string, the word without the corresponding vector expression may be converted into an arbitrary vector. For example, in the word embedding correspondence information 133 and the graph embedding correspondence information 134, a vector to be assigned to a word without a corresponding vector expression may be defined in advance. 9, for example, when the word embedding correspondence information 133 does not have a vector expression corresponding to the marked word "$UCH-L1@", the learning processing unit 122 may convert "$UCH-L1@" into a vector v5 defined as "unknown". For example, when the graph embedding correspondence information 134 does not have vector information corresponding to "The", "of", and "$UCH-L1@", the learning processing unit 122 may convert "The", "of", and "$UCH-L1@" into a vector v8 defined as "unknown". In the word embedding correspondence information 133 and the graph embedding correspondence information 134, vectors to be assigned to marked words may be defined.
[0053] After that, the learning processing unit 122 combines the vectors generated based on the word embedding correspondence information 133 and the graph embedding correspondence information 134. In the case of stacking, the learning processing unit 122 vertically combines each vector to generate a matrix. For example, in the case of "The", "The" is converted to vector v1 based on the word embedding correspondence information 133, and to vector v8 based on the graph embedding correspondence information 134. The learning processing unit 122 vertically combines vector v1 and vector v8 to generate a matrix. The learning processing unit 122 converts all words included in the word string into vectors and combines each vector. In this way, the learning processing unit 122 generates data 61 to be input to the causal relationship extraction model 136.
[0054] When using concatenation to combine vectors, the learning processing unit 122 may generate a new vector by horizontally combining the vectors generated based on the word embedding correspondence information 133 and the graph embedding correspondence information 134. When using summation to combine vectors, the learning processing unit 122 may generate a new vector by using the sum of the vectors generated based on the word embedding correspondence information 133 and the graph embedding correspondence information 134 as the vector value.
[0055] The learning processing unit 122 inputs the generated data 61 to the causal relationship extraction model 136 and executes training of the causal relationship extraction model 136. The learning processing unit 122 calculates the error between the output of the causal relationship extraction model 136 and the label attached to the training data 135 using a loss function. The learning processing unit 122 updates various parameters of the causal relationship extraction model 136 so as to reduce the calculated error. When training is completed, the learning processing unit 122 outputs the trained causal relationship extraction model 136.
[0056] In addition, when a vector based on word embedding and a vector based on graph embedding corresponding to each word are stored in a combined format in the storage unit 13 or the like, the learning processing unit 122 may not perform a process of combining the vectors. In this case, the learning processing unit 122 acquires correspondence information in a combined format from the storage unit 13 and inputs it to the causal relationship extraction model 136 based on the word string. The learning processing unit 122 may acquire correspondence information in a combined format of a vector based on word embedding and a vector based on graph embedding corresponding to each word from an external device other than the learning device 10 via the communication unit 11. The correspondence information in a combined format of a vector based on word embedding and a vector based on graph embedding corresponding to each word is an example of third correspondence information. The third correspondence information is a tensor, and may be a vector or a matrix.
[0057] A functional configuration of the inference device according to the first embodiment will be described with reference to Fig. 10. Fig. 10 is a functional block diagram illustrating an example of the functional configuration of the inference device according to the first embodiment. The inference device 20 includes a communication unit 21, a control unit 22, and a storage unit 23.
[0058] The communication unit 21 controls communication with external devices. The communication unit 21 is realized by a communication interface such as a NIC. For example, word embedding correspondence information 233, graph embedding correspondence information 234, a causal relationship extraction model 136, and prediction target data 235 may be input and output via the communication unit 21.
[0059] The storage unit 23 stores various programs executed by the control unit 22 and data used for executing the various programs. The storage unit 23 is realized by, for example, a main storage device such as a RAM or an auxiliary storage device such as a HDD. The data stored in the storage unit 23 include, for example, word embedding correspondence information 233, graph embedding correspondence information 234, a causal relationship extraction model 136, and prediction target data 235.
[0060] The word embedding correspondence information 233 is information in which words and vectors are associated with each other, and is obtained by word embedding, for example. The word embedding correspondence information 233 is used when the inference processing unit 221 converts words included in the prediction target data 235 into vectors. The word embedding correspondence information 233 indicates the same correspondence information as the word embedding correspondence information 133 used when the learning device 10 trains the causal relationship extraction model 136.
[0061] The inference device 20 may obtain the word embedding correspondence information 133 from the learning device 10 and use it as the word embedding correspondence information 233. The inference device 20 may generate the word embedding correspondence information 233 using the same method as the method used by the learning device 10 to generate the word embedding correspondence information 133 used when training the causal relationship extraction model 136.
[0062] The graph embedding correspondence information 234 is information in which words and vectors are associated with each other based on the characteristics of the causal relationships between words, and is obtained by graph embedding, for example. The graph embedding correspondence information 234 is used when the inference processing unit 221 converts words included in the prediction target data 235 into vectors. The graph embedding correspondence information 234 indicates the same correspondence information as the graph embedding correspondence information 134 used when the learning device 10 trains the causal relationship extraction model 136.
[0063] The inference device 20 may obtain graph embedding correspondence information 134 from the learning device 10 and use it as graph embedding correspondence information 234. The inference device 20 may generate the graph embedding correspondence information 234 by using the same data as the data used by the learning device 10 when generating the graph embedding correspondence information 134, and by using the same method as the learning device 10 used to generate the graph embedding correspondence information 134.
[0064] The causal relationship extraction model 136 is a trained causal relationship extraction model 136 that has been trained by the learning device 10. The causal relationship extraction model 136 is used when the inference processing unit 221 predicts a causal relationship from prediction target data 235.
[0065] The prediction target data 235 is target data when the inference processing unit 221 predicts a causal relationship using the causal relationship extraction model 136. The prediction target data 235 is, for example, text included in an academic paper or a document in a specialized field. The prediction target data 235 may include multiple texts. The text included in the prediction target data 235 may include multiple sentences.
[0066] In the text included in the prediction target data 235, markings are added to the word pairs to be predicted. The markings may be added in a manner similar to the manner in which the learning device 10 adds markings to the training data 135, as shown in Fig. 6. The symbols used for the markings may be the same as the symbols used for marking the training data 135.
[0067] The marking may be added by the inference device 20 in response to an input from a user. The process of adding the marking may be performed by an external device other than the inference device 20. The inference device 20 may acquire the prediction target data 235 with the marking from the external device via the communication unit 21. The prediction target data 235 may not be marked, for example, when the causal relationship extraction model 136 is trained using training data 135 with no marking.
[0068] The control unit 22 controls the overall processing of the inference device 20. The control unit 22 is realized by a processor such as a CPU, GPU, or DSP calling up a program stored in a storage device, and expanding and executing the program in a main storage device such as a RAM. The control unit 22 may be realized by including an integrated circuit such as an ASIC or FPGA. The control unit 22 includes an inference processing unit 221.
[0069] The inference processing unit 221 is a processing unit that inputs prediction target data 235 to a trained causal relationship extraction model 136 and executes inference to predict the causal relationship of the prediction target data 235 .
[0070] When the inference processing unit 221 acquires the prediction target data 235, it converts each word in the word string included in the prediction target data 235 into a vector based on the word embedding correspondence information 233 and the graph embedding correspondence information 234.
[0071] The inference processing unit 221 combines the vector obtained from the word embedding correspondence information 233 and the vector obtained from the graph embedding correspondence information 234. The combination method is the same as the method used when the learning device 10 trained the causal relationship extraction model 136.
[0072] The inference processing unit 221 inputs data in a format in which a vector obtained from the word embedding correspondence information 233 and a vector obtained from the graph embedding correspondence information 234 are combined into the trained causal relationship extraction model 136, and executes inference. Upon completion of inference, the inference processing unit 221 outputs an inference result for the prediction target data 235.
[0073] The inference device 20 may be realized by providing the learning device 10 with an inference processing unit 221, for example.
[0074] [Processing flow] 11 is a flowchart illustrating a flow of a process of graph embedding according to Example 1. The flow of a process in which the learning device 10 generates a knowledge graph and embeds a graph will be described with reference to FIG.
[0075] First, the graph embedding unit 121 acquires the text 131 (S100). The text 131 may be acquired from the storage unit 13, or may be acquired from an external device or the web via the communication unit 11. The text 131 may be generated from multiple documents or media, and may include multiple texts. The text included in the text 131 may include multiple sentences.
[0076] Next, the graph embedding unit 121 selects one text from the acquired text 131 (S101). The graph embedding unit 121 extracts sentences including keywords indicating causal relationships from the text selected in step S101 (S102). The graph embedding unit 121 may extract sentences including keywords indicating causal relationships by acquiring keywords indicating causal relationships from the keyword DB 132 and comparing them with each sentence included in the selected text.
[0077] Next, the graph embedding unit 121 selects one sentence from the sentences including the keyword indicating the causal relationship extracted in step S102 (S103). The graph embedding unit 121 divides the sentence selected in step S103 into a cause part and a result part based on the keyword indicating the causal relationship. In this embodiment, in each sentence, the word string before the keyword is the cause part, and the word string after the keyword is the result part. Then, the graph embedding unit 121 extracts nouns included in each of the cause part and the result part (S104). The graph embedding unit 121 may use morphological analysis to extract the nouns.
[0078] Next, the graph embedding unit 121 generates word pairs for generating KG by combining each of the nouns extracted from the cause part and the result part in step S104 (S105).
[0079] The graph embedding unit 121 determines whether the sentences extracted in step S102 include an unprocessed sentence (S106). If the graph embedding unit 121 determines that the sentences extracted in step S102 include an unprocessed sentence (S106 Yes), the process returns to step S103. If the graph embedding unit 121 determines that the sentences extracted in step S102 do not include an unprocessed sentence (S106 No), the process proceeds to step S107.
[0080] The graph embedding unit 121 determines whether or not unprocessed text is included in the text 131 (S107). If the graph embedding unit 121 determines that unprocessed text is included in the text 131 (S107 Yes), the process returns to step S101. If the graph embedding unit 121 determines that unprocessed text is not included in the text 131 (S107 No), the process proceeds to step S108.
[0081] The graph embedding unit 121 calculates a causal relationship score indicating the characteristics of the causal relationship for each KG generating word pair generated in step S105 (S108). The causal relationship score is calculated using, for example, Equation (1).
[0082] Next, the graph embedding unit 121 generates a knowledge graph representing the causal relationships between words using the KG generation word pairs generated in step S105 and the corresponding causal relationship scores calculated in step S108 (S109). Each word in the KG generation word pair corresponds to a node in the knowledge graph, and the nodes are connected by edges. The weight of the edge is the causal relationship score. As a result, the characteristics of the causal relationships between words are expressed in the form of a knowledge graph.
[0083] Next, the graph embedding unit 121 performs graph embedding using the knowledge graph representing the causal relationships generated in step S109, and acquires embedded representations of words (S110). The graph embedding unit 121 generates graph embedding correspondence information 134 using the embedded representations of words acquired by graph embedding. The graph embedding unit 121 stores the generated graph embedding correspondence information 134 in the storage unit 13.
[0084] 12 is a flowchart illustrating the flow of the learning process according to the embodiment 1. The flow of the learning process of the learning device 10 will be described with reference to FIG.
[0085] First, the learning processing unit 122 acquires the training data 135 (S200). The learning processing unit 122 may acquire the training data 135 from the storage unit 13, or may acquire the training data 135 from an external device via the communication unit 11. A label is attached to each text used in the training data 135, and markings are attached to word pairs included in the text. The labels and markings may be attached by the learning device 10 in response to an input from a user. The learning processing unit 122 may acquire the training data 135 to which the labels and markings are attached via the communication unit 11.
[0086] Next, the learning processing unit 122 converts a string of words in the text included in the training data 135 into vectors based on the word embedding correspondence information 133 and the graph embedding correspondence information 134 (S201). The learning processing unit 122 obtains a vector based on the word embedding correspondence information 133 and a vector based on the graph embedding correspondence information 134 for each word.
[0087] Next, the learning processing unit 122 combines the vector based on the word embedding correspondence information 133 and the vector based on the graph embedding correspondence information 134, which are acquired for each word in step S201 (S202). The combining method is, for example, stacking, concatenation, or summation.
[0088] Next, the learning processing unit 122 inputs data in a format in which the vector based on the word embedding correspondence information 133 and the vector based on the graph embedding correspondence information 134 acquired in step S202 are combined into the causal relationship extraction model 136, and executes training of the causal relationship extraction model 136 (S203). The learning processing unit 122 uses a loss function to calculate an error between the output of the causal relationship extraction model 136 and a label attached to each text included in the training data 135. The learning processing unit 122 updates various parameters of the causal relationship extraction model 136 so as to reduce the calculated error. The learning processing unit 122 executes training of the causal relationship extraction model 136 until a predetermined stopping condition is satisfied.
[0089] The learning processing unit 122 outputs the trained causal relationship extraction model 136 (S204). The learning processing unit 122 may store the output causal relationship extraction model 136 in the storage unit 13, or may transmit the output causal relationship extraction model 136 to an external device such as the inference device 20 via the communication unit 11.
[0090] 13 is a flowchart showing the flow of the inference process according to the embodiment 1. The flow of the inference process for extracting a causal relationship in the inference device 20 will be described with reference to FIG.
[0091] First, the inference device 20 acquires prediction target data 235 to be inferred (S300). The inference device 20 may acquire the prediction target data 235 from an external device other than the inference device 20 via the communication unit 21, or may acquire it from the storage unit 23. In the text included in the prediction target data 235, markings are added to word pairs for which it is desired to predict the presence or absence of a causal relationship. The markings may be added by the inference device 20 in response to an input from a user. The inference device 20 may acquire the prediction target data 235 with the markings added from an external device.
[0092] Next, the inference device 20 converts each word in the word string included in the prediction target data 235 into a vector based on the word embedding correspondence information 233 and the graph embedding correspondence information 234 (S301). For each word, the inference device 20 obtains a vector based on the word embedding correspondence information 233 and a vector based on the graph embedding correspondence information 234. The inference device 20 may use the word embedding correspondence information 133 and the graph embedding correspondence information 134 used by the learning device 10 when training the causal relationship extraction model 136 as the word embedding correspondence information 233 and the graph embedding correspondence information 234.
[0093] Next, the inference device 20 combines the vector based on the word embedding correspondence information 233 and the vector based on the graph embedding correspondence information 234, which were acquired for each word in step S301 (S302). The inference device 20 uses the combination method used by the learning device 10 when training the causal relationship extraction model 136. For example, if the learning device 10 trained the causal relationship extraction model 136 using vectors combined by stacking, the inference device 20 combines the vectors by stacking.
[0094] Then, the inference device 20 inputs the data obtained in step S302, which is a combination of the vector based on the word embedding correspondence information 233 and the vector based on the graph embedding correspondence information 234, to the trained causal relationship extraction model 136, and executes an inference process (S303). The trained causal relationship extraction model 136 outputs a prediction result of the presence or absence of a causal relationship between the word pairs included in the prediction target data 235 (S304).
[0095] [effect] As described above, the learning device 10 uses the correspondence information between words and vectors based on word embedding and graph embedding to acquire vectors corresponding to each word included in the training data, inputs the acquired vectors to the causal relationship extraction model, and executes training of the causal relationship extraction model. The learning device 10 can input the features of the causal relationships of words to the causal relationship extraction model by using a distributed representation of words that includes information on the causal relationships between words. This allows the learning device 10 to improve the prediction accuracy of the causal relationship extraction model.
[0096] In addition, in the field of natural language processing, when performing machine learning for a task with little training data, a pre-trained language model such as Word2Vec or BERT may be used for word embedding. Since the pre-trained language model is generated by machine learning using a large amount of data, high accuracy can be expected, and it is a technology used for tasks for which training data is difficult to obtain. However, in the pre-trained language model, features related to causal relationships are not incorporated into the vector, and it is also difficult to incorporate features related to causal relationships into the language model later. The learning device 10 can retroactively incorporate vectors based on the features of causal relationships obtained by graph embedding into the vectors generated by the pre-trained language model. This allows the learning device 10 to take advantage of the accuracy of the pre-trained language model and further improve the prediction accuracy of the causal relationship extraction model.
[0097] Furthermore, the learning device 10 can automatically generate a knowledge graph that represents the causal relationships between words through processing by the graph embedding unit 121.
[0098] [Hardware] Fig. 14 is a diagram illustrating an example of the hardware configuration of the learning device according to the first embodiment. An example of the hardware configuration of the learning device 10 will be described with reference to Fig. 14. As illustrated in Fig. 14, the learning device 10 includes, as an example, a CPU 101, a RAM 102, an input / output interface 103, a communication interface 104, and a HDD 105 as components, and these components are connected via a bus 106.
[0099] The CPU 101 is a processor that operates a process that executes each function of the control unit 12. Specifically, the CPU 101 reads a program that executes the same functions as the graph embedding unit 121 and the learning processing unit 122 from the HDD 105 or the like, loads the program into the RAM 102 or the like, and executes a process that executes the functions of the graph embedding unit 121 and the learning processing unit 122. The CPU 101 may obtain the above program and data used when executing the above program from a medium reading device, or may obtain the data via the communication interface 104. The CPU 101 may have one or more processor cores. The learning device 10 may be equipped with a processor other than a CPU, or may be equipped with multiple types of processors.
[0100] RAM 102 operates as the main memory device of learning device 10, and stores programs read from auxiliary storage devices such as HDD 105 and data used to execute the programs. Learning device 10 may include a memory other than RAM, or may include multiple memories.
[0101] Input / output interface 103 is an interface that inputs signals to learning device 10 and outputs signals from learning device 10. As an example, input / output interface 103 receives signals from input devices such as a keyboard or mouse connected to learning device 10, and transmits signals such as images to output devices such as a display connected to learning device 10. Multiple input devices and output devices may be connected to learning device 10 via input / output interface 103.
[0102] The communication interface 104 is an interface for connecting the learning device 10 to a network. As an example, the standard of the communication interface 104 may be a wired LAN communication standard such as Ethernet, a wireless LAN communication standard such as WiFi, or a wireless mobile communication standard such as local 5G.
[0103] HDD 105 operates as an auxiliary storage device for storing programs for executing the functions of the operating system (OS) of learning device 10 and control unit 12, and data used by the programs. Learning device 10 may be provided with an auxiliary storage device other than an HDD, such as a solid state drive (SSD), or may be provided with multiple auxiliary storage devices.
[0104] Fig. 15 is a diagram illustrating an example of a hardware configuration of the inference device according to the first embodiment. An example of a hardware configuration of the inference device 20 will be described with reference to Fig. 15. As illustrated in Fig. 15, the inference device 20 includes, as an example, a CPU 201, a RAM 202, an input / output interface 203, a communication interface 204, and a HDD 205 as components, and these components are connected via a bus 206.
[0105] The CPU 201 is a processor that operates a process that executes each function of the control unit 22. Specifically, the CPU 201 reads a program that executes the same function as the inference processing unit 221 from the HDD 205 or the like, expands it in the RAM 202 or the like, and executes the process that executes the function of the inference processing unit 221. The CPU 201 may obtain the above program and data used when executing the above program from a medium reading device, or may obtain them via the communication interface 204. The CPU 201 may have one or more processor cores. The inference device 20 may be provided with a processor other than a CPU, or may be provided with multiple types of processors.
[0106] RAM 202 operates as a main memory device of inference device 20, and stores programs read from auxiliary storage devices such as HDD 205 and data used to execute the programs. Inference device 20 may be provided with a memory other than RAM, or may be provided with multiple memories.
[0107] The input / output interface 203 is an interface that inputs signals to the inference device 20 and outputs signals from the inference device 20. As an example, the input / output interface 203 receives signals from input devices such as a keyboard or a mouse connected to the inference device 20, and transmits signals such as images to output devices such as a display connected to the inference device 20. A plurality of input devices and output devices may be connected to the inference device 10 via the input / output interface 203.
[0108] The communication interface 204 is an interface for connecting the inference device 20 to a network. As an example, the standard of the communication interface 204 may be a communication standard for a wired LAN such as Ethernet, a communication standard for a wireless LAN such as WiFi, or a wireless standard for mobile communication such as local 5G.
[0109] HDD 205 operates as an auxiliary storage device for storing programs for executing the functions indicated by the OS and control unit 22 of inference device 20 and data used by the programs. Inference device 20 may be provided with a storage device other than an HDD, such as an SSD, or may be provided with multiple storage devices.
[0110] Although the embodiments of the present invention have been described above, the embodiments of the present invention are not limited to those described above. The present invention may be embodied in various different forms other than the above-described embodiments.
[0111] The calculation formulas, processing procedures, processing methods, names of each part, various data and parameters shown in the embodiments and drawings are merely examples and may be changed arbitrarily unless otherwise specified.
[0112] The functional configurations and hardware configurations shown in the embodiments and drawings are merely examples, and therefore may not necessarily be configured or arranged as shown in the drawings, and may be changed as desired unless otherwise specified. For example, the components of the functional configurations and hardware configurations may be distributed or integrated in any unit, such as a function.
[0113] The machine learning program according to the embodiment is not limited to being executed by the learning device 10. For example, the machine learning program according to the embodiment may be executed across a plurality of devices.
[0114] The machine learning program according to the embodiment may be distributed via a network such as the Internet. The machine learning program according to the embodiment may be recorded on a computer-readable recording medium and sold. Examples of the computer-readable recording medium include a Compact Disc Read Only Memory (CD-ROM), a Digital Versatile Disc (DVD), a Universal Serial Bus memory (USB memory), a floppy disk, and a Magneto-Optical Disk (MO). The machine learning program according to the embodiment may be read from the computer-readable recording medium by a computer and executed by the computer. [Explanation of symbols]
[0115] 10 Learning Device 11 Communications Department 12 Control section 13 Storage section 20 Reasoning device 21 Communications Department 22 Control section 23 Memory section 30 Knowledge Graph 121 Graph Embedding 122 Learning processing unit 131 Text 132 Keyword Database 133 Word Embedding Correspondence Information 134 Graph embedding support information 135 Training Data 136 Causal Relationship Extraction Model 221 Inference Processing Unit 233 Word Embedding Correspondence Information 234 Graph embedding support information 235 Data to be predicted
Claims
1. obtain third correspondence information generated based on first correspondence information in which words and vectors are associated with each other based on word embedding, for each word included in the first text, and second correspondence information in which words and vectors are associated with each other based on a word pair relationship between a first word indicating a cause and a second word indicating a result based on the cause; Using the acquired third correspondence information, training of a neural network for performing natural language processing is performed. A machine learning program that causes a computer to execute processing.
2. The third correspondence information is correspondence information in which, for each word, information is associated with a vector associated in the first correspondence information and a vector associated in the second correspondence information.
2. The machine learning program according to claim 1 .
3. Dividing a sentence including a keyword indicating a causal relationship included in the second text into a first part and a second part based on the keyword; the first word is a word extracted from the first portion; the second words are words extracted from the second portion; The second correspondence information is correspondence information in which words and vectors are associated with each other based on the word pair and the strength of a causal relationship between the words included in the word pair.
3. The machine learning program according to claim 1 or 2.
4. The strength of the causal relationship is calculated based on the frequency with which the word pair occurs together with the keyword in the second text.
4. The machine learning program according to claim 3 .
5. generating a knowledge graph based on the word pairs and the strengths of the causal relationships corresponding to each of the word pairs; The second correspondence information is correspondence information generated by graph embedding using the knowledge graph.
5. The machine learning program according to claim 4.
6. The second correspondence information is correspondence information generated based on an adjacency matrix generated based on the word pairs and the strengths of the causal relationships corresponding to each of the word pairs.
5. The machine learning program according to claim 4.
7. obtain third correspondence information generated based on first correspondence information in which words and vectors are associated with each other based on word embedding, for each word included in the first text, and second correspondence information in which words and vectors are associated with each other based on a word pair relationship between a first word indicating a cause and a second word indicating a result based on the cause; The obtained vector is used to train a neural network for natural language processing. A machine learning method characterized in that processing is executed by a computer.
8. obtain third correspondence information generated based on first correspondence information in which words and vectors are associated with each other based on word embedding, for each word included in the first text, and second correspondence information in which words and vectors are associated with each other based on a word pair relationship between a first word indicating a cause and a second word indicating a result based on the cause; The obtained vector is used to train a neural network for natural language processing. A machine learning device comprising a control unit.
Citation Information
Patent Citations
Semantic relation extraction device and program
JP2015200961A
Causal relation recognition device and computer program therefor
JP2018060364A
Relation extraction from a corpus using an information retrieval based procedure
US20190197104A1
Creating a knowledge graph based on text-based knowledge corpora
US20210117509A1
