CN114386528A - Model training method and device, computer equipment and storage medium - Google Patents

Model training method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN114386528A
CN114386528A CN202210057007.1A CN202210057007A CN114386528A CN 114386528 A CN114386528 A CN 114386528A CN 202210057007 A CN202210057007 A CN 202210057007A CN 114386528 A CN114386528 A CN 114386528A
Authority
CN
China
Prior art keywords
sample data
prescription
model
drug
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202210057007.1A
Other languages
Chinese (zh)
Other versions
CN114386528B (en
Inventor
赵越
徐卓扬
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN202210057007.1A priority Critical patent/CN114386528B/en
Priority claimed from CN202210057007.1A external-priority patent/CN114386528B/en
Publication of CN114386528A publication Critical patent/CN114386528A/en
Priority to PCT/CN2022/090760 priority patent/WO2023137924A1/en
Application granted granted Critical
Publication of CN114386528B publication Critical patent/CN114386528B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • G06F18/241Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • G06F40/289Phrasal analysis, e.g. finite state techniques or chunking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/30Semantic analysis
    • G06F40/35Discourse or dialogue representation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G16INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR SPECIFIC APPLICATION FIELDS
    • G16HHEALTHCARE INFORMATICS, i.e. INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR THE HANDLING OR PROCESSING OF MEDICAL OR HEALTHCARE DATA
    • G16H20/00ICT specially adapted for therapies or health-improving plans, e.g. for handling prescriptions, for steering therapy or for monitoring patient compliance
    • G16H20/10ICT specially adapted for therapies or health-improving plans, e.g. for handling prescriptions, for steering therapy or for monitoring patient compliance relating to drugs or medications, e.g. for ensuring correct administration to patients

Abstract

The embodiment provides a model training method and device, computer equipment and a storage medium, and belongs to the technical field of artificial intelligence. The method comprises the following steps: acquiring a plurality of inquiry sample data and corresponding prescription sample data; predicting patient sample data and conversation sample data through a pre-training model to obtain prescription prediction data; calculating a first loss value from the plurality of drug prediction data; constructing a drug co-occurrence matrix according to a plurality of drug sample data, and calculating a second loss value; and training the pre-training model according to the first loss value and the second loss value to obtain a prescription recommendation model. In the embodiment, the medicine co-occurrence matrix is constructed through prescription sample data, and the medicine co-occurrence loss is added according to the medicine co-occurrence matrix, so that the correlation among a plurality of medicines is considered, and the problem that a classifier is increased along with the increase of the number of medicines in a prescription recommendation model is avoided, and the training efficiency of the model is improved.

Description

Model training method and device, computer equipment and storage medium
Technical Field
The invention relates to the technical field of artificial intelligence, in particular to a model training method and device, computer equipment and a storage medium.
Background
In the task of prescription recommendation, there is often a dependency between the multiple medications in the prescription, e.g., antipyretic patches and antitussive medications are often in the same prescription. Therefore, it is crucial to efficiently mine the correlation between drugs. Prescription recommendations are often translated into multi-label classification tasks because the number of drugs contained in a prescription is more than one, but as the number of drugs grows, the number of classifiers in the prescription recommendation model also increases, thereby affecting the training efficiency of the model.
Disclosure of Invention
The embodiment of the disclosure mainly aims to provide a model training method and device, a computer device and a storage medium, which can improve the model training efficiency.
To achieve the above object, a first aspect of the embodiments of the present disclosure provides a method for training a model, which is used for training a prescription recommendation model, and includes:
acquiring a plurality of inquiry sample data and prescription sample data of the inquiry sample data; wherein each said prescription sample data comprises patient sample data and session sample data, each said prescription sample data comprising a plurality of drug sample data;
predicting the patient sample data and the dialogue sample data through a pre-training model to obtain prescription prediction data; wherein the prescription prediction data comprises a plurality of medication prediction data;
calculating a first loss function of the pre-training model according to the plurality of drug prediction data to obtain a first loss value;
constructing a drug co-occurrence matrix according to the plurality of drug sample data;
calculating a second loss function of the pre-training model according to the drug co-occurrence matrix to obtain a second loss value;
training the pre-training model according to the first loss value and the second loss value to obtain a prescription recommendation model; wherein the prescription recommendation model is used for recommendation of prescriptions.
In some embodiments, said performing prediction processing on said patient sample data and said session sample data through a pre-training model to obtain prescription prediction data comprises:
standardizing the patient sample data according to a preset data format to obtain corresponding patient characteristics;
carrying out first coding processing on the patient characteristics to obtain corresponding patient vectors;
performing second coding processing on the dialogue sample data to obtain a corresponding dialogue vector;
and performing prediction processing according to the patient vector and the dialogue vector to obtain prescription prediction data.
In some embodiments, performing a second encoding process on the dialog sample data to obtain a corresponding dialog vector includes:
acquiring a preset level attention model; wherein the hierarchical attention model comprises a word-level neural network and a sentence-level neural network;
performing word segmentation processing on the dialogue sample data to obtain word segmentation data;
carrying out coding processing on the word segmentation data to obtain a word coding vector;
coding the word coding vector through the word level neural network to obtain a sentence coding vector;
and coding the sentence coding vector through the sentence level neural network to obtain a dialogue vector.
In some embodiments, each said drug sample data comprises a plurality of preset drugs; the predicting according to the patient vector and the dialogue vector to obtain prescription prediction data, comprising:
splicing the patient vector and the dialogue vector to obtain a spliced vector;
predicting the splicing vector through a full-connection layer to obtain the opening probability of each preset medicine;
screening the preset medicines according to a preset threshold value and the opening probability to obtain target medicines;
using the target drug as the prescription prediction data.
In some embodiments, said constructing a drug co-occurrence matrix from said plurality of drug sample data comprises:
acquiring a co-occurrence relation among the preset medicines in the medicine sample data to obtain a medicine co-occurrence relation;
constructing a drug co-occurrence pair of the preset drugs based on the drug co-occurrence relationship, and acquiring corresponding drug co-occurrence times;
normalizing the co-occurrence times of the medicines to obtain a first co-occurrence value;
calculating the difference between the first co-occurrence value and the preset threshold value to obtain a second co-occurrence value;
and constructing a drug co-occurrence matrix according to the second co-occurrence value.
In some embodiments, the training the pre-trained model according to the first loss value and the second loss value to obtain a prescription recommendation model includes:
and adjusting model parameters of the pre-training model by taking the first loss value and the second loss value as reverse propagation quantities so as to train the pre-training model and obtain the prescription recommendation model.
In some embodiments, further comprising: acquiring actual inquiry data; wherein the actual interrogation data comprises actual patient data and actual session data;
inputting the actual patient data and the actual dialogue data into the prescription recommendation model to perform prescription recommendation processing to obtain a recommended prescription; wherein the prescription recommendation model is trained according to the method of any one of the embodiments of the first aspect of the present application.
A second aspect of the embodiments of the present disclosure provides a training apparatus for training a prescription recommendation model, including:
a first obtaining module: the system comprises a data acquisition module, a data acquisition module and a data processing module, wherein the data acquisition module is used for acquiring a plurality of inquiry sample data and acquiring prescription sample data corresponding to each inquiry sample data; wherein each said prescription sample data comprises patient sample data and session sample data, each said prescription sample data comprising a plurality of drug sample data;
a prescription prediction module: the system is used for predicting the patient sample data and the dialogue sample data through a pre-training model to obtain prescription prediction data; wherein the prescription prediction data comprises a plurality of medication prediction data;
a first calculation module: the first loss function of the pre-training model is calculated according to the plurality of medicine prediction data to obtain a first loss value;
a matrix construction module: for constructing a drug co-occurrence matrix from the plurality of drug sample data;
a second calculation module: the second loss function of the pre-training model is calculated according to the drug co-occurrence matrix to obtain a second loss value;
a model training module: the pre-training model is used for training according to the first loss value and the second loss value to obtain a prescription recommendation model; wherein the prescription recommendation model is used for recommendation of prescriptions.
A third aspect of the embodiments of the present disclosure provides a computer device, which includes a memory and a processor, where the memory stores a program, and the processor is configured to execute the method according to any one of the embodiments of the first aspect of the present disclosure when the program is executed by the processor.
A fourth aspect of the embodiments of the present disclosure provides a storage medium, which is a computer-readable storage medium, and the storage medium stores computer-executable instructions, where the computer-executable instructions are configured to cause a computer to perform the method according to any one of the embodiments of the first aspect of the present disclosure.
According to the model training method and device, the computer equipment and the storage medium provided by the embodiment of the disclosure, a plurality of inquiry sample data are obtained, and prescription sample data corresponding to each inquiry sample data are obtained, wherein each inquiry sample data comprises patient sample data and conversation sample data, and each prescription sample data comprises a plurality of medicine sample data; predicting patient sample data and conversation sample data through a pre-training model to obtain prescription prediction data; wherein the prescription prediction data comprises a plurality of medication prediction numbers; calculating a first loss function of the pre-training model according to the plurality of drug prediction data to obtain a first loss value; constructing a drug co-occurrence matrix according to a plurality of drug sample data; calculating a second loss function of the pre-training model according to the drug co-occurrence matrix to obtain a second loss value; and training the pre-training model according to the first loss value and the second loss value to obtain a prescription recommendation model for recommending a prescription. According to the method and the device, the prescription sample data is introduced after the patient sample data and the conversation sample data are subjected to prediction processing by the pre-training model, the medicine co-occurrence matrix is built according to the prescription sample data, and the medicine co-occurrence loss is added according to the medicine co-occurrence matrix, so that the correlation among a plurality of medicines is considered, the problem that a classifier is increased along with the increase of the number of medicines in the prescription recommendation model is solved, and the training efficiency of the model is improved.
Drawings
FIG. 1 is a flow chart of a method of training a model provided by an embodiment of the present disclosure;
FIG. 2 is a flowchart of step S200 in FIG. 1;
FIG. 3 is a flowchart of step S230 in FIG. 2;
FIG. 4 is a first flowchart of step S240 in FIG. 2;
FIG. 5 is a second flowchart of step S400 in FIG. 1;
FIG. 6 is a block diagram of a module structure of a model training apparatus according to an embodiment of the present disclosure;
fig. 7 is a hardware structure diagram of a computer device provided in an embodiment of the present disclosure.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
It should be noted that although functional blocks are partitioned in a schematic diagram of an apparatus and a logical order is shown in a flowchart, in some cases, the steps shown or described may be performed in a different order than the partitioning of blocks in the apparatus or the order in the flowchart. The terms first, second and the like in the description and in the claims, and the drawings described above, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. The terminology used herein is for the purpose of describing embodiments of the invention only and is not intended to be limiting of the invention.
First, several terms referred to in the present application are resolved:
artificial Intelligence (AI): is a new technical science for researching and developing theories, methods, technologies and application systems for simulating, extending and expanding human intelligence; artificial intelligence is a branch of computer science that attempts to understand the essence of intelligence and produces a new intelligent machine that can react in a manner similar to human intelligence, and research in this field includes robotics, language recognition, image recognition, natural language processing, and expert systems, among others. The artificial intelligence can simulate the information process of human consciousness and thinking. Artificial intelligence is also a theory, method, technique and application system that uses a digital computer or a machine controlled by a digital computer to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use the knowledge to obtain the best results.
Multi-label classification (multi-label classification): it is meant that a piece of data may have one or more labels, such as a patient's physical examination report, which may be labeled with multiple labels, hypertension, hyperglycemia, etc.
And II, classification: indicating that there are two categories in the classification task, such as whether one wants to identify a picture as a cat or not. That is, a classifier is trained to input a picture, represented by the feature vector x, and output if it is a cat, represented by y ═ 0 or 1, and two classes of classification assume that each sample is set to one and only one label, 0 or 1.
Softmax classifier: for a generalized generalization of the logistic regression classifier in the face of multiple classes, probability values belonging to different classes are output.
Serial communication (Serial communication): in telecommunications and computer science, serial communication refers to a communication method in which one bit of data is transmitted at a time on a computer bus or other data channel, and the above single processes are continuously performed. Corresponding to this is a parallel communication, which communicates over a serial port by transmitting several bits of data at once. Serial communication is used for long distance communication and most computer networks where cable and synchronization make practical parallel communication difficult. With their improved signal integrity and propagation speed, serial communication buses are becoming more and more popular, and even in short range applications, their advantages have begun to surpass parallel buses in that no serializing element (serializer) is required, and shortcomings such as Clock skew (Clock skew), interconnect density (interconnect density) are addressed.
Hierarchical Attention Networks (HAN): is a neural network for document classification, and the model has two distinct features: first, it has a hierarchical structure (words form sentences, sentences form documents), reflecting the hierarchical structure of documents, we construct a document representation by first constructing a representation of sentences and then aggregating them into a document representation; second, it applies two levels of attention mechanisms at the word and sentence level, enabling it to participate in increasingly important content separately in building the document representation.
One-Hot Encoding (One-Hot Encoding): also known as one-bit-efficient encoding, mainly uses a bit state register to encode each state, with each state being represented by its own independent register bit and only one bit being active at any time.
Encoding (encoder): the input sequence is converted into a vector of fixed length.
Decoding (decoder): converting the fixed vector generated before into an output sequence; wherein, the input sequence can be characters, voice, images and videos; the output sequence may be text, images.
The Recurrent Neural Network (RNN) is a Recurrent Neural Network (Recurrent Neural Network) in which sequence data is input, recursion is performed in the evolution direction of the sequence, and all nodes (Recurrent units) are connected in a chain, wherein a Bidirectional Recurrent Neural Network (Bi-RNN) and a Long-Short Term Memory Network (Long Short-Term Memory Network (LSTM)) are common Recurrent Neural networks. The recurrent neural network has memory, parameter sharing and graph completion (training completion), and thus has certain advantages in learning the nonlinear characteristics of a sequence. The recurrent neural network has applications in Natural Language Processing (NLP), such as speech recognition, Language modeling, machine translation, and other fields, and is also used for various time series predictions. A cyclic Neural Network constructed by introducing a Convolutional Neural Network (CNN) can process computer vision problems containing sequence input.
self-Attention Mechanism (Attention Mechanism): the attention mechanism may enable a neural network to have the ability to focus on a subset of its inputs (or features), selecting a particular input, and be applied to any type of input regardless of its shape. In situations where computing power is limited, the attention mechanism is a resource allocation scheme that is the primary means to solve the information overload problem, allocating computing resources to more important tasks.
sigmoid function: is an earlier occurring excitation function that ultimately projects the excitation values onto both 0 and 1 values. In this way, a non-linear factor is introduced, wherein 1 represents a fully activated state, 0 represents a state that is not activated at all, and other output values are between the two, which indicates that the activation degrees are different.
Cross Entropy (Cross Entropy): the method is an important concept in Shannon information theory and is mainly used for measuring the difference information between two probability distributions. The performance of a language model is typically measured in terms of cross-entropy and complexity (perplexity). The meaning of cross entropy is the difficulty of text recognition using this model, or from a compression point of view, on average, several bits per word are encoded. The meaning of complexity is the number of branches that represent this text average with the model, whose inverse can be considered as the average probability of each word. Smoothing means that a probability value is given to the combination of N-tuples that is not observed, so as to ensure that a probability value can be obtained always through a language model by the word sequence. Commonly used smoothing techniques are turing estimation, subtractive interpolation smoothing, Katz smoothing, and Kneser-Ney smoothing.
Data Normalization (Normalization): also called as normalization, normalization is to limit the data to be processed to a certain range after being processed by some algorithm. The data standardization processing is a basic work of data mining, different evaluation indexes often have different dimensions and dimension units, the data analysis result is influenced under the condition, and in order to eliminate the dimension influence among the indexes, the data needs to be subjected to normalization processing, so that the comparability problem among the data indexes is solved. The purpose of data normalization is to unify data from different sources to the same order of magnitude (a reference coordinate system) so that comparisons are meaningful. Normalization makes the processing of the following data more convenient, and has two advantages: firstly, normalization can accelerate the speed of solving the optimal solution by gradient descent; second, normalization has the potential to improve accuracy.
Co-occurrence matrix: the co-occurrence matrix can count the number of times of the simultaneous occurrence of the classification tags and then can be used for PMI value calculation (the basic idea of the PMI algorithm is to count the probability of the simultaneous occurrence of two classification tags in a text, if the probability is larger, the correlation is tighter, and the correlation degree is higher), so the calculation of the co-occurrence matrix has an important role in data mining and analysis.
Sparse matrix: in the matrix, if the number of elements with the numerical value of 0 is far more than the number of elements other than 0, and the distribution of the elements other than 0 is not regular, the matrix is called a sparse matrix; on the contrary, if the number of elements other than 0 is the majority, the matrix is called dense matrix. The total number of non-zero elements is defined as the density of the matrix compared to the total number of all elements of the matrix.
The embodiment of the application can acquire and process related data based on an artificial intelligence technology. Among them, Artificial Intelligence (AI) is a theory, method, technique and application system that simulates, extends and expands human Intelligence using a digital computer or a machine controlled by a digital computer, senses the environment, acquires knowledge and uses the knowledge to obtain the best result.
The training method of the model provided by the embodiment of the application can be applied to artificial intelligence. The artificial intelligence infrastructure generally includes technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technologies, operation/interaction systems, mechatronics, and the like. The artificial intelligence software technology mainly comprises a computer vision technology, a robot technology, a biological recognition technology, a voice processing technology, a natural language processing technology, machine learning/deep learning and the like.
In the task of prescription recommendation, there is often a dependency between the multiple medications in the prescription, e.g., antipyretic patches and antitussive medications are often in the same prescription. Therefore, it is crucial to efficiently mine the correlation between drugs. Prescription recommendations are often translated into multi-label classification tasks because the number of drugs contained in a prescription is more than one, but as the number of drugs grows, the number of classifiers in the prescription recommendation model also increases, thereby affecting the training efficiency of the model.
For example, existing multi-label classification methods can be roughly classified into three strategies according to the strength of the correlation mining between drugs, the first strategy is: first order strategies that ignore the correlations between drugs altogether. Such as decomposing prescription recommendations into multiple independent binary tasks; in a scene with a large amount of medicines, more classifiers need to be trained, and the operation is complex, time-consuming and labor-consuming. The second strategy is: a second order strategy that only considers the correlation between two drugs. For example, drug pairs are constructed, classifiers are trained for each drug pair, the number of classifiers is d (d-1)/2, d is the number of drugs, and when the number of drugs increases, the number of classifiers increases sharply and the complexity is high. The third strategy is as follows: a higher order strategy that takes into account the interplay between multiple drugs. For example, a plurality of two classifiers are trained, the output label of the previous two classifiers is used as the input of the next two classifiers, the model performance is influenced by the label sequence and can only be trained in series, and the calculation efficiency is low.
In conclusion, the existing model is high in complexity and low in calculation efficiency. In addition, the flexibility is weak, when a new drug label is added, the classifier of the new label needs to be retrained, and the training efficiency of the model is seriously influenced.
Based on the above, the application provides a model training method and device, a computer device, and a storage medium, which can improve the model training efficiency.
The training method of the model provided by the embodiment of the disclosure relates to the technical field of artificial intelligence and also relates to the technical field of virtual reality. The model training method provided by the embodiment of the disclosure can be applied to a terminal, a server side and software running in the terminal or the server side. In some embodiments, the terminal may be a smartphone, tablet, laptop, desktop computer, smart watch, or the like; the server side can be configured into an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, and cloud servers for providing basic cloud computing services such as cloud service, a cloud database, cloud computing, cloud functions, cloud storage, network service, cloud communication, middleware service, domain name service, security service, CDN (content delivery network) and big data and artificial intelligence platforms; the software may be an application or the like implementing the above method, but is not limited to the above form.
The disclosed embodiments are operational with numerous general purpose or special purpose computing system environments or configurations. For example: personal computers, server computers, hand-held or portable devices, tablet-type devices, multiprocessor systems, microprocessor-based systems, set top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments that include any of the above systems or devices, and the like. The application may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The application may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
The embodiment of the present disclosure provides a training method and apparatus for a model, a computer device, and a storage medium, which are specifically described in the following embodiments, and first, a training method for a model in the embodiment of the present disclosure is described for training a prescription recommendation model.
Referring to fig. 1, a training method of a model according to an embodiment of the first aspect of the present disclosure includes, but is not limited to, step S100 to step S600.
Step S100, obtaining a plurality of inquiry sample data, and obtaining prescription sample data corresponding to each inquiry sample data;
step S200, predicting patient sample data and conversation sample data through a pre-training model to obtain prescription prediction data;
step S300, calculating a first loss function of the pre-training model according to the plurality of medicine prediction data to obtain a first loss value;
step S400, constructing a drug co-occurrence matrix according to a plurality of drug sample data;
step S500, calculating a second loss function of the pre-training model according to the drug co-occurrence matrix to obtain a second loss value;
and S600, training the pre-training model according to the first loss value and the second loss value to obtain a prescription recommendation model.
In step S100 of some embodiments, a plurality of inquiry sample data is acquired, and prescription sample data corresponding to each inquiry sample data is acquired. The system comprises a plurality of pieces of inquiry sample data, a plurality of pieces of inquiry sample data and a plurality of pieces of dialogue sample data, wherein the inquiry sample data are some data generated when a patient performs online inquiry or hospital inquiry, each inquiry sample data comprises patient sample data and dialogue sample data, and the patient sample data mainly comprises a patient name, a patient age, a patient gender and the like; the conversation sample data is the conversation content generated by the patient and the doctor during the treatment, etc.; the inquiry sample data is the diagnosis result made by the doctor according to the patient sample data and the dialogue sample data, namely the prescribed prescription, and the prescribed prescription comprises the medicines prescribed according to the patient's condition.
In practical applications, the content of a certain patient sample data may be: the patient name is Zhang III, the patient age is 22 years old, and the user gender is male. The content of a certain pair of session sample data may be in the following form, and its corresponding prescription sample data includes drug a and drug B.
The patients: the doctor is good, the quilt is removed when the child sleeps at night today, the child starts to cough the next day, the child eats the wind-cold common cold particles, the feeling of sweating is good, but the child coughs seriously at 4 points today, feels that much phlegm exists in the throat, asks how to do at present?
A doctor: the body temperature of the child is monitored to see whether the body temperature is increased or not, if the body temperature is not increased, the child can take the medicine firstly, and if the body temperature is increased, the child is advised to visit a hospital to check blood routine.
The patients: what medicine is eaten well?
A doctor: some expectorant and antitussive drugs, such as drug a and drug B, can be taken orally first.
Each piece of inquiry sample data comprises patient sample data and conversation sample data, each piece of prescription sample data comprises a plurality of pieces of medicine sample data, when preliminary prescription prediction is carried out, prediction is carried out according to the patient sample data, such as the age of a patient, the sex of the patient and some key information in the conversation data, such as symptoms ' cough, phlegm and sweating ' in throat ' and medicine names ' medicine A and medicine B ' in the conversation sample data, after the prescription sample data is obtained through prediction, a first loss value and a second loss value are further required to be calculated so as to correct a loss function of a pre-training model, the pre-training model is trained according to a target loss value, the model is optimized towards a new target, and the optimized pre-training model, namely, a prescription recommendation model is obtained.
In step S200 of some embodiments, prediction processing is performed on patient sample data and session sample data through a pre-training model to obtain prescription prediction data; the pre-training model is a prediction model which is trained in advance, such as a text classification model, and can preliminarily predict a prescription required to be made according to patient sample data and dialogue data to obtain prescription prediction data, wherein the prescription prediction data comprises a plurality of medicine prediction data, such as medicine C and medicine D. Furthermore, the pre-training model outputs the probability of each prescribed drug after prediction processing is carried out according to patient sample data and conversation sample data, and then the probability of the prescribed drug is converted into the range of [0,1] by using a sigmoid excitation function, namely prescribed prediction data.
Specifically, for the xth inquiry, the score of each drug, i.e., the probability of being prescribed, is recorded as sx∈RdAs shown in equation (1):
sx={y1,y2,...,yd},yi∈[0,1] (1)
wherein d is the number of all drugs, yiIs the score of the ith drug, and if the score exceeds the threshold, the final recommended prescription is marked as Px∈Rd
Figure BDA0003476755560000091
Px={p1,p2,...,pd},pi∈{0,1} (3)
In step S300 of some embodiments, a first loss function of the pre-trained model is calculated based on the plurality of drug prediction data to obtain a first loss value. If the pre-training model in the embodiment of the present application is a hierarchical attention network model, a BCE loss function may be selected as a first loss function of the pre-training model, and the BCE loss function is calculated to obtain a first loss value, where the specific calculation process is shown in formula (4):
Figure BDA0003476755560000092
wherein L ismodelFor the first loss value, d is the amount of all drugs, piFor indicating whether the prescription contains the corresponding drug, piWhen 0 indicates that the drug is not contained, piDescription of the formula 1 contains the drug, yiIs the score for the ith drug.
In step S400 of some embodiments, a drug co-occurrence matrix is constructed according to a plurality of drug sample data, wherein the drug co-occurrence matrix represents the co-occurrence number between each two drugs, and the co-occurrence number refers to the number of times that the drug E and the drug F co-occur in a certain prescription.
In step S500 of some embodiments, a second loss function of the pre-trained model is calculated according to the drug co-occurrence matrix to obtain a second loss value.
In step S600 of some embodiments, a pre-training model is trained according to the first loss value and the second loss value, so as to obtain a prescription recommendation model. Specifically, the first loss value and the second loss value are used as reverse propagation quantities, and model parameters of the pre-training model are adjusted to train the pre-training model to obtain the prescription recommendation model. The method comprises the steps that a first loss function and a second loss function are combined to obtain a target loss function of a pre-training model, a first loss value and a second loss value are combined to obtain a target loss value of the pre-training model, the second loss value is used for correcting the target loss function of the pre-training model in combination with the first loss value, so that the pre-training model is trained according to the target loss value, the pre-training model is optimized towards a new target, the pre-training model is trained by adjusting model parameters of the pre-training model, and a trained prescription recommendation model is obtained, wherein the prescription recommendation model is used for recommending prescriptions.
In some embodiments, as shown in fig. 2, step S200 specifically includes, but is not limited to, step S210 to step S240.
Step S210, standardizing patient sample data according to a preset data format to obtain corresponding patient characteristics;
step S220, carrying out first coding processing on the patient characteristics to obtain corresponding patient vectors;
step S230, carrying out second coding processing on the dialogue sample data to obtain a corresponding dialogue vector;
and step S240, performing prediction processing according to the patient vector and the dialogue vector to obtain prescription prediction data.
In step S210 of some embodiments, patient sample data is normalized according to a preset data format, for example, for the patient 'S sex and the patient' S age, to obtain a corresponding patient vector. Specifically, patient gender can be standardized using one-hot encoding by using an N-bit status register to encode N states, each with its own independent register bit, and at any time, only one of the bits is valid, i.e., only one bit is 1, and the rest are zero values. For example, the standardized data obtained by unique heat encoding of patient gender characteristics "male" and "female" are: male is 10, female is 01. The method has the advantages that the independent-heat coding is used, values of discrete features are expanded to the European space, a certain value of the discrete features corresponds to a certain point of the European space, the independent-heat coding is used for the discrete features, distance calculation between the features can be more reasonable, and accordingly the effect of model training is improved. Furthermore, as for the patient age, since the obtained patient ages are not all in a uniform format, such as "32 years", "thirty-two years", "age 32", etc., during the inquiry process, the patient ages need to be uniform in format, such as uniform patient ages as arabic data, such as "32", etc.
In step S220 of some embodiments, during the modeling process, a first encoding process, i.e., an encoding process, needs to be performed on the patient features to obtain corresponding patient vectors.
In step S230 of some embodiments, during the modeling process, a second encoding process, i.e., an encoding process, needs to be performed on the dialog sample data to obtain a corresponding dialog vector. The first encoding process and the second encoding process are identical, and both represent processes for encoding and converting the feature or data into a corresponding encoded vector, and the first and second processes are used for distinguishing different encoding objects.
In step S240 of some embodiments, a prediction process is performed according to the patient vector and the dialogue vector, that is, a preliminary prescription prediction is performed by using a pre-trained model, so as to obtain prescription prediction data.
In some embodiments, as shown in fig. 3, step S230 specifically includes, but is not limited to, step S231 to step S235.
Step S231, acquiring a preset level attention model;
step S232, performing word segmentation processing on the dialogue sample data to obtain word segmentation data;
step S233, the word data is coded to obtain a word coding vector;
step S234, carrying out coding processing on the word coding vector through a word level neural network to obtain a sentence coding vector;
and step S235, coding the sentence coding vector through the sentence level neural network to obtain a dialogue vector.
In step S231 of some embodiments, a preset hierarchical attention model, also referred to as a hierarchical attention network model, is obtained, which includes a word-level neural network and a sentence-level neural network, the word-level neural network includes a word sequence encoder and a word-level attention layer, and the sentence-level neural network includes a sentence sequence encoder and a sentence-level attention layer.
In step S232 of some embodiments, word segmentation processing is performed on the dialogue sample data to obtain word segmentation data.
In step S233 of some embodiments, the participle data is encoded, specifically, the participle data is encoded by the encoder, so as to obtain a word encoding vector.
In step S234 of some embodiments, the word encoding vector is input to the word level neural network, and the word sequence encoder of the word level neural network performs encoding processing on the word encoding vector to obtain the sentence encoding vector. The method specifically comprises the following steps: in the word-level neural network, the task is a classification task, that is, each dialogue data to be classified is considered to be divided into a plurality of sentences, so the word-level neural network processes each sentence. For words in a sentence, however, not every word is useful for the classification task, such as in the case of emotional classification of text, the important words of interest are: "nice", "hurt", etc., in order to enable the recurrent neural network to automatically put "attention" on these words, words important to the meaning of the sentence are extracted by a word-level attention mechanism, and the representations of those information words are summarized to form a sentence vector, i.e., a sentence coding vector.
In step S235 of some embodiments, the sentence coding vector obtained in step S234 is input to the sentence-level neural network, and the sentence sequence encoder of the sentence-level neural network performs coding processing on the sentence coding vector to obtain a dialogue vector, and the specific process of the dialogue vector coincides with the process of the coding processing performed by the sentence-level neural network.
In some embodiments, as shown in fig. 4, step S240 specifically includes, but is not limited to, step S241 to step S244.
Step S241, splicing the patient vector and the dialogue vector to obtain a spliced vector;
step S242, carrying out prediction processing on the splicing vectors through the full connection layer to obtain the opening probability of each preset medicine;
step S243, screening preset medicines according to a preset threshold value and the opening probability to obtain target medicines;
in step S244, the target drug is used as prescription prediction data.
In step S241 of some embodiments, the patient vector and the dialogue vector are stitched through the stitching layer to obtain a stitching vector.
In step S242 of some embodiments, the stitching vector is subjected to prediction processing by the full-link layer, and specifically, the stitching vector may be input to a classifier for classification processing, so as to obtain an opening probability of each preset drug.
In step S243 of some embodiments, a preset drug is screened according to a preset threshold and an opening probability to obtain a target drug, wherein if the preset drug exceeds the preset threshold, the preset drug is considered as the target drug, and if the preset drug does not exceed the preset threshold, the preset drug is considered as not the target drug; and screening out the preset drug with the opening probability larger than a preset threshold value as the target drug.
In step S244 of some embodiments, the target drug is taken as the prescription prediction data, i.e., the prescription includes a plurality of target drugs.
In practical applications, the embodiment of the application selects the hierarchical attention network HAN due to the hierarchical structure of "word-sentence-piece" in the dialogue data. The specific operation is as follows, firstly, data preprocessing is carried out, and the sex unique hot code and the age of the patient are standardized; the above features are then entered into the fully connected layer to obtain a representation e of the patient1Inputting the dialogue information into HAN, and obtaining the integral expression e of the dialogue information by sequentially passing through RNN and attention of word level and RNN and attention of sentence level2(ii) a Finally, the patient is represented as e1And a dialog representation e2Splicing and inputting the full-link layer to obtain the opened probability of each predicted medicine, wherein the opened probability of the predicted medicine is converted into [0,1] by using a sigmoid excitation function]This is the prescribed recipe.
In some embodiments, as shown in fig. 5, step S400 specifically includes, but is not limited to, step S410 to step S450.
S410, acquiring a co-occurrence relation among preset medicines in medicine sample data to obtain a medicine co-occurrence relation;
s420, constructing a drug co-occurrence pair of preset drugs based on the drug co-occurrence relation, and acquiring corresponding drug co-occurrence times;
s430, normalizing the co-occurrence times of the medicines to obtain a first co-occurrence value;
s440, calculating the difference between the first coexistence value and a preset threshold value to obtain a second coexistence value;
and S450, constructing a drug co-occurrence matrix according to the second co-occurrence value.
In step S410 of some embodiments, the drug sample data includes a plurality of preset drugs, and a co-occurrence relationship between the preset drugs in the drug sample data is obtained to obtain a drug co-occurrence relationship, where the co-occurrence relationship refers to whether each two preset drugs are co-present in the same drug sample data.
In step S420 of some embodiments, a drug co-occurrence pair of a preset drug is constructed based on the drug co-occurrence relationship, and the corresponding number of drug co-occurrences is obtained, for example, if the preset drug includes drug G, drug H, etc., and drug G and drug H have a co-occurrence relationship, the co-occurrence pair of drug G and drug H is constructed, and the number of co-occurrences corresponding to the co-occurrence pair is obtained, for example, if 1 co-occurrence is found, the number of co-occurrences is 1.
In step S430 of some embodiments, the number of co-occurrences of the drug is normalized, i.e., the number of co-occurrences of the drug is limited to a certain range, such as a [0,1] range, as required.
In step S440 of some embodiments, a difference between the first coexistence value and the preset threshold is calculated to obtain a second coexistence value, that is, the first coexistence value is subtracted by the preset threshold to obtain the second coexistence value.
In step S450 of some embodiments, a drug co-occurrence matrix of the preset drug is constructed according to the second co-occurrence value.
In practical application, the process of constructing the drug co-occurrence matrix is as follows:
k diagnoses are set, for the k diagnosis, k prescription sample data, namely k training sets are obtained, and a medicine co-occurrence matrix A is obtained through statistics from the k training setsco,k∈Rd×dAs shown in equation (5):
Figure BDA0003476755560000131
wherein cnt [ i, j ] is the number of co-occurrences of the ith drug and the jth drug in the prescription for the kth diagnosis, and the values of the ith drug and the jth drug in the drug co-occurrence matrix are obtained by normalizing the number of co-occurrences.
For example, under the diagnosis of "fever and cough", the doctor has 3 prescriptions one (including antipyretic patch and antitussive medicine) and 1 prescription two (including antitussive medicine and antiphlogistic medicine), and supposing that there are three medicines of antipyretic patch, antitussive medicine and antiphlogistic medicine together, the co-occurrence matrix is as shown in (6):
Figure BDA0003476755560000132
based on the co-occurrence matrix, the embodiment of the present application designs a second loss function LcoSpecifically, as shown in formula (7):
Figure BDA0003476755560000133
wherein the content of the first and second substances,
Figure BDA0003476755560000134
element (1) of
Figure BDA0003476755560000135
The product of the ith drug and the jth drug score, which is obtained by preliminary prediction of a pre-trained model, can also be regarded as the probability of the paired occurrence of the ith drug and the jth drug. L iscoThe design of (a) makes the fraction obtained in the model of the drug pair with high co-occurrence number under the kth diagnosis high, and skillfully capturesCorrelations between drugs were obtained. For example, in the diagnosis of "fever and cough", the number of co-occurrences of antipyretic patch and antitussive drug is high, whereas if the score of antipyretic patch predicted by the pre-trained model is 0.8 and the score of antitussive drug is 0.3, then L iscoThe product of the scores of the antipyretic patch and the antitussive medicine tends to be increased, and the scores of the antipyretic patch and the antitussive medicine tend to be increased.
Therefore, the target loss function of the pre-training model is finally determined as the sum of the first loss function and the second loss function, which is specifically shown in formula (8):
L=Lmodel+Lco (8)
to sum up, the embodiment of the present application mainly utilizes prescription sample data, i.e., diagnostic information, to construct a drug co-occurrence matrix, and then adds a drug co-occurrence loss, i.e., a second loss function, on the basis of the first loss function of the original classification task.
In practical application, a specific training process of the prescription recommendation model is as follows, first, patient information and dialogue information are input into a text classification model (for example, a hierarchical attention model HAN selected in the embodiment of the present application, and a specific model structure thereof is described in the above embodiment), then a co-occurrence matrix of each diagnosed drug is constructed, a loss function of the model is reset to L, the model is optimized toward a target of minimizing L in the training process, and the prescription recommendation model is obtained after optimization, so that a final recommended prescription is obtained. The implementation of the application has the capability of mining the relationship among a plurality of medicines, in other words, although the scheme constructs the co-occurrence matrix of the medicine pairs, all the medicine pairs are considered at the same time for the same diagnosis, and the correlation among a plurality of medicines is indirectly mined. In addition, on the basis of the existing model, the embodiment of the application only needs to add one loss function and does not need to add a classifier, so that the training efficiency is improved. In addition, the embodiment of the application is suitable for any number of diagnoses, even if the number of diagnoses is increased, the co-occurrence matrix of the medicines under each diagnosis is extremely sparse, the co-occurrence matrix can be stored in a sparse matrix form, too much storage space is not occupied, the embodiment of the application is also suitable for any number of medicines, and only one model is needed no matter the number of the medicines.
According to the training method of the model provided by the embodiment of the disclosure, a plurality of inquiry sample data are obtained, and prescription sample data corresponding to each inquiry sample data are obtained, wherein each inquiry sample data comprises patient sample data and conversation sample data, and each prescription sample data comprises a plurality of medicine sample data; predicting patient sample data and conversation sample data through a pre-training model to obtain prescription prediction data; wherein the prescription prediction data comprises a plurality of medication prediction numbers; calculating a first loss function of the pre-training model according to the plurality of drug prediction data to obtain a first loss value; constructing a drug co-occurrence matrix according to a plurality of drug sample data; calculating a second loss function of the pre-training model according to the drug co-occurrence matrix to obtain a second loss value; and training the pre-training model according to the first loss value and the second loss value to obtain a prescription recommendation model for recommending a prescription. According to the method and the device, the prescription sample data is introduced after the patient sample data and the conversation sample data are subjected to prediction processing by the pre-training model, the medicine co-occurrence matrix is built according to the prescription sample data, and the medicine co-occurrence loss is added according to the medicine co-occurrence matrix, so that the correlation among a plurality of medicines is considered, the problem that a classifier is increased along with the increase of the number of medicines in the prescription recommendation model is solved, and the training efficiency of the model is improved.
Embodiments of the present disclosure also include, but are not limited to, the following steps: acquiring actual inquiry data; wherein the actual inquiry data comprises actual patient data and actual dialogue data; inputting actual patient data and actual dialogue data into a prescription recommendation model to perform prescription recommendation processing to obtain a recommended prescription; the prescription recommendation model is obtained by training according to the training method of the model in the embodiment of the first aspect of the application.
The embodiment of the present disclosure further provides a training apparatus for a model, which is used for training a prescription recommendation model, as shown in fig. 6, and can implement a training method for the model, where the apparatus includes: the system comprises a first acquisition module 710, a prescription prediction module 720, a first calculation module 730, a matrix construction module 740, a second calculation module 750 and a model training module 760, wherein the first acquisition module 710 is used for acquiring a plurality of inquiry sample data and acquiring prescription sample data corresponding to each inquiry sample data; each piece of inquiry sample data comprises patient sample data and conversation sample data, and each piece of prescription sample data comprises a plurality of pieces of medicine sample data; the prescription prediction module 720 is used for performing prediction processing on patient sample data and conversation sample data through a pre-training model to obtain prescription prediction data; wherein the prescription prediction data comprises a plurality of medication prediction data; the first calculating module 730 is configured to calculate a first loss function of the pre-training model according to the plurality of drug prediction data to obtain a first loss value; the matrix construction module 740 is configured to construct a drug co-occurrence matrix according to the plurality of drug sample data; the second calculating module 750 is configured to calculate a second loss function of the pre-training model according to the drug co-occurrence matrix to obtain a second loss value; the model training module 760 is used for training the pre-training model according to the first loss value and the second loss value to obtain a prescription recommendation model; wherein, the prescription recommendation model is used for recommending the prescription. It should be noted that the training apparatus for a model in the embodiment of the present disclosure is used to execute the training method for a model in the above embodiment, and a specific processing procedure of the training apparatus is the same as that of the training method for a model in the above embodiment, and is not described here any more.
An embodiment of the present disclosure further provides a computer device, including:
at least one processor, and,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions for execution by the at least one processor to cause the at least one processor, when executing the instructions, to implement a method as in any one of the embodiments of the first aspect of the application.
The hardware structure of the computer apparatus will be described in detail below with reference to fig. 7. The computer device includes: a processor 810, a memory 820, an input/output interface 830, a communication interface 840, and a bus 850.
The processor 810 may be implemented by a general Central Processing Unit (CPU), a microprocessor, an Application Specific Integrated Circuit (ASIC), or one or more Integrated circuits, and is configured to execute a related program to implement the technical solution provided by the embodiment of the present disclosure;
the Memory 820 may be implemented in the form of a Read Only Memory (ROM), a static storage device, a dynamic storage device, or a Random Access Memory (RAM). The memory 820 may store an operating system and other application programs, and when the technical solution provided by the embodiments of the present disclosure is implemented by software or firmware, the relevant program codes are stored in the memory 820 and are called by the processor 810 to execute the training method of the model of the embodiments of the present disclosure;
an input/output interface 830 for implementing information input and output;
the communication interface 840 is used for realizing communication interaction between the device and other devices, and can realize communication in a wired manner (for example, USB, network cable, etc.) or in a wireless manner (for example, mobile network, WIFI, bluetooth, etc.); and
a bus 850 that transfers information between the various components of the device (e.g., the processor 810, the memory 820, the input/output interface 830, and the communication interface 840);
wherein processor 810, memory 820, input/output interface 830, and communication interface 840 are communicatively coupled to each other within the device via bus 850.
The disclosed embodiments also provide a storage medium that is a computer-readable storage medium storing computer-executable instructions for causing a computer to perform the training method of the model of the disclosed embodiments.
The memory, which is a non-transitory computer readable storage medium, may be used to store non-transitory software programs as well as non-transitory computer executable programs. Further, the memory may include high speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, the memory optionally includes memory located remotely from the processor, and these remote memories may be connected to the processor through a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The embodiments described in the embodiments of the present disclosure are for more clearly illustrating the technical solutions of the embodiments of the present disclosure, and do not constitute a limitation to the technical solutions provided in the embodiments of the present disclosure, and it is obvious to those skilled in the art that the technical solutions provided in the embodiments of the present disclosure are also applicable to similar technical problems with the evolution of technology and the emergence of new application scenarios.
Those skilled in the art will appreciate that the solutions shown in fig. 1-5 are not meant to limit embodiments of the present disclosure, and may include more or fewer steps than those shown, or may combine certain steps, or different steps.
The above-described embodiments of the apparatus are merely illustrative, wherein the units illustrated as separate components may or may not be physically separate, i.e. may be located in one place, or may also be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
One of ordinary skill in the art will appreciate that all or some of the steps of the methods, systems, functional modules/units in the devices disclosed above may be implemented as software, firmware, hardware, and suitable combinations thereof.
The terms "first," "second," "third," "fourth," and the like in the description of the application and the above-described figures, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the application described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It should be understood that in the present application, "at least one" means one or more, "a plurality" means two or more. "and/or" for describing an association relationship of associated objects, indicating that there may be three relationships, e.g., "a and/or B" may indicate: only A, only B and both A and B are present, wherein A and B may be singular or plural. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. "at least one of the following" or similar expressions refer to any combination of these items, including any combination of single item(s) or plural items. For example, at least one (one) of a, b, or c, may represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", wherein a, b, c may be single or plural.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes multiple instructions for causing a computer device (which may be a personal computer, a server, or a network device) to perform all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing programs, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The preferred embodiments of the present disclosure have been described above with reference to the accompanying drawings, and therefore do not limit the scope of the claims of the embodiments of the present disclosure. Any modifications, equivalents and improvements within the scope and spirit of the embodiments of the present disclosure should be considered within the scope of the claims of the embodiments of the present disclosure by those skilled in the art.

Claims (10)

1. A method for training a model, the method being used for training a prescription recommendation model, and the method comprising:
acquiring inquiry sample data and prescription sample data of the inquiry sample data; wherein each said prescription sample data comprises patient sample data and session sample data, each said prescription sample data comprising a plurality of drug sample data;
predicting the patient sample data and the dialogue sample data through a pre-training model to obtain prescription prediction data; wherein the prescription prediction data comprises a plurality of medication prediction data;
calculating a first loss function of the pre-training model according to the plurality of drug prediction data to obtain a first loss value;
constructing a drug co-occurrence matrix according to the plurality of drug sample data;
calculating a second loss function of the pre-training model according to the drug co-occurrence matrix to obtain a second loss value;
training the pre-training model according to the first loss value and the second loss value to obtain a prescription recommendation model; wherein the prescription recommendation model is used for recommendation of prescriptions.
2. The method of claim 1, wherein said predictive processing of said patient sample data and said session sample data through a pre-trained model to obtain prescription prediction data comprises:
standardizing the patient sample data according to a preset data format to obtain corresponding patient characteristics;
carrying out first coding processing on the patient characteristics to obtain corresponding patient vectors;
performing second coding processing on the dialogue sample data to obtain a corresponding dialogue vector;
and performing prediction processing according to the patient vector and the dialogue vector to obtain prescription prediction data.
3. The method according to claim 2, wherein said performing a second encoding process on the dialog sample data to obtain a corresponding dialog vector comprises:
acquiring a preset level attention model; wherein the hierarchical attention model comprises a word-level neural network and a sentence-level neural network;
performing word segmentation processing on the dialogue sample data to obtain word segmentation data;
carrying out coding processing on the word segmentation data to obtain a word coding vector;
coding the word coding vector through the word level neural network to obtain a sentence coding vector;
and coding the sentence coding vector through the sentence level neural network to obtain a dialogue vector.
4. The method of claim 2, wherein each of said drug sample data comprises a plurality of predetermined drugs; the predicting according to the patient vector and the dialogue vector to obtain prescription prediction data, comprising:
splicing the patient vector and the dialogue vector to obtain a spliced vector;
predicting the splicing vector through a full-connection layer to obtain the opening probability of each preset medicine;
screening the preset medicines according to a preset threshold value and the opening probability to obtain target medicines;
using the target drug as the prescription prediction data.
5. The method of claim 4, wherein said constructing a drug co-occurrence matrix from said plurality of drug sample data comprises:
acquiring a co-occurrence relation among the preset medicines in the medicine sample data to obtain a medicine co-occurrence relation;
constructing a drug co-occurrence pair of the preset drugs based on the drug co-occurrence relationship, and acquiring corresponding drug co-occurrence times;
normalizing the co-occurrence times of the medicines to obtain a first co-occurrence value;
calculating the difference between the first co-occurrence value and the preset threshold value to obtain a second co-occurrence value;
and constructing a drug co-occurrence matrix according to the second co-occurrence value.
6. The method of claim 1, wherein the training the pre-trained model according to the first loss value and the second loss value to obtain a prescription recommendation model comprises:
and adjusting model parameters of the pre-training model by taking the first loss value and the second loss value as reverse propagation quantities so as to train the pre-training model and obtain the prescription recommendation model.
7. The method of any one of claims 1-6, further comprising:
acquiring actual inquiry data; wherein the actual interrogation data comprises actual patient data and actual session data;
and inputting the actual patient data and the actual dialogue data into the prescription recommendation model to perform prescription recommendation processing to obtain a recommended prescription.
8. A training device for a model, for training a prescription recommendation model, comprising:
a first obtaining module: the system comprises prescription sample data used for acquiring a plurality of inquiry sample data and the inquiry sample data; wherein each said prescription sample data comprises patient sample data and session sample data, each said prescription sample data comprising a plurality of drug sample data;
a prescription prediction module: the system is used for predicting the patient sample data and the dialogue sample data through a pre-training model to obtain prescription prediction data; wherein the prescription prediction data comprises a plurality of medication prediction data;
a first calculation module: the first loss function of the pre-training model is calculated according to the plurality of medicine prediction data to obtain a first loss value;
a matrix construction module: for constructing a drug co-occurrence matrix from the plurality of drug sample data;
a second calculation module: the second loss function of the pre-training model is calculated according to the drug co-occurrence matrix to obtain a second loss value;
a model training module: the pre-training model is used for training according to the first loss value and the second loss value to obtain a prescription recommendation model; wherein the prescription recommendation model is used for recommendation of prescriptions.
9. A computer device comprising a memory and a processor, wherein the memory has stored therein a program, and wherein the processor is configured to perform, when the program is executed by the processor:
the method of any one of claims 1 to 7.
10. A storage medium which is a computer-readable storage medium, wherein the computer-readable storage stores a computer program, and when the computer program is executed by a computer, the computer is configured to perform:
the method of any one of claims 1 to 7.
CN202210057007.1A 2022-01-18 2022-01-18 Model training method and device, computer equipment and storage medium Active CN114386528B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202210057007.1A CN114386528B (en) 2022-01-18 Model training method and device, computer equipment and storage medium
PCT/CN2022/090760 WO2023137924A1 (en) 2022-01-18 2022-04-29 Model training method and apparatus, computer device, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210057007.1A CN114386528B (en) 2022-01-18 Model training method and device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN114386528A true CN114386528A (en) 2022-04-22
CN114386528B CN114386528B (en) 2024-05-14

Family

ID=

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114968412A (en) * 2022-06-20 2022-08-30 中国平安财产保险股份有限公司 Configuration file generation method, device, equipment and medium based on artificial intelligence
CN115458049A (en) * 2022-06-29 2022-12-09 四川大学 Universal anti-citrullinated polypeptide antibody epitope prediction method and device based on bidirectional circulating neural network
WO2023137924A1 (en) * 2022-01-18 2023-07-27 平安科技(深圳)有限公司 Model training method and apparatus, computer device, and storage medium

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108647236A (en) * 2018-03-30 2018-10-12 山东管理学院 A kind of prescriptions of traditional Chinese medicine vector space model method and device based on Term co-occurrence
CN111191020A (en) * 2019-12-27 2020-05-22 江苏省人民医院(南京医科大学第一附属医院) Prescription recommendation method and system based on machine learning and knowledge graph
CN111753543A (en) * 2020-06-24 2020-10-09 北京百度网讯科技有限公司 Medicine recommendation method and device, electronic equipment and storage medium
US20210142173A1 (en) * 2019-11-12 2021-05-13 The Cleveland Clinic Foundation Network-based deep learning technology for target identification and drug repurposing
CN112951362A (en) * 2021-02-23 2021-06-11 上海商汤智能科技有限公司 Medicine recommendation method, device, equipment and storage medium
CN113707264A (en) * 2021-08-31 2021-11-26 平安科技(深圳)有限公司 Medicine recommendation method, device, equipment and medium based on machine learning
CN113808693A (en) * 2021-09-10 2021-12-17 浙江科技学院 Medicine recommendation method based on graph neural network and attention mechanism
CN113889219A (en) * 2021-10-29 2022-01-04 华中科技大学 Drug recommendation method and system for chronic obstructive pulmonary disease

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108647236A (en) * 2018-03-30 2018-10-12 山东管理学院 A kind of prescriptions of traditional Chinese medicine vector space model method and device based on Term co-occurrence
US20210142173A1 (en) * 2019-11-12 2021-05-13 The Cleveland Clinic Foundation Network-based deep learning technology for target identification and drug repurposing
CN111191020A (en) * 2019-12-27 2020-05-22 江苏省人民医院(南京医科大学第一附属医院) Prescription recommendation method and system based on machine learning and knowledge graph
CN111753543A (en) * 2020-06-24 2020-10-09 北京百度网讯科技有限公司 Medicine recommendation method and device, electronic equipment and storage medium
CN112951362A (en) * 2021-02-23 2021-06-11 上海商汤智能科技有限公司 Medicine recommendation method, device, equipment and storage medium
CN113707264A (en) * 2021-08-31 2021-11-26 平安科技(深圳)有限公司 Medicine recommendation method, device, equipment and medium based on machine learning
CN113808693A (en) * 2021-09-10 2021-12-17 浙江科技学院 Medicine recommendation method based on graph neural network and attention mechanism
CN113889219A (en) * 2021-10-29 2022-01-04 华中科技大学 Drug recommendation method and system for chronic obstructive pulmonary disease

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023137924A1 (en) * 2022-01-18 2023-07-27 平安科技(深圳)有限公司 Model training method and apparatus, computer device, and storage medium
CN114968412A (en) * 2022-06-20 2022-08-30 中国平安财产保险股份有限公司 Configuration file generation method, device, equipment and medium based on artificial intelligence
CN114968412B (en) * 2022-06-20 2024-02-02 中国平安财产保险股份有限公司 Configuration file generation method, device, equipment and medium based on artificial intelligence
CN115458049A (en) * 2022-06-29 2022-12-09 四川大学 Universal anti-citrullinated polypeptide antibody epitope prediction method and device based on bidirectional circulating neural network

Also Published As

Publication number Publication date
WO2023137924A1 (en) 2023-07-27

Similar Documents

Publication Publication Date Title
CN112214995B (en) Hierarchical multitasking term embedded learning for synonym prediction
Duarte et al. Deep neural models for ICD-10 coding of death certificates and autopsy reports in free-text
CN116682553B (en) Diagnosis recommendation system integrating knowledge and patient representation
WO2023137924A1 (en) Model training method and apparatus, computer device, and storage medium
CN112100406B (en) Data processing method, device, equipment and medium
WO2023029506A1 (en) Illness state analysis method and apparatus, electronic device, and storage medium
CN114722826B (en) Model training method and device, electronic equipment and storage medium
CN111881292B (en) Text classification method and device
CN113823412B (en) Health management plan generation method and device, electronic equipment and storage medium
CN113704428A (en) Intelligent inquiry method, device, electronic equipment and storage medium
CN114358007A (en) Multi-label identification method and device, electronic equipment and storage medium
CN114358201A (en) Text-based emotion classification method and device, computer equipment and storage medium
CN111540470B (en) Social network depression tendency detection model based on BERT transfer learning and training method thereof
CN114240552A (en) Product recommendation method, device, equipment and medium based on deep clustering algorithm
CN116050352A (en) Text encoding method and device, computer equipment and storage medium
CN114613462A (en) Medical data processing method and device, electronic equipment and storage medium
CN114358020A (en) Disease part identification method and device, electronic device and storage medium
CN114637847A (en) Model training method, text classification method and device, equipment and medium
CN116469546A (en) Disease auxiliary identification method, device, equipment and medium based on attention mechanism
Ning et al. Research on a vehicle-mounted intelligent TCM syndrome differentiation system based on deep belief network
CN114386528B (en) Model training method and device, computer equipment and storage medium
CN114360715A (en) Constitution identification method and device, electronic equipment and storage medium
CN114998041A (en) Method and device for training claim settlement prediction model, electronic equipment and storage medium
CN114863521A (en) Expression recognition method, expression recognition device, electronic equipment and storage medium
CN114091475A (en) Dialog text generation method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant