Traditional Chinese medicine model training method and device based on knowledge structure and four diagnostic traits
The method enhances TCM model training by integrating entity recognition and masking techniques to improve diagnostic accuracy, aligning with TCM logical thinking and improving diagnostic precision.
Patent Information
- Application Number
- CN202210540736.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-17
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2042-05-17
AI Technical Summary
Existing methods for training traditional Chinese medicine (TCM) models using neural networks struggle to integrate with the logical thinking of TCM syndrome differentiation and treatment, leading to inaccurate diagnosis.
A method involving entity recognition, knowledge structure training, and masking techniques to construct a TCM diagnosis model that infers subsequent medical entities based on entity relationships and diagnostic traits, enhancing diagnostic accuracy.
The method trains a TCM diagnosis model with higher diagnostic accuracy by organizing knowledge structure and masking to predict four diagnostic traits, aligning with TCM logical thinking.
Smart Images

Figure CN114783618B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of intelligent decision-making technology, and in particular to a method, device, equipment and computer-readable storage medium for training a traditional Chinese medicine model based on knowledge structure and four diagnostic traits. Background Art
[0002] In recent years, with the increasing number of international medical problems solved by traditional Chinese medicine, the international status of traditional Chinese medicine has gradually improved. Traditional Chinese medicine is a long-standing knowledge accumulation in my country. It conducts a comprehensive and harmless diagnosis of patients through the four diagnostic characteristics of observation, auscultation, inquiry and palpation. It requires doctors to have knowledge covering all aspects of the human body, but the accumulation of knowledge points also limits the development of traditional Chinese medicine. With the development of the times, in order to enable more people to enjoy the convenience of traditional Chinese medicine diagnosis and treatment, a medical diagnosis model has been obtained by training neural networks through massive text corpora related to traditional Chinese medicine, and then fine-tuning the training through medical case books.
[0003] However, TCM is a highly specialized field. The existing training methods use a large amount of text corpus with uneven quality. The trained model cannot be well integrated into the logical thinking of TCM syndrome differentiation and treatment. The trained model can barely be regarded as a medical diagnosis model but not a TCM diagnosis model. Therefore, a more effective training method is needed to obtain a TCM diagnosis model that can reflect the power of TCM and increase the accuracy of diagnosis. Summary of the invention
[0004] The present invention provides a method, device, equipment and storage medium for training a TCM model based on knowledge structure and four diagnostic traits. Its main purpose is to train a TCM diagnostic model with higher diagnostic accuracy by organizing knowledge structure and masking to predict four diagnostic traits.
[0005] To achieve the above object, the present invention provides a TCM model training method based on knowledge structure and four diagnostic traits, comprising:
[0006] Perform entity recognition on the pre-constructed TCM corpus dataset to obtain entity results, and classify the entity results to obtain medical entity sets of various types;
[0007] For the medical entity set, a chain sample set is constructed according to the preset entity superior-subordinate relationship;
[0008] Conducting knowledge structure training on the chain sample set to obtain a primary TCM diagnosis model;
[0009] Acquire a diagnostic information set of four diagnostic traits, and perform a text conversion operation on the diagnostic information set of the four diagnostic traits according to a preset preprocessing strategy to obtain a four diagnostic text set;
[0010] The primary TCM diagnosis model is trained according to a preset masking method and the four-diagnosis text set to obtain a TCM diagnosis model.
[0011] Optionally, the method of training the primary TCM diagnosis model using the four-diagnosis text set according to a preset masking method to obtain a TCM diagnosis model includes:
[0012] Masking the four diagnostic text sets according to a preset mask and a preset masking ratio to obtain a masked sample set, wherein each of the masked samples includes at least one masked portion;
[0013] According to a preset ratio, the masked sample set is allocated into a training set and a test set;
[0014] Predicting the masked sequence using the primary TCM diagnosis model to obtain a prediction result;
[0015] Calculating the loss value between the predicted result and the actual shielded part, and based on the loss value, reversely updating the primary TCM diagnosis model to obtain an updated diagnosis model;
[0016] Determining whether all masked samples in the training set participate in the training;
[0017] When not all masked samples in the training set participate in the training, return to the above step of using the primary TCM diagnosis model to predict the masked part in the training set, and obtain the prediction result to iteratively update the updated diagnosis model;
[0018] When all the masked samples in the training set participate in the training, a final updated diagnostic model is obtained;
[0019] Using the updated diagnostic model to perform comparative prediction on the test set to obtain the prediction accuracy; and when the prediction accuracy is less than the qualified threshold, returning to the step of using the preset mask to mask the four diagnosis text set according to the preset masking ratio to obtain the masked sample set, and retraining the primary TCM diagnostic model;
[0020] When the prediction accuracy is greater than or equal to the qualified threshold, a TCM diagnosis model is obtained.
[0021] Optionally, the chain sample set is subjected to knowledge structure training to obtain a primary TCM diagnosis model, including:
[0022] The chain samples in the chain sample set are sequentially imported into the pre-trained semantic recognition model, the type of each medical entity in the chain sample is identified to obtain a predicted type, and the predicted entity corresponding to the next stage type of each medical entity is predicted;
[0023] According to the actual type of each medical entity in the chain sample and the real next entity, the predicted type and the predicted entity are compared to obtain an error value;
[0024] Minimize the error value to obtain the neural network parameters when the error value is minimum, and use the neural network parameters to perform reverse network propagation to update the model parameters of the semantic recognition model to obtain an updated model;
[0025] Recording the error value, and determining the convergence of the error value;
[0026] When the error value does not converge, return to the above step of sequentially importing one chain sample in the chain sample set into the pre-built semantic recognition model, and iteratively update the semantic recognition model;
[0027] When the error value converges, the final updated semantic recognition model is output to obtain a primary TCM diagnosis model.
[0028] Optionally, the diagnostic information set of the four diagnostic traits is converted into a text according to a preset preprocessing strategy to obtain a four diagnostic text set, including:
[0029] Extract image features of the visual diagnostic traits including the face and tongue pictures in the four diagnostic traits to obtain an image feature text set;
[0030] Extract voiceprint features from the four diagnostic characteristics including the pulse regularity diagnostic characteristic and the question diagnostic characteristic including the auscultation noise, and obtain a pulse feature text set and an auscultation feature text set respectively;
[0031] The image feature text set, the pulse feature text set, the auscultation feature text set and the question and answer text in the four diagnostic traits are taken as the four diagnostic text set.
[0032] Optionally, performing entity recognition on a pre-constructed TCM corpus dataset to obtain entity results includes:
[0033] Segmenting the traditional Chinese medicine corpus data set, and performing part-of-speech tagging on the segmentation results to obtain a medical segmentation set;
[0034] Performing a quantization operation on the medical word segmentation set to obtain a quantized data set;
[0035] The pre-trained entity extraction network is used to perform entity recognition on the quantitative data set to obtain entity results.
[0036] Optionally, the entity results are classified to obtain medical entity sets of various types, including:
[0037] According to a preset classification strategy and category set, the entity results are preliminarily classified to obtain a preliminarily classified result;
[0038] Each entity in the primary classification results under the same category is hierarchically classified to obtain a set of medical entities of various types.
[0039] Optionally, constructing a chain sample set for the medical entity set according to a preset entity superior-subordinate relationship includes:
[0040] According to the preset entity superior-subordinate relationship, the medical entities in the adjacent type medical entity set are constructed into key-value pairs;
[0041] According to the key-value pairs, each of the medical entities is chain-connected to obtain a chain sample set.
[0042] In order to solve the above problems, the present invention also provides a TCM model training device based on knowledge structure and four diagnostic traits, the device comprising:
[0043] The knowledge sample acquisition module is used to perform entity recognition on the pre-constructed TCM corpus data set to obtain entity results, classify the entity results to obtain medical entity sets of various types, and construct a chain sample set for the medical entity set according to the preset entity superior-subordinate relationship;
[0044] A primary training module, used for performing knowledge structure training on the chain sample set to obtain a primary TCM diagnosis model;
[0045] A four-diagnostic trait sample acquisition module is used to obtain a diagnostic information set of the four-diagnostic traits, and according to a preset preprocessing strategy, convert the diagnostic information set of the four-diagnostic traits into a text to obtain a four-diagnostic text set;
[0046] The fine-tuning training module is used to train the primary TCM diagnosis model according to a preset masking method and the four-diagnosis text set to obtain a TCM diagnosis model.
[0047] In order to solve the above problem, the present invention further provides an electronic device, the electronic device comprising:
[0048] at least one processor; and,
[0049] a memory communicatively connected to the at least one processor; wherein,
[0050] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the above-mentioned traditional Chinese medicine model training method based on knowledge structure and four diagnostic traits.
[0051] In order to solve the above problems, the present invention also provides a computer-readable storage medium, in which at least one computer program is stored. The at least one computer program is executed by a processor in an electronic device to implement the above-mentioned TCM model training method based on knowledge structure and four diagnostic traits.
[0052] The implementation of the present invention first obtains medical entities in a TCM corpus data set, and then constructs each medical entity into a chain sample set according to a preset entity superior-subordinate relationship to train a model to obtain a primary TCM diagnosis model, wherein the primary TCM diagnosis model can infer subsequent types of medical entities based on a specific medical entity, such as deriving syndrome types from syndrome elements, thereby realizing machine learning on the TCM knowledge structure; then this scheme converts the four diagnostic traits into text to obtain a four diagnostic text set, and according to a preset masking method, uses the four diagnostic text set to train the primary TCM diagnosis model to obtain a TCM diagnosis model, wherein the masking method is to randomly mask several four diagnostic shape features in the four diagnostic text set, and then the model predicts the features of the masked part, so that the trained TCM diagnosis model can infer other possible traits based on the existing diagnostic traits, and when the derived traits are recognized by the patient, the final diagnosis conclusion can be obtained. Therefore, the embodiment of the present invention provides a method, device, equipment and storage medium for training a TCM model based on knowledge structure and four diagnostic traits, which can train a TCM diagnostic model with higher diagnostic accuracy by organizing the knowledge structure and masking to predict the four diagnostic traits. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] Figure 1 A schematic diagram of a flow chart of a TCM model training method based on knowledge structure and four diagnostic traits provided by an embodiment of the present invention;
[0054] Figure 2 A detailed flowchart of a step in a TCM model training method based on knowledge structure and four diagnostic traits provided by an embodiment of the present invention;
[0055] Figure 3 A detailed flowchart of a step in a TCM model training method based on knowledge structure and four diagnostic traits provided by an embodiment of the present invention;
[0056] Figure 4 A detailed flowchart of a step in a TCM model training method based on knowledge structure and four diagnostic traits provided by an embodiment of the present invention;
[0057] Figure 5 A detailed flowchart of a step in a TCM model training method based on knowledge structure and four diagnostic traits provided by an embodiment of the present invention;
[0058] Figure 6 A detailed flowchart of a step in a TCM model training method based on knowledge structure and four diagnostic traits provided by an embodiment of the present invention;
[0059] Figure 7 A functional module diagram of a TCM model training device based on knowledge structure and four diagnostic traits provided by one embodiment of the present invention;
[0060] Figure 8 A schematic diagram of the structure of an electronic device for implementing the TCM model training method based on knowledge structure and four diagnostic traits provided by one embodiment of the present invention.
[0061] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0062] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0063] The embodiment of the present application provides a method for training a Chinese medicine model based on knowledge structure and four diagnostic traits. In the embodiment of the present application, the execution subject of the Chinese medicine model training method based on knowledge structure and four diagnostic traits includes but is not limited to at least one of the electronic devices such as a server, a terminal, etc. that can be configured to execute the method provided in the embodiment of the present application. In other words, the Chinese medicine model training method based on knowledge structure and four diagnostic traits can be executed by software or hardware installed on a terminal device or a server device, and the software can be a blockchain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, etc. The server can be an independent server, or it can be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), and big data and artificial intelligence platforms.
[0064] Reference Figure 1 As shown, it is a flow chart of a TCM model training method based on knowledge structure and four diagnostic traits provided by one embodiment of the present invention. In this embodiment, the TCM model training method based on knowledge structure and four diagnostic traits includes steps S1-S5:
[0065] S1. Perform entity recognition on a pre-constructed TCM corpus dataset to obtain entity results, and classify the entity results to obtain medical entity sets of various types.
[0066] In the embodiment of the present invention, the TCM corpus dataset is a knowledge text paragraph in the form of text related to TCM, such as "irritability is a manifestation of liver fever...".
[0067] For more details, please refer to Figure 2 As shown, in the embodiment of the present invention, the entity recognition is performed on the pre-constructed TCM corpus dataset to obtain the entity result, including steps S101-S103:
[0068] S101, performing word segmentation on the traditional Chinese medicine corpus dataset, and performing part-of-speech tagging on the word segmentation results to obtain a medical word segmentation set;
[0069] S102, performing a quantization operation on the medical word segmentation set to obtain a quantized data set;
[0070] S103: Use a pre-trained entity extraction network to perform entity recognition on the quantized data set to obtain entity results.
[0071] The embodiment of the present invention can use the NLPIR Chinese word segmentation system or other tools to perform word segmentation annotation on the TCM corpus dataset, such as: "irritability (common name), yes (particle), liver (common name), fever (common name), ...". The embodiment of the present invention uses a one-hot quantization model to quantize and encode each word segmentation to obtain "E 烦躁 、E 是 、E 肝 ,...” Then, the pre-trained entity extraction network is used to perform entity recognition on the quantitative data set to obtain the entity result “E 烦躁 、E 肝 、E 发热 ”.
[0072] Among them, the entity extraction network in the embodiment of the present invention is an entity recognition method based on Bert+Bi-LSTM+CRF, which can extract the subject in the text through the text context semantics and part-of-speech relationship. The specific entity extraction process is not described here.
[0073] For further reference, Figure 3 As shown, in the embodiment of the present invention, the entity results are classified to obtain medical entity sets of various types, including steps S111-S112:
[0074] S111, performing primary classification on the entity results according to a preset classification strategy and category set to obtain a primary classification result;
[0075] S112, classifying each entity in the primary classification result under the same category hierarchically to obtain medical entity sets of various types.
[0076] The classification strategy refers to first classifying different types of medical entities, and then classifying whether there is a containment relationship among the same type of medical entities.
[0077] The embodiment of the present invention classifies the entity results according to a preset category set to obtain a medical entity set. The medical entity set includes: [“symptom category, such as irritability, dry mouth”, “syndrome category, such as liver heat, qi deficiency”, “syndrome type category, such as spleen and stomach deficiency and cold”, “disease category, such as palpitations”, “diagnosis type, such as question and answer, pulse diagnosis” and “symptom location type, such as epilepsy vertex, abdomen”]. Then, for the same type of medical entities, such as syndrome type, inclusion relationship classification is performed, such as exterior syndrome → exterior deficiency syndrome; damp-heat syndrome → damp-heat syndrome → damp-heat syndrome → damp-heat syndrome.
[0078] S2. For the medical entity set, a chain sample set is constructed according to the preset entity superior-subordinate relationship.
[0079] In the embodiment of the present invention, the entity hierarchical relationship is a disease derivation diagnosis process constructed according to the diagnosis theory of traditional Chinese medicine, such as derivation of syndrome factors according to symptoms (irritability → liver heat), derivation of syndrome type according to syndrome factors (Qi deficiency → spleen and stomach deficiency and cold), derivation of disease type according to syndrome type (heart and spleen deficiency → palpitations), syndrome type inclusion relationship (heat and dampness syndrome → dampness and heat are both important, dampness is more important than heat), derivation of diagnosis method according to symptoms (stringy pulse → pulse diagnosis), and derivation of site according to symptoms (epilepsy → head).
[0080] In detail, in an embodiment of the present invention, the medical entity set is constructed into a chain sample set according to a preset entity hierarchical relationship, including: according to the preset entity hierarchical relationship, the medical entities in the adjacent type medical entity set are constructed into key-value pairs; according to the key-value pairs, each of the medical entities is chained to obtain a chain sample set.
[0081] Specifically, the embodiment of the present invention performs function F mapping on each medical entity in the medical entity set K according to the entity superior-subordinate relationship R, and obtains a key-value pair set K′, wherein the function mapping relationship diagram is as follows:
[0082] F(R, K) = K′
[0083] Then, the key-value pairs in K′ are connected correspondingly to obtain a chain sample set, where one chain sample is, for example:
[0084] Pulse diagnosis → thick yellow tongue coating → dampness, heat → dampness-heat syndrome
[0085] Interview → Abdominal distension → Abdomen → Dampness and heat → Stomach distension
[0086] Consultation → abdominal distension → stomach
[0087] S3. Perform knowledge structure training on the chain sample set to obtain a primary TCM diagnosis model.
[0088] For more details, please refer to Figure 4 As shown, in the embodiment of the present invention, the knowledge structure training of the chain sample set to obtain the primary TCM diagnosis model includes steps S31-S35:
[0089] S31, sequentially importing the chain samples in the chain sample set into the pre-trained semantic recognition model, performing type recognition on each medical entity in the chain sample to obtain a predicted type, and predicting a predicted entity corresponding to the next stage type of each medical entity;
[0090] S32, comparing the predicted type and the predicted entity according to the actual type of each medical entity in the chain sample and the real next entity to obtain an error value;
[0091] S33, minimizing the error value to obtain the neural network parameters when the error value is the smallest, and using the neural network parameters to perform reverse network propagation to update the model parameters of the semantic recognition model to obtain an updated model;
[0092] S34, recording the error value, and determining the convergence of the error value;
[0093] When the error value does not converge, return to the above step of sequentially importing one chain sample in the chain sample set into the pre-built semantic recognition model, and iteratively update the semantic recognition model;
[0094] When the error value converges, S35, the final updated semantic recognition model is output to obtain a primary TCM diagnosis model.
[0095] The semantic recognition model is a text recognition model based on the BERT neural network, which can recognize and classify the content of text segmentation.
[0096] The embodiment of the present invention configures the output layer of the semantic recognition model so that the semantic recognition model outputs the category of the medical entity and the predicted entity corresponding to the next stage type, wherein the next stage type is, for example: the next stage type when the syndrome type is the syndrome element, and the next stage type when the syndrome element is the symptom.
[0097] The embodiment of the present invention utilizes the semantic recognition model to perform type recognition on each medical entity in the chain sample to obtain a predicted type, and predicts the predicted entity corresponding to the next stage type of each medical entity, and then compares the obtained predicted type and predicted entity with the true type and true entity by means of mean square error calculation to obtain an error value; according to the gradient descent method, the error value is minimized to obtain the neural network parameters when the error value is minimized, and then the semantic recognition model is updated using the neural network parameters, thereby completing a sample training, and training other samples until the error value converges, indicating that the training effect of the semantic recognition model gradually disappears, then the training process is stopped, and a primary Chinese medicine diagnosis model that can infer the next stage medical entity based on a medical entity is obtained.
[0098] S4. Obtain a diagnostic information set of four diagnostic traits, and according to a preset preprocessing strategy, perform a text conversion operation on the diagnostic information set of the four diagnostic traits to obtain a four-diagnosis text set.
[0099] In the embodiment of the present invention, the four diagnostic characteristics refer to diagnostic characteristics obtained through the four means of "observation, auscultation, questioning and palpation", for example [observation: how the tongue coating is, how the complexion is] [smell: auscultation of the chest and abdominal sounds] [ask: ask where you feel uncomfortable, what you feel] [palpation: taking the pulse, pressing a certain part, etc.].
[0100] Among them, except for the medical interview, other diagnostic methods are not in text form. Therefore, the embodiment of the present invention needs to convert the four diagnostic characteristics into text.
[0101] For more details, please refer to Figure 5 As shown, in the embodiment of the present invention, according to the preset preprocessing strategy, the diagnostic information set of the four diagnostic traits is converted into text to obtain the four diagnostic text set, including steps S41-S43:
[0102] S41, extracting image features of the visual diagnostic traits including the face and tongue pictures among the four diagnostic traits to obtain an image feature text set;
[0103] S42, extracting voiceprint features from the four diagnostic characteristics including the pulse regularity diagnostic characteristic and the question diagnostic characteristic including the auscultation noise, to obtain a pulse feature text set and an auscultation feature text set respectively;
[0104] S43, taking the image feature text set, the pulse feature text set, the auscultation feature text set and the question and answer text in the four diagnostic traits as the four diagnostic text set.
[0105] In the embodiment of the present invention, the diagnostic characteristics of inspection belong to picture type data. The embodiment of the present invention can use the method of image feature extraction to extract the diagnostic characteristics; then, pulse diagnosis and auscultation can use the method of sound feature extraction to check the pulse pattern and whether there are noises in the abdomen and chest, and obtain a pulse feature text set and an auscultation feature text set respectively, and finally obtain a four-diagnosis text set containing the image feature text set, the pulse feature text set, the auscultation feature text set and the question and answer text in the four diagnostic characteristics.
[0106] S5. The primary TCM diagnosis model is trained according to a preset masking method and the four-diagnosis text set to obtain a TCM diagnosis model.
[0107] The masking refers to a training method of masking part of the content in the four diagnostic text sets and then deducing the masked part.
[0108] In the embodiment of the present invention, the process of the above step S3 is to perform a single-chain, single-item prediction on the chain sample, which is not in line with the idea of TCM syndrome differentiation and treatment. Therefore, the embodiment of the present invention uses the masking method to perform cross-chain, non-directional medical entity prediction on the primary TCM diagnostic model.
[0109] For more details, please refer to Figure 6 As shown, in the embodiment of the present invention, the primary TCM diagnosis model is trained using the four-diagnosis text set according to the preset masking method to obtain the TCM diagnosis model, including steps S61-S69:
[0110] S61, masking the four diagnostic text sets according to a preset mask and a preset masking ratio to obtain a masked sample set, wherein each of the masked samples includes at least one masked portion;
[0111] S62, allocating the masked sample set into a training set and a test set according to a preset ratio;
[0112] S63, predicting the masked sequence using the primary TCM diagnosis model to obtain a prediction result;
[0113] S64, calculating the loss value between the predicted result and the actual shielded part, and based on the loss value, reversely updating the primary TCM diagnosis model to obtain an updated diagnosis model;
[0114] S65, determining whether all masked samples in the training set participate in the training;
[0115] When not all masked samples in the training set participate in the training, return to the above step of using the primary TCM diagnosis model to predict the masked part in the training set, and obtain the prediction result to iteratively update the updated diagnosis model;
[0116] When all the masked samples in the training set participate in the training, S66, a final updated diagnostic model is obtained;
[0117] S67, using the updated diagnostic model to perform comparative prediction on the test set to obtain prediction accuracy;
[0118] S68, determining whether the prediction accuracy is greater than or equal to a preset qualified threshold;
[0119] When the prediction accuracy is less than the qualified threshold, returning to the step of using a preset mask to mask the four diagnostic text set according to a preset masking ratio to obtain a masked sample set, and retraining the primary TCM diagnosis model;
[0120] When the prediction accuracy is greater than or equal to the qualified threshold, S69, a TCM diagnosis model is obtained.
[0121] In the embodiment of the present invention, the masking ratio is 15%, then 15% of the medical entities in the four diagnostic traits are masked, and the primary TCM diagnosis model is used to infer the masked part based on the unmasked medical entities before and after the masked part. Then, the cross entropy algorithm is used to train the primary TCM diagnosis model based on the loss value between the predicted result and the true result, using a reverse update method similar to the above step S3, so that the primary TCM diagnosis model can predict the medical entities before and after or in parallel.
[0122] The embodiment of the present invention divides the masked samples into a training set and a test set in a ratio of 7:1. After the training of the training set is completed, the accuracy of the trained model is tested using the test set. When the accuracy reaches a preset qualified threshold, such as 90%, it indicates that the primary TCM diagnosis model can be trained to infer the unprovided medical entities from several medical entities based on the essence of TCM syndrome differentiation diagnosis, thereby accurately obtaining the diagnosis effect, and the primary TCM diagnosis model is trained to become a TCM diagnosis model.
[0123] The present invention is implemented by first obtaining medical entities in a TCM corpus data set, and then constructing each medical entity into a chain sample set according to a preset entity superior-subordinate relationship to train the model and obtain a primary TCM diagnosis model, wherein the primary TCM diagnosis model can infer subsequent types of medical entities according to a specific medical entity, for example, deriving syndrome types from syndrome elements, and realizing machine learning about the TCM knowledge structure; then this scheme converts the four diagnostic traits into text to obtain a four diagnostic text set, and according to a preset masking method, the primary TCM diagnosis model is trained using the four diagnostic text set to obtain a TCM diagnosis model, wherein the masking method is to randomly mask several four diagnostic shape features in the four diagnostic text set, and then the model predicts the features of the masked part, so that the trained TCM diagnosis model can infer other possible traits based on the existing diagnostic traits, and then more accurately obtain the final diagnosis conclusion. Therefore, a TCM model training method based on knowledge structure and four diagnostic traits provided in an embodiment of the present invention can train a TCM diagnosis model with a higher diagnostic accuracy by arranging the knowledge structure and masking to predict the four diagnostic traits.
[0124] like Figure 7 , which is a functional module diagram of a TCM model training device based on knowledge structure and four diagnostic traits provided by one embodiment of the present invention.
[0125] The TCM model training device 100 based on knowledge structure and four diagnostic traits of the present invention can be installed in an electronic device. According to the functions to be implemented, the TCM model training device 100 based on knowledge structure and four diagnostic traits can include a knowledge sample acquisition module 101, a primary training module 102, a four diagnostic trait sample acquisition module and a fine-tuning training module 104. The module of the present invention can also be referred to as a unit, which refers to a series of computer program segments that can be executed by an electronic device processor and can complete fixed functions, which are stored in the memory of the electronic device.
[0126] In this embodiment, the functions of each module / unit are as follows:
[0127] The knowledge sample acquisition module 101 is used to perform entity recognition on the pre-constructed TCM corpus data set to obtain entity results, and classify the entity results to obtain medical entity sets of various types, and construct a chain sample set for the medical entity set according to the preset entity superior-subordinate relationship;
[0128] The primary training module 102 is used to perform knowledge structure training on the chain sample set to obtain a primary TCM diagnosis model;
[0129] The four diagnostic traits sample acquisition module 103 is used to acquire a diagnostic information set of the four diagnostic traits, and convert the diagnostic information set of the four diagnostic traits into text according to a preset preprocessing strategy to obtain a four diagnostic text set;
[0130] The fine-tuning training module 104 is used to train the primary TCM diagnosis model using the four-diagnosis text set according to a preset masking method to obtain a TCM diagnosis model.
[0131] In detail, each module described in the TCM model training device 100 based on knowledge structure and four diagnostic traits described in the embodiment of the present application is used in the same manner as described above. Figures 1 to 3 The same technical means are used as the TCM model training method based on knowledge structure and four diagnostic traits described in , and can produce the same technical effects, so I will not go into details here.
[0132] like Figure 8 , which is a schematic diagram of the structure of an electronic device for implementing a TCM model training method based on knowledge structure and four diagnostic traits provided by an embodiment of the present invention.
[0133] The electronic device 1 may include a processor 10, a memory 11, a communication bus 12 and a communication interface 13, and may also include a computer program stored in the memory 11 and executable on the processor 10, such as a TCM model training program based on knowledge structure and four diagnostic traits.
[0134] In some embodiments, the processor 10 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and combinations of various control chips. The processor 10 is the control core (ControlUnit) of the electronic device, and uses various interfaces and lines to connect the various components of the entire electronic device, and executes or executes the programs or modules stored in the memory 11 (for example, executing the TCM model training program based on the knowledge structure and the four diagnostic traits, etc.), and calls the data stored in the memory 11 to execute various functions of the electronic device and process data.
[0135] The memory 11 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, mobile hard disk, multimedia card, card-type memory (for example: SD or DX memory, etc.), magnetic memory, disk, optical disk, etc. The memory 11 may be an internal storage unit of an electronic device in some embodiments, such as a mobile hard disk of the electronic device. The memory 11 may also be an external storage device of an electronic device in other embodiments, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device. Further, the memory 11 may also include both an internal storage unit of the electronic device and an external storage device. The memory 11 may not only be used to store application software and various types of data installed in the electronic device, such as the code of the TCM model training program based on the knowledge structure and the four diagnostic traits, but may also be used to temporarily store data that has been output or is to be output.
[0136] The communication bus 12 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is configured to realize connection and communication between the memory 11 and at least one processor 10, etc.
[0137] The communication interface 13 is used for communication between the above-mentioned electronic device and other devices, including a network interface and a user interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is generally used to establish a communication connection between the electronic device and other electronic devices. The user interface may be a display (Display), an input unit (such as a keyboard (Keyboard)), and optionally, the user interface may also be a standard wired interface, a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an OLED (Organic Light-Emitting Diode, organic light-emitting diode) touch device, etc. Among them, the display may also be appropriately referred to as a display screen or a display unit, which is used to display information processed in the electronic device and to display a visual user interface.
[0138] Figure 8 Only an electronic device with components is shown, and those skilled in the art will understand that Figure 8The structure shown does not constitute a limitation on the electronic device 1, and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.
[0139] For example, although not shown, the electronic device may also include a power source (such as a battery) for supplying power to each component. Preferably, the power source may be logically connected to the at least one processor 10 through a power management device, so that the power management device can realize functions such as charging management, discharging management, and power consumption management. The power source may also include one or more DC or AC power sources, recharging devices, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components. The electronic device may also include a variety of sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.
[0140] It should be understood that the embodiment is for illustration only and the scope of the patent application is not limited to this structure.
[0141] The TCM model training program based on the knowledge structure and the four diagnostic characteristics stored in the memory 11 of the electronic device 1 is a combination of multiple instructions. When running in the processor 10, it can achieve:
[0142] Perform entity recognition on the pre-constructed TCM corpus dataset to obtain entity results, and classify the entity results to obtain medical entity sets of various types;
[0143] For the medical entity set, a chain sample set is constructed according to the preset entity superior-subordinate relationship;
[0144] Conducting knowledge structure training on the chain sample set to obtain a primary TCM diagnosis model;
[0145] Acquire a diagnostic information set of four diagnostic traits, and perform a text conversion operation on the diagnostic information set of the four diagnostic traits according to a preset preprocessing strategy to obtain a four diagnostic text set;
[0146] According to a preset masking method, the primary TCM diagnosis model is trained using the four-diagnosis text set to obtain a TCM diagnosis model.
[0147] Specifically, the specific implementation method of the processor 10 for the above instructions can refer to the description of the relevant steps in the corresponding embodiment of the accompanying drawings, which will not be repeated here.
[0148] Furthermore, if the module / unit integrated in the electronic device 1 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. The computer-readable storage medium can be volatile or non-volatile. For example, the computer-readable medium can include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a mobile hard disk, a magnetic disk, an optical disk, a computer memory, and a read-only memory (ROM).
[0149] The present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor of an electronic device, the computer program can implement:
[0150] Perform entity recognition on the pre-constructed TCM corpus dataset to obtain entity results, and classify the entity results to obtain medical entity sets of various types;
[0151] For the medical entity set, a chain sample set is constructed according to the preset entity superior-subordinate relationship;
[0152] Conducting knowledge structure training on the chain sample set to obtain a primary TCM diagnosis model;
[0153] Acquire a diagnostic information set of four diagnostic traits, and perform a text conversion operation on the diagnostic information set of the four diagnostic traits according to a preset preprocessing strategy to obtain a four diagnostic text set;
[0154] According to a preset masking method, the primary TCM diagnosis model is trained using the four-diagnosis text set to obtain a TCM diagnosis model.
[0155] In the several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.
[0156] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0157] In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional modules.
[0158] It is obvious to those skilled in the art that the present invention is not limited to the details of the above exemplary embodiments, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.
[0159] Therefore, no matter from which point of view, the embodiments should be regarded as illustrative and non-restrictive, and the scope of the present invention is limited by the appended claims rather than the above description, so it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present invention. Any attached figure mark in the claims should not be regarded as limiting the claims involved.
[0160] The blockchain referred to in this invention is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.
[0161] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0162] In addition, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in the system claim can also be implemented by one unit or device through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any particular order.
[0163] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention.
Claims
1. A method for training a TCM model based on knowledge structure and four diagnostic traits, characterized in that: The method comprises: Perform entity recognition on the pre-constructed TCM corpus dataset to obtain entity results, and classify the entity results to obtain medical entity sets of various types; For the medical entity set, a chain sample set is constructed according to the preset entity superior-subordinate relationship; Conducting knowledge structure training on the chain sample set to obtain a primary TCM diagnosis model; Acquire a diagnostic information set of four diagnostic traits, and perform a text conversion operation on the diagnostic information set of the four diagnostic traits according to a preset preprocessing strategy to obtain a four diagnostic text set; According to a preset masking method and the four-diagnosis text set, the primary TCM diagnosis model is trained to obtain a TCM diagnosis model; Among them, the primary TCM diagnosis model is trained according to the preset masking method and the four-diagnosis text set to obtain the TCM diagnosis model, including: masking the four-diagnosis text set according to the preset mask and the preset masking ratio to obtain a masked sample set, wherein each of the masked samples includes at least one masked part; according to the preset ratio, the masked sample set is allocated as a training set and a test set; the masked part in the training set is predicted by the primary TCM diagnosis model to obtain a prediction result; the loss value between the prediction result and the actual masked part is calculated, and according to the loss value, the primary TCM diagnosis model is reversely updated to obtain an updated diagnosis model; it is determined whether all the masked samples in the training set participate in the training; when the masked samples in the training set participate in the training, If not all masked samples in the training set participate in the training, then return to the above step of predicting the masked part in the training set through the primary TCM diagnosis model to obtain the prediction result, so as to iteratively update the updated diagnosis model; when all masked samples in the training set participate in the training, the final updated updated diagnosis model is obtained; the updated diagnosis model is used to perform comparative prediction on the test set to obtain the prediction accuracy; and when the prediction accuracy is less than the qualified threshold, return to the step of masking the four diagnosis text set according to the preset mask and the preset masking ratio to obtain the masked sample set, so as to retrain the primary TCM diagnosis model; when the prediction accuracy is greater than or equal to the qualified threshold, the TCM diagnosis model is obtained; The knowledge structure training of the chain sample set to obtain a primary TCM diagnosis model includes: sequentially importing the chain samples in the chain sample set into a pre-trained semantic recognition model, performing type recognition on each medical entity in the chain sample to obtain a predicted type, and predicting a predicted entity corresponding to the next stage type of each medical entity; comparing the predicted type and the predicted entity according to the actual type of each medical entity in the chain sample and the real next entity to obtain an error value; minimizing the error value to obtain a neural network parameter with the minimum error value, and using the neural network parameters to perform reverse network propagation to update the model parameters of the semantic recognition model to obtain an updated model; recording the error value and judging the convergence of the error value; when the error value does not converge, returning to the above step of sequentially importing the chain samples in the chain sample set into the pre-trained semantic recognition model to iteratively update the semantic recognition model; when the error value converges, outputting the finally updated semantic recognition model to obtain a primary TCM diagnosis model; According to the preset preprocessing strategy, the diagnostic information set of the four diagnostic characteristics is converted into text to obtain a four diagnostic text set, including: extracting image features from the visual diagnostic characteristics including face and tongue pictures among the four diagnostic characteristics to obtain an image feature text set; extracting voiceprint features from the palpation diagnostic characteristics including pulse patterns and the questioning diagnostic characteristics including auscultation noise among the four diagnostic characteristics to obtain a pulse feature text set and an auscultation feature text set respectively; and taking the image feature text set, the pulse feature text set, the auscultation feature text set and the question and answer text in the four diagnostic characteristics as the four diagnostic text set.
2. The TCM model training method based on knowledge structure and four diagnostic traits as claimed in claim 1, characterized in that: The entity recognition is performed on the pre-constructed TCM corpus dataset to obtain entity results, including: Segmenting the traditional Chinese medicine corpus data set, and performing part-of-speech tagging on the segmentation results to obtain a medical segmentation set; Performing a quantization operation on the medical word segmentation set to obtain a quantized data set; The pre-trained entity extraction network is used to perform entity recognition on the quantitative data set to obtain entity results.
3. The TCM model training method based on knowledge structure and four diagnostic traits as claimed in claim 1, characterized in that: The entity results are classified to obtain medical entity sets of various types, including: According to a preset classification strategy and category set, the entity results are preliminarily classified to obtain a preliminarily classified result; Each entity in the primary classification results under the same category is hierarchically classified to obtain a set of medical entities of various types.
4. The TCM model training method based on knowledge structure and four diagnostic traits as claimed in claim 1, characterized in that: The medical entity set is constructed into a chain sample set according to a preset entity superior-subordinate relationship, including: According to the preset entity superior-subordinate relationship, the medical entities in the adjacent type medical entity set are constructed into key-value pairs; According to the key-value pairs, each of the medical entities is chain-connected to obtain a chain sample set.
5. A TCM model training device based on knowledge structure and four diagnostic traits, used to implement the TCM model training method based on knowledge structure and four diagnostic traits as claimed in any one of claims 1 to 4, characterized in that: The device comprises: The knowledge sample acquisition module is used to perform entity recognition on the pre-constructed TCM corpus data set to obtain entity results, classify the entity results to obtain medical entity sets of various types, and construct a chain sample set for the medical entity set according to the preset entity superior-subordinate relationship; A primary training module, used for performing knowledge structure training on the chain sample set to obtain a primary TCM diagnosis model; A four-diagnostic trait sample acquisition module is used to obtain a diagnostic information set of the four-diagnostic traits, and according to a preset preprocessing strategy, convert the diagnostic information set of the four-diagnostic traits into a text to obtain a four-diagnostic text set; The fine-tuning training module is used to train the primary TCM diagnosis model according to a preset masking method and the four-diagnosis text set to obtain a TCM diagnosis model.
6. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the traditional Chinese medicine model training method based on knowledge structure and four diagnostic traits as described in any one of claims 1 to 4.
7. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, it implements the TCM model training method based on knowledge structure and four diagnostic traits as described in any one of claims 1 to 4.
Citation Information
Cited By
AI analysis-integrated traditional Chinese medicine four-diagnosis comprehensive diagnosis method and equipment thereof
CN120995021A