Decision information acquisition model training method, decision tree construction method and device

By calculating the training sample set and loss function value, a decision tree is automatically constructed, solving the problems of time-consuming expert knowledge construction and the data type limitations of traditional methods, and realizing a method for efficiently constructing decision trees from text data sources.

CN116226669BActive Publication Date: 2026-03-20WINNING HEALTH TECHNOLOGY GROUP CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-14
Publication Date
2026-03-20

AI Technical Summary

Technical Problem

In existing technologies, building decision trees based on expert knowledge is time-consuming and labor-intensive, and traditional machine learning methods cannot build decision trees from text-based data sources, resulting in limitations in data types.

Method used

By acquiring a training sample set, labeling the triples and node types corresponding to the text samples, calculating the loss function value using a preset initial model, and training the decision information acquisition model, a decision tree can be automatically constructed.

Benefits of technology

It enables efficient construction of decision trees from text data sources, improving construction efficiency and solving the data type limitations of traditional methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116226669B_ABST
    Figure CN116226669B_ABST
Patent Text Reader

Abstract

The application provides a decision information acquisition model training method, a decision tree construction method and equipment. The model training method comprises the following steps: obtaining a training sample set, the training sample set comprising a plurality of text samples, the training sample set being labeled with a first triple corresponding to a plurality of nodes on a decision tree of each text sample, a first node type of the plurality of nodes, obtaining a second triple corresponding to the plurality of nodes and a second node type of the plurality of nodes by using a preset initial model according to each text sample, calculating a first loss function value according to the first triple corresponding to the plurality of nodes, the second triple corresponding to the plurality of nodes, the first node type of the plurality of nodes and the second node type of the plurality of nodes, training the preset initial model according to the first loss function value, and obtaining a decision information acquisition model. Decision information is extracted from a text data source by using the decision information acquisition model, and a decision tree is constructed, thereby saving time and effort.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer, in particular to a decision information acquisition model training method, a decision tree construction method and equipment. BACKGROUND

[0002] A decision tree is a reliable and effective decision support tool, which is a method of classifying decision-making behaviors by representing decision-making knowledge in a tree structure. A diagnosis and treatment decision tree is a modeling of a clinical diagnosis and treatment process, because the clinical diagnosis and treatment can be regarded as a process of making different clinical decisions according to different conditions.

[0003] At present, the mainstream construction method of a decision tree is based on expert knowledge and realized manually, for example, inviting experts in the medical field to manually construct a decision tree by relying on expert experience, or using a decision tree learning algorithm in traditional machine learning to automatically mine a decision process from table data, also known as structured discrete data.

[0004] However, the method based on expert knowledge is time-consuming and labor-intensive, and the method based on decision tree learning has limitations in the types of data that can be processed, and cannot construct a decision tree based on a text-form data source. SUMMARY

[0005] Therefore, the embodiments of the present application provide a decision information acquisition model training method, a decision tree construction method and equipment to solve the problems of time-consuming and labor-intensive construction of a decision tree and inability to construct a decision tree based on a text-form data source.

[0006] In a first aspect, the embodiments of the present application provide a decision tree information acquisition method, comprising:

[0007] obtaining a training sample set, the training sample set comprising a plurality of text samples, the training sample set being labeled with a first triple corresponding to a plurality of nodes on a decision tree of each text sample, a first node type of the plurality of nodes, one triple comprising a subject, an object and a subject-object relationship;

[0008] According to the plurality of text samples, an initial preset model is used to obtain a second triple corresponding to the plurality of nodes and a second node type of the plurality of nodes;

[0009] According to the first triple corresponding to the plurality of nodes, the second triple corresponding to the plurality of nodes, the first node type of the plurality of nodes and the second node type of the plurality of nodes, a first loss function value is calculated;

[0010] According to the first loss function value, the preset initial model is trained to obtain a decision information acquisition model.

[0011] In a second aspect, the embodiments of the present application further provide a decision tree construction method, comprising:

[0012] Obtaining a to-be-processed text;

[0013] According to the decision information acquisition model of the first aspect, a plurality of triplets corresponding to a plurality of decision tree nodes and node types of the plurality of decision tree nodes are obtained from the to-be-processed text.

[0014] According to the plurality of triplets corresponding to the plurality of decision tree nodes and the node types of the plurality of decision tree nodes, a decision tree corresponding to the to-be-processed text is constructed.

[0015] In a third aspect, the embodiments of the present application further provide a training device of a decision information acquisition model, comprising:

[0016] An obtaining module is configured to obtain a training sample set, wherein the training sample set comprises a plurality of text samples, and the training sample set is labeled with a plurality of nodes corresponding to a decision tree of each text sample, first triplets corresponding to the plurality of nodes, and first node types of the plurality of nodes, wherein one triplet comprises one subject, one object, and one subject-object relationship.

[0017] The obtaining module is further configured to obtain, according to the each text sample, second triplets corresponding to the plurality of nodes and second node types of the plurality of nodes by using a preset initial model.

[0018] A calculating module is configured to calculate a first loss function value according to the first triplets corresponding to the plurality of nodes, the second triplets corresponding to the plurality of nodes, the first node types of the plurality of nodes, and the second node types of the plurality of nodes.

[0019] A training module is configured to train the preset initial model according to the first loss function value to obtain a decision information acquisition model.

[0020] In an optional embodiment, the number of the first triplets and the number of the second triplets are both at least one, and the training sample set is further labeled with first logical operators between at least one first triplet corresponding to each node, wherein the logical operators are used to indicate logical relationships between at least one triplet.

[0021] The obtaining module is further configured to obtain, according to the each text sample, second logical operators between at least one second triplet of the plurality of nodes.

[0022] The computing module is further configured to calculate a second loss function value according to the first logical operator and the second logical operator.

[0023] The training module is specifically configured to:

[0024] train the preset initial model according to the first loss function value and the second loss function value to obtain the decision information acquisition model.

[0025] In an optional implementation, the acquisition module is specifically configured to:

[0026] acquire, according to the text samples, a second triple corresponding to a root node in the plurality of nodes and a second node type of the root node by using the preset initial model;

[0027] acquire, according to the text samples and the second triple corresponding to the root node, a second triple corresponding to a first-level child node of the root node and a second node type of the first-level child node by using the preset initial model;

[0028] if the first node type of the first-level child node indicates that the first-level child node is a conditional node, acquire, according to the text samples and the second triple corresponding to the first-level child node, a second triple corresponding to a second-level child node of the first-level child node and a second node type of the second-level child node by using the preset initial model, until second triples corresponding to all-level child nodes and second node types of the all-level child nodes are obtained, the plurality of nodes including the root node and the all-level child nodes.

[0029] In an optional implementation, the acquisition module is specifically configured to:

[0030] if the first node type of the first-level child node indicates that the first-level child node is a decision node, acquire the second triples corresponding to the plurality of nodes according to the second triple corresponding to the root node and the second triple corresponding to the first-level child node, the plurality of nodes including the root node and the first-level child node;

[0031] acquire the second node types of the plurality of nodes according to the second node type of the root node and the second node type of the first-level child node.

[0032] In an optional implementation, each-level child node includes each-level first child node and each-level second child node, the each-level first child node and the each-level second child node corresponding to a decision result meeting a corresponding decision condition and a decision result not meeting the corresponding decision condition;

[0033] The acquisition module is specifically configured to:

[0034] According to the text samples, the preset initial model is adopted to obtain the second triple corresponding to the root node, the second node type of the root node, the second triple corresponding to each first child node, the second node type of each first child node, the second triple corresponding to each second child node, and the second node type of each second child node.

[0035] In an optional implementation, the obtaining module is further configured to:

[0036] According to the text samples, the neurons in the preset initial model are randomly removed, and the preset initial model after the removal is adopted to obtain the third triple corresponding to the root node, the third node type of the root node, the third triple corresponding to each first child node, the third node type of each first child node, the third triple corresponding to each second child node, and the third node type of each second child node.

[0037] The computing module is further configured to calculate a third loss function value according to the second triple corresponding to the root node, the third triple corresponding to the root node, the second node type of the root node, and the third node type of the root node.

[0038] The computing module is further configured to calculate a fourth loss function value according to the second triple corresponding to each first child node, the third triple corresponding to each first child node, the second node type of each first child node, and the third node type of each first child node.

[0039] The computing module is further configured to calculate a fifth loss function value according to the second triple corresponding to each second child node, the third triple corresponding to each second child node, the second node type of each second child node, and the third node type of each second child node.

[0040] The training module is specifically configured to:

[0041] According to the first loss function value, the third loss function value, the fourth loss function value, and the fifth loss function value, the preset initial model is trained to obtain the decision information acquisition model.

[0042] In an optional implementation, the training module is specifically configured to:

[0043] According to the second triple corresponding to each first child node, the second triple corresponding to each second child node, the second node type of each first child node, and the third node type of each second child node, a sixth loss function value is calculated.

[0044] The seventh loss function value is calculated based on the second triplet corresponding to the second child node at each level, the third triplet corresponding to the second child node at each level, the second node type of the second child node at each level, and the third node type of the second child node at each level.

[0045] The preset initial model is trained based on the first loss function value, the third loss function value, the fourth loss function value, the fifth loss function value, the sixth loss function value, and the seventh loss function value to obtain the decision information acquisition model.

[0046] Fourthly, embodiments of this application also provide a decision tree construction apparatus, comprising:

[0047] The acquisition module is used to acquire the text to be processed;

[0048] The acquisition module is further configured to acquire, according to the decision information acquisition model described in the first aspect, the triples corresponding to multiple decision tree nodes and the node types of the multiple decision tree nodes from the text to be processed;

[0049] The construction module is used to construct the decision tree corresponding to the text to be processed based on the triples corresponding to the multiple decision tree nodes and the node types of the multiple decision tree nodes.

[0050] Fifthly, embodiments of this application also provide an electronic device, including: a processor, a memory, and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the memory via the bus, and the processor executes the machine-readable instructions to perform the method described in either the first aspect or the second aspect.

[0051] In a sixth aspect, embodiments of this application also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the methods described in either the first or second aspect.

[0052] The application provides a decision information acquisition model training method, a decision tree construction method and equipment. The model training method comprises the following steps: obtaining a training sample set, the training sample set comprising a plurality of text samples, the training sample set being labeled with a first triple corresponding to a plurality of nodes on a decision tree of each text sample, a first node type of the plurality of nodes, obtaining a second triple corresponding to the plurality of nodes and a second node type of the plurality of nodes by using a preset initial model according to each text sample, calculating a first loss function value according to the first triple corresponding to the plurality of nodes, the second triple corresponding to the plurality of nodes, the first node type of the plurality of nodes and the second node type of the plurality of nodes, training the preset initial model according to the first loss function value, and obtaining a decision information acquisition model. The decision information acquisition model is used to extract decision information from a text data source, and a decision tree is constructed, thereby saving time and effort.

[0053] In order to make the above objectives, features and advantages of the present application more apparent, the following will describe a preferred embodiment in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF DRAWINGS

[0054] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments. It should be understood that the following drawings only show some embodiments of the present application, and therefore should not be considered as a limitation to the scope. For those skilled in the art, other related drawings can also be obtained without creative labor.

[0055] Figure 1 A schematic diagram of a diagnosis and treatment decision tree provided by the embodiments of the present application;

[0056] Figure 2 A schematic diagram of a decision tree construction process provided by the embodiments of the present application;

[0057] Figure 3 A flowchart of a decision information acquisition model training method provided by the embodiments of the present application Figure 1 ;

[0058] Figure 4 A schematic diagram of a plurality of decision trees provided by the embodiments of the present application;

[0059] Figure 5 A flowchart of a decision information acquisition model training method provided by the embodiments of the present application Figure 2 ;

[0060] Figure 6 A schematic diagram of a decision tree formula representation provided by the embodiments of the present application;

[0061] Figure 7A flowchart of a training method of a decision information acquisition model provided by an embodiment of the present application Figure 3 ;

[0062] Figure 8 A schematic diagram of a model inference process based on multi-round question answering provided by an embodiment of the present application

[0063] Figure 9 A flowchart of a training method of a decision information acquisition model provided by an embodiment of the present application Figure 4 ;

[0064] Figure 10 A flowchart of a training method of a decision information acquisition model provided by an embodiment of the present application Figure 5 ;

[0065] Figure 11 A schematic diagram of an overall structure of a preset initial model provided by an embodiment of the present application

[0066] Figure 12 A flowchart of a decision tree construction method provided by an embodiment of the present application

[0067] Figure 13 A schematic diagram of a structure of a training device of a decision information acquisition model provided by an embodiment of the present application

[0068] Figure 14 A schematic diagram of a structure of a decision tree construction device provided by an embodiment of the present application

[0069] Figure 15 A schematic diagram of a structure of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0070] In order to make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the following will be combined with the accompanying drawings for the embodiments of the present application to make a clear and complete description of the technical solutions of the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all the embodiments. The components of the embodiments of the present application described and shown in the accompanying drawings can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the claimed present application, but only represents selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.

[0071] The diagnosis and treatment decision tree is one of the core components of the intelligent medical system such as the auxiliary diagnosis and treatment system, and through comprehensive judgment of the patient's condition, the diagnosis and treatment decision is automatically obtained, Figure 1 A schematic diagram of a diagnosis and treatment decision tree provided by an embodiment of the present application, such asFigure 1 As shown in the following table, a simple example of taking different treatment examination decisions by judging the severity of symptoms of a community-acquired pneumonia (CAP) patient.

[0072] The example describes that when a CAP patient has mild symptoms, routine examination needs to be performed; when the patient has moderate or severe symptoms, blood sputum culture, pneumococcal antigen detection and legionella urine antigen detection need to be performed at the same time. The diagnosis and treatment decision tree models the above decision knowledge in a tree structure, which is a computer-storable and easy-to-process way. Meanwhile, the method can trace the reasoning path of the system to derive the decision conclusion, and has strong interpretability and can be manually modified and maintained later.

[0073] The following is a standard definition of the diagnosis and treatment decision tree, as well as the explanation of related terms involved: the diagnosis and treatment decision tree is composed of nodes, Figure 1 The middle box represents the node of the decision tree, and the node type is divided into conditional nodes and decision nodes. The decision tree is defined as a binary tree (each node must include a left child node and a right child node, and if a child node does not exist, it is recorded as "empty"). By judging the conditional node, it is determined whether to enter the left child node (indicating compliance) or the right child node (indicating non-compliance) of the node according to whether the condition is met. The decision node represents making a corresponding decision, and the reasoning process of the tree ends at the same time. Therefore, the decision node in the decision tree must be a leaf node (does not contain any child node). Among them, the node in the tree is composed of one or more triples, and the triple is represented as: (subject, relationship, object). This is completely consistent with the definition of triples in common relation extraction, knowledge graph and other tasks. The subject and object are both named entities (the definition can be seen in the named entity recognition task).

[0074] In the above example, each row in the box represents a triple. When the number of triples in the node is more than one, a logical operator needs to be marked, that is: Figure 1 "and" and "or" in the above table are used to prompt the logical relationship when the condition is judged or the decision is executed. In summary: the diagnosis and treatment decision tree is defined as a binary tree composed of nodes, and the node is composed of triples, logical operators and node types (i.e.: condition or decision).

[0075] The current decision tree construction method is one based on expert knowledge and manually implemented, and the other is to use the decision tree learning in the traditional machine learning to automatically mine the decision process from the structured discrete data. However, the method based on expert knowledge is time-consuming and laborious, and in addition, since the large data used to construct the decision tree is called a decision knowledge source, in addition to the structured data such as table data, there are also unstructured data such as text data, and the decision tree learning method can only mine the decision process from the table data and cannot process the text data, and this decision process is not audited and certified by the field experts, so the method based on the decision tree learning has limitations in the type of data that can be processed.

[0076] In addition, since many decision knowledge or decision specifications are stored in the form of text after being summarized and formulated by expert experience, for example, the Clinical Diagnosis and Treatment Guidelines and various medical textbooks, there is currently no method for automatically constructing decision trees in batches from the decision knowledge source in the form of text.

[0077] Based on the above problems, the present application provides a method based on deep learning for automatically constructing decision trees from decision knowledge sources in the form of text, and the application fields include but are not limited to the medical field.

[0078] Taking the medical field as an example, the diagnosis and treatment decision tree can be automatically constructed from the text knowledge source such as the Clinical Diagnosis and Treatment Guidelines and various medical textbooks audited and formulated by experts, which can greatly improve the construction efficiency, fully utilize the text knowledge source that has been deposited for a long time and needs to be mined, and the results are also helpful for constructing the clinical decision support system and other auxiliary diagnosis and treatment systems.

[0079] Figure 2 The schematic diagram of the decision tree construction process provided by the embodiment of the present application is shown in Figure 2 The input data on the left side is a text segment selected from the knowledge source, and the output data on the right side is the diagnosis and treatment decision tree automatically constructed by the scheme of the present application.

[0080] Figure 3 The flowchart of the training method of the decision information acquisition model provided by the embodiment of the present application is shown in Figure 1 The execution subject of the embodiment can be an electronic device such as a terminal, a server, etc.

[0081] As shown in Figure 3 The method can include:

[0082] S101, acquiring a training sample set.

[0083] The training sample set includes a plurality of text samples, and the training sample set is labeled with a first triple corresponding to a plurality of nodes on a decision tree of each text sample, and a first node type of the plurality of nodes.

[0084] See Figure 2 Each text sample corresponds to a decision tree, which has multiple nodes. The first triplet is the triplet used to label the nodes on the decision tree. A triplet includes: a subject, an object, and a subject-object relation. The subject-object relation is used to indicate the relationship between the subject and the object. Taking the medical field as an example, see Table 1. The subject types of the diagnosis and treatment decision tree include, but are not limited to: patient, drug. The object types include, but are not limited to: symptoms and signs, drug name, treatment method, usage method, basic information, drug name. The subject-object relation types include, but are not limited to: clinical manifestations, treatment drugs, treatment plan, usage and dosage, basic information, and prohibited drugs.

[0085]

[0086]

[0087] Table 1

[0088] In Figure 1 For example, the triple (CAP patient, treatment plan, routine examination) corresponds to the relation type numbered 3. Its subject "CAP patient" is an instance of the subject type "patient", "routine examination" is an instance of the object type "treatment method", and "treatment plan" is an instance of the relation type "treatment plan".

[0089] The first node type is the node type labeled for the node. Node types include condition nodes and decision nodes. Condition nodes are used to make decision condition judgments, and decision nodes are used to make decisions based on the conditions. Condition nodes contain child nodes, while decision nodes do not contain child nodes. See [link to documentation]. Figure 1 Taking the root node C as an example, the decision condition is "to determine whether the clinical manifestations of CAP patients are mild". If the decision condition is met (i.e., mild), routine examinations are required for CAP patients. If the decision condition is not met (i.e., not mild), it is necessary to determine whether the clinical manifestations of CAP patients are moderate or severe. It can be seen that the node corresponding to the decision condition that routine examinations are required for CAP patients if the decision condition is met (i.e., mild) is the decision node, which is used to make a decision on the decision condition of "to determine whether the clinical manifestations of CAP patients are mild".

[0090] In other words, during the data annotation process, the annotators obtain text samples, and after annotating them through a graphical interface, a decision tree is generated. For a triple, the annotators need to annotate the position of the subject and object in the original text, as well as the relationship between the two.

[0091] In addition, after labeling the plurality of triplets, the labeler can group and concatenate the plurality of triplets to form different nodes, and determine the types of the nodes, that is, generate a plurality of decision trees corresponding to the plurality of text samples, wherein the structures of the plurality of decision trees can be fixed and diversified. Figure 4 A schematic diagram of the plurality of decision trees provided by the embodiment of the present application is shown in Figure 4 As shown, C represents a condition node, and D represents a decision node. In the computer storage process, the decision tree is stored in the preorder sequence, and the preorder sequences are CDD, CDCDD, CDCDCDD, CCDDD, CCDCDDD, CDCDCDCDD, and CCDDCDD, respectively.

[0092] It can be understood that when the order of any two condition nodes in the decision tree can be interchanged, for example, in the example of Figure 2 the patient can be determined to be moderate or severe first, and then to be mild, and the order can be sorted according to the order of the subject and the object of the node appearing in the text sample during labeling. In addition, since the null node is set, each condition node must have two child nodes, so that the rule ensures that the decision tree generated by each input text is uniquely determined.

[0093] S102, according to each text sample, using a preset initial model, obtaining a second triplet corresponding to a plurality of nodes and a second node type of the plurality of nodes.

[0094] The preset initial model is used to process each text sample to obtain a second triplet corresponding to a plurality of nodes and a second node type of the plurality of nodes corresponding to the decision of each text sample, wherein the second triplet of the node is the triplet of the node obtained by the model reasoning, and the second node type is the type of the node obtained by the model reasoning.

[0095] S103, according to the first triplet corresponding to the plurality of nodes, the second triplet corresponding to the plurality of nodes, the first node type of the plurality of nodes, and the second node type of the plurality of nodes, calculating a first loss function value.

[0096] According to the first triplet corresponding to the plurality of nodes and the second triplet corresponding to the plurality of nodes, a total loss function value of the triplets can be calculated, and according to the first node type of the plurality of nodes and the second node type of the plurality of nodes, a total loss function value of the node types can be calculated. Then, the first loss function value is calculated by comprehensively considering the total loss function value of the triplets and the total loss function value of the node types, wherein the first loss function value can be a weighted value or a sum of the two loss function values, and the present embodiment does not particularly limit this.

[0097] It is worth noting that the first triplet loss function value of each node can be calculated according to the first triplet corresponding to each node and the second triplet corresponding to each node, and then the total triplet loss function value is obtained according to the triplet loss function values of the plurality of nodes. Similarly, the node type loss function value of each node is calculated according to the first node type of each node and the second node type of each node, respectively, and then the total node type loss function value is obtained according to the node type loss function values of the plurality of nodes. The specific calculation of the total triplet loss function value and the total node type loss value can refer to the calculation method of the first loss function value, and the present embodiment does not make special limitations thereto.

[0098] S104, training the preset initial model according to the first loss function value to obtain a decision information acquisition model.

[0099] The preset initial model is trained according to the first loss function value until the preset training stopping condition is reached, and the model obtained when the preset training stopping condition is reached is taken as the decision information acquisition model. For example, the preset training stopping condition can include that the first loss function value does not exceed a preset threshold.

[0100] It is worth noting that the supervised learning method in deep learning is followed, and a certain scale of data set is constructed by artificial labeling. The data set can also be divided into a training set, a validation set and a test set according to a certain proportion, wherein the training set is the above-mentioned training sample set, the training set is used to train the artificial intelligence model to enable the machine to automatically learn the artificially labeled data, the validation set is used to verify the performance of the model during the training process to prevent the artificial intelligence model from overfitting, and the test set is used to test the performance of the model after the model training is completed. That is, after the decision information acquisition model is trained, the model performance can also be verified by using the validation set, and the model performance can also be tested by using the test set to optimize the model.

[0101] In the model training method of the present embodiment, by obtaining a training sample set, the training sample set includes a plurality of text samples, the training sample set is labeled with the first triplet corresponding to each text sample on the plurality of nodes of the decision tree, the first node type of the plurality of nodes, according to each text sample, using a preset initial model, obtaining the second triplet corresponding to the plurality of nodes and the second node type of the plurality of nodes, calculating the first loss function value according to the first triplet corresponding to the plurality of nodes, the second triplet corresponding to the plurality of nodes, the first node type of the plurality of nodes and the second node type of the plurality of nodes, training the preset initial model according to the first loss function value to obtain a decision information acquisition model. The decision information acquisition model extracts decision information from the text data source to construct a decision tree, which is more efficient, time-saving and labor-saving than traditional methods, and solves the difficulty that traditional technology cannot extract decision information from text.

[0102] Figure 5The flowchart of the training method of the decision information acquisition model provided by the embodiments of the present application is shown Figure 2 As shown in Figure 5 Step S104, the preset initial model is trained according to the first loss function value, and the decision information acquisition model is obtained. Before that, the method can further include:

[0103] S201, according to each text sample, obtaining a second logical operator between at least one second triple of multiple nodes.

[0104] The number of first triples and the number of second triples are both at least one, and the training sample set is also labeled with a first logical operator between at least one first triple corresponding to each node. The logical operator is used to indicate the logical relationship between at least one triple.

[0105] Among them, the first logical operator is the logical operator between the at least one first triple corresponding to each node, the logical relationship is divided into "and" (AND), "or" (OR), "empty" (NULL) three kinds, L is a logical operator, its value range L∈{AND,OR,NULL}, when and only when the node is empty or there is only one triple inside (i.e.: n≤1) L is empty (NULL), otherwise the value is "and" (AND) or "or" (OR).

[0106] The second logical operator is the logical operator between the at least one first triple corresponding to each node obtained by model reasoning, and the preset initial model is used to process each text sample to obtain a second logical operator between at least one second triple of multiple nodes.

[0107] It is worth noting that, given a text sample s={w1,…, L}, s represents a text containing L characters, w i represents the i-th text character, and the text must contain decision information. The decision tree is represented and stored by the pre-order sequence of the tree, denoted as: DT=[N1,…, H ], DT is a tree containing H nodes, the i-th node N i is represented as {C / D, L(tri1,ri2,…,tri n ), where C / D represents N i is a condition node (Condition Node) or a decision node (Decision Node); tri j represents the j-th triple inside the node, which contains n triples in total.

[0108] S202, according to the first logical operator and the second logical operator, calculating a second loss function value.

[0109] According to the first logical operator corresponding to each node and the second logical operator corresponding to each node, the operator loss function value of each node can be calculated, and then the second loss function value can be obtained according to the operator loss function values of the plurality of nodes. The second loss function value can be a weighted value or a sum value of the operator loss function values of the plurality of nodes, and the embodiment is not particularly limited in this regard.

[0110] Correspondingly, in step S104, the preset initial model is trained according to the first loss function value to obtain the decision information acquisition model, which can include:

[0111] S203, training the preset initial model according to the first loss function value and the second loss function value to obtain the decision information acquisition model.

[0112] The preset initial model is trained according to the first loss function value and the second loss function value until the preset training stopping condition is reached, and the model obtained when the preset training stopping condition is reached is taken as the decision information acquisition model. The preset training stopping condition may, for example, include that the first loss function value and the second loss function value are both less than a preset threshold.

[0113] Of course, the total loss function value can also be calculated according to the first loss function value and the second loss function value, and the preset initial model can be trained according to the total loss function value to obtain the decision information acquisition model.

[0114] In the training method of the decision information acquisition model of the embodiment, the second loss function value is calculated according to the first logical operator and the second logical operator, and the model is trained according to the first loss function value and the second loss function value, which improves the model training accuracy.

[0115] Figure 6 The schematic diagram of the decision tree formula representation provided by the embodiment of the present application is shown in Figure 6 As shown, the decision tree is represented by a formula for description, Text represents a text sample, the nodes of the tree are represented by capital letters such as A, B, etc., and x i represents the i-th triple in the node X.

[0116] Inspired by the inference process of the tree, it is assumed that each node is only related to its parent node and independent of other nodes during the training process of the model. Based on this assumption, the decision tree extraction problem is modeled as a conditional relation extraction problem, and the condition is the parent node of the extraction object. If the extraction object is the root node A, since the root node A has no parent node, the condition is an empty set.

[0117] The training process of the scheme is: conditionally extracting triples in each node in the tree, denoted as P(X(x1, x2, …) | Text, Condition, Operator), wherein X e {A, B, …} is a node to be extracted; Condition refers to the condition required for extracting the node, that is: the parent node, and Operator refers to an operator corresponding to the node to be extracted, Operator e {Left, Right}. In order to distinguish whether the node to be extracted is a left child node or a right child node under the same condition, the B node and the D node are left nodes, and the C node and the E node are right nodes.

[0118] Based on this idea, assuming that the decision tree has n conditional nodes, 2x(n+1) training data will be generated, as shown in Figure 6 A and C are conditional nodes, and 6 training data are generated. In 2x(n+1), 1 represents the generation of a root node, and in addition, in order to enable the input data to be aligned when the model is trained in batches, the root node can be regarded as a special left child node, and the right child node can be regarded as empty.

[0119] Based on Figure 6 , Figure 7 the training method of the decision information acquisition model provided by the embodiments of the present application provides a flowchart of Figure 3 , as shown in Figure 7 step S102, according to each text sample, using a preset initial model, obtaining a second triple corresponding to a plurality of nodes and a second node type of a plurality of nodes, which can include:

[0120] S301, according to each text sample, using a preset initial model, obtaining a second triple corresponding to a root node of a plurality of nodes and a second node type of the root node.

[0121] Among the plurality of nodes of the decision tree, the root node is a node without a parent node. The preset initial model is used to process each text sample to obtain a second triple corresponding to a root node of a decision tree of each text sample and a second node type of the root node.

[0122] S302, according to each text sample and the second triple corresponding to the root node, using a preset initial model, obtaining a second triple corresponding to a first level child node of the root node and a second node type of the first level child node.

[0123] The preset initial model is used to process each text sample and the second triple corresponding to the root node to obtain a second triple corresponding to a first level child node of the root node and a second node type of the first level child node. The first level child node is a child node of the root node, as shown in Figure 6 , the first level child nodes of the root node A include: node B and node C.

[0124] S303, if the first node type of the first level child node indicates that the first level child node is a conditional node existing child node, then according to each text sample and the second triple corresponding to the first level child node, the second triple corresponding to the second level child node of the first level child node and the second node type of the second level child node are obtained by using the preset initial model, until the second triple corresponding to all level child nodes and the second node type of all level child nodes are obtained.

[0125] If the first node type of the first level child node indicates that the first level child node is a conditional node, i.e. the first level child node actually has child nodes, then the second triple corresponding to the second level child node of the first level child node and the second node type of the second level child node are obtained by using the preset initial model to process each text sample and the second triple corresponding to the first level child node, the second level child node being a child node of the first level child node. Then, the second triple corresponding to the third level child node of the second level child node and the second node type of the third child node are obtained by using the preset initial model to process each text sample and the second triple corresponding to the second level child node, the third level child node being a child node of the second level child node. The process is repeated until the second triple corresponding to all level child nodes and the second node type of all level child nodes are obtained, wherein the plurality of nodes include: the root node and all level child nodes.

[0126] Referring to Figure 6 , the first level child node includes: node C, wherein node C is a conditional node, then the second triple corresponding to the second level child node (i.e. node D and node E) and the second node type of the second level child node are obtained by using the preset initial model to process each text sample and the second triple corresponding to the first level child node.

[0127] In an optional embodiment, step S102, according to each text sample, the second triple corresponding to the plurality of nodes and the second node type of the plurality of nodes are obtained by using the preset initial model, which can also include:

[0128] S304, if the first node type of the first level child node indicates that the first level child node is a decision node, then the second triple corresponding to the plurality of nodes is obtained according to the second triple corresponding to the root node and the second triple corresponding to the first level child node, wherein the plurality of nodes include: the root node and the first level child node;

[0129] S305, the second node type of the plurality of nodes is obtained according to the second node type of the root node and the second node type of the first level child node.

[0130] If the first node type of the first-level child node does not exist a child node, i.e., the first-level child node is a decision node, it is determined that the second triple corresponding to the plurality of nodes comprises a second triple corresponding to the root node and a second triple corresponding to the first-level child node, the second node type of the plurality of nodes comprises a second node type of the root node and a second node type of the first-level child node, and the plurality of nodes comprises the root node and the first-level child node.

[0131] With reference to Figure 6 , the first-level child node comprises the node B, wherein the node B is a decision node, the inference terminates, and the plurality of nodes comprises the root node A and the node B.

[0132] In the training method of the decision information acquisition model, the decision tree extraction problem is modeled as a conditional relation extraction problem by a conditional independence assumption for model training, and an iterative multi-round question and answer inference method is used for model reasoning, so that the process naturally forms a decision tree. Meanwhile, a prompt learning method is used to describe the condition node in a natural language manner, conditional relation extraction is realized, and the model training accuracy is improved.

[0133] In an optional embodiment, each level of child nodes comprises each level of first child nodes and each level of second child nodes, and each level of first child nodes and each level of second child nodes correspond to a decision result meeting a corresponding decision condition and a decision result not meeting the corresponding decision condition.

[0134] Each level of child nodes comprises each level of first child nodes and each level of second child nodes, for example, the first-level child nodes comprise the first-level first child nodes and the first-level second child nodes.

[0135] Each level of first child nodes and each level of second child nodes correspond to a decision result meeting a corresponding decision condition and a decision result not meeting the corresponding decision condition, wherein the corresponding decision condition is a decision condition corresponding to a parent node of each level of child nodes, and the parent node is a condition node, with reference to Figure 1 Taking the root node C as an example, the decision condition is to determine whether the clinical manifestations of the CAP patient are mild, if the decision condition is met (i.e., mild), the CAP patient needs to be subjected to routine examination, if the decision condition is not met (i.e., not mild), it is necessary to determine whether the clinical manifestations of the CAP patient are moderate or severe. It can be seen that under the condition of meeting the decision condition and not meeting the decision condition, two first-level child nodes are correspondingly obtained, which are the first-level first child node and the first-level second child node, wherein the first child node is a left child node, and the second child node is a right child node.

[0136] It is worth noting that the number of first-level first child nodes includes but is not limited to one, the number of first-level second child nodes includes but is not limited to one, for example, the first-level child nodes include: a first-level first child node and a first-level second child node, the child nodes of the first-level first child node include: a second-level first child node and a second-level second child node, and the child nodes of the second-level second child node include: a second-level first child node and a second-level second child node, so it can be seen that in this example, the number of first-level first child nodes and first-level second child nodes is 1, and the number of second-level first child nodes and second-level second child nodes is 2.

[0137] In step S102, according to each text sample, a preset initial model is used to obtain a second triple corresponding to each node and a second node type of each node, which can include:

[0138] According to each text sample, a preset initial model is used to obtain a second triple corresponding to the root node, a second node type of the root node, a second triple corresponding to each first child node, a second node type of each first child node, a second triple corresponding to each second child node, and a second node type of each second child node.

[0139] According to each text sample, a preset initial model is used to obtain a second triple corresponding to the root node, a second node type of the root node, a second triple corresponding to each first child node, a second node type of each first child node, a second triple corresponding to each second child node, and a second node type of each second child node.

[0140] In some embodiments, a preset initial model is used to process each text sample to obtain a second triple corresponding to the root node and a second node type of the root node, and then a preset initial model is used to process each text sample and the second triple corresponding to the root node to obtain a second triple corresponding to the first-level first child node of the root node and a second triple corresponding to the first-level second child node of the root node. For example, taking the first-level first child node as a condition node, a preset initial model is used to process each text sample and the second triple corresponding to the first-level first child node to obtain a second triple corresponding to the second-level first child node of the first-level first child node and a second triple corresponding to the second-level second child node of the first-level first child node. For the first-level first child node as a decision node and the first-level second child node as a condition node or a decision node, please refer to Figure 7 The specific description of the embodiments is not repeated here.

[0141] Figure 8 The schematic diagram of the model inference process based on multi-round question answering provided by the embodiments of the present application is as follows: Figure 8As shown, given a decision tree, the input is a text sample corresponding to the decision tree, the preset initial model outputs an initialized root node A, and then the root node A and the text sample are input into the preset initial model to output nodes B and C, the B node is a decision node, and the inference is terminated after the B node, and the C node is a condition node, the C node and the text sample are input to output D node and E node, and the D node and the E node are decision nodes, and the inference is terminated after the D node and the E node.

[0142] Figure 9 The flowchart of the training method of the decision information acquisition model provided by the embodiments of the present application Figure 4 As shown in the figure, Figure 9 In an optional embodiment, step S103, according to the first loss function value, the preset initial model is trained to obtain the decision information acquisition model, and before that, the method can further include:

[0143] S401, according to each text sample, randomly remove neurons in the preset initial model, and use the removed preset initial model to obtain the third triple corresponding to the root node, the third node type of the root node, the third triple corresponding to each first child node, the third node type of each first child node, the third triple corresponding to each second child node, and the third node type of each second child node.

[0144] Among them, the preset initial model includes a neuron random removal layer, the same text sample is input into the preset initial model, and the neuron random removal layer in the model will randomly remove neurons, and the neuron random removal layer can be a Dropout layer.

[0145] Each text sample is input into the preset initial model again, the neurons in the preset initial model are randomly removed by the neuron random removal layer, and the removed preset initial model is used to process each text sample to obtain the third triple corresponding to the root node, the third node type of the root node, the third triple corresponding to each first child node, the third node type of each first child node, the third triple corresponding to each second child node, and the third node type of each second child node.

[0146] Among them, the third triple corresponding to the root node is the triple corresponding to the root node obtained by the inference of the removed preset initial model, and the third node type of the root node is the node type of the root node obtained by the inference of the removed preset initial model, and similarly, the explanation of the third triple corresponding to each first child node, the third node type of each first child node, the third triple corresponding to each second child node, and the third node type of each second child node is similar.

[0147] In some embodiments, the preset initial model after removal is used to process each text sample to obtain the third triple corresponding to the root node and the third node type of the root node, and then the preset initial model after removal is used to process each text sample and the third triple corresponding to the root node to obtain the third triple corresponding to the first first child node of the first level of the root node and the third triple corresponding to the second first child node of the first level. Taking the first first child node as a condition node as an example, the preset initial model after removal is used to process each text sample and the third triple corresponding to the first first child node to obtain the third triple corresponding to the second first child node of the second level of the first first child node and the third triple corresponding to the second second child node of the second level of the first first child node. For the case that the first first child node is a decision node and the first second child node is a condition node or a decision node, please refer to Figure 7 The specific description of the embodiments is not repeated here.

[0148] S402, according to the second triple corresponding to the root node, the third triple corresponding to the root node, the second node type of the root node and the third node type of the root node, calculating the third loss function value.

[0149] According to the second triple corresponding to the root node and the third triple corresponding to the root node, the root node triple loss function value is calculated, according to the second node type of the root node and the third node type of the root node, the root node type loss function value is calculated, and then according to the root node triple loss function value and the root node type loss function value, the third loss function value is calculated.

[0150] It can be understood that the second triple corresponding to the root node and the second node type of the root node are used as anchor points, the third triple corresponding to the root node is used as a positive sample, and the third node type of the root node is used as a positive sample. When the model is trained, the distance between the anchor point and the positive sample needs to be shortened. The loss function value can be the difference between the two.

[0151] S403, according to the second triple corresponding to each first child node, the third triple corresponding to each first child node, the second node type of each first child node and the third node type of each first child node, calculating the fourth loss function value.

[0152] According to the second triple corresponding to each first child node and the third triple corresponding to each first child node, the first triple loss function value of each level is calculated, according to the second node type of each first child node and the third node type of each first child node, the first node type loss function value of each level is calculated, and then according to the first triple loss function value of multiple levels and the first node type loss function value of multiple levels, the fourth loss function is calculated.

[0153] For example, according to the second triple corresponding to the first child node of the first level and the third triple corresponding to the first child node of the first level, the first first triple loss function value is calculated, and according to the second node type of the first child node of the first level and the third node type of the first child node of the first level, the first first node type loss function value is calculated, and the other levels are similar, wherein the multi-level first triple loss function value can be a weighted value or a sum of the multi-level first triple loss function values, the multi-level first node type loss function value can be a weighted value or a sum of the multi-level first node type loss function values, and similarly, the fourth loss function can be a weighted value or a sum of the multi-level first triple loss function values and the multi-level first node type loss function values. The specific calculation method of the loss function is not particularly limited in this embodiment.

[0154] It can be understood that the second triple corresponding to the first child node of each level and the second node type of the first child node of each level are anchor points, the third triple corresponding to the first child node of each level is a positive sample, and the third node type of the first child node of each level is a positive sample. During model training, the distance between the anchor points and the positive samples needs to be narrowed. The loss function value can be the difference between the two.

[0155] S404, according to the second triple corresponding to the second child node of each level, the third triple corresponding to the second child node of each level, the second node type of the second child node of each level and the third node type of the second child node of each level, calculate the fifth loss function value.

[0156] According to the second triple corresponding to the second child node of each level and the third triple corresponding to the second child node of each level, the second triple loss function value of each level is calculated, and according to the second node type of the second child node of each level and the third node type of the second child node of each level, the second node type loss function value of each level is calculated, and then according to the multi-level second triple loss function value and the multi-level second node type loss function value, the fifth loss function value is calculated.

[0157] The calculation method of the second triple loss function value of each level and the second node type loss function value of each level can be referred to the calculation method of the first triple loss function value of each level and the first node type loss function value of each level, and the calculation method of the fifth loss function value can be referred to the calculation method of the fourth loss function value, which will not be repeated here.

[0158] It can be understood that the second triple corresponding to the second child node of each level and the second node type of the second child node of each level are anchor points, the third triple corresponding to the second child node of each level is a positive sample, and the third node type of the second child node of each level is a positive sample. During model training, the distance between the anchor points and the positive samples needs to be narrowed. The loss function value can be the difference between the two.

[0159] Accordingly, in step S103, the preset initial model is trained according to the first loss function value to obtain a decision information acquisition model, including:

[0160] In step S405, the preset initial model is trained according to the first loss function value, the third loss function value, the fourth loss function value, and the fifth loss function value to obtain the decision information acquisition model.

[0161] The preset initial model is trained according to the first loss function value, the third loss function value, the fourth loss function value, and the fifth loss function value until a preset training stop condition is reached, and the model obtained when the preset training stop condition is reached is taken as the decision information acquisition model.

[0162] It is worth noting that the preset initial model can also be used to obtain the second logical operator between the second triplets of the root node, the second logical operator between the second triplets of each first child node, the second logical operator between the second triplets of each second child node, and the preset initial model after removal is used to obtain the third logical operator between the third triplets of the root node, the third logical operator between the third triplets of each first child node, and the third logical operator between the third triplets of each second child node. Then, according to the second logical operator corresponding to the root node and the third logical operator corresponding to the root node, the second logical operator corresponding to each first child node and the third logical operator corresponding to each first child node, the second logical operator corresponding to each second child node and the third logical operator corresponding to each second child node, the logical operator loss function value is calculated, and the preset initial model is trained according to the first loss function value, the third loss function value, the fourth loss function value, the fifth loss function value, and the logical operator loss function value to obtain the decision information acquisition model.

[0163] In the training method of the decision information acquisition model of the present embodiment, by randomly removing neurons in the preset initial model, the model is better learned by the dual contrast learning method to learn each first child node under the same input and each second child node under the same input, and the model training accuracy is improved.

[0164] Figure 10 Flowchart of the training method of the decision information acquisition model provided by the present embodiment Figure 5 As shown in Figure 10 In step S405, the preset initial model is trained according to the first loss function value, the third loss function value, the fourth loss function value, and the fifth loss function value to obtain the decision information acquisition model, which can include:

[0165] S501, calculate a sixth loss function value according to the second triple corresponding to each level of first child node, the second triple corresponding to each level of second child node, the second node type of each level of first child node, and the third node type of each level of second child node.

[0166] According to the second triple corresponding to each level of first child node and the second triple corresponding to each level of second child node, calculate each level of comparison triple loss function value, according to the second node type of each level of first child node and the second triple corresponding to each level of second child node, calculate each level of comparison node type loss function value, according to each level of comparison triple loss function value and each level of comparison node type loss function value, calculate the sixth loss function value.

[0167] For example, according to the second triple corresponding to the first level of first child node and the second triple corresponding to the first second child node, calculate the first level of comparison triple loss function value, according to the second node type of the first level of first child node and the second node type of the first level of second child node, calculate the first level of comparison node type loss function value, and so on, until according to the multi-level comparison triple loss function value and the multi-level comparison node type loss function value, calculate the sixth loss function value.

[0168] It can be understood that the second triple corresponding to each level of first child node and the second node type of each level of first child node as anchor point, the second triple corresponding to each level of second child node as negative sample, the second node type of each level of second child node as negative sample, in model training, need to push away the distance between anchor point and negative sample, that is, the farther the better.

[0169] S502, calculate a seventh loss function value according to the second triple corresponding to each level of second child node, the third triple corresponding to each level of second child node, the second node type of each level of second child node, and the third node type of each level of second child node.

[0170] According to the second triple corresponding to each level of second child node and the third triple corresponding to each level of second child node, calculate each level of second triple loss function value, according to the second node type of each level of second child node and the third node type of each level of second child node, calculate each level of second node type loss function value, according to each level of second triple loss function value and each level of second node type loss function value, calculate the seventh loss function value.

[0171] It can be understood that the second triple corresponding to each level of second child node and the second node type of each level of second child node as anchor point, the second triple corresponding to each level of second child node as positive sample, the second node type of each level of second child node as positive sample, in model training, need to pull the distance between anchor point and positive sample, that is, the farther the better.

[0172] It is worth noting that the calculation method of the sixth loss function value and the seventh loss function value can refer to the calculation method of the fourth loss function value and the fifth loss function value described above, and will not be repeated here.

[0173] S503, according to the first loss function value, the third loss function value, the fourth loss function value, the fifth loss function value, the sixth loss function value and the seventh loss function value, the preset initial model is trained to obtain the decision information acquisition model.

[0174] Among them, according to the third loss function, the fourth loss function value, the fifth loss function value and the sixth loss function value, the contrast loss function value is calculated, and according to the first loss function value and the contrast loss function value, the total loss function value is calculated, and the preset initial model is trained according to the total loss function value, to obtain the decision information acquisition model.

[0175] According to the first loss function value, the third loss function value, the fourth loss function value, the fifth loss function value, the preset initial model is trained until the preset training stop condition is reached, and the model obtained when the preset training stop condition is reached is used as the decision information acquisition model.

[0176] It is worth noting that the root node can be a special left child node, and the corresponding right child node is empty, and the model training can also be combined with the right child node to obtain the final decision information acquisition model.

[0177] In the training method of the decision information acquisition model of the embodiment, the neurons in the preset initial model are randomly removed to make the model learn the difference between the first level nodes and the second level nodes better through the dual contrast learning method, and the model training accuracy is improved.

[0178] As an example, Figure 11 The overall structure diagram of the preset initial model provided by the embodiment of the application is shown in Figure 11 As shown, the model mainly includes an encoder and a global pointer network, the encoder is used for encoding the text input sequence, and the global pointer network is used for decoding the encoding and scoring the entities (including the subject and the object) and the relationship in the text sample.

[0179] The encoder of the model is divided into two parts: a pre-trained language model BERT and a filtering partition network. BERT is a contextual semantic encoder that generates contextual representations of text through deep self-attention modules. The filtering partition network aims to model the bidirectional balanced interaction between entity recognition and relationship extraction tasks when the model extracts triples. The model is based on the pre-trained language model BERT and uses the "pre-training-fine-tuning" paradigm to fine-tune the existing pre-trained model BERT. In each time step, the network follows two sub-steps: partitioning and filtering, thereby generating entity (including subject and object) and relationship-specific text representations.

[0180] The model uses a global pointer network GPLinker to decode the relationship in the text and the entities contained in the relationship. The smallest module inside GPLinker is called Global Pointer. For specific details, please refer to the existing related description.

[0181] During the training process, the present scheme adopts the methods of prompt learning and contrastive learning to solve the conditional relationship extraction problem through the method of prompt learning. Here, the prompt refers to the use of parent nodes and text samples to extract sub-node decision information.

[0182] The input sequence is: [CLS] [SEP] [SEP] [SEP], where [CLS] represents the start of the input, and [SEP] is a separator, both of which are special symbols set by the BERT model during the pre-training stage. The operator operator∈{[Left],[Righ] is a special symbol added to the BERT model's word table to distinguish whether the current extraction object is a left child node or a right child node.

[0183] Through the method of prompt learning, the natural language description of the conditional node (parent node) is used as a prompt (prompt) and placed in the input sequence. For any two triples in the conditional node and If and r x = y exist, then the triples are merged to reduce redundancy, where is the subject, is the object, r x , r y is the subject-object relationship. For example, the triple (CAP patient, clinical manifestations, moderate or severe) has a prompt information p1…p k and a text sample Text w1…w L .

[0184] Secondly, a template with slots for natural language forms is designed for each type of relationship, and the subject and object in the triple are filled into the slots to form a complete sentence. For example, the above triple will generate: "The clinical manifestations of CAP patients are moderate or severe", and the final prompt needs to splice multiple sentences generated by multiple triples in the node (if there are multiple) together, and the connection words for splicing are determined by the logical operator L of the node.

[0185] In addition, a dual contrast learning method is proposed during training, which aims to improve the model's ability to distinguish between left and right child nodes under similar input, because the inputs of left and right child nodes are very similar, have the same conditions, and only differ in the operator.

[0186] Since the left child node and the right child node represent the satisfaction and non-satisfaction of the decision condition respectively, the two nodes can be regarded as negative samples of each other, and the same method applies to the other node when one node is used as an anchor to implement contrast learning, i.e., dual contrast learning.

[0187] Taking the extraction of decision information of the left child node X as an example, the same input sequence is fed into the model twice. Since the encoder Dropout layer will randomly discard neurons, the encoder output P(X|Text, Condition, [Left]) is regarded as the left anchor, and thus different sub-models generated by two inputs will generate two different distributions, one of which is regarded as the positive sample of the left anchor, i.e., P(X|Text, Condition + , [Left]), and the negative sample is P(Y|Text, Condition, [Right]).

[0188] Similarly, if the decision information of the right child node Y is extracted, P(X|Text, Condition, [Right]) is regarded as the right anchor, and the positive sample of the right anchor is P(X|Text, Condition + , [Right]), and the negative sample is P(Y|Text, Condition, [Left]).

[0189] The four outputs of the encoder of this dual contrast learning method are input into the global pointer network, and contrast learning is performed through scoring in the global pointer network, which pushes away the distance between the left anchor and the negative sample of the left anchor, and pulls closer the distance between the left anchor and the positive sample of the left anchor, and pulls closer the distance between the right anchor and the positive sample of the right anchor, and pushes away the distance between the right anchor and the negative sample of the right anchor. The final loss function during model training is the sum of the multi-label loss function set in GPLinker and the contrast loss function, and the four outputs share the same global pointer network.

[0190] P(X|Text, Condition, [Left]) is denoted as P L , P(X|Text, Condition + , [Left]) is denoted as P(X|Text, Condition, [Righ]) is denoted as P R , P(X|Text, Condition + , [Right]) is denoted as P(X|Text, Condition + , [Left]), P(X|Text, Condition + , [Right]) are respectively outputs of the left child node and the right child node of the post-encoder of the random dropout neuron.

[0191] Figure 12 A flowchart of a decision tree construction method provided by an embodiment of the present application is shown in the figure. The execution subject of the embodiment can be an electronic device, such as a terminal, a server, or the like.

[0192] As shown in the figure, the method can include: Figure 12

[0193] S601, obtaining a to-be-processed text.

[0194] S602, obtaining, according to a decision information acquisition model, a plurality of triplets corresponding to a plurality of decision tree nodes and node types of the plurality of decision tree nodes from the to-be-processed text.

[0195] S603, constructing a decision tree corresponding to the to-be-processed text according to the plurality of triplets corresponding to the plurality of decision tree nodes and the node types of the plurality of decision tree nodes.

[0196] The to-be-processed text can be a text in any field, for example, a diagnosis and treatment text in the medical field.

[0197] The trained decision information acquisition model is used to process the to-be-processed text, and the plurality of triplets corresponding to the plurality of decision tree nodes and the node types of the plurality of decision tree nodes are obtained from the to-be-processed text. The node types include condition nodes and decision nodes.

[0198] According to the plurality of triplets corresponding to the plurality of decision tree nodes and the node types of the plurality of decision tree nodes, the decision tree corresponding to the to-be-processed text can be constructed. The constructed decision tree is similar to the decision tree shown in the figure. Figure 2

[0199] ​​Wherein, the decision information acquisition model obtained by training can be used to process the to-be-processed text, obtain the triple corresponding to the root node of the decision tree and the node type of the root node of the decision tree from the to-be-processed text, and then use the model to process the triple corresponding to the root node of the decision tree and the to-be-processed text to obtain the triple corresponding to the first-level child node of the root node and the node type of the first-level child node. If the node type indicates that the first-level child node is a condition node, the process is repeated until the last obtained child node is a decision node, and the model reasoning terminates. The first-level child node is a child node of the root node of the decision tree.

[0200] In addition, the model can also infer the number of triples corresponding to each decision tree node and the logical operators between the triples. When constructing the decision tree, the logical operators, the triples corresponding to the decision tree nodes and the node types of the decision tree nodes are combined to construct the decision tree. For the process of model reasoning, please refer to the related description in the above embodiments.

[0201] In the decision tree construction method of the embodiment, the corresponding model structure is proposed based on the task specification, the hint learning method is used, the condition node is described in a natural language manner, the conditional relation extraction is implemented, in the medical field, the clinical diagnosis and treatment decision tree can be constructed based on the medical literature to assist in constructing the clinical auxiliary diagnosis and treatment system. Compared with the traditional method, the method is more efficient, time-saving and labor-saving, and solves the difficulty that the traditional technology cannot extract decision information from the text.

[0202] Based on the same inventive concept, the training device of the decision information acquisition model corresponding to the training method of the decision information acquisition model is also provided in the embodiments of the present application. Since the principle of the device in the embodiments of the present application solves the problem similar to the training method of the decision information acquisition model described above, the implementation of the device can be referred to the implementation of the method, and the repeated parts will not be described again.

[0203] Figure 13 The structure diagram of the training device of the decision information acquisition model provided in the embodiments of the present application is shown in the figure. The device can be integrated in an electronic device. As shown in the figure, the device can include: Figure 13

[0204] The obtaining module 701 is configured to obtain a training sample set. The training sample set includes a plurality of text samples. The training sample set is labeled with a first triple corresponding to a plurality of nodes on a decision tree of each text sample, a first node type of the plurality of nodes, and a second triple corresponding to the plurality of nodes and a second node type of the plurality of nodes.

[0205] The obtaining module 701 is further configured to obtain the second triple corresponding to the plurality of nodes and the second node type of the plurality of nodes according to each text sample and using a preset initial model.

[0206] ​The computing module 702 is configured to calculate a first loss function value according to the first triple corresponding to the plurality of nodes, the second triple corresponding to the plurality of nodes, the first node type of the plurality of nodes, and the second node type of the plurality of nodes.

[0207] The training module 703 is configured to train a preset initial model according to the first loss function value to obtain the decision information acquisition model.

[0208] In an optional implementation, the number of the first triples and the number of the second triples are both at least one, and the training sample set is further labeled with: a first logical operator between the at least one first triple corresponding to each node, the logical operator being used to indicate a logical relationship between the at least one triple;

[0209] The obtaining module 701 is further configured to obtain a second logical operator between the at least one second triple of the plurality of nodes according to each text sample;

[0210] The computing module 702 is further configured to calculate a second loss function value according to the first logical operator and the second logical operator;

[0211] The training module 703 is specifically configured to:

[0212] train the preset initial model according to the first loss function value and the second loss function value to obtain the decision information acquisition model.

[0213] In an optional implementation, the obtaining module 701 is specifically configured to:

[0214] obtain, according to each text sample, the second triple corresponding to a root node in the plurality of nodes and the second node type of the root node by using a preset initial model;

[0215] obtain, according to each text sample and the second triple corresponding to the root node, the second triple corresponding to a first-level child node of the root node and the second node type of the first-level child node by using the preset initial model;

[0216] if the first node type of the first-level child node indicates that the first-level child node is a condition node, then obtain, according to each text sample and the second triple corresponding to the first-level child node, the second triple corresponding to a second-level child node of the first-level child node and the second node type of the second-level child node by using the preset initial model, until the second triple corresponding to all-level child nodes and the second node type of all-level child nodes are obtained, and the plurality of nodes include the root node and all-level child nodes.

[0217] In an optional implementation, the obtaining module 701 is specifically configured to:

[0218] If the first node type of the first-level child node indicates that the first-level child node is a decision node, the second triple corresponding to the plurality of nodes is obtained according to the second triple corresponding to the root node and the second triple corresponding to the first-level child node, the plurality of nodes including the root node and the first-level child node.

[0219] The second node type of the plurality of nodes is obtained according to the second node type of the root node and the second node type of the first-level child node.

[0220] In an optional implementation, each level of child nodes includes first-level child nodes and second-level child nodes, the first-level child nodes and the second-level child nodes corresponding to a decision result meeting a corresponding decision condition and a decision result not meeting the corresponding decision condition.

[0221] The obtaining module 701 is specifically configured to:

[0222] According to each text sample, the second triple corresponding to the root node, the second node type of the root node, the second triple corresponding to each first-level child node, the second node type of each first-level child node, the second triple corresponding to each second-level child node, and the second node type of each second-level child node are obtained by using the preset initial model.

[0223] In an optional implementation, the obtaining module 701 is further configured to:

[0224] According to each text sample, the third triple corresponding to the root node, the third node type of the root node, the third triple corresponding to each first-level child node, the third node type of each first-level child node, the third triple corresponding to each second-level child node, and the third node type of each second-level child node are obtained by randomly removing neurons in the preset initial model and using the removed preset initial model.

[0225] The computing module 702 is further configured to calculate the third loss function value according to the second triple corresponding to the root node, the third triple corresponding to the root node, the second node type of the root node, and the third node type of the root node.

[0226] The computing module 702 is further configured to calculate the fourth loss function value according to the second triple corresponding to each first-level child node, the third triple corresponding to each first-level child node, the second node type of each first-level child node, and the third node type of each first-level child node.

[0227] The computing module 702 is further configured to calculate the fifth loss function value according to the second triple corresponding to each second-level child node, the third triple corresponding to each second-level child node, the second node type of each second-level child node, and the third node type of each second-level child node.

[0228] The training module 703 is specifically configured to:

[0229] According to the first loss function value, the third loss function value, the fourth loss function value, the fifth loss function value, the sixth loss function value, and the seventh loss function value, the preset initial model is trained to obtain the decision information acquisition model.

[0230] In an optional implementation, the training module 703 is specifically configured to:

[0231] According to the second triple corresponding to the first child node at each level, the second triple corresponding to the second child node at each level, the second node type of the first child node at each level, and the third node type of the second child node at each level, a sixth loss function value is calculated.

[0232] According to the second triple corresponding to the second child node at each level, the third triple corresponding to the second child node at each level, the second node type of the second child node at each level, and the third node type of the second child node at each level, a seventh loss function value is calculated.

[0233] According to the first loss function value, the third loss function value, the fourth loss function value, the fifth loss function value, the sixth loss function value, and the seventh loss function value, the preset initial model is trained to obtain the decision information acquisition model.

[0234] The description of the processing procedure of each module in the device and the interaction procedure between the modules can refer to the related description in the above method embodiments, and will not be described in detail here.

[0235] Based on the same inventive concept, the embodiments of the present application also provide a decision tree construction device corresponding to the decision tree construction method. Since the principle of solving problems in the device of the embodiments of the present application is similar to the above-mentioned decision tree construction method of the embodiments of the present application, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be described in detail.

[0236] Figure 14 The structure diagram of the decision tree construction device provided in the embodiments of the present application is shown in the figure. The device can be integrated in an electronic device. As shown in the figure, the device can include: Figure 14

[0237] The acquisition module 801 is configured to acquire the to-be-processed text.

[0238] The acquisition module 802 is further configured to acquire, according to the decision information acquisition model of the first aspect, the triples corresponding to the plurality of decision tree nodes and the node types of the plurality of decision tree nodes from the to-be-processed text.

[0239] The construction module 802 is configured to construct the decision tree corresponding to the to-be-processed text according to the triples corresponding to the plurality of decision tree nodes and the node types of the plurality of decision tree nodes.

[0240] ​The description of the processing flow of each module in the device and the interaction flow between the modules can refer to the related description in the method embodiments, and will not be described in detail here.

[0241] Figure 15 A structural schematic diagram of an electronic device provided in the embodiments of the present application is shown in FIG. 9. As shown in FIG. 9, the device can include a processor 901, a memory 902, and a bus 903. The memory 902 stores machine readable instructions executable by the processor 901. When the electronic device is running, the processor 901 communicates with the memory 902 through the bus 903. The processor 901 executes the machine readable instructions to perform the above method. Figure 15

[0242] The embodiments of the present application also provide a computer readable storage medium, which stores a computer program. The computer program is executed by a processor to perform the above method.

[0243] In the embodiments of the present application, the computer program executed by the processor can also execute other machine readable instructions to perform the methods described in other embodiments. For specific method steps and principles, refer to the description of the embodiments, which will not be described in detail here.

[0244] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division, and there can be another division manner in actual implementation. For example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some communication interfaces, and can be electrical, mechanical or other forms.

[0245] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, that is, they can be located in one place, or can be distributed on a plurality of network units. According to actual needs, some or all of the units can be selected to achieve the purpose of the embodiments of the present application.

[0246] In addition, each functional unit in the embodiments provided in the present application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit.

[0247] ​If the functions are implemented in the form of software function units and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application essentially or the parts that contribute to the prior art or parts of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.

[0248] It should be noted that similar reference numbers and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. In addition, the terms "first", "second", "third" and the like are only used to distinguish the description and cannot be understood as indicating or implying relative importance.

[0249] Finally, it should be noted that the above-described embodiments are only specific implementations of the present application, which are used to illustrate the technical solutions of the present application, but not to limit them. The protection scope of the present application is not limited thereto. Although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can modify or easily think of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed by the present application, or make equivalent replacements to some of the technical features. These modifications, changes or replacements do not cause the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application. They should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A training method for a decision information acquisition model, characterized in that, include: Obtain a training sample set, which includes: multiple text samples, and the training sample set is labeled with the first triplet corresponding to multiple nodes on the decision tree for each text sample, and the first node type of the multiple nodes. A triplet includes: a subject, an object, and a subject-object relationship. Based on the text samples, a preset initial model is used to obtain the second triplets corresponding to the multiple nodes and the second node types of the multiple nodes. Calculate the first loss function value based on the first triplet corresponding to the plurality of nodes, the second triplet corresponding to the plurality of nodes, the first node type of the plurality of nodes, and the second node type of the plurality of nodes; Based on the first loss function value, the preset initial model is trained to obtain a decision information acquisition model; The step of obtaining the second triplet corresponding to the multiple nodes and the second node type of the multiple nodes based on the text samples and using a preset initial model includes: Based on the text samples, the second triplet corresponding to the root node and the second node type of the root node are obtained using the preset initial model. Based on each text sample and the second triplet corresponding to the root node, the preset initial model is used to obtain the second triplet corresponding to the first-level child node of the root node and the second node type of the first-level child node. If the first node type of the first-level child node indicates that the first-level child node is a condition node, then based on the text samples and the second triplet corresponding to the first-level child node, the preset initial model is used to obtain the second triplet corresponding to the second-level child node of the first-level child node and the second node type of the second-level child node, until the second triplet corresponding to all-level child nodes and the second node type of all-level child nodes are obtained, and the plurality of nodes include: the root node and the all-level child nodes; Each level of sub-node includes: each level of first sub-node and each level of second sub-node, wherein each level of first sub-node and each level of second sub-node corresponds to a decision result that meets the corresponding decision condition and a decision result that does not meet the corresponding decision condition; The step of obtaining the second triplet corresponding to the multiple nodes and the second node type of the multiple nodes based on the text samples and using a preset initial model includes: Based on the text samples, using the preset initial model, the second triplet corresponding to the root node, the second node type of the root node, the second triplet corresponding to the first child node at each level, the second node type of the first child node at each level, the second triplet corresponding to the second child node at each level, and the second node type of the second child node at each level are obtained. Before training the preset initial model based on the first loss function value to obtain the decision information acquisition model, the method further includes: Based on each text sample, neurons in the preset initial model are randomly removed, and the removed preset initial model is used to obtain the third triplet corresponding to the root node, the third node type of the root node, the third triplet corresponding to the first child node at each level, the third node type of the first child node at each level, the third triplet corresponding to the second child node at each level, and the third node type of the second child node at each level. The third loss function value is calculated based on the second triplet corresponding to the root node, the third triplet corresponding to the root node, the second node type of the root node, and the third node type of the root node. The fourth loss function value is calculated based on the second triplet corresponding to the first child node at each level, the third triplet corresponding to the first child node at each level, the second node type of the first child node at each level, and the third node type of the first child node at each level. The fifth loss function value is calculated based on the second triplet corresponding to the second child node at each level, the third triplet corresponding to the second child node at each level, the second node type of the second child node at each level, and the third node type of the second child node at each level. The step of training the preset initial model based on the first loss function value to obtain the decision information acquisition model includes: The preset initial model is trained based on the first loss function value, the third loss function value, the fourth loss function value, and the fifth loss function value to obtain the decision information acquisition model.

2. The method according to claim 1, characterized in that, The number of the first triplet and the number of the second triplet are both at least one, and the training sample set is also labeled with: at least one logical operator between at least one first triplet corresponding to each node, the logical operator being used to indicate the logical relationship between at least one triplet; Before training the preset initial model based on the first loss function value to obtain the decision information acquisition model, the method further includes: Based on each text sample, obtain a second logical operator between at least one second triplet of the plurality of nodes; Calculate the second loss function value based on the first logical operator and the second logical operator; The step of training the preset initial model based on the first loss function value to obtain the decision information acquisition model includes: The preset initial model is trained based on the first loss function value and the second loss function value to obtain the decision information acquisition model.

3. The method according to claim 1, characterized in that, The step of obtaining the second triplet corresponding to the multiple nodes and the second node type of the multiple nodes based on the text samples and using a preset initial model further includes: If the first node type of the first-level child node indicates that the first-level child node is a decision node, then based on the second triplet corresponding to the root node and the second triplet corresponding to the first-level child node, the second triplet corresponding to the plurality of nodes is obtained, and the plurality of nodes include: the root node and the first-level child node; Based on the second node type of the root node and the second node type of the first-level child node, the second node type of the plurality of nodes is obtained.

4. The method according to claim 1, characterized in that, The step of training the preset initial model based on the first loss function value, the third loss function value, the fourth loss function value, and the fifth loss function value to obtain the decision information acquisition model includes: The sixth loss function value is calculated based on the second triplet corresponding to the first child node at each level, the second triplet corresponding to the second child node at each level, the second node type of the first child node at each level, and the third node type of the second child node at each level. The seventh loss function value is calculated based on the second triplet corresponding to the second child node at each level, the third triplet corresponding to the second child node at each level, the second node type of the second child node at each level, and the third node type of the second child node at each level. The preset initial model is trained based on the first loss function value, the third loss function value, the fourth loss function value, the fifth loss function value, the sixth loss function value, and the seventh loss function value to obtain the decision information acquisition model.

5. A decision tree construction method, characterized in that, include: Get the text to be processed; According to any one of the decision information acquisition models in claims 1-4, the triples corresponding to multiple decision tree nodes and the node types of the multiple decision tree nodes are obtained from the text to be processed. Based on the triples corresponding to the multiple decision tree nodes and the node types of the multiple decision tree nodes, construct the decision tree corresponding to the text to be processed.

6. An electronic device, characterized in that, include: The device includes a processor, a memory, and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is in operation, the processor communicates with the memory via the bus, and the processor executes the machine-readable instructions to perform the method according to any one of claims 1 to 5.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the method described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Question generation method and device, computer equipment and storage medium

    CN114880443A