Matching method between disease and medicine based on naive Bayesian network
Through the disease and drug matching method based on the naive Bayesian network, the problem of drug compatibility dependence on experience in traditional Chinese and Mongolian medical treatment is solved, the nonlinear relationship between the disease and the drug is accurately matched, the irrational use of drugs is reduced, and the work efficiency of doctors is improved. .
Patent Information
- Application Number
- CN202210639583.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-08
- Publication Date
- 2024-09-17
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The drug compatibility process in traditional Chinese and Mongolian medicine treatment relies on the doctor's experience, and it is difficult to accurately match the non-linear mapping relationship between the disease and the drug, resulting in irrational drug use and increased doctor work dependence.
Using the disease and drug matching method based on the Naive Bayesian network, by collecting formula sample sets, performing binarization processing and training the Naive Bayesian network model, the probability and conditional probability of the disease and drug are calculated, and the characteristics of each drug are inferred. Use posterior probabilities to recommend reasonable drug combinations.
Reduce irrational drug use, reduce doctors’ reliance on experience, improve treatment efficiency, and provide accurate drug compatibility recommendations.
Smart Images

Figure CN114822875B
Abstract
Description
Technical field:
[0001] The present invention relates to the field of biomedicine technology, and in particular to a method for matching symptoms and drugs based on a naive Bayesian network. Background technology:
[0002] In the traditional Chinese and Mongolian medicine treatment process, doctors need to prescribe medicine for patients based on what they have learned. However, due to the complexity and diversity of symptoms and the efficacy of medicinal materials, the doctor is highly dependent on his or her experience when prescribing drugs. This leads to irrational use of drugs, which will directly affect the treatment effect and even the health of the patient.
[0003] At present, there are many methods to study the relationship between the drugs in the prescription and the diseases they treat, and most of them use the method of decomposing the prescription, such as the drug pair research method, the single drug research method, etc. This kind of method can obviously only change one or two drugs while keeping other drugs unchanged, explore the relationship between the drugs in the prescription and the disease, and study one or two drugs for the diseases treated in the prescription. Obviously, it is not possible to accurately conduct a comprehensive study on the nonlinear mapping relationship between the diseases treated in the prescription and the drugs from an overall perspective, and it is impossible to provide a reference for doctors to prescribe medicines, and it is impossible to efficiently and effectively reduce the situation of irrational drug use and the degree of dependence on doctors' experience. Summary of the invention:
[0004] The purpose of the present invention is to provide a method for matching symptoms and drugs based on a naive Bayesian network, which can provide a reference for determining a treatment plan, recommend reasonable, effective and efficient drugs to doctors, reduce the situation of irrational use of drugs, reduce the degree of dependence on doctors' experience, and improve doctors' work efficiency.
[0005] The present invention is implemented by the following technical solutions:
[0006] The matching method of disease and medicine based on naive Bayesian network includes the following steps:
[0007] S1. Collect several traditional prescriptions, match the symptoms X corresponding to the prescriptions with the drugs Y used, and form a prescription sample set Z;
[0008] S2, using part of the recipes in the recipe sample set Z established in S1 as a training recipe set, binarizing the training recipe set to obtain a training set, using the training set to train the naive Bayesian network model, and calculating the probability P(x i ), the probability of drug P(y j ) and the conditional probability P(x i =t|y j=1), t=0, 1 represents the symptom x i There are two cases: absence and presence, l = 0, 1 represents drug y j There are two situations: unused and used;
[0009] S3, taking the symptom X' of the case to be prescribed as an input parameter, and calculating the probability P(x') of the symptom calculated in S2. i ), the probability of drug P(y j ) and the conditional probability P(x i =t|y j = l), calculate the posterior probability P(y j =1|X) and the posterior probability P(y j =0|X), where X=(x 1 , x 2 , …, x i , …, x I ) represents the symptoms of each disease of the patient, x i The value of (i=1, 2, ..., I) is 1 or 0;
[0010] S4. Compare P(y j =1|X) and P(y j =0|X), if P(y j =1|X)≥P(y j =0|X), then the medicine is judged to be a medicine that matches the symptoms X' of the case, and all the medicines that match the symptoms X' of the case are combined to obtain the matching medicine result Y=(y 1 ,y 2 , ..., y J ).
[0011] Preferably, in said S1,
[0012] Recipe sample set Z = {(X1, Y1), (X2, Y2), ..., (X n , Y n ),…,(X N , Y N )},
[0013] Where N is the total number of recipes in the recipe sample set;
[0014] The corresponding symptom characteristics in the nth recipe are recorded as In vector It is the symptom of the i-th disease corresponding to the n-th recipe;
[0015] The drug combination in the nth prescription is recorded as In vector It is the jth medicine in the nth recipe.
[0016] Preferably, S2 comprises the following steps: the method of binarizing the training recipe set is: in a recipe, if the symptom x i If present, then the symptoms of the disease are x i Assign 1; if the symptom x i If not present, then x i Assign a value of 0; similarly, if the prescription contains drug y j , then for this drug y j Assign a value of 1; if the prescription does not contain drug y j , then for this drug y j Assign the value 0.
[0017] Preferably, S2 comprises the following steps:
[0018] (1) Calculate the probability P(x) of the symptoms in the training set i ) and the probability of drug P(y j ), specifically,
[0019]
[0020] In formula (1), Indicates the symptoms x in the training set i = the cumulative frequency of t, t = 0, 1 represents the symptom x i There are two cases: absence and presence, that is, t = 0 means the symptom x in the nth recipe i does not exist, t=1 means the symptom x in the nth recipe i exists, N is the total number of recipes in the recipe sample set;
[0021]
[0022] In formula (2), Indicates the drug y in the training set j = the cumulative frequency of l; l = 0, 1 represents drug y j There are two cases: not used and used, that is, l = 0 means that drug y in the nth formula j Not used, l=1 means drug y in the nth formula j is used, N is the total number of recipes in the recipe sample set;
[0023] (2) Calculate the symptoms x in the training set i = t and drug y j = l when the probability P(x i =t,y j =1),
[0024]
[0025] In formula (3), Indicates the symptoms x in the training set i = t and drug y j =The cumulative frequency of the formula at l;
[0026] (3) Calculate the conditional probability P(x) between the symptoms and the drug i =t|y j =1),
[0027]
[0028] Substituting equations (2) and (3) into equation (4) we can find the conditional probability.
[0029] Preferably, in S3: the posterior probability P(y j =l|X) is calculated as follows:
[0030]
[0031] In formula (5), X = (x 1 , x 2 , …, x i , …, x I ) represents the symptoms of each disease of the patient, x i (i=1,2,…,I) takes the value of 1 or 0; l=0,1 represents drug y j There are two cases of unused and used, that is, P(y j =0|X) represents drug y j The unused posterior probability, P(y j =1|X) represents drug y j The posterior probability used.
[0032] Advantages of the present invention:
[0033] The present invention is based on symptoms (x 1 , x 2 , …, x i , …, x I ) as input nodes, each input node represents a symptom of a disease; 1 ,y 2 , …, y j , …, y J) as output nodes, each output node represents a medicine; the connection between the input node and the output node represents the mapping relationship between the disease symptoms and the medicine. The relationship between the disease symptom node and the medicine node is represented by conditional probability, which reflects the probability strength between each input node and the output node. The larger the conditional probability, the stronger the correlation between the disease symptoms and the medicine at both ends of the connection, that is, the more suitable the medicine is for treating the disease symptoms.
[0034] Through the present invention, doctors only need to determine the patient's symptoms and input the symptoms to output matching drug results, which can provide a reference for determining treatment plans, recommend reasonable, effective and efficient drugs to doctors, reduce irrational use of drugs, reduce dependence on doctors' experience, and improve doctors' work efficiency. Description of the drawings:
[0035] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0036] Figure 1 The flowchart of the method for matching disease and medicine based on naive Bayesian network of the present invention;
[0037] Figure 2 This is a structural model diagram of the disease and drug matching method based on the naive Bayesian network of the present invention. Specific implementation method:
[0038] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0039] Embodiment 1:
[0040] like Figure 1 , Figure 2 The method for matching disease and medicine based on naive Bayesian network shown includes the following steps:
[0041] S1. Collect 24 traditional Mongolian medicine prescriptions, match the symptoms X corresponding to the prescriptions with the medicine Y used, and form a prescription sample set
[0042] Z={(X1, Y1), (X2, Y2),…, (X n , Yn ) ,…,(X 24 , Y 24 )}, as shown in Table 1.
[0043] Table 1 Recipe sample set
[0044]
[0045]
[0046]
[0047]
[0048] Table 1 involves 46 symptoms and 78 medicines. i (i=1, 2, ..., 46) and drug y j (j=1, 2,…, 78) are listed in Table 2.
[0049] Table 2 Symptoms and medications
[0050]
[0051] S2. The first 22 recipes in the recipe sample set Z established in S1 are used as the training recipe set, as shown in Table 3; the last 2 are used as the test recipe set.
[0052] Table 3 Training recipe set
[0053]
[0054]
[0055]
[0056] The symptoms x in the training formula set in Table 3 i and drugs j Binarize the data, that is, in a formula, if the symptom x i If present, then the symptoms of the disease are x i Assign 1; if the symptom x i If not present, then x i Assign 0; when When , it means that the symptom of the i-th disease exists in the n-th prescription, that is, the drug combination in the n-th prescription can treat the symptom of the disease; when When , it means that the symptom of the ith disease does not exist in the nth prescription, that is, the drug combination in the nth prescription does not treat the symptom of the disease. Similarly, if the prescription contains drug y j , then for this drug y j Assign a value of 1; if the prescription does not contain drug y j , then for this drug y j Assign 0; when When the jth drug is used in the nth formula, When , it means that the jth drug is not used in the nth formula. Finally, the training set shown in Table 4 is formed.
[0057] Table 4 Training set
[0058]
[0059] The naive Bayesian network model is trained using the training set to calculate the probability P(x i ), the probability of drug P(y j ) and the conditional probability P(x i =t|y j =1), t=0, 1 represents the symptom x i There are two cases: absence and presence, l = 0, 1 represents drug y j There are two situations: unused and used; specifically, the following steps are included:
[0060] (1) Calculate the probability P(x) of the symptoms in the training set i ) and the probability of drug P(y j ), specifically,
[0061]
[0062] In formula (1), Indicates the symptoms x in the training set i = the cumulative frequency of t, t = 0, 1 represents the symptom x i There are two cases: absence and presence, that is, t = 0 means the symptom x in the nth recipe i does not exist, t=1 means the symptom x in the nth recipe i Existence, N is the total number of formulas in the formula sample set; Formula (1) can be used to calculate the probability of non-existence of each symptom P(x i =0) and the probability of each symptom existing P(x i =1).
[0063]
[0064] In formula (2), Indicates the drug y in the training set j = the cumulative frequency of l; l = 0, 1 represents drug y j There are two cases: not used and used, that is, l = 0 means that drug y in the nth formula j Not used, l=1 means drug y in the nth formula j is used, N is the total number of formulas in the formula sample set; the probability of each medicine not being used P(y j =0) and the probability of drug use P(y j =1).
[0065] (2) Calculate the symptoms x in the training set i = t and drug y j = l when the probability P(x i =t,y j =1),
[0066]
[0067] In formula (3), Indicates the symptoms x in the training set i = t and drug y j =The cumulative frequency of the formula at l;
[0068] Formula (3) can be used to calculate the probability of drugs and symptoms in different situations in the prescription training set, which are P(x i =1,y j =1), P(x i =1,y j =0), P(x i =0,y j =1) and P(x i =0,y j =0) four-part probability.
[0069] (3) Calculate the conditional probability P(x) between the symptoms and the drug i =t|y j =1),
[0070]
[0071] The calculated data P(y j =1) and P(x i =1,y j =1) into formula (4) to calculate the conditional probability P(x i =1|y j =1); the calculated data P(y j =1) and P(xi =0,y j =1) into formula (4) to calculate the conditional probability P(x i =0|y j =1); the calculated data P(y j =0) and P(x i =1,y j =0) into formula (4) to calculate the conditional probability P(x) of drug non-use and the presence of disease symptoms in the training set. i =1|y j =0); the calculated data P(y j =0) and P(x i =0,y j =0) into formula (4) to calculate the conditional probability P(x) that the drug is not used and the symptoms do not exist in the training set. i =0|y j =0).
[0072] S3, taking the symptom X' of the case to be prescribed as an input parameter, and calculating the probability P(x') of the symptom calculated in S2. i ), the probability of drug P(y j ) and the conditional probability P(x i =t|y j = l), calculate the posterior probability P(y j =1|X) and the posterior probability P(y j =0|X), where X=(x 1 , x 2 , …, x i , …, x I ) represents the symptoms of each disease of the patient, x i The value of (i=1, 2, ..., I) is 1 or 0;
[0073] The posterior probability P(y) of using and not using each drug j =l|X) is calculated as follows:
[0074]
[0075] In formula (5),
[0076] X=(x 1 , x 2 , …, x i , …, x I ) represents the various symptoms of the patient, x iThe value of (i=1, 2, ..., I) is 1 or 0. l=0, 1 represents drug y j There are two cases of unused and used, that is, P(y j =0|X) represents drug y j The unused posterior probability, P(y j =1|X) represents drug y j The posterior probability used.
[0077] S4. Compare P(y j =1|X) and P(y j =0|X), if P(y j =1|X)≥P(y j =0|X), then the medicine is judged to be a medicine that matches the symptoms X' of the case, and all the medicines that match the symptoms X' of the case are combined to obtain the matching medicine result Y=(y 1 ,y 2 , ..., y J ).
[0078] Experimental Example 1:
[0079] The symptoms corresponding to the two formulas in the test formula set in Example 1 were used to obtain drugs matching them using the method of the present invention, and then the consistency of the drug compatibility in the traditional formula and the drug compatibility given by the method of the present invention was verified. The symptoms and drug compatibility are listed in Table 5.
[0080] Table 5 Test recipe set
[0081]
[0082] Table 5 Test formula set symptoms x i and drugs j The data is binarized and finally a test set is formed.
[0083] Using the symptoms in the test set as input parameters, according to the method of Example 1, first, the probability P(x i ), the probability of drug P(y j ) and the conditional probability P(x i =t|y j = l), and then calculate the posterior probability P(y j =1|X) and the posterior probability P(y j =0|X). j =0|X) and P(y j =1|X) for comparison, if P(y j=1|X)≥P(y j =0|X), then it is judged that the drug is used under the symptoms of the disease, otherwise it is judged that the drug is not used under the symptoms of the disease; finally, all the drugs judged to be used under the symptoms of the disease are matched, that is, the drug result Y=(y 1 ,y 2 , ..., y J ), and the results are listed in Table 6.
[0084] Table 6 Drug results obtained by using the method of the present invention to match
[0085]
[0086] Comparing the traditional drug combinations in Table 5 with the drug results obtained by using the method of the present invention in Table 6, it can be seen that the two groups of drug combinations in sequence number 2 are exactly the same. In sequence number 1, there are 9 drugs in the traditional formula of Table 5, while there are 10 drugs in Table 6 using the method of the present invention to obtain the drug results matching the traditional drug combinations, among which Table 6 uses Gardenia, Toosendan Fructus and Carthamus tinctorius to replace the rabbit heart and clove in Table 5.
[0087] For the symptoms in sequence number 2, the matching drug results obtained by the traditional formula and the present invention are different, so the following analysis is performed:
[0088] According to formula (5) in Example 1, the posterior probability P(x) of using a single drug under a single symptom can be calculated. i =1|y j =1), it can reflect the therapeutic effect of the drug on the symptoms of the disease. i =1), P(y j =1) and P(x i =1|y j =1) into formula (5) to obtain the posterior probability P(y j =1|x i =1), that is, the use and non-use of single-flavor drugs are obtained, and the results are shown in Table 7.
[0089] Table 7 Use and non-use of single drugs
[0090]
[0091] The symptoms listed in Table 7 are the symptoms that appear in sequence number 2, and it can be seen that the therapeutic effects of various medicines on various symptoms. From Table 7, it can be seen that in the treatment of palpitations, in the traditional formula of drug compatibility, cloves and rabbit hearts are better than gardenia, Chuanlianzi and safflower; and in terms of chest pain, gardenia and Chuanlianzi have better therapeutic effects than cloves and rabbit hearts. Safflower has better therapeutic effects than cloves and rabbit hearts in terms of cough and white sputum. Therefore, for patients with severe chest pain, cough and white sputum, the drug compatibility in Table 5 can be used; for patients with severe palpitations, the drug compatibility in Table 4 can be used.
[0092] In summary, it can be seen that the method for matching medicines to disease symptoms of the present invention is reliable.
[0093] 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, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for matching disease and medicine based on naive Bayesian network, characterized in that: The following steps are involved: S1. Collect several traditional prescriptions, match the symptoms X corresponding to the prescriptions with the drugs Y used, and form a prescription sample set Z; S2, using part of the recipes in the recipe sample set Z established in S1 as a training recipe set, binarizing the training recipe set to obtain a training set, using the training set to train the naive Bayesian network model, and calculating the probability P(x i ), the probability of drug P(y j ) and the conditional probability P(x i =t|y j = l), t = 0, 1 represents the symptom x i There are two cases: absence and presence, l = 0, 1 represents drug y j There are two situations: unused and used; S3, taking the symptom X' of the case to be prescribed as an input parameter, and calculating the probability P(x') of the symptom calculated in S2. i ), the probability of drug P(y j ) and the conditional probability P(x i =t|y j = l), calculate the posterior probability P(y j =1|X) and the posterior probability P(y j =0|X), where X=(x 1 ,x 2 ,…,x i ,…,x I ) represents the symptoms of each disease of the patient, x i The value of (i=1,2,…,I) is 1 or 0; S4. Compare P(y j =1|X) and P(y j =0|X), if P(y j =1|X)≥P(y j =0|X), then the medicine is judged to be a medicine that matches the symptoms X' of the case, and all the medicines that match the symptoms X' of the case are combined to obtain the matching medicine result Y=(y 1 ,y 2 ,…,y J ).
2. The method for matching symptoms and drugs based on a naive Bayesian network according to claim 1, characterized in that: In S1, Recipe sample set Z = {(X1, Y1), (X2, Y2), …, (X n ,Y n ),…,(X N ,Y N )}, Where N is the total number of recipes in the recipe sample set; The corresponding symptom characteristics in the nth recipe are recorded as In vector It is the symptom of the i-th disease corresponding to the n-th recipe; The drug combination in the nth prescription is recorded as In vector It is the jth medicine in the nth recipe.
3. The method for matching symptoms and drugs based on a naive Bayesian network according to claim 2, characterized in that: The S2 comprises the following steps: the method of binarizing the training recipe set is: in a recipe, if the symptom x i If present, then the symptoms of the disease are x i Assign 1; if the symptom x i If not present, then x is the symptom of the disease i Assign a value of 0; similarly, if the prescription contains drug y j , then for this drug y j Assign a value of 1; if the prescription does not contain drug y j , then for this drug y j Assign the value 0.
4. The method for matching symptoms and drugs based on a naive Bayesian network according to claim 2, characterized in that: The S2 comprises the following steps: (1) Calculate the probability P(x) of the symptoms in the training set i ) and the probability of drug P(y j ), specifically, In formula (1), Indicates the symptoms x in the training set i = the cumulative frequency of t, t = 0, 1 represents the symptom x i There are two cases: absence and presence, that is, t = 0 means the symptom x in the nth recipe i does not exist, t=1 means the symptom x in the nth recipe i exists, N is the total number of recipes in the recipe sample set; In formula (2), Indicates the drug y in the training set j = the cumulative frequency of l; l = 0, 1 represents drug y j There are two cases: not used and used, that is, l = 0 means that drug y in the nth formula j Not used, l=1 means drug y in the nth formula j is used, N is the total number of recipes in the recipe sample set; (2) Calculate the symptoms x in the training set i = t and drug y j = l when the probability P(x i =t,y j =1), In formula (3), Indicates the symptoms x in the training set i = t and drug y j =The cumulative frequency of the formula at l; (3) Calculate the conditional probability P(x) between the symptoms and the drug i =t|y j =1), Substituting equations (2) and (3) into equation (4) we can find the conditional probability.
5. The method for matching symptoms and drugs based on a naive Bayesian network according to claim 4, characterized in that: In S3: the posterior probability P(y) of each drug being used and not being used j =l|X) is calculated as follows: In formula (5), X = (x 1 ,x 2 ,…,x i ,…,x I ) represents the symptoms of each disease of the patient, x i (i=1,2,…,I) takes the value of 1 or 0; l=0,1 represents drug y j There are two cases of unused and used, that is, P(y j =0|X) represents drug y j The unused posterior probability, P(y j =1|X) represents drug y j The posterior probability used.
