A knowledge graph-based model training method, apparatus, device, and medium
By employing a knowledge graph-based model training method, and combining a BERT pre-trained model with a classifier and a graph neural network, the treatment efficacy of liver cancer patients is evaluated. This addresses the problem of insufficient evaluation of liver cancer treatment efficacy and improves the effectiveness of treatment and quality of life.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-18
- Publication Date
- 2026-03-06
AI Technical Summary
In current technologies, the treatment and prognosis of liver cancer are poor, resulting in short and low-quality survival for patients, and there is a lack of effective methods for evaluating treatment effectiveness.
By employing a knowledge graph-based model training method, utilizing a BERT pre-trained model and classifier, combined with a graph neural network model, patient medical record data is trained to evaluate treatment effectiveness. This includes generating a knowledge graph, extracting heterogeneous graphs, and training the model. The final treatment effect is determined by using the probabilities output by multiple models.
It enables accurate assessment of treatment outcomes for liver cancer patients, provides more effective treatment options, prolongs survival time, and improves quality of life.
Smart Images

Figure CN115206536B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing, and more specifically, to a knowledge graph-based model training method, apparatus, device, and medium. Background Technology
[0002] Compared to other common cancers, liver cancer has a slightly lower incidence rate but a higher mortality rate, indicating that its treatment and prognosis are relatively poor. In other words, liver cancer patients urgently need relatively effective treatment and prognosis to prolong survival time and improve quality of life. Therefore, assessing the treatment effectiveness of liver cancer patients based on their medical records is essential. Summary of the Invention
[0003] In view of this, the purpose of this application is to provide a knowledge graph-based model training method, apparatus, device and medium that can evaluate the treatment effect of a patient's disease through a trained first target model, a second target model and a graph neural network model.
[0004] In a first aspect, embodiments of this application provide a model training method based on a knowledge graph, the method comprising:
[0005] Obtain the medical records of multiple first patients with the target disease;
[0006] For each first patient, based on the textual information included in the first patient's medical record, at least one first triplet corresponding to the first patient is obtained, wherein the first triplet corresponding to the first patient is used to characterize the first patient's diagnosis and treatment status for the target disease;
[0007] Based on each of the first triplets corresponding to each first patient, a knowledge graph of the target disease is generated, and a heterogeneous graph is extracted from the knowledge graph.
[0008] For each first patient, the first node in the heterogeneous graph and the relationships between different first nodes are used as inputs to the first target model, the second target model, and the graph neural network model. The target label representing the treatment effect of the first patient on the target disease is used as the output of the first target model, the second target model, and the graph neural network model. The first target model, the second target model, and the graph neural network model are trained to obtain the trained first target model, the trained second target model, and the trained graph neural network model. The first node is the node formed by the first triplet corresponding to the first patient in the heterogeneous graph. The target label has n categories, where n is an integer greater than 1. The first target model sequentially includes a BERT pre-trained model and a first classifier. The second target model sequentially includes the BERT pre-trained model and a second classifier.
[0009] In one possible implementation, for each first patient, the method further includes using the first node in the heterogeneous graph and the relationships between different first nodes as inputs to the first target model, the second target model, and the graph neural network model, and using the target label representing the treatment effect of the first patient on the target disease as the output of the first target model, the second target model, and the graph neural network model, training the first target model, the second target model, and the graph neural network model to obtain the trained first target model, the trained second target model, and the trained graph neural network model.
[0010] Obtain the medical records of a second patient suffering from the target disease;
[0011] Based on the textual information included in the second patient's medical record, at least one second ternary set corresponding to the second patient is obtained, wherein the second ternary set corresponding to the second patient is used to characterize the second patient's diagnosis and treatment status for the target disease;
[0012] Based on the second triplet, the heterogeneous graph is updated to obtain the updated heterogeneous graph;
[0013] The second node corresponding to the second triplet in the updated heterogeneous graph and the relationship between different second nodes are respectively input into the first target model after training, the second target model after training, and the graph neural network model after training to obtain the first probability of the category of each target label output by the first target model after training, the second probability of the category of each target label output by the second target model after training, and the third probability of the category of each target label output by the graph neural network model after training.
[0014] The target category of the target label corresponding to the second patient is determined based on a first probability of the category of each target label, a second probability of the category of each target label, and a third probability of the category of each target label.
[0015] In one possible implementation, determining the target category of the target label corresponding to the second patient based on a first probability of the category of each target label, a second probability of the category of each target label, and a third probability of the category of each target label includes:
[0016] Select the first category of the target label with the highest probability, select the second category of the target label with the highest probability, and select the third category of the target label with the highest probability.
[0017] If at least two of the first category, the second category, and the third category are the same, then the target category is the category that is the same as at least two of the first category, the second category, and the third category;
[0018] If the first category, the second category, and the third category are all different, then any one of the first category, the second category, and the third category shall be determined as the target category.
[0019] In one possible implementation, determining the target category of the target label corresponding to the second patient based on a first probability of the category of each target label, a second probability of the category of each target label, and a third probability of the category of each target label further includes:
[0020] For each category of the target label, the first probability, the second probability, and the third probability of the target label category are taken as an arithmetic average to obtain the comprehensive average probability of the target label category.
[0021] The category of the target label with the highest overall average probability is determined as the target category.
[0022] Secondly, embodiments of this application also provide a knowledge graph-based model training device, the device comprising:
[0023] The first acquisition module is used to acquire the medical records of multiple first patients suffering from the target disease.
[0024] The first construction module is used to obtain at least one first triplet corresponding to each first patient based on the text information included in the first patient's medical record, wherein the first triplet corresponding to the first patient is used to characterize the first patient's diagnosis and treatment status for the target disease.
[0025] An extraction module is used to generate a knowledge graph of the target disease based on each of the first triplets corresponding to each of the first patients, and to extract a heterogeneous graph from the knowledge graph.
[0026] The training module is used, for each first patient, to take the first node in the heterogeneous graph and the relationships between different first nodes as inputs to the first target model, the second target model, and the graph neural network model, and to take the target label representing the treatment effect of the first patient on the target disease as the output of the first target model, the second target model, and the graph neural network model, to train the first target model, the second target model, and the graph neural network model, to obtain the trained first target model, the trained second target model, and the trained graph neural network model, wherein the first node is the node formed by the first triplet corresponding to the first patient in the heterogeneous graph, the target label includes n categories, where n is an integer greater than 1, the first target model sequentially includes: a BERT pre-trained model and a first classifier, and the second target model sequentially includes: the BERT pre-trained model and a second classifier.
[0027] In one possible implementation, the device further includes:
[0028] The second acquisition module is used to, for each first patient, take the first node in the heterogeneous graph and the relationship between different first nodes as input to the first target model, the second target model and the graph neural network model, take the target label representing the treatment effect of the first patient on the target disease as output to the first target model, the second target model and the graph neural network model, train the first target model, the second target model and the graph neural network model, and obtain the trained first target model, the trained second target model and the trained graph neural network model, and then acquire the medical records of the second patient suffering from the target disease.
[0029] The second construction module is used to obtain at least one second triplet corresponding to the second patient based on the text information included in the second patient's medical record, wherein the second triplet corresponding to the second patient is used to characterize the second patient's diagnosis and treatment status for the target disease;
[0030] An update module is used to update the heterogeneous graph based on the second triplet to obtain an updated heterogeneous graph;
[0031] The input module is used to input the second node corresponding to the second triplet in the updated heterogeneous graph and the relationship between different second nodes into the first target model, the second target model, and the graph neural network model after training, respectively, to obtain the first probability of the category of each target label output by the first target model after training, the second probability of the category of each target label output by the second target model after training, and the third probability of the category of each target label output by the graph neural network model after training;
[0032] The classification module is used to determine the target category of the target label corresponding to the second patient based on a first probability of the category of each target label, a second probability of the category of each target label, and a third probability of the category of each target label.
[0033] In one possible implementation, the classification module is specifically used for:
[0034] Select the first category of the target label with the highest probability, select the second category of the target label with the highest probability, and select the third category of the target label with the highest probability.
[0035] If at least two of the first category, the second category, and the third category are the same, then the target category is the category that is the same as at least two of the first category, the second category, and the third category;
[0036] If the first category, the second category, and the third category are all different, then any one of the first category, the second category, and the third category shall be determined as the target category.
[0037] In one possible implementation, the classification module is further configured to:
[0038] For each category of the target label, the first probability, the second probability, and the third probability of the target label category are taken as an arithmetic average to obtain the comprehensive average probability of the target label category.
[0039] The category of the target label with the highest overall average probability is determined as the target category.
[0040] Thirdly, embodiments of this application also provide an electronic device, including: a processor, a storage medium, and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium via the bus, and the processor executes the machine-readable instructions to perform the steps of the knowledge graph-based model training method described in any of the first aspects.
[0041] Fourthly, embodiments of this application also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of the knowledge graph-based model training method as described in any of the first aspects.
[0042] This application provides a knowledge graph-based model training method, apparatus, device, and medium that can evaluate the treatment effect of a patient's disease through a trained first target model, a second target model, and a graph neural network model. Attached Figure Description
[0043] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0044] Figure 1 A flowchart of a knowledge graph-based model training method provided in an embodiment of this application is shown;
[0045] Figure 2 A flowchart of another knowledge graph-based model training method provided in an embodiment of this application is shown;
[0046] Figure 3 A flowchart of another knowledge graph-based model training method provided in an embodiment of this application is shown;
[0047] Figure 4 A schematic diagram of the structure of a knowledge graph-based model training device provided in an embodiment of this application is shown.
[0048] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of this application is shown. Detailed Implementation
[0049] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. It should be understood that the accompanying drawings in this application are for illustrative and descriptive purposes only and are not intended to limit the scope of protection of this application. Furthermore, it should be understood that the schematic drawings are not drawn to scale. The flowcharts used in this application illustrate operations implemented according to some embodiments of this application. It should be understood that the operations in the flowcharts may not be implemented in sequence, and steps without logical contextual relationships may be reversed or implemented simultaneously. In addition, those skilled in the art, guided by the content of this application, may add one or more other operations to the flowcharts, or remove one or more operations from the flowcharts.
[0050] Furthermore, the described embodiments are merely some, not all, of the embodiments of this application. The components of the embodiments of this application described and illustrated herein can typically be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0051] It should be noted that the term "comprising" will be used in the embodiments of this application to indicate the presence of the features declared thereafter, but does not exclude the addition of other features.
[0052] To facilitate understanding of this embodiment, a detailed description of a knowledge graph-based model training method, apparatus, device, and medium provided in this application embodiment will be given.
[0053] Reference Figure 1 The diagram shown is a flowchart of a knowledge graph-based model training method provided in an embodiment of this application. The method includes:
[0054] S101. Obtain the medical records of multiple first patients suffering from the target disease.
[0055] For example, the target disease could be liver cancer.
[0056] S102. For each first patient, based on the textual information included in the first patient's medical record, at least one first triplet corresponding to the first patient is obtained, wherein the first triplet corresponding to the first patient is used to characterize the first patient's diagnosis and treatment status for the target disease.
[0057] For example, the first triplet corresponding to the first patient can be in the form of (target disease D, target disease-related influencing factors F, the first patient P).
[0058] S103. Based on each of the first triplets corresponding to each of the first patients, generate a knowledge graph of the target disease, and extract a heterogeneous graph from the knowledge graph.
[0059] For example, each first triplet corresponding to each first patient can be imported into the graph database neo4j to generate a knowledge graph of the target disease.
[0060] S104. For each first patient, the first node in the heterogeneous graph and the relationships between different first nodes are used as inputs to the first target model, the second target model, and the graph neural network model. The target label representing the treatment effect of the first patient on the target disease is used as the output of the first target model, the second target model, and the graph neural network model. The first target model, the second target model, and the graph neural network model are trained to obtain the trained first target model, the trained second target model, and the trained graph neural network model. The first node is the node formed by the first triplet corresponding to the first patient in the heterogeneous graph. The target label has n categories, where n is an integer greater than 1. The first target model sequentially includes: a BERT pre-trained model and a first classifier. The second target model sequentially includes: the BERT pre-trained model and a second classifier.
[0061] For example, the first classifier can be an LR classifier, and the activation function can be Softman; the second classifier can be an SVM classifier; the activation function of the graph neural network model can be LeakyReLU, and the graph neural network model can introduce an attention mechanism for training.
[0062] For example, if n is 3, the target label categories can include 3: "good", "average" and "poor". The number of categories can be reduced or increased according to actual needs.
[0063] For example, consider three patients: patient a, patient b, and patient c. Patient a currently shows good treatment results for the target disease, patient b currently shows moderate treatment results, and patient c currently shows poor treatment results. When training the first target model, the second target model, and the graph neural network model using the first node (and its relationships) corresponding to patient a as input, the outputs of these three models represent the first label indicating good treatment results (i.e., the label category is "good"). When training the first target model, the second target model, and the graph neural network model using the first node (and its relationships) corresponding to patient b as input, the outputs of these three models represent the second label indicating moderate treatment results (i.e., the label category is "moderate"). When training the first target model, the second target model, and the graph neural network model using the first node (and its relationships) corresponding to patient c as input, the outputs of these three models represent the third label indicating poor treatment results (i.e., the label category is "poor").
[0064] Reference Figure 2 The diagram shows a flowchart of another knowledge graph-based model training method provided in this application. In one possible implementation, for each first patient, the first node in the heterogeneous graph and the relationships between different first nodes are used as inputs to a first target model, a second target model, and a graph neural network model. The target label representing the treatment effect of the first patient on the target disease is used as the output of the first target model, the second target model, and the graph neural network model. After training the first target model, the second target model, and the graph neural network model to obtain the trained first target model, the trained second target model, and the trained graph neural network model, the method further includes:
[0065] S201. Obtain the medical records of a second patient suffering from the target disease.
[0066] S202. Based on the textual information included in the medical record of the second patient, at least one second ternary set corresponding to the second patient is obtained, wherein the second ternary set corresponding to the second patient is used to characterize the diagnosis and treatment status of the second patient for the target disease.
[0067] For example, the second triplet can be in the form of (target disease D, target disease-related influencing factors F, second patient O).
[0068] S203. Based on the second triplet, update the heterogeneous graph to obtain the updated heterogeneous graph.
[0069] In some cases, a second triplet may result in the addition of new nodes to the heterogeneous graph.
[0070] S204. Input the second node corresponding to the second triplet in the updated heterogeneous graph and the relationship between different second nodes into the first target model, the second target model, and the graph neural network model after training, respectively, to obtain the first probability of the category of each target label output by the first target model after training, the second probability of the category of each target label output by the second target model after training, and the third probability of the category of each target label output by the graph neural network model after training.
[0071] Given that the target label categories include "good", "average", and "poor", for example, the outputs of the first target model can be: a first probability of 70% for "good", a first probability of 20% for "average", and a first probability of 10% for "poor"; the outputs of the second target model can be: a second probability of 80% for "good", a second probability of 15% for "average", and a second probability of 5% for "poor"; and the outputs of the graph neural network model can be: a third probability of 30% for "good", a third probability of 10% for "average", and a third probability of 60% for "poor".
[0072] S205. Determine the target category of the target label corresponding to the second patient based on the first probability of the category of each target label, the second probability of the category of each target label, and the third probability of the category of each target label.
[0073] In one possible implementation, determining the target category of the target label corresponding to the second patient based on a first probability of the category of each target label, a second probability of the category of each target label, and a third probability of the category of each target label includes:
[0074] Select the first category of the target label with the highest probability, select the second category of the target label with the highest probability, and select the third category of the target label with the highest probability.
[0075] If at least two of the first category, the second category, and the third category are the same, then the target category is the category that is the same as at least two of the first category, the second category, and the third category;
[0076] Given that the target label categories include "good", "average", and "poor", for example, suppose the outputs of the first target model are: a first probability of 70% for "good", a first probability of 20% for "average", and a first probability of 10% for "poor"; the outputs of the second target model are: a second probability of 80% for "good", a second probability of 15% for "average", and a second probability of 5% for "poor"; and the outputs of the graph neural network model are: a third probability of 30% for "good", a third probability of 10% for "average", and a third probability of 60% for "poor".
[0077] So, the first category is "good", the second category is "good", and the third category is "bad".
[0078] If the first category is the same as the second category, then the target category is the same as both the first and second categories, that is, the target category is "good".
[0079] If the first category, the second category, and the third category are all different, then any one of the first category, the second category, and the third category shall be determined as the target category.
[0080] Given that the target label categories include "good", "average", and "poor", for example, suppose the outputs of the first target model are: a first probability of 70% for "good", a first probability of 20% for "average", and a first probability of 10% for "poor"; the outputs of the second target model are: a second probability of 15% for "good", a second probability of 80% for "average", and a second probability of 5% for "poor"; and the outputs of the graph neural network model are: a third probability of 30% for "good", a third probability of 10% for "average", and a third probability of 60% for "poor".
[0081] Therefore, the first category is "good", the second category is "average", and the third category is "poor".
[0082] Therefore, the target category can be any one of "good", "average" and "poor".
[0083] Reference Figure 3 The diagram shows a flowchart of another knowledge graph-based model training method provided in this application. In one possible implementation, the target category of the target label corresponding to the second patient is determined based on a first probability of the category of each target label, a second probability of the category of each target label, and a third probability of the category of each target label. The method further includes:
[0084] S301. For each category of the target label, the first probability of the target label category, the second probability of the target label category, and the third probability of the target label category are taken as an arithmetic average to obtain the comprehensive average probability of the target label category.
[0085] Given that the target label categories include "good", "average", and "poor", for example, suppose the outputs of the first target model are: a first probability of 70% for "good", a first probability of 20% for "average", and a first probability of 10% for "poor"; the outputs of the second target model are: a second probability of 80% for "good", a second probability of 15% for "average", and a second probability of 5% for "poor"; and the outputs of the graph neural network model are: a third probability of 30% for "good", a third probability of 10% for "average", and a third probability of 60% for "poor".
[0086] Therefore, the overall average probability of the category "good" is (70% + 80% + 30%) / 3 = 60%;
[0087] The overall average probability of the category "average" is (20% + 15% + 10%) / 3 = 15%;
[0088] The overall average probability of the category "poor" is (10% + 5% + 60%) / 3 = 25%.
[0089] S302. The category of the target label with the highest overall average probability is determined as the target category.
[0090] The category with the highest overall average probability is "good". Therefore, the target category is "good".
[0091] This application provides a knowledge graph-based model training method that can evaluate the treatment effect of a patient's disease through a trained first target model, a second target model, and a graph neural network model.
[0092] Reference Figure 4 The diagram shown is a structural schematic of a knowledge graph-based model training device provided in an embodiment of this application. The device includes:
[0093] The first acquisition module 401 is used to acquire the medical records of multiple first patients suffering from the target disease.
[0094] The first construction module 402 is used to obtain at least one first triplet corresponding to each first patient based on the text information included in the first patient's medical record, wherein the first triplet corresponding to the first patient is used to characterize the first patient's diagnosis and treatment status for the target disease.
[0095] Extraction module 403 is used to generate a knowledge graph of the target disease based on each of the first triplets corresponding to each of the first patients, and to extract heterogeneous graphs from the knowledge graph.
[0096] The training module 404 is used, for each first patient, to take the first node in the heterogeneous graph and the relationships between different first nodes as inputs to the first target model, the second target model, and the graph neural network model, and to take the target label representing the treatment effect of the first patient on the target disease as the output of the first target model, the second target model, and the graph neural network model, to train the first target model, the second target model, and the graph neural network model, to obtain the trained first target model, the trained second target model, and the trained graph neural network model, wherein the first node is the node formed by the first triplet corresponding to the first patient in the heterogeneous graph, the target label includes n categories, where n is an integer greater than 1, the first target model sequentially includes: a BERT pre-trained model and a first classifier, and the second target model sequentially includes: the BERT pre-trained model and a second classifier.
[0097] In one possible implementation, the device further includes:
[0098] The second acquisition module is used to, for each first patient in the training module 404, take the first node in the heterogeneous graph and the relationship between different first nodes as the input of the first target model, the second target model and the graph neural network model, take the target label used to characterize the treatment effect of the first patient on the target disease as the output of the first target model, the second target model and the graph neural network model, train the first target model, the second target model and the graph neural network model, and obtain the trained first target model, the trained second target model and the trained graph neural network model, and then acquire the medical records of the second patient suffering from the target disease.
[0099] The second construction module is used to obtain at least one second triplet corresponding to the second patient based on the text information included in the second patient's medical record, wherein the second triplet corresponding to the second patient is used to characterize the second patient's diagnosis and treatment status for the target disease;
[0100] An update module is used to update the heterogeneous graph based on the second triplet to obtain an updated heterogeneous graph;
[0101] The input module is used to input the second node corresponding to the second triplet in the updated heterogeneous graph and the relationship between different second nodes into the first target model, the second target model, and the graph neural network model after training, respectively, to obtain the first probability of the category of each target label output by the first target model after training, the second probability of the category of each target label output by the second target model after training, and the third probability of the category of each target label output by the graph neural network model after training;
[0102] The classification module is used to determine the target category of the target label corresponding to the second patient based on a first probability of the category of each target label, a second probability of the category of each target label, and a third probability of the category of each target label.
[0103] In one possible implementation, the classification module is specifically used for:
[0104] Select the first category of the target label with the highest probability, select the second category of the target label with the highest probability, and select the third category of the target label with the highest probability.
[0105] If at least two of the first category, the second category, and the third category are the same, then the target category is the category that is the same as at least two of the first category, the second category, and the third category;
[0106] If the first category, the second category, and the third category are all different, then any one of the first category, the second category, and the third category shall be determined as the target category.
[0107] In one possible implementation, the classification module is further configured to:
[0108] For each category of the target label, the first probability, the second probability, and the third probability of the target label category are taken as an arithmetic average to obtain the comprehensive average probability of the target label category.
[0109] The category of the target label with the highest overall average probability is determined as the target category.
[0110] This application provides a knowledge graph-based model training device that can evaluate the treatment effect of a patient's disease through a trained first target model, a second target model, and a graph neural network model.
[0111] Reference Figure 5As shown in the embodiment of this application, an electronic device 500 includes a processor 501, a memory 502, and a bus. The memory 502 stores machine-readable instructions executable by the processor 501. When the electronic device is running, the processor 501 communicates with the memory 502 via the bus, and the processor 501 executes the machine-readable instructions to perform the steps of the knowledge graph-based model training method described above.
[0112] Specifically, the memory 502 and processor 501 mentioned above can be general-purpose memory and processor, without any specific limitations. When the processor 501 runs the computer program stored in the memory 502, it can execute the above-mentioned method for training the knowledge graph-based model.
[0113] Corresponding to the above-described knowledge graph-based model training method, this application embodiment also provides a computer-readable storage medium storing a computer program, which, when run by a processor, executes the steps of the above-described knowledge graph-based model training method.
[0114] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems and devices described above can be referred to the corresponding processes in the method embodiments, and will not be repeated here. In the several embodiments provided in this application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed mutual coupling or direct coupling or communication connection can be through some communication interfaces; the indirect coupling or communication connection of devices or modules can be electrical, mechanical, or other forms.
[0115] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0116] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0117] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a processor-executable, non-volatile, computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks.
[0118] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for training a model based on a knowledge graph, characterized in that, The method comprises: obtaining medical records of a plurality of first patients suffering from a target disease respectively; for each of the first patients, obtaining at least one first triple corresponding to the first patient based on textual information included in the medical record of the first patient, wherein the first triple corresponding to the first patient is used to represent the diagnosis and treatment condition of the first patient for the target disease; based on each of the first triples corresponding to each of the first patients, generating a knowledge graph of the target disease, and extracting a heterogeneous graph from the knowledge graph; for each of the first patients, taking the first nodes in the heterogeneous graph and the relationships between different first nodes as inputs of a first target model, a second target model and a graph neural network model, taking a target label used to represent the treatment effect of the first patient for the target disease as an output of the first target model, the second target model and the graph neural network model, training the first target model, the second target model and the graph neural network model, and obtaining a trained first target model, a trained second target model and a trained graph neural network model, wherein the first nodes are nodes formed by the first triples corresponding to the first patient in the heterogeneous graph, the target label has n categories, n is an integer greater than 1, the first target model comprises a Bert pre-training model and a first classifier in sequence, and the second target model comprises the Bert pre-training model and a second classifier in sequence; The method further comprises: obtaining a medical record of a second patient suffering from the target disease; obtaining at least one second triple corresponding to the second patient based on textual information included in the medical record of the second patient, wherein the second triple corresponding to the second patient is used to represent the diagnosis and treatment condition of the second patient for the target disease; updating the heterogeneous graph based on the second triples to obtain an updated heterogeneous graph; inputting the second nodes corresponding to the second triples in the updated heterogeneous graph and the relationships between different second nodes into the trained first target model, the trained second target model and the trained graph neural network model respectively to obtain a first probability of each category of the target label output by the trained first target model, a second probability of each category of the target label output by the trained second target model and a third probability of each category of the target label output by the trained graph neural network model; determining a target category of the target label corresponding to the second patient according to the first probability of each category of the target label, the second probability of each category of the target label and the third probability of each category of the target label. 2.The knowledge graph based model training method of claim 1, wherein, determining a target category of the target label corresponding to the second patient according to the first probability of each category of the target label, the second probability of each category of the target label and the third probability of each category of the target label, comprises: selecting a first category of a target label with a first probability being maximum, selecting a second category of the target label with a second probability being maximum, and selecting a third category of the target label with a third probability being maximum; if at least two of the first category, the second category and the third category are the same, the target category is the category which is the same as at least two of the first category, the second category and the third category; if the first category, the second category and the third category are all different, any one of the first category, the second category and the third category is determined as the target category. 3.The knowledge graph based model training method of claim 1, wherein, determining the target category of the target label corresponding to the second patient according to the first probability of the category of each target label, the second probability of the category of each target label and the third probability of the category of each target label, further comprising: for the category of each target label, performing arithmetic average on the first probability of the category of the target label, the second probability of the category of the target label and the third probability of the category of the target label to obtain a comprehensive average probability of the category of the target label; determining the category of the target label with the maximum comprehensive average probability as the target category. 4.A model training apparatus based on a knowledge graph, characterized in that, The device comprises: a first acquisition module configured to acquire medical records of a plurality of first patients suffering from a target disease; a first construction module configured to, for each of the first patients, obtain at least one first triple corresponding to the first patient based on textual information included in the medical record of the first patient, wherein the first triple corresponding to the first patient is used to represent a diagnosis and treatment condition of the first patient for the target disease; an extraction module configured to generate a knowledge graph of the target disease based on each of the first triples corresponding to each of the first patients, and extract a heterogeneous graph from the knowledge graph; a training module configured to, for each of the first patients, take a first node in the heterogeneous graph and a relationship between different first nodes as inputs of a first target model, a second target model and a graph neural network model, take a target label used to represent a treatment effect of the first patient for the target disease as an output of the first target model, the second target model and the graph neural network model, and train the first target model, the second target model and the graph neural network model to obtain a trained first target model, a trained second target model and a trained graph neural network model, wherein the first node is a node formed by the first triple corresponding to the first patient in the heterogeneous graph, the target label has n categories, n is an integer greater than 1, the first target model comprises a Bert pre-training model and a first classifier in sequence, and the second target model comprises the Bert pre-training model and a second classifier in sequence. The second obtaining module is configured to, for each of the first patients, take a first node in the heterogeneous graph and a relationship between different first nodes as an input of a first target model, a second target model, and a graph neural network model, take a target label used to represent a treatment effect of the first patient on the target disease as an output of the first target model, the second target model, and the graph neural network model, train the first target model, the second target model, and the graph neural network model, and obtain a first target model after training, a second target model after training, and a graph neural network model after training, and then obtain medical records of a second patient with the target disease. The second constructing module is configured to obtain at least one second triple corresponding to the second patient based on textual information included in the medical records of the second patient, where the second triple corresponding to the second patient is used to represent a diagnosis and treatment condition of the second patient on the target disease. The updating module is configured to update the heterogeneous graph based on the second triple to obtain an updated heterogeneous graph. The input module is configured to input a second node corresponding to the second triple and a relationship between different second nodes in the updated heterogeneous graph into the first target model after training, the second target model after training, and the graph neural network model after training, respectively, to obtain a first probability of a class of each target label output by the first target model after training, a second probability of a class of each target label output by the second target model after training, and a third probability of a class of each target label output by the graph neural network model after training. The classification module is configured to determine a target class of the target label corresponding to the second patient according to the first probability of the class of each target label, the second probability of the class of each target label, and the third probability of the class of each target label. 5.The knowledge graph based model training apparatus of claim 4, wherein, The classification module is specifically configured to: select a first class of a target label with the maximum first probability, select a second class of a target label with the maximum second probability, and select a third class of a target label with the maximum third probability; if at least two of the first class, the second class, and the third class are the same, the target class is a class that is the same as the at least two of the first class, the second class, and the third class; if the first class, the second class, and the third class are all different, any one of the first class, the second class, and the third class is determined as the target class. 6.The knowledge graph based model training apparatus of claim 4, wherein, The classification module is further configured to: for each class of the target label, perform arithmetic averaging on the first probability of the class of the target label, the second probability of the class of the target label, and the third probability of the class of the target label to obtain a comprehensive average probability of the class of the target label; and determine a class of a target label with the maximum comprehensive average probability as the target class.
7. An electronic device, comprising: The method comprises the following steps: A processor, a storage medium, and a bus, the storage medium storing machine readable instructions executable by the processor, the processor in communication with the storage medium via the bus when the electronic device is running, the processor executing the machine readable instructions to perform the steps of the knowledge graph-based model training method of any one of claims 1 to 3.
8. A computer-readable storage medium, characterized in that, A computer program is stored on the computer readable storage medium, and when the processor runs the computer program, the steps of the knowledge graph-based model training method of any one of claims 1 to 3 are performed.
Citation Information
Patent Citations
Model training method and device, heart disease diagnosis device and equipment, and medium
CN110517783A
Disease diagnosis and prediction system based on graph neural network
CN113990495A