Training method, device, storage medium and computer equipment for drug recommendation model

Training a lightweight drug recommendation model through knowledge distillation solves the problem that existing models cannot be deployed online, and achieves efficient drug recommendation and diagnostic assistance.

CN113569999BActive Publication Date: 2025-04-29SHENZHEN PING AN MEDICAL HEALTH TECHNOLOGY SERVICES CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111017415.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-31
Publication Date
2025-04-29
Estimated Expiration
2041-08-31

AI Technical Summary

Technical Problem

The existing machine learning model is used for drug recommendations. Due to the large number of parameters and heavy models, it cannot be deployed online, so it cannot assist doctors in online consultations.

Method used

A lightweight drug recommendation model is trained through knowledge distillation, and a preset natural language model is used to extract the distribution characteristics of sample disease information, and a loss function is constructed based on these features for iterative training to build a drug recommendation model that can be deployed online.

Benefits of technology

While ensuring the accuracy of drug recommendation, it reduces model parameters and calculation volume, improves drug recommendation efficiency, and can effectively assist doctors in online consultations, thereby improving diagnostic efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113569999B_ABST
    Figure CN113569999B_ABST
Patent Text Reader

Abstract

The present invention discloses a training method, device, storage medium and computer equipment for a drug recommendation model, which is mainly capable of using the knowledge distillation method to train a lightweight drug recommendation model for online deployment. The method includes: using a preset natural language model to extract the first distribution characteristics of the sample disease information for different drug information; inputting the sample disease information into a preset initial drug recommendation model for drug recommendation, and obtaining the second distribution characteristics of the sample disease information for the different drug information, and the recommended drug information corresponding to the sample disease information; respectively constructing the first loss function and the second loss function corresponding to the initial drug recommendation model; based on the first loss function and the second loss function, iteratively training the initial drug recommendation model to construct a preset drug recommendation model. The present invention relates to the fields of artificial intelligence and digital medicine.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence, and in particular to a training method, device, storage medium and computer equipment for a drug recommendation model. Background Art

[0002] With the rise of online consultation models in the medical field, patients can conduct online consultations through the Internet without leaving their homes. During the online consultation process, the doctor determines the patient's disease based on the condition described by the patient and prescribes corresponding prescription drugs for the patient. This online consultation method brings great convenience to users and also enables doctors to diagnose more patients.

[0003] At present, in the process of diagnosing patients, machine learning technology can be used to recommend appropriate drugs for patients. However, due to the large number of parameters and heavy model of existing machine learning models, this machine learning model for drug recommendation is only applicable offline and cannot be deployed online, thus failing to assist doctors in online consultations. Summary of the invention

[0004] The present invention provides a training method, device, storage medium and computer equipment for a drug recommendation model, which mainly uses the knowledge distillation method to train a lightweight drug recommendation model for online deployment, while ensuring the accuracy of drug recommendations and improving the efficiency of drug recommendations.

[0005] According to a first aspect of the present invention, a method for training a drug recommendation model is provided, comprising:

[0006] Obtain the patient's sample disease information and its corresponding actual drug information;

[0007] Extracting first distribution features of the sample disease information for different drug information using a preset natural language model;

[0008] Inputting the sample disease information into a preset initial drug recommendation model to perform drug recommendation, obtaining a second distribution feature of the sample disease information for the different drug information, and recommended drug information corresponding to the sample disease information;

[0009] Based on the first distribution feature and the second distribution feature, as well as the actual drug information and the recommended drug information, respectively construct a first loss function and a second loss function corresponding to the initial drug recommendation model;

[0010] Based on the first loss function and the second loss function, the initial drug recommendation model is iteratively trained to construct a preset drug recommendation model.

[0011] According to a second aspect of the present invention, there is provided a training device for a drug recommendation model, comprising:

[0012] An acquisition unit, used to acquire the patient's sample disease information and its corresponding actual drug information;

[0013] An extraction unit, configured to extract first distribution features of the sample disease information for different drug information using a preset natural language model;

[0014] A recommendation unit, configured to input the sample disease information into a preset initial drug recommendation model to make drug recommendations, and obtain a second distribution feature of the sample disease information for the different drug information, and recommended drug information corresponding to the sample disease information;

[0015] A construction unit, configured to respectively construct a first loss function and a second loss function corresponding to the initial drug recommendation model based on the first distribution feature and the second distribution feature, as well as the actual drug information and the recommended drug information;

[0016] A training unit is used to iteratively train the initial drug recommendation model based on the first loss function and the second loss function to construct a preset drug recommendation model.

[0017] According to a third aspect of the present invention, there is provided a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the following steps:

[0018] Obtain the patient's sample disease information and its corresponding actual drug information;

[0019] Extracting first distribution features of the sample disease information for different drug information using a preset natural language model;

[0020] Inputting the sample disease information into a preset initial drug recommendation model to perform drug recommendation, obtaining a second distribution feature of the sample disease information for the different drug information, and recommended drug information corresponding to the sample disease information;

[0021] Based on the first distribution feature and the second distribution feature, as well as the actual drug information and the recommended drug information, respectively construct a first loss function and a second loss function corresponding to the initial drug recommendation model;

[0022] Based on the first loss function and the second loss function, the initial drug recommendation model is iteratively trained to construct a preset drug recommendation model.

[0023] According to a fourth aspect of the present invention, there is provided a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the following steps are implemented:

[0024] Obtain the patient's sample disease information and its corresponding actual drug information;

[0025] Extracting first distribution features of the sample disease information for different drug information using a preset natural language model;

[0026] Inputting the sample disease information into a preset initial drug recommendation model to perform drug recommendation, obtaining a second distribution feature of the sample disease information for the different drug information, and recommended drug information corresponding to the sample disease information;

[0027] Based on the first distribution feature and the second distribution feature, as well as the actual drug information and the recommended drug information, respectively construct a first loss function and a second loss function corresponding to the initial drug recommendation model;

[0028] Based on the first loss function and the second loss function, the initial drug recommendation model is iteratively trained to construct a preset drug recommendation model.

[0029] According to a training method, device, storage medium and computer equipment of a drug recommendation model provided by the present invention, compared with the current way in which doctors use offline machine learning technology to recommend corresponding drugs to patients based on the diseases they have, the present application obtains the patient's sample disease information and the corresponding actual drug information; and uses a preset natural language model to extract the first distribution characteristics of the sample disease information for different drug information; at the same time, the sample disease information is input into a preset initial drug recommendation model for drug recommendation, and the second distribution characteristics of the sample disease information for the different drug information, as well as the recommended drug information corresponding to the sample disease information, are obtained; and based on the first distribution characteristics and the second distribution characteristics, as well as the actual drug information and the recommended drug information, a first loss function and a second loss function corresponding to the initial drug recommendation model are respectively constructed. loss function; finally, based on the first loss function and the second loss function, the initial drug recommendation model is iteratively trained to construct a preset drug recommendation model, thereby obtaining the first distribution feature and the second distribution feature, as well as the actual drug information and the recommended drug information, the first loss function and the second loss function corresponding to the initial drug recommendation model can be constructed, and based on the first loss function and the second loss function, a preset drug recommendation model is constructed, so that the preset drug recommendation model has the learning ability of the offline model, and is lightweight and can be deployed online. At the same time, since the preset drug recommendation model reduces the model parameters compared to the offline model, the preset drug recommendation model can reduce the amount of calculation while ensuring the accuracy of drug recommendations, improve the efficiency of drug recommendations, and effectively assist doctors in online consultations, thereby improving the doctor's diagnostic efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0031] Figure 1 A flow chart of a training method for a drug recommendation model provided by an embodiment of the present invention is shown;

[0032] Figure 2 A flow chart of another method for training a drug recommendation model provided by an embodiment of the present invention is shown;

[0033] Figure 3 A schematic diagram showing the structure of a training device for a drug recommendation model provided by an embodiment of the present invention is shown;

[0034] Figure 4 A schematic diagram showing the structure of another training device for a drug recommendation model provided by an embodiment of the present invention is shown;

[0035] Figure 5 A schematic diagram of the physical structure of a computer device provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0036] The present invention will be described in detail below with reference to the accompanying drawings and in combination with embodiments. It should be noted that the embodiments and features in the embodiments of the present application can be combined with each other without conflict.

[0037] At present, since the existing machine learning models have many parameters and are heavy, this type of machine learning model for drug recommendation is only applicable offline and cannot be deployed online, and thus cannot assist doctors in online consultations.

[0038] In order to solve the above problems, the present invention provides a method for training a drug recommendation model. Figure 1 As shown, the method includes:

[0039] 101. Obtain the patient's sample disease information and its corresponding actual drug information.

[0040] The sample disease information specifically includes the names or codes of various diseases diagnosed by doctors, such as coronary heart disease, diabetes, acute enteritis, etc. The actual drug information specifically includes the names or drug codes of drugs for treating diseases, such as erythromycin, penicillin, etc.

[0041] For the embodiment of the present invention, in order to overcome the defects in the prior art that the machine learning model has too many parameters and is too heavy to be deployed online, and thus cannot assist doctors in online consultation, the embodiment of the present invention adopts the method of knowledge distillation to slim down the offline model, and trains a lightweight model with offline model learning capabilities, so that it can be deployed online to assist doctors in online consultation. The embodiment of the present invention is mainly used in the scenario of training a drug recommendation model. The execution subject of the embodiment of the present invention is a device or equipment that can train a drug recommendation model, which can be specifically set on the server side.

[0042] Specifically, different disease information corresponds to different actual drug information. The sample database stores a large amount of disease information suffered by patients, as well as the actual drug information prescribed by doctors for patients during the consultation process. When the drug recommendation model needs to be trained, it is first necessary to extract a large amount of patient sample disease information and its corresponding actual drug information from the sample database as sample data, and build a preset drug recommendation model based on the sample data.

[0043] 102. Use a preset natural language model to extract first distribution features of the sample disease information for different drug information.

[0044] Among them, the preset natural language model can specifically be a preset BERT model, and the first distribution feature is the distribution feature of the disease information after being processed by the fully connected layer and before being input into the softmax layer during the prediction process.

[0045] For the embodiment of the present invention, in order to obtain the first distribution feature of the sample disease information for different drug information, the encoder in the preset BERT model is first used to extract the semantic information vector corresponding to the sample disease information. The specific process of extracting the semantic information vector is shown in step 203. Then, the semantic information vector corresponding to the disease information is input into the preset classifier for classification. The preset classifier includes a fully connected layer and a softmax layer. In the classification process, the first distribution feature of the sample disease information in the preset classifier after being processed by the fully connected layer and before being input into the softmax layer is extracted. The sample disease information has different first distribution features for different drug information. It should be noted that the preset BERT model and the preset classifier are both pre-trained models offline. Since the preset BERT model contains a large number of parameters, it is difficult to deploy it to the online consultation system. Therefore, in this embodiment, the preset BERT model and the preset classifier trained offline are used as teacher models, and a lightweight student model (preset drug recommendation model) is trained using the teacher model for online deployment, thereby ensuring the accuracy of drug recommendations while reducing model parameters and reducing the amount of calculation to improve the efficiency of drug recommendations, thereby assisting doctors in online consultation.

[0046] 103. Input the sample disease information into a preset initial drug recommendation model to perform drug recommendation, and obtain the second distribution characteristics of the sample disease information for the different drug information, and the recommended drug information corresponding to the sample disease information.

[0047] Among them, the initial drug recommendation model is a model that is about to be deployed online. The initial drug recommendation model can specifically be a multi-layer perceptron. The second distribution feature is the distribution feature of the disease information after being processed by the fully connected layer of the initial drug recommendation model and before being input into the softmax layer.

[0048] For the embodiment of the present invention, in order to train the initial drug recommendation model (student model) using the teacher model, first initialize the parameters of the multilayer perceptron to obtain an initial drug recommendation model, then input the sample disease information into the initial drug recommendation model, after being processed by the fully connected layer of the initial drug recommendation model and before inputting the softmax layer, obtain the second distribution feature of the sample disease information for different drug information, then input the second distribution feature into the softmax layer of the multilayer perceptron to obtain the recommended drug information corresponding to the sample disease information, and then construct the first loss function and the second loss function of the initial drug recommendation model respectively according to the first distribution feature and the second distribution feature, as well as the actual drug information and the recommended drug information, finally construct a preset drug recommendation model based on the first loss function and the second loss function, and deploy the model online to assist doctors in online consultation, thereby improving the doctor's consultation efficiency. The specific structure of the multilayer perceptron and the specific process of obtaining the second distribution feature and the recommended drug information are shown in step 205.

[0049] 104. Based on the first distribution feature and the second distribution feature, as well as the actual drug information and the recommended drug information, respectively construct a first loss function and a second loss function corresponding to the initial drug recommendation model.

[0050] For the embodiments of the present invention, in order to make the constructed drug recommendation model have both the learning ability of the preset BERT model and meet the requirements of drug recommendation accuracy in the actual recommendation process, it is necessary to construct the first loss function and the second loss function corresponding to the initial drug recommendation model respectively. Specifically, according to the first distribution characteristics of the sample disease information extracted from the BERT model for different drug information, and the second distribution characteristics of the sample disease information extracted from the initial drug recommendation model for different drug information, the first loss function corresponding to the initial drug recommendation model is constructed according to the first distribution characteristics and the second distribution characteristics. At the same time, according to the actual drug information and the recommended drug information, the second loss function of the initial drug recommendation model is constructed. The specific formulas for constructing the first loss function and the second loss function are shown in step 206. Finally, based on the first loss function and the second loss function, the preset drug recommendation model is constructed, which not only ensures the drug recommendation accuracy, but also improves the drug recommendation efficiency.

[0051] 105. Based on the first loss function and the second loss function, iteratively train the initial drug recommendation model to construct a preset drug recommendation model.

[0052] Among them, the preset drug recommendation model is the drug recommendation model that is finally deployed online.

[0053] For an embodiment of the present invention, in order to construct a preset drug recommendation model, after constructing the first loss function and the second loss function corresponding to the initial drug recommendation model, it is also necessary to determine the weight coefficients corresponding to the first loss function and the second loss function respectively, and based on the weight coefficients, construct the total loss function of the initial drug recommendation model, and use the total loss function to iteratively train the initial drug recommendation model, update the parameters of the initial drug recommendation model, and finally obtain the preset drug recommendation model. The preset drug recommendation model has the learning ability of the teacher model, is lightweight, and can be deployed online. During the doctor's consultation, after the doctor inputs the patient's disease information, the preset drug recommendation model will automatically recommend the corresponding drug information, thereby assisting the doctor in conducting online consultation.

[0054] According to a training method for a drug recommendation model provided by the present invention, compared with the current way in which doctors use offline machine learning technology to recommend corresponding drugs to patients based on the diseases they have, the present application obtains the patient's sample disease information and its corresponding actual drug information; and uses a preset natural language model to extract the first distribution characteristics of the sample disease information for different drug information; at the same time, the sample disease information is input into a preset initial drug recommendation model for drug recommendation, and the second distribution characteristics of the sample disease information for the different drug information, as well as the recommended drug information corresponding to the sample disease information, are obtained; and based on the first distribution characteristics and the second distribution characteristics, as well as the actual drug information and the recommended drug information, the first loss function and the second loss function corresponding to the initial drug recommendation model are respectively constructed; and finally based on The initial drug recommendation model is iteratively trained based on the first loss function and the second loss function to construct a preset drug recommendation model. By acquiring the first distribution feature and the second distribution feature, as well as the actual drug information and the recommended drug information, the first loss function and the second loss function corresponding to the initial drug recommendation model can be constructed, and based on the first loss function and the second loss function, a preset drug recommendation model is constructed, so that the preset drug recommendation model has the learning ability of the offline model and is lightweight and can be deployed online. At the same time, since the preset drug recommendation model reduces model parameters compared to the offline model, the preset drug recommendation model can reduce the amount of calculation while ensuring the accuracy of drug recommendations, improve the efficiency of drug recommendations, and effectively assist doctors in online consultations, thereby improving the doctor's diagnostic efficiency.

[0055] Further, in order to better illustrate the training process of the drug recommendation model, as a refinement and extension of the above embodiment, the embodiment of the present invention provides another training method for the drug recommendation model, such as Figure 2 As shown, the method includes:

[0056] 201. Obtain the patient's sample disease information and its corresponding actual drug information.

[0057] For the embodiments of the present invention, when a doctor is consulting a patient, he needs to prescribe corresponding actual drug information for the patient based on the disease information of the patient, and these disease information and the actual drug information prescribed by the doctor for the disease information are stored in the sample database. Therefore, when it is necessary to build a drug recommendation model, it is first necessary to extract the patient's sample disease information and the actual drug information corresponding to the sample disease information from the sample database, and use it as a training set. Based on the training set, a drug recommendation model is built and deployed online to assist doctors in conducting online consultations, which can improve the doctor's consultation efficiency.

[0058] 202. Determine each character included in the sample disease information and an embedding vector corresponding to each character.

[0059] For an embodiment of the present invention, in order to obtain the first distribution characteristics of the sample disease information for different drug information, it is first necessary to determine the various characters contained in the sample disease information. For example, if the sample disease information is acute enteritis, then the various characters corresponding to the sample disease information are acute / sexual / enteritis. Then, the various characters in the sample disease information are converted into embedding vectors using word embedding methods such as Word2Vec, and the embedding vectors corresponding to the various characters are input into a preset natural language model to extract the first distribution characteristics of the sample disease information for different drug information.

[0060] 203. Input the embedding vector into the preset natural language model to extract semantic information, and obtain a semantic information vector corresponding to the sample disease information.

[0061] Among them, the preset natural language model can specifically be a preset BERT model, which includes multiple encoders, such as 8 encoders, each encoder is connected end to end, and the output of the previous encoder will be used as the input of the next encoder. The encoder specifically includes an attention layer and a feedforward neural network layer.

[0062] For the embodiment of the present invention, in order to extract the semantic information vector corresponding to the sample disease information, step 203 specifically includes: inputting the embedding vector into the attention layer for feature extraction to obtain the first feature vector corresponding to each character; adding the first feature vector and the embedding vector to obtain the second feature vector corresponding to each character; inputting the second feature vector into the feedforward neural network layer for feature extraction to obtain the semantic information vector corresponding to the sample disease information. Among them, the first feature vector is the output vector of the attention layer, and the semantic information vector corresponding to the sample disease information is the output vector of the feedforward neural network layer of the last encoder. Specifically, in the process of extracting the semantic information vector corresponding to the sample disease information using the preset BERT model, the embedding vector corresponding to each character is first input into the attention layer of the first encoder in the preset BERT model for feature extraction to obtain the output vector of the attention layer, that is, the first feature vector corresponding to each character, wherein the specific process of feature extraction in the attention layer is: according to the embedding vector corresponding to each character, determine the query vector, key vector and value vector corresponding to each character; multiply the query vector corresponding to the target character among the characters by the key vector corresponding to each character to obtain the attention score of each character for the target character; multiply the attention score corresponding to each character and the value vector and sum them to obtain the first feature vector corresponding to the target character.

[0063] For an embodiment of the present invention, in the process of obtaining the first feature vector corresponding to each character, the embedding vector corresponding to each character in the sample disease information can be multiplied by the weight matrix corresponding to the attention layer in the preset BERT model to obtain the query vector, key vector and value vector corresponding to each character. Furthermore, it is necessary to calculate the attention score corresponding to each character. When calculating the attention score corresponding to any one of the characters (target character), it is necessary to use each character in the sample disease information to score the target character. Specifically, the query vector corresponding to the target character is multiplied by the key vector corresponding to each character to obtain the score value of each character for the target character, that is, the attention score. Then, the attention score corresponding to each character is multiplied and summed with the value vector, and finally the attention layer output vector corresponding to the target character is obtained, that is, the first feature vector corresponding to the target character. Therefore, the first feature vector corresponding to each character can be determined in the above manner, so that the semantic information vector corresponding to the sample disease information can be obtained using the first feature vector corresponding to each character.

[0064] Furthermore, in order to obtain the semantic information vector corresponding to the sample disease information, after extracting the first feature vector corresponding to each character, it is necessary to add the first feature vector to the embedding vector corresponding to each character to obtain the second feature vector corresponding to each character, and input the second feature vector into the feedforward neural network layer of the first encoder for feature extraction to obtain the output vector of the first encoder. Because the preset BERT model in the embodiment of the present invention includes multiple encoders, and the multiple encoders are connected in series head to tail, the output vector of the first encoder is input into the second encoder for feature extraction to obtain the output vector of the second encoder, so that the output vector of the previous encoder is used as the input vector of the next encoder, and finally the output vector of the last encoder is determined as the semantic information vector corresponding to the sample disease information.

[0065] 204. Input the semantic information vector into a preset classifier for classification, and extract the first distribution feature of the sample disease information for the different drug information.

[0066] Among them, the preset classifier is a neural network model, which specifically includes a fully connected layer and a softmax layer.

[0067] For an embodiment of the present invention, after determining the semantic information vector corresponding to the sample disease information, the semantic information vector is input into the neural network model for classification. After the semantic information vector is output through a fully connected layer in the preset neural network model and before being input into the softmax layer, the distribution feature corresponding to the semantic information vector is extracted, and the distribution feature is used as the first distribution feature of the sample disease information for different drug information, so as to utilize the first distribution feature to construct the loss function corresponding to the initial drug recommendation model.

[0068] 205. Input the sample disease information into a preset initial drug recommendation model to perform drug recommendation, and obtain the second distribution characteristics of the sample disease information for the different drug information, and the recommended drug information corresponding to the sample disease information.

[0069] Among them, the preset initial drug recommendation model can specifically be a multi-layer perceptron, which is a neural network model, which includes an input layer, a hidden layer and an output layer.

[0070] For the embodiment of the present invention, in order to obtain the second distribution characteristics of the sample disease information for the different drug information, and the recommended drug information corresponding to the sample disease information, step 205 specifically includes: inputting the sample disease information into the multilayer perceptron, extracting the features output by the last fully connected layer in the multilayer perceptron, and determining the features output by the last fully connected layer as the second distribution characteristics of the sample disease information for the different drug information; inputting the features output by the last fully connected layer into the softmax layer in the multilayer perceptron to obtain the recommended drug information corresponding to the sample disease information.

[0071] Specifically, the embedding vector corresponding to each character in the sample disease information is input to the hidden layer through the input layer of the multilayer perceptron, and the result output by the hidden layer is:

[0072] f(W 1 x+b 1 )

[0073] Among them, x is the embedding vector corresponding to each character, w 1 is the weight of the hidden layer, which is also the connection coefficient of the multilayer perceptron, b 1 is the bias coefficient of the hidden layer. The f function can usually use a sigmoid function or a tanh function, as shown below:

[0074] sigmoid(x)=1 / (1+e -x )

[0075] tanh(x)=(e x -e -x ) / (e 1 +e -x )

[0076] Furthermore, after the output of the hidden layer is processed by a fully connected layer, the output of the fully connected layer is input to the output layer, that is, the softmax layer of the multilayer perceptron, and the drug recommendation is performed through the output layer. The recommendation result is:

[0077] softmax(W 2 f(W 1 x+b 1 )+b 2 )

[0078] Among them, the W 2 f(W 1 +b 1 )+b 2That is, the embedding vector corresponding to each character is fully connected through the initial drug recommendation model, and the disease information before entering the softmax layer is the second distribution feature of different drug information, W 2 is the weight coefficient of the output layer, b 2 is the bias coefficient of the output layer. The output layer of the multilayer perceptron can output the recommended drug information corresponding to the sample disease information. The recommended drug information is essentially the recommended drug classification probability corresponding to the sample disease information. The drug information corresponding to the maximum classification probability is determined as the recommended drug information corresponding to the sample disease information.

[0079] 206. Based on the first distribution feature and the second distribution feature, as well as the actual drug information and the recommended drug information, respectively construct a first loss function and a second loss function corresponding to the initial drug recommendation model.

[0080] For the embodiment of the present invention, in order to enable the drug recommendation model to meet the requirements of drug recommendation accuracy in the actual recommendation process, it is necessary to construct a first loss function and a second loss function corresponding to the initial drug recommendation model. For constructing the first loss function and the second loss function of the initial drug recommendation model, step 206 specifically includes: setting a parameter value of a distillation parameter corresponding to the initial drug recommendation model, wherein the parameter value is greater than 1; using the parameter value to adjust the first distribution feature and the second distribution feature respectively to obtain an adjusted first distribution feature and an adjusted second distribution feature; based on the adjusted first distribution feature and the adjusted second distribution feature, constructing a first loss function corresponding to the initial drug recommendation model; based on the actual drug information and the recommended drug information, constructing a second loss function corresponding to the initial drug recommendation model.

[0081] The distillation parameter is introduced to avoid the output result of the initial drug recommendation model from being too concentrated. For the embodiment of the present invention, after extracting the first distribution feature of the sample disease information for different drug information using the preset BERT model and extracting the second distribution feature of the sample disease information for different drug information in the initial drug recommendation model, a first loss function corresponding to the initial drug recommendation model is constructed according to the first distribution feature and the second distribution feature. The specific formula is as follows:

[0082] in,

[0083] Among them, L soft is the first loss function (distillation loss function), z i is the second distribution feature of sample disease information for different drug information, v iis the first distribution feature of sample disease information for different drug information. In order to avoid the over-centralization of the output of the initial drug recommendation model, it is necessary to introduce a distillation parameter T. In the process of constructing the first loss function, T>1, v i / T is the first distribution characteristic after adjustment, z i / T is the adjusted second distribution characteristic.

[0084] Furthermore, according to the actual drug information and recommended drug information corresponding to the sample disease information, a second loss function corresponding to the initial drug recommendation model is constructed. The specific formula is as follows:

[0085]

[0086] Among them, L hard is the second loss function, C j is the actual drug information corresponding to the sample disease information, m j is the recommended drug information output by the initial drug recommendation model, j represents the jth drug information, and N represents the number of drug information categories. Thus, the first loss function and the second loss function corresponding to the initial drug recommendation model can be constructed in the above manner.

[0087] 207. Based on the first loss function and the second loss function, iteratively train the initial drug recommendation model to construct a preset drug recommendation model.

[0088] For the embodiment of the present invention, after constructing the first loss function and the second loss function corresponding to the initial drug recommendation model, it is necessary to construct the total loss function corresponding to the initial drug recommendation model, and based on the total loss function, iteratively train the initial drug recommendation model to construct a preset drug recommendation model. Based on this, step 207 specifically includes: respectively determining the weight coefficients corresponding to the first loss function and the second loss function; based on the weight coefficients, adding the first loss function and the second loss function to obtain the total loss function corresponding to the initial drug recommendation model; based on the total loss function, iteratively train the initial drug recommendation model to construct the preset drug recommendation model.

[0089] Among them, the weight coefficient can be set according to actual needs. Specifically, the weight coefficients corresponding to the first loss function and the second loss function corresponding to the initial drug recommendation model are determined respectively, and then the product of the first loss function and its corresponding weight coefficient is added to the product of the second loss function and its corresponding weight coefficient to obtain the total loss function corresponding to the initial drug recommendation model. The specific formula is as follows:

[0090] L=αL soft +βL hard

[0091] Among them, L is the total loss function corresponding to the initial drug recommendation model, α and β are the weight coefficients corresponding to the first loss function and the second loss function respectively. After determining the total loss function corresponding to the initial drug recommendation model, the total loss function is used to iteratively train the initial drug recommendation model, update the parameters in the initial drug recommendation model, and obtain the preset drug recommendation model.

[0092] Furthermore, after obtaining the preset drug recommendation model, in order to use the preset drug recommendation model to prescribe corresponding drugs for patients based on the disease information of the patients, the method also includes: obtaining the disease information of the patient to be predicted; inputting the disease information into the preset drug recommendation model for drug recommendation, and obtaining the probability value of the disease information for the different drug information, wherein the parameter value of the distillation parameter corresponding to the preset drug recommendation model is 1; determining the maximum probability value from each probability value, and determining the drug information corresponding to the maximum probability value as the recommended drug information corresponding to the patient to be predicted.

[0093] Specifically, after the preset drug recommendation model is constructed, the preset drug recommendation model is deployed online. At the same time, in order to improve the accuracy and efficiency of the recommendations of the preset drug recommendation model and meet the performance requirements of the online preset drug recommendation model, the distillation parameter T of the preset drug recommendation model needs to be set to 1. When recommending actual drug information to the patient using the preset drug recommendation model based on the disease information of the patient to be predicted, the doctor first needs to diagnose the disease for the patient to be predicted to obtain the disease information of the patient to be predicted, and then input the disease information into the preset drug recommendation model for drug recommendation to obtain the probability value of the disease information corresponding to different drug information, select the maximum probability value from the probability values, and determine the drug information corresponding to the maximum probability value as the recommended drug information corresponding to the patient to be predicted. For example, the disease information of the patient to be predicted is acute enteritis, and the acute enteritis is input into the preset drug recommendation model for drug recommendation, and the classification probabilities corresponding to acute enteritis are 50% for quinolone antibiotics, 20% for second-generation cephalosporins, and 30% for anti-anaerobic antibiotics. Among them, the probability value of 50% is the largest, so the drug quinolone antibiotic corresponding to the probability value is determined as the recommended drug information corresponding to the patient to be predicted.

[0094] According to another training method of a drug recommendation model provided by the present invention, compared with the current way in which doctors use offline machine learning technology to recommend corresponding drugs to patients based on the diseases they have, the present application obtains the patient's sample disease information and its corresponding actual drug information; and uses a preset natural language model to extract the first distribution characteristics of the sample disease information for different drug information; at the same time, the sample disease information is input into a preset initial drug recommendation model for drug recommendation, and the second distribution characteristics of the sample disease information for the different drug information, as well as the recommended drug information corresponding to the sample disease information, are obtained; and based on the first distribution characteristics and the second distribution characteristics, as well as the actual drug information and the recommended drug information, the first loss function and the second loss function corresponding to the initial drug recommendation model are respectively constructed; and finally based on The initial drug recommendation model is iteratively trained based on the first loss function and the second loss function to construct a preset drug recommendation model. By acquiring the first distribution feature and the second distribution feature, as well as the actual drug information and the recommended drug information, the first loss function and the second loss function corresponding to the initial drug recommendation model can be constructed, and based on the first loss function and the second loss function, a preset drug recommendation model is constructed, so that the preset drug recommendation model has the learning ability of the offline model and is lightweight and can be deployed online. At the same time, since the preset drug recommendation model reduces model parameters compared to the offline model, the preset drug recommendation model can reduce the amount of calculation while ensuring the accuracy of drug recommendations, improve the efficiency of drug recommendations, and effectively assist doctors in online consultations, thereby improving the doctor's diagnostic efficiency.

[0095] Further, as Figure 1 In a specific implementation, an embodiment of the present invention provides a training device for a drug recommendation model, such as Figure 3 As shown, the device includes: an acquisition unit 31, an extraction unit 32, a recommendation unit 33, a construction unit 34 and a training unit 35.

[0096] The acquisition unit 31 may be used to acquire the patient's sample disease information and its corresponding actual drug information.

[0097] The extraction unit 32 may be configured to extract first distribution features of the sample disease information for different drug information using a preset natural language model.

[0098] The recommendation unit 33 can be used to input the sample disease information into a preset initial drug recommendation model for drug recommendation, obtain the second distribution characteristics of the sample disease information for the different drug information, and the recommended drug information corresponding to the sample disease information.

[0099] The construction unit 34 can be used to construct a first loss function and a second loss function corresponding to the initial drug recommendation model based on the first distribution feature and the second distribution feature, as well as the actual drug information and the recommended drug information.

[0100] The training unit 35 can be used to iteratively train the initial drug recommendation model based on the first loss function and the second loss function to construct a preset drug recommendation model.

[0101] In a specific application scenario, in order to determine the first distribution characteristics of sample disease information for different drug information, such as Figure 4 As shown, the extraction unit 32 includes a first determination module 321 , a first extraction module 322 and a classification module 323 .

[0102] The first determination module 321 may be used to determine each character included in the sample disease information and an embedding vector corresponding to each character.

[0103] The extraction module 322 can be used to input the embedding vector into the preset natural language model to extract semantic information, so as to obtain the semantic information vector corresponding to the sample disease information.

[0104] The classification module 323 can be used to input the semantic information vector into a preset classifier for classification, and extract the first distribution feature of the sample disease information for the different drug information.

[0105] In a specific application scenario, in order to obtain the semantic information vector corresponding to the sample disease information, the extraction module 322 includes an extraction submodule and an addition submodule.

[0106] The extraction submodule can be used to input the embedding vector into the attention layer for feature extraction to obtain the first feature vector corresponding to each character.

[0107] The adding submodule may be used to add the first feature vector and the embedding vector to obtain a second feature vector corresponding to each character.

[0108] The extraction submodule can be specifically used to input the second feature vector into the feedforward neural network layer for feature extraction to obtain the semantic information vector corresponding to the sample disease information.

[0109] In a specific application scenario, in order to obtain the second distribution characteristics of the sample disease information for different drug information and the recommended drug information corresponding to the sample disease information, the recommendation unit 33 includes a second extraction module 331 and a third extraction module 332 .

[0110] The second extraction module 331 can be used to input the sample disease information into the multilayer perceptron, extract the features output by the last fully connected layer in the multilayer perceptron, and determine the features output by the last fully connected layer as the second distribution features of the sample disease information for the different drug information.

[0111] The third extraction module 332 can be used to input the features output by the last fully connected layer into the softmax layer in the multi-layer perceptron to obtain the recommended drug information corresponding to the sample disease information.

[0112] In a specific application scenario, in order to construct the first loss function and the second loss function corresponding to the initial drug recommendation model, the construction unit 34 includes a setting module 341, an adjustment module 342, a first construction module 343 and a second construction module 344.

[0113] The setting module 341 can be used to set the parameter value of the distillation parameter corresponding to the initial drug recommendation model, wherein the parameter value is greater than 1.

[0114] The adjustment module 342 may be configured to adjust the first distribution feature and the second distribution feature respectively using the parameter value to obtain an adjusted first distribution feature and an adjusted second distribution feature.

[0115] The first construction module 343 can be used to construct a first loss function corresponding to the initial drug recommendation model based on the adjusted first distribution feature and the adjusted second distribution feature.

[0116] The second construction module 344 can be used to construct a second loss function corresponding to the initial drug recommendation model based on the actual drug information and the recommended drug information.

[0117] In a specific application scenario, in order to construct a preset drug recommendation model, the training unit 35 includes a second determination module 351 , an addition module 352 and a training module 353 .

[0118] The second determination module 351 may be configured to respectively determine weight coefficients corresponding to the first loss function and the second loss function.

[0119] The adding module 352 can be used to add the first loss function and the second loss function based on the weight coefficient to obtain a total loss function corresponding to the initial drug recommendation model.

[0120] The training module 353 can be used to iteratively train the initial drug recommendation model based on the total loss function to construct the preset drug recommendation model.

[0121] In a specific application scenario, in order to use the constructed preset drug recommendation model to make drug recommendations, the device also includes: a determination unit 36.

[0122] The acquisition unit 31 may also be used to acquire disease information of the patient to be predicted.

[0123] The recommendation unit 33 can also be used to input the disease information into a preset drug recommendation model for drug recommendation to obtain the probability value of the disease information for the different drug information, wherein the parameter value of the distillation parameter corresponding to the preset drug recommendation model is 1.

[0124] The determination unit 36 ​​may be configured to determine a maximum probability value from among the probability values, and determine the drug information corresponding to the maximum probability value as the recommended drug information corresponding to the patient to be predicted.

[0125] It should be noted that for other corresponding descriptions of the functional modules involved in the training device for a drug recommendation model provided in an embodiment of the present invention, reference can be made to Figure 1 The corresponding description of the method shown will not be repeated here.

[0126] Based on the above Figure 1 The method shown, accordingly, an embodiment of the present invention also provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the following steps are implemented: obtaining the patient's sample disease information and the corresponding actual drug information; using a preset natural language model to extract the first distribution characteristics of the sample disease information for different drug information; inputting the sample disease information into a preset initial drug recommendation model for drug recommendation, and obtaining the second distribution characteristics of the sample disease information for the different drug information, and the recommended drug information corresponding to the sample disease information; based on the first distribution characteristics and the second distribution characteristics, as well as the actual drug information and the recommended drug information, respectively constructing a first loss function and a second loss function corresponding to the initial drug recommendation model; based on the first loss function and the second loss function, iteratively training the initial drug recommendation model to construct a preset drug recommendation model.

[0127] Based on the above Figure 1 The method shown and Figure 3 The embodiment of the device shown in the figure, the embodiment of the present invention also provides a physical structure diagram of a computer device, such as Figure 5As shown, the computer device includes: a processor 41, a memory 42, and a computer program stored in the memory 42 and executable on the processor, wherein the memory 42 and the processor 41 are both arranged on a bus 43, and when the processor 41 executes the program, the following steps are implemented: obtaining the patient's sample disease information and its corresponding actual drug information; extracting the first distribution characteristics of the sample disease information for different drug information using a preset natural language model; inputting the sample disease information into a preset initial drug recommendation model for drug recommendation, and obtaining the second distribution characteristics of the sample disease information for the different drug information, and the recommended drug information corresponding to the sample disease information; constructing the first loss function and the second loss function corresponding to the initial drug recommendation model based on the first distribution characteristics and the second distribution characteristics, as well as the actual drug information and the recommended drug information; iteratively training the initial drug recommendation model based on the first loss function and the second loss function to construct a preset drug recommendation model.

[0128] Through the technical solution of the present invention, the present invention obtains the patient's sample disease information and the corresponding actual drug information; and uses a preset natural language model to extract the first distribution characteristics of the sample disease information for different drug information; at the same time, the sample disease information is input into a preset initial drug recommendation model for drug recommendation, and the second distribution characteristics of the sample disease information for the different drug information, and the recommended drug information corresponding to the sample disease information are obtained; and based on the first distribution characteristics and the second distribution characteristics, as well as the actual drug information and the recommended drug information, the first loss function and the second loss function corresponding to the initial drug recommendation model are respectively constructed; finally, based on the first loss function and the second loss function, the initial drug recommendation model is The recommendation model is iteratively trained to construct a preset drug recommendation model, thereby constructing a first loss function and a second loss function corresponding to the initial drug recommendation model by obtaining the first distribution feature and the second distribution feature, as well as the actual drug information and the recommended drug information, and constructing a preset drug recommendation model based on the first loss function and the second loss function, so that the preset drug recommendation model has the learning ability of the offline model and is lightweight and can be deployed online. At the same time, since the preset drug recommendation model reduces model parameters compared to the offline model, the preset drug recommendation model can reduce the amount of calculation while ensuring the accuracy of drug recommendations, improve the efficiency of drug recommendations, and effectively assist doctors in online consultations, thereby improving the doctor's diagnostic efficiency.

[0129] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.

[0130] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A training method for a drug recommendation model, characterized in that: include: Obtain the patient's sample disease information and its corresponding actual drug information; Extracting first distribution features of the sample disease information for different drug information using a preset natural language model; Inputting the sample disease information into a preset initial drug recommendation model to perform drug recommendation, obtaining a second distribution feature of the sample disease information for the different drug information, and recommended drug information corresponding to the sample disease information; Based on the first distribution feature and the second distribution feature, as well as the actual drug information and the recommended drug information, respectively construct a first loss function and a second loss function corresponding to the initial drug recommendation model; Based on the first loss function and the second loss function, iteratively train the initial drug recommendation model to construct a preset drug recommendation model; The method of extracting the first distribution characteristics of the sample disease information for different drug information by using a preset natural language model includes: Determine each character contained in the sample disease information and an embedding vector corresponding to each character; Inputting the embedding vector into the preset natural language model to extract semantic information, and obtaining a semantic information vector corresponding to the sample disease information; Inputting the semantic information vector into a preset classifier for classification, and extracting the first distribution feature of the sample disease information for the different drug information; The preset natural language model is a preset BERT model, and the preset BERT model includes an attention layer and a feedforward neural network layer. The embedding vector is input into the preset natural language model to extract semantic information, and the semantic information vector corresponding to the sample disease information is obtained, including: Inputting the embedding vector into the attention layer for feature extraction to obtain a first feature vector corresponding to each character; Adding the first feature vector and the embedding vector to obtain a second feature vector corresponding to each character; Inputting the second feature vector into the feedforward neural network layer for feature extraction to obtain a semantic information vector corresponding to the sample disease information; The initial drug recommendation model is a multi-layer perceptron, and the sample disease information is input into a preset initial drug recommendation model for drug recommendation to obtain the second distribution characteristics of the sample disease information for the different drug information, and the recommended drug information corresponding to the sample disease information, including: Inputting the sample disease information into the multilayer perceptron, extracting features output by the last fully connected layer in the multilayer perceptron, and determining the features output by the last fully connected layer as the second distribution features of the sample disease information for the different drug information; The features output by the last fully connected layer are input into the softmax layer in the multi-layer perceptron to obtain the recommended drug information corresponding to the sample disease information.

2. The method according to claim 1, characterized in that The first loss function and the second loss function corresponding to the initial drug recommendation model are respectively constructed based on the first distribution feature and the second distribution feature, as well as the actual drug information and the recommended drug information, including: Setting a parameter value of a distillation parameter corresponding to the initial drug recommendation model, wherein the parameter value is greater than 1; Using the parameter value to adjust the first distribution feature and the second distribution feature respectively, to obtain an adjusted first distribution feature and an adjusted second distribution feature; Based on the adjusted first distribution feature and the adjusted second distribution feature, constructing a first loss function corresponding to the initial drug recommendation model; Based on the actual drug information and the recommended drug information, a second loss function corresponding to the initial drug recommendation model is constructed.

3. The method according to claim 1, characterized in that The iterative training of the initial drug recommendation model based on the first loss function and the second loss function to construct a preset drug recommendation model includes: Determine weight coefficients corresponding to the first loss function and the second loss function respectively; Based on the weight coefficient, the first loss function and the second loss function are added to obtain a total loss function corresponding to the initial drug recommendation model; Based on the total loss function, the initial drug recommendation model is iteratively trained to construct the preset drug recommendation model.

4. The method according to any one of claims 1 to 3, characterized in that: After the initial drug recommendation model is iteratively trained based on the first loss function and the second loss function to construct a preset drug recommendation model, the method further includes: Obtain disease information of the patient to be predicted; Inputting the disease information into a preset drug recommendation model for drug recommendation, and obtaining probability values ​​of the disease information for the different drug information, wherein the parameter value of the distillation parameter corresponding to the preset drug recommendation model is 1; The maximum probability value is determined from each probability value, and the drug information corresponding to the maximum probability value is determined as the recommended drug information corresponding to the patient to be predicted.

5. A training device for a drug recommendation model, characterized in that: include: An acquisition unit, used to acquire the patient's sample disease information and its corresponding actual drug information; An extraction unit, configured to extract first distribution features of the sample disease information for different drug information using a preset natural language model; A recommendation unit, configured to input the sample disease information into a preset initial drug recommendation model for drug recommendation, obtain the second distribution characteristics of the sample disease information for the different drug information, and the recommended drug information corresponding to the sample disease information, wherein the initial drug recommendation model is a multi-layer perceptron; A construction unit, configured to respectively construct a first loss function and a second loss function corresponding to the initial drug recommendation model based on the first distribution feature and the second distribution feature, as well as the actual drug information and the recommended drug information; A training unit, configured to iteratively train the initial drug recommendation model based on the first loss function and the second loss function to construct a preset drug recommendation model; The extraction unit includes: a first determination module, a first extraction module and a classification module. The first determination module is used to determine each character included in the sample disease information and an embedding vector corresponding to each character; The first extraction module is used to input the embedding vector into the preset natural language model to extract semantic information, so as to obtain a semantic information vector corresponding to the sample disease information, wherein the preset natural language model is a preset BERT model, and the preset BERT model includes an attention layer and a feedforward neural network layer; The classification module is used to input the semantic information vector into a preset classifier for classification, and extract the first distribution feature of the sample disease information for the different drug information; The first extraction module is specifically used to input the embedding vector into the attention layer for feature extraction to obtain the first feature vector corresponding to each character; add the first feature vector and the embedding vector to obtain the second feature vector corresponding to each character; input the second feature vector into the feedforward neural network layer for feature extraction to obtain the semantic information vector corresponding to the sample disease information; The recommendation unit is specifically used to input the sample disease information into the multilayer perceptron, extract the features of the output of the last fully connected layer in the multilayer perceptron, determine the features of the output of the last fully connected layer as the second distribution features of the sample disease information for the different drug information; input the features of the output of the last fully connected layer into the softmax layer in the multilayer perceptron to obtain the recommended drug information corresponding to the sample disease information.

6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.

7. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.

Citation Information

Patent Citations

  • Deep learning based over-the-counter drug recommendation system and recommendation method

    CN109087691A

  • Model training method and device for realizing drug recommendation, and computing meter device

    CN110837565A