A personalized drug recommendation method and system based on knowledge graph
By applying a personalized drug recommendation method based on knowledge graphs in the medical field, using a large model to generate knowledge graphs and combining a two-way attention graph neural network, the problem of insufficient data dependence and interpretability of deep learning technology in the medical field is solved, and more accurate and reliable drug recommendations are achieved.
Patent Information
- Application Number
- CN202311660390.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-06
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2043-12-06
AI Technical Summary
The existing deep learning technology has problems of insufficient data dependence and interpretability in the application of the medical field, and it is difficult to effectively implement it in the medical field.
Using a personalized drug recommendation method based on knowledge graphs, a patient's disease data set is obtained, a knowledge graph is generated using a large model, and a two-way attention graph neural network is used for drug recommendation.
It achieves more accurate drug recommendations, provides medication plans that are more in line with the patient's physical condition, and has better interpretability and credibility.
Smart Images

Figure CN117672450B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of smart medical technology, and in particular relates to a personalized drug recommendation method and system based on knowledge graph. Background Art
[0002] With the development of artificial intelligence, the increasingly mature AI technology is gradually turning to the medical field. Smart medical care is the application of artificial intelligence technology to disease diagnosis and treatment. Computers can diagnose and treat, help doctors with statistics such as pathological examination reports, and independently provide medication assistance, triage guidance, health consultation and other services. Through technologies such as big data and deep mining, the patient's medical data is analyzed and mined to automatically identify the patient's clinical variables and indicators. Computers "learn" relevant professional knowledge, simulate doctors' thinking and diagnostic reasoning, and thus provide reliable diagnosis and treatment plans. That is, computers become brains with medical knowledge, simulate doctors' thinking and diagnostic reasoning, and provide auxiliary decision-making for doctors' diagnosis and treatment.
[0003] Deep learning technology has achieved some breakthroughs in the field of disease diagnosis. Its purpose is to establish a model to simulate the neural connection structure of the human brain. When dealing with practical problems, data is processed by multiple processing layers composed of multiple nonlinear transformations.
[0004] However, deep learning technology is a technology that relies on data-driven modeling. It needs to be trained with large-scale samples to achieve good generalization ability. In addition to the requirements for data quantity, data quality is also particularly important, especially for data related to the medical field. Most of them require experienced experts to manually sort out "standard answers" to improve the accuracy of deep learning predictions. In addition, due to its "black box" mechanism, deep learning is difficult to apply in the medical field, which has high requirements for explainability; it needs to be improved. Summary of the invention
[0005] The purpose of the embodiments of the present invention is to provide a personalized drug recommendation method and system based on a knowledge graph, which can calculate the similarity between the user portrait vector and the vector in the user feature vector space according to the high-dimensional vector converted from the user portrait, and determine the disease according to the user feature with the highest similarity, so as to assist the user in diagnosis and treatment; thereby, an accurate, fast and complete diagnosis and treatment plan can be implemented according to the user portrait, so that the user can experience accurate disease diagnosis online, and provide support for telemedicine and smart medicine.
[0006] One objective of an embodiment of the present invention is to provide a personalized drug recommendation method based on a knowledge graph, the method comprising the following steps:
[0007] Obtain a patient's disease data set, which includes diagnosis data, treatment records, and medication records;
[0008] Using a big model, generate knowledge in the form of triples of conceptual entities surrounding each medical code in diagnosis data, therapy records, and medication records; cluster nodes and edges of this knowledge to form a knowledge graph;
[0009] According to the diagnosis and treatment data of different patients, a personalized knowledge subgraph is constructed for each patient in combination with the knowledge recommended by the knowledge graph, and the time information in the diagnosis and treatment data of the patient is used for data labeling;
[0010] The knowledge subgraph is mapped to the word vector space using text embedding technology to obtain a feature fusion matrix; the feature fusion matrix is input into a bidirectional attention graph neural network for prediction to obtain a predicted drug recommendation result.
[0011] Another object of an embodiment of the present invention is to provide a personalized drug recommendation system based on knowledge graph, the system comprising: a data acquisition module, a large model module, a personalized knowledge graph construction module, and a bidirectional attention graph neural network module;
[0012] The data acquisition module is used to acquire a patient's disease data set, which includes diagnosis data, therapy records, and medication records;
[0013] The big model module is used to generate knowledge in the form of triples of conceptual entities surrounding each medical code in the diagnosis data, treatment records and medication records using the big model; and cluster the nodes and edges of the knowledge to form a knowledge graph;
[0014] The personalized knowledge graph construction module is used to construct a personalized knowledge subgraph for each patient based on the diagnosis and treatment data of different patients and the knowledge recommended by the knowledge graph, and to use the time information in the diagnosis and treatment data of the patient for data tagging;
[0015] The bidirectional attention graph neural network module is used to map the knowledge subgraph to the word vector space using text embedding technology to obtain a feature fusion matrix; the feature fusion matrix is input into the bidirectional attention graph neural network for prediction to obtain a predicted drug recommendation result.
[0016] The present invention also provides a computer device, including a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the processor executes the computer program, the steps of the personalized drug recommendation method based on the knowledge graph as described above are implemented.
[0017] A personalized drug recommendation method based on knowledge graph provided by an embodiment of the present invention has achieved the following beneficial effects compared with the existing technology: this method integrates data-driven and knowledge-driven, and can not only mine the patient's implicit disease information through the patient's medical records, but also introduce the knowledge graph as a knowledge decision, so as to obtain more accurate prediction results and realize accurate and intelligent auxiliary diagnosis compared with the current mainstream single information source for drug recommendation; the present invention uses a knowledge graph generated based on a large model, which has richer and more comprehensive patient personalized information compared with the traditional auxiliary drug recommendation based on the knowledge graph; and with the help of the data mining capabilities of deep learning, it can provide patients with medication recommendations that are more in line with their physical conditions, and have better explainability and credibility. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 A structural block diagram of a personalized drug recommendation system based on knowledge graph provided in an embodiment of the present invention;
[0019] Figure 2 A flowchart of a method for personalized drug recommendation based on a knowledge graph provided in an embodiment of the present invention;
[0020] Figure 3 A flow chart of preprocessing of a disease data set provided by an embodiment of the present invention;
[0021] Figure 4 A flowchart for constructing a personalized knowledge subgraph provided by an embodiment of the present invention;
[0022] Figure 5 The figure is a block diagram of the internal structure of a computer device in an embodiment of the invention. DETAILED DESCRIPTION
[0023] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0024] It should be noted that knowledge graph is an important technology in the field of artificial intelligence and the technical basis for building a computer medical knowledge brain. Therefore, knowledge graph has become one of the key technologies of intelligent medicine. After Ledley et al. first applied the data model to the field of clinical medicine, various forms of medical expert assistance devices emerged. The main workflow of these devices is to build the clinical experience and knowledge of medical experts to establish a medical knowledge base. Then the reasoning rules are formulated by experts. Finally, in practical applications, diagnosis and reasoning are performed based on the physical examination data input by the user. However, the mechanization of the device and the overly simple rule-based reasoning method have certain limitations in building a knowledge base and performing diagnostic reasoning on medical data with different data.
[0025] Large language models (i.e., large models) are one of the important research directions in the field of artificial intelligence in recent years. They have powerful language understanding and generation capabilities and have broad application potential for natural language processing tasks. Through deep network structures and self-attention mechanisms, they can effectively capture contextual information in texts and understand the logical relationships and semantic meanings in sentences. This has enabled large language models to achieve remarkable results in tasks such as text classification, sentiment analysis, and entity recognition. Its rich corpus information and huge number of parameters can form a huge implicit knowledge graph. It has been proven to have significant effects to extract knowledge from it and construct a knowledge graph through prompting technology.
[0026] With the development of computer technology, machine learning and artificial intelligence technology, more and more scholars have begun to use the combination of knowledge graphs and deep learning to make the algorithm have reliable performance and explainability. However, this method only focuses on the simple hierarchical relationship within the knowledge graph and ignores the comprehensive relationship between medical entities, making it difficult to give personalized drug recommendations for individual patients.
[0027] In summary, the current disease prediction system mainly uses the constructed knowledge graph in combination with deep learning methods to make drug recommendations and has achieved good results. However, this method only focuses on the simple hierarchical relationships within the knowledge graph and ignores the comprehensive relationships between medical entities, making it difficult to give personalized drug recommendations for individual patients. Therefore, the embodiment of the present invention utilizes the excellent reasoning ability of the large language model (LLM, referred to as the large model) and introduces the knowledge graph extracted by the large model to mine more detailed information for individual patients, establish a personalized knowledge graph for each patient, and make personalized drug recommendations in combination with deep learning.
[0028] Figure 2 A flowchart of a method for personalized drug recommendation based on a knowledge graph provided in an embodiment of the present invention may specifically include steps S101 to S107:
[0029] S101, obtaining a patient's disease data set, where the disease data set includes diagnosis data, treatment records, and medication records;
[0030] S103, using the big model to generate knowledge in the form of triples of conceptual entities surrounding each medical code in the diagnosis data, treatment records, and medication records; clustering nodes and edges of the knowledge to form a knowledge graph;
[0031] S105. Based on the diagnosis and treatment data of different patients, a personalized knowledge subgraph is constructed for each patient in combination with the knowledge recommended by the knowledge graph, and the time information in the diagnosis and treatment data of the patient is used for data tagging;
[0032] S107, mapping the knowledge subgraph to a word vector space using text embedding technology to obtain a feature fusion matrix; inputting the feature fusion matrix into a bidirectional attention graph neural network for prediction to obtain a predicted drug recommendation result;
[0033] In this embodiment, the method integrates data-driven and knowledge-driven methods. It can mine the patient's implicit disease information not only through the patient's medical records, but also by introducing the knowledge graph, a knowledge decision. Compared with the current mainstream single information source for drug recommendation, more accurate prediction results can be obtained, and accurate and intelligent auxiliary diagnosis can be achieved. The present invention uses a knowledge graph generated based on a large model, which has richer and more comprehensive patient personalized information compared to traditional auxiliary drug recommendations based on knowledge graphs. With the help of deep learning data mining capabilities, it can provide patients with medication recommendations that are more in line with their physical conditions, and have better explainability and credibility.
[0034] In step S101, in some scenarios, not all the collected diagnosis data, treatment records, and medication records are available, so the method further includes: after forming the disease data set, performing data cleaning;
[0035] After cleaning the data, named entity recognition technology is used to extract available entity data and construct the conceptual entity of the medical code to facilitate the representation of the medical code; it is convenient for the big model to generate triple-form knowledge around the conceptual entity of the medical code. In the process of generating knowledge in the form of triples, the big model can perform feature extraction, classification, and knowledge structuring on the input data through deep learning. Of course, the big model is an application of existing technology and will not be described in detail here.
[0036] In this embodiment, the big model is used to generate knowledge in the form of triples of conceptual entities around each medical code in the diagnosis data, treatment records, and medication records; in this step, the big model can deeply mine the comprehensive relationship between entities (or medical entities) in the diagnosis data, treatment records, and medication records. In this way, the constructed knowledge graph will not ignore the comprehensive relationship between medical entities, making it easy to give personalized drug recommendations for individual patients. That is, by introducing the knowledge graph extracted by the big model, more detailed information for individual patients can be mined, which helps to give more reasonable drug recommendations; at the same time, it also has reliable performance and interpretability.
[0037] In an example of this embodiment, the patient's disease data set can be obtained offline or online, taking online acquisition as an example. For example, through a multi-round dialogue interface, a dialogue is conducted with the patient, and the patient's dialogue is extracted to obtain one or more data of diagnosis data, treatment records, and medication records;
[0038] For example, if the user profile represented by the dialogue is (abdominal pain, diarrhea, nausea), by comparing the word segmentation or similarity calculation with the name features in the preset medical dictionary (abdominal pain, diarrhea, nausea, vomiting ==> acute gastroenteritis), it is found that the closest disease is acute gastroenteritis. Therefore, it can be concluded that there is a high probability of acute gastroenteritis.
[0039] In this step, the patient's diagnostic data includes but is not limited to the patient's basic information, which is personal information including height, weight, medical history, family medical history, etc.; as well as the patient's disease and symptom information, etc.
[0040] In some examples, the patient's diagnostic data may include the patient's diagnosis of his or her own symptoms. For example, "I have severe abdominal pain today, accompanied by nausea," which may be acute gastroenteritis. Deep learning can then extract the name of the disease as a reference or even as an important basis for diagnostic output.
[0041] like Figure 3 As shown, in an example of this embodiment, the method further includes:
[0042] After obtaining the patient's disease data set, data preprocessing is performed, including:
[0043] S202, embedding the text data and structured data in the disease dataset through a word embedding model, and mapping them into a state, procedure, and medication record representation matrix X;
[0044] S204, increasing or decreasing the state, program, and medication record representation matrix X by a certain amount of data to meet the data generation requirements of the large model.
[0045] like Figure 4 As shown, in an example of this embodiment, the steps of using the big model to generate knowledge in the form of triples of conceptual entities around each medical code in the diagnosis data, therapy records, and medication records; and clustering the nodes and edges of these knowledge to form a knowledge graph specifically include:
[0046] The text data and structured data in the disease data set are represented by word embedding through a word embedding model, and mapped into a state, program, and medication record representation matrix X. Then, step S401 is performed to generate knowledge in the form of triples for the state, program, and medication record representation matrix X through instructions, examples, and prompts to guide the large model; and the generated knowledge in the form of triples is integrated into a knowledge graph;
[0047] S402, clustering similar nodes and edges in the knowledge graph on the global graph G corresponding to all medical codes using a hierarchical clustering algorithm to obtain a new global graph G′;
[0048] Among them, the global graph G' is used to create a new knowledge subgraph, denoted as G' e .
[0049] S403. Create a new knowledge subgraph for each medical code; the knowledge subgraphs of all medical codes constitute the knowledge graph.
[0050] Specifically, G' e =(ν' e ,ε' e )∈G', where ν' e represents a node, ε' e Represents the edges in the graph;
[0051] In an example of this embodiment, the step of constructing a personalized knowledge subgraph for each patient based on the diagnosis and treatment data of different patients and the knowledge recommended by the knowledge graph specifically includes:
[0052] For each patient, a personalized knowledge subgraph is formed by merging the clustered knowledge of their medical codes;
[0053] Create a patient node P and connect it to the node corresponding to the directly corresponding diagnosis and treatment record in the knowledge subgraph;
[0054] The patient’s personalized knowledge subgraph is represented as:
[0055]
[0056] in, where e 1 ,e 2 ,…,e ω} is the medical code directly related to the patient, ω is the number of medical codes for the patient, ν' e , ε' represents the nodes of the patient's medical records and the edges in the graph;
[0057] If a patient is represented as a sequence of J consultations, the knowledge subgraph of patient i is represented as:
[0058]
[0059] The sequence of questions is {x_1,x_2,...,x_j}, where Here, the set with the subscript pat refers to the patient treatment record sequence; for 1≤j≤J.
[0060] In an example of this embodiment, the steps of mapping the knowledge subgraph to a word vector space using a text embedding technology to obtain a feature fusion matrix; and inputting the feature fusion matrix into a bidirectional attention graph neural network for prediction to obtain a predicted drug recommendation result specifically include:
[0061] Use text embedding technology to map the nodes and edges in the knowledge subgraph to the word vector space, and obtain the word embedding vectors corresponding to the nodes and the word embedding vectors corresponding to the edges respectively;
[0062] Perform dimensionality reduction processing on the word embedding vectors corresponding to the nodes and the word embedding vectors corresponding to the edges;
[0063] Calculate the knowledge subgraph for each visit of the patient and the nodes in the knowledge subgraph corresponding to each visit respectively;
[0064] Aggregate adjacent nodes in all visited knowledge subgraphs to update node embeddings;
[0065] After each node passes through the set multi-layer attention layer, the representation of the last layer of each node is obtained;
[0066] Set up a multi-layer perceptron of a bidirectional attention graph neural network and input the representation of the last layer of each node to obtain the deep feature z joint ;
[0067] The deep feature z joint Input into the sigmoid function to obtain the final probability output corresponding to each drug and give the corresponding drug code; that is, the predicted drug recommendation result is obtained.
[0068] In one embodiment, the obtained word embedding vectors corresponding to the nodes and the word embedding vectors corresponding to the edges are subjected to dimensionality reduction processing, which can improve model performance and solve the sparsity problem. In specific implementation, the word embedding vectors corresponding to the nodes and the word embedding vectors corresponding to the edges are respectively expressed as: The dimensionality reduction process is as follows:
[0069] Dimensionality reduction Where W v , b v is a learnable weight vector (same meaning below);
[0070] Then calculate the knowledge subgraph for each visit of the patient and the nodes in the knowledge subgraph corresponding to each visit, including the attention weight. For example: the node-level attention weight of the kth node in the knowledge subgraph visited by patient i for the jth time is expressed as α (i,j,k) and the visit-level attention weight of patient i’s jth visit, denoted as β (i,j) :The formula is as follows:
[0071] α i,j,1 ,…,α i,j,M =Softmax(W α g i,j +b α ), softmax is used to calculate α i,j,1 ,…,α i,j,M Mapping function of probability value;
[0072] β i,1 ,…,β i,N =λ T Tanh(w β G i +b β ), Tanh is the activation function;
[0073] Where λ=[λ 1 ,…,λ N ],g i,j ∈R M represents the multi-hot encoding of the visit-level subgraph, λ∈R N is the corresponding attenuation coefficient vector. G i Graph G representing patient i i A multi-hot matrix of , where N is the maximum number of visits for all patients.
[0074] In this example, node embeddings are updated by aggregating neighboring nodes in all knowledge subgraphs visited:
[0075]
[0076] Among them, ReLU represents the linear activation layer function, and the Aggregate function captures the contribution of attention-weighted nodes and edges, so the attention layer integrates the features of edges and nodes, enabling the model to learn rich representations of patients' disease data. After the set multi-layer attention layer, the representation of the last layer (L) of each node is obtained Used in subsequent processes.
[0077] In one example of this embodiment, in order to utilize the global information of the patient's knowledge graph and the local accurate diagnosis information corresponding to the electronic medical record, a multi-layer perceptron (MLP) of a bidirectional attention graph neural network is designed to meet the following requirements:
[0078]
[0079] The multi-layer perceptron is used to integrate the global information of the knowledge graph and the local accurate diagnosis information. Where J is the number of visits of patient i, K j is the number of nodes in visit j, represents the patient graph embedding obtained by averaging the embeddings of all nodes in all knowledge subgraphs and the embeddings of each node in each knowledge subgraph of patient i; represents the patient node embedding calculated by averaging the node embeddings linked to the patient’s corresponding medical code. i,j,k ∈{0,1}, is a binary label indicating that node v i ,j,k corresponds to the medical code of patient i. MEAN is the mean function, and MLP is the multi-layer perceptron function.
[0080] Then obtain the deep features z from the multi-layer perceptron joint After that, input to the sigmoid function:
[0081]
[0082] The final probability output P corresponding to each drug is obtained, e is a natural constant, and the corresponding drug code is given.
[0083] As described above, the multi-layer perceptron can utilize the global information of the patient knowledge graph and the local precise diagnosis information corresponding to the electronic medical record.
[0084] like Figure 1 As shown, in another embodiment, a personalized drug recommendation system based on knowledge graph, the system includes: a data acquisition module, a large model module, a personalized knowledge graph construction module, and a bidirectional attention graph neural network module;
[0085] The data acquisition module is used to acquire a patient's disease data set, which includes diagnosis data, therapy records, and medication records;
[0086] The big model module is used to generate knowledge in the form of triples of conceptual entities surrounding each medical code in the diagnosis data, treatment records and medication records using the big model; and cluster the nodes and edges of the knowledge to form a knowledge graph;
[0087] The personalized knowledge graph construction module is used to construct a personalized knowledge subgraph for each patient based on the diagnosis and treatment data of different patients and the knowledge recommended by the knowledge graph, and to use the time information in the diagnosis and treatment data of the patient for data tagging;
[0088] The bidirectional attention graph neural network module is used to map the knowledge subgraph to the word vector space using text embedding technology to obtain a feature fusion matrix; the feature fusion matrix is input into the bidirectional attention graph neural network for prediction to obtain a predicted drug recommendation result.
[0089] In an example of this embodiment, the data acquisition module includes a diagnosis record module, a surgical treatment record module and a medication record module.
[0090] Among them, the diagnosis record module is used to obtain the patient's diagnosis data, the surgical treatment record module is used to obtain the patient's treatment record; and the medication record module is used to obtain the patient's medication record.
[0091] In another embodiment, a computer device includes a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the processor executes the computer program, steps S101-S107 of the personalized drug recommendation method based on the knowledge graph as described above are implemented:
[0092] S101, obtaining a patient's disease data set, where the disease data set includes diagnosis data, treatment records, and medication records;
[0093] S103, using the big model to generate knowledge in the form of triples of conceptual entities surrounding each medical code in the diagnosis data, treatment records, and medication records; clustering nodes and edges of the knowledge to form a knowledge graph;
[0094] S105. Based on the diagnosis and treatment data of different patients, a personalized knowledge subgraph is constructed for each patient in combination with the knowledge recommended by the knowledge graph, and the time information in the diagnosis and treatment data of the patient is used for data tagging;
[0095] S107. Map the knowledge subgraph to the word vector space using text embedding technology to obtain a feature fusion matrix; input the feature fusion matrix into a bidirectional attention graph neural network for prediction to obtain a predicted drug recommendation result.
[0096] In this step, for the word vector space, the text information represented by the knowledge subgraph can be converted into a vector through word2vec, and the vector is mapped to the word vector space to obtain a feature fusion matrix;
[0097] Among them, the bidirectional attention graph neural network includes: convolution layer, pooling layer, fully connected layer and output layer;
[0098] Using a convolutional layer to extract all local feature vectors in the feature fusion matrix;
[0099] Through the pooling layer, the maximum pooling operation is applied to all local feature vectors output by the convolutional layer, and the maximum value is selected to represent the local feature;
[0100] In the fully connected layer, the above multi-layer perceptron is used as a replacement to obtain the above deep features z joint ;
[0101] Output layer: used to convert the output of the fully connected layer into a probability distribution to determine the drug recommendation results.
[0102] The embodiment of the present invention provides a personalized drug recommendation method based on knowledge graph, and based on this method provides a personalized drug recommendation system based on knowledge graph. The method integrates data-driven and knowledge-driven. Not only through the patient's medical records, but also by introducing the knowledge graph as a knowledge decision, the patient's implicit disease information can be mined. Compared with the current mainstream single information source for drug recommendation, more accurate prediction results can be obtained, and accurate and intelligent auxiliary diagnosis can be achieved. The present invention uses a knowledge graph generated based on a large model, which has richer and more comprehensive patient personalized information compared to traditional auxiliary drug recommendations based on knowledge graphs. With the help of deep learning data mining capabilities, patients can be provided with medication recommendations that are more in line with their physical conditions, and have better explainability and credibility.
[0103] Figure 5 The internal structure diagram of a computer device in one embodiment is shown. The computer device includes a processor, a memory, a network interface, an input device and a display screen connected via a system bus. Among them, the memory includes a non-volatile storage medium and an internal memory. The non-volatile storage medium of the computer device stores an operating system and may also store a computer program, which, when executed by the processor, enables the processor to implement a personalized drug recommendation method based on a knowledge graph. The internal memory may also store a computer program, which, when executed by the processor, enables the processor to execute a personalized drug recommendation method based on a knowledge graph. The display screen of the computer device may be a liquid crystal display or an electronic ink display screen, and the input device of the computer device may be a touch layer covered on the display screen, or may be a button, trackball or touchpad provided on the housing of the computer device, or may be an external keyboard, touchpad or mouse, etc.
[0104] It should be understood that, although each step in the flow chart of each embodiment of the present invention is shown in sequence according to the indication of the arrow, these steps are not necessarily performed in sequence according to the order indicated by the arrow. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be performed in other orders. Moreover, at least a portion of the steps in each embodiment may include a plurality of sub-steps or a plurality of stages, and these sub-steps or stages are not necessarily performed at the same time, but can be performed at different times, and the execution order of these sub-steps or stages is not necessarily performed in sequence, but can be performed in turn or alternately with at least a portion of other steps or sub-steps or stages of other steps.
[0105] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the program can be stored in a non-volatile computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0106] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0107] The above-mentioned embodiments only express several implementation methods of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the patent of the present invention. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.
[0108] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A personalized drug recommendation method based on knowledge graph, characterized in that: The method comprises the following steps: Obtain a patient's disease data set, which includes diagnosis data, treatment records, and medication records; Using a big model, generate knowledge in the form of triples of conceptual entities surrounding each medical code in diagnosis data, therapy records, and medication records; cluster nodes and edges of this knowledge to form a knowledge graph; Based on the diagnosis and treatment data of different patients, we build a personalized knowledge subgraph for each patient in combination with the knowledge recommended by the knowledge graph, and use the time information in the patient's diagnosis and treatment data for data labeling; Mapping the knowledge subgraph to a word vector space using text embedding technology to obtain a feature fusion matrix; inputting the feature fusion matrix into a bidirectional attention graph neural network for prediction to obtain a predicted drug recommendation result; The method further comprises: After obtaining the patient's disease data set, data preprocessing is performed, including: The text data and structured data in the disease dataset are represented by word embedding through the word embedding model and mapped into the state, procedure, and medication record representation matrix X; The state, program, and medication record representation matrix X is increased or decreased by a certain amount of data to meet the data generation requirements of the large model; The steps of using the big model to generate knowledge in the form of triples of conceptual entities surrounding each medical code in the diagnosis data, therapy records, and medication records; and clustering the nodes and edges of the knowledge to form a knowledge graph specifically include: For the state, procedure, and medication record representation matrix X, the large model is guided to generate knowledge in the form of triples through instructions, examples, and prompts; the generated knowledge in the form of triples is integrated into a knowledge graph; similar nodes and edges in the knowledge graph are clustered on the global graph G corresponding to all medical codes using a hierarchical clustering algorithm to obtain a new global graph G'; A new knowledge subgraph is created for each medical code; the knowledge subgraphs of all medical codes constitute the knowledge graph; The steps of mapping the knowledge subgraph to the word vector space using text embedding technology to obtain a feature fusion matrix; and inputting the feature fusion matrix into a bidirectional attention graph neural network for prediction to obtain a predicted drug recommendation result specifically include: Use text embedding technology to map the nodes and edges in the knowledge subgraph to the word vector space, and obtain the word embedding vectors corresponding to the nodes and the word embedding vectors corresponding to the edges respectively; Perform dimensionality reduction processing on the word embedding vectors corresponding to the nodes and the word embedding vectors corresponding to the edges; Calculate the knowledge subgraph for each visit of the patient and the nodes in the knowledge subgraph corresponding to each visit respectively; Aggregate adjacent nodes in all visited knowledge subgraphs to update node embeddings; After each node passes through the set multi-layer attention layer, the representation of the last layer of each node is obtained; Set up a multi-layer perceptron of a bidirectional attention graph neural network and input the representation of the last layer of each node to obtain the deep feature z joint ; The deep feature z joint Input into the sigmoid function to obtain the final probability output corresponding to each drug and give the corresponding drug code; that is, the predicted drug recommendation result is obtained.
2. The method for personalized drug recommendation based on knowledge graph according to claim 1, characterized in that: The step of constructing a personalized knowledge subgraph for each patient based on the diagnosis and treatment data of different patients and the knowledge recommended by the knowledge graph specifically includes: For each patient, a personalized knowledge subgraph is formed by merging the clustered knowledge of their medical codes; a patient node P is created and connected to the node corresponding to the diagnosis and treatment record directly in the knowledge subgraph; The patient’s personalized knowledge subgraph is represented as: in , , where {e1, e2, ..., e ω } is the medical code directly related to the patient, ω is the number of medical codes for the patient; If a patient is represented as a sequence of J consultations, the knowledge subgraph of patient i is represented as: The sequence of questions is {x_1, x_2, ..., x_j}, where For 1≤j≤J.
3. A personalized drug recommendation system based on knowledge graph, characterized in that: Used to implement the personalized drug recommendation method based on knowledge graph according to claim 1 or 2; the system includes: a data acquisition module, a large model module, a personalized knowledge graph construction module, and a bidirectional attention graph neural network module; The data acquisition module is used to acquire a patient's disease data set, which includes diagnosis data, therapy records, and medication records; The big model module is used to generate knowledge in the form of triples of conceptual entities surrounding each medical code in the diagnosis data, treatment records and medication records using the big model; and cluster the nodes and edges of the knowledge to form a knowledge graph; The personalized knowledge graph construction module is used to construct a personalized knowledge subgraph for each patient based on the diagnosis and treatment data of different patients and the knowledge recommended by the knowledge graph, and to use the time information in the diagnosis and treatment data of the patient for data tagging; The bidirectional attention graph neural network module is used to map the knowledge subgraph to the word vector space using text embedding technology to obtain a feature fusion matrix; the feature fusion matrix is input into the bidirectional attention graph neural network for prediction to obtain a predicted drug recommendation result.
4. The personalized drug recommendation system based on knowledge graph according to claim 3, characterized in that: The data acquisition module includes a diagnosis record module, a surgical treatment record module and a medication record module.
5. A computer device comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, characterized in that: When the processor executes the computer program, the steps of the personalized drug recommendation method based on the knowledge graph as described in any one of claims 1 to 2 are implemented.
Citation Information
Patent Citations
Graph neural network model construction method, system and device, diagnosis and treatment scheme recommendation method, system and device
CN113434692A
Chinese herbal medicine recommendation method and device, electronic equipment and storage medium
CN117133414A