Electronic medical record text analysis method based on hypergraph

Through the hypergraph-aware electronic medical record text analysis method, combined with multi-task learning and BERT model, the problem of difficult negative sample processing and hypergraph structure information capture in the existing technology is solved, and the performance and robustness of electronic medical record text analysis is improved. .

CN119230043AActive Publication Date: 2024-12-31XIANGAN HOSPITAL AFFILIATED TO XIAMEN UNIV

Patent Information

Application Number
CN202411319544.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-20
Publication Date
2024-12-31
Estimated Expiration
2044-09-20

AI Technical Summary

Technical Problem

Existing electronic medical record text analysis techniques are difficult to effectively process negative samples, resulting in a degradation in model performance in entity recognition and relationship extraction tasks, and it is difficult to capture the complex relationship between hypergraph structure information and node attributes.

Method used

Using the electronic medical record text analysis method based on hypergraph, through data preprocessing, entity relationship extraction framework and multi-task learning, combined with fine-tuned BERT model and HyperBERT layer, entity recognition, relationship extraction and node classification are realized, and hypergraph perception pre-training is used. Fine-tuning of tasks and downstream tasks enhances the model's understanding of hypergraph structure information.

Benefits of technology

Improve the performance and robustness of the model in negative sample processing, enhance the accuracy of entity recognition and relationship extraction, improve the effect and generalization ability of node classification, improve the robustness and higher-order processing of electronic medical record text Structural information understanding.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119230043A_ABST
    Figure CN119230043A_ABST
Patent Text Reader

Abstract

The invention discloses an electronic medical record text analysis method based on a hypergraph, and the method specifically comprises the following steps: 1, data collection: determining a data collection source, carrying out the communication with an interface of a data source or an AP I, automatically collecting medical dialogue records, and safely storing the collected data in a database or a data warehouse; 2, data preprocessing: performing data cleaning, standard formatting, duplicate removal, data segmentation, feature extraction, data conversion, data enhancement and sensitive information desensitization on the data; the invention relates to the technical field of electronic medical record texts, provides an electronic medical record text processing technology, and aims to improve the influence of negative samples in entity recognition and relation extraction tasks on model performance. By utilizing a multi-task learning method in span-based joint entity relationship extraction, the problem that the performance is reduced when a current model processes non-entity spans or irrelevant spans is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of electronic medical record text, and in particular to an electronic medical record text analysis method based on a hypergraph. Background Art

[0002] Electronic medical record text analysis refers to the technology of automatically processing and analyzing electronic medical record texts in the medical field. With the rapid development of medical information technology and the widespread application of electronic medical records, electronic medical record text analysis has become increasingly important. Electronic medical record texts contain a wealth of medical information, including patients' medical history, symptom descriptions, diagnosis results, treatment plans, etc. By analyzing electronic medical record texts, key information can be extracted and mined, providing valuable support for medical research, clinical decision-making, and medical quality improvement. Summary of the invention

[0003] In view of the deficiencies of the prior art, the present invention provides an electronic medical record text analysis method based on a hypergraph, which solves the problem that it is impossible to ensure that its wireless signal can fully cover this area without being interfered with by the signal.

[0004] To achieve the above objectives, the present invention is implemented through the following technical solutions: a hypergraph-based electronic medical record text analysis method, specifically comprising the following steps:

[0005] Step 1: Data collection: Determine the source of data collection, automatically collect medical conversation records through the interface or API of the data source, and store the collected data securely in a database or data warehouse;

[0006] Step 2: Data preprocessing: data cleaning, formatting standards, deduplication, data segmentation, feature extraction, data conversion, data enhancement and sensitive information desensitization;

[0007] Step 3: Input the preprocessed data into the entity relationship extraction framework to realize the entity relationship recognition and extraction of medical record text, and complete the automatic recording of the diagnosis dialogue system and electronic medical record (EMR);

[0008] Step 4. After text entity relationship extraction, the identified entities and extracted relationships are input into the node classification model on the hypergraph based on text attributes. According to the characteristics of the medical record text and task requirements, the entities are used as nodes of the hypergraph and the relationships are used as hyperedges of the hypergraph. The results of entity recognition and relationship extraction are integrated into the hypergraph. The hyperedges connect multiple nodes to reflect the association relationship between nodes and complete the text classification task.

[0009] Preferably, the entity relationship extraction framework includes vector representation, span representation, entity recognition and relationship extraction, and the entity recognition and relationship extraction are integrated to form a multi-task framework;

[0010] Vector representation: The vector representation layer uses a fine-tuned pre-trained BERT to extract context information. The input sentence is byte-pair encoded by BPE and split into a sequence of n tokens. The BPE tokens are propagated through the internal BERT to generate an embedding sequence E of length n+1: E = (e [CLS] ,e1,e2,...,e n ), where e [CLS] Represents the embedding representation of the entire sentence context, each embedding vector Where d1 represents the embedding dimension;

[0011] Span representation: The span representation layer uses the embedding of the tokens generated by BERT to represent the span, maintaining a consistent representation dimension s in different spans: = (e i ,e i+1 ,...,e j ), apply a fusion process to s, using max pooling in the fusion process:

[0012]

[0013] The model sets the maximum span length L. In order to reduce complexity, the width embedding matrix is ​​used to merge the width information w (0≤w≤L) into the fused span representation s. Spans of different widths contribute differently to the representation:

[0014]

[0015] in, represents the concatenation of vectors, w k Derived from the width embedding matrix obtained from the training model;

[0016] The multi-task framework includes recognition tasks and classification tasks:

[0017] Recognition task, the recognition task is used to determine whether the current entity or entity pair is indeed an entity or whether there is a certain relationship; binary cross entropy is selected as the loss function, which is defined as follows:

[0018]

[0019] Among them, q∈{0,1} represents the true category of the span or span pair (0 represents a negative sample and 1 represents a positive sample), and p∈[0,1] is the model's estimated probability for the label q=1 category;

[0020] Therefore, the loss for the recognition task is calculated as follows:

[0021]

[0022] Classification task, in order to enhance the diversity of multi-task learning loss pattern and prevent the two tasks from degenerating into a single task, the pairwise ranking loss function is selected as the loss function of the classification task; this loss function has the same task goal as the cross entropy loss, but has a different optimization direction;

[0023] Given a span (pair) representation s and a set of entity or relation classes C, the score of the class label x∈C is computed using the dot product:

[0024] score c =s T [W classes ] c ;

[0025] Where W classes is the matrix to be learned, the number of columns is the number of classes, is the column vector corresponding to class c, whose dimension is equal to the dimension of s;

[0026] For a span (pair), where y + is the correct label, y - no, and They are defined as + and - The score of ; then the calculation formula of rank loss is:

[0027]

[0028] where γ is the scaling factor, m + and m - is the margin. For non-entity classes or irrelevant entity pairs, only L is calculated. - to penalize incorrect predictions; in the training step, the ranking loss selects only the error class with the highest score among all error classes; then, the pairwise ranking loss is optimized:

[0029] Loss2=∑(L + +L - );

[0030] Finally, the loss function of the multi-task framework used is expressed as:

[0031] Loss = αLoss1 + βLoss2;

[0032] Entity Recognition,The entity recognition layer directly uses the output of the span representation layer as input and uses a multi-task framework to extract entity categories from spans;

[0033] In the recognition task of the entity recognition multi-task framework, the IoU (Intersection over Union) metric is used to introduce the position information between spans; formally, the IoU is calculated as follows:

[0034]

[0035] Where s(i,j) represents the span space with left and right indexes i and j in the sentence;

[0036] Calculate and utilize the maximum IoU (intersection / union) between span s and all entity spans in the sentence, defined as ENIoU(s), which is calculated as:

[0037] ENIoU(s)=max(IoU(s,en),en∈E);

[0038] Where E represents the set of all entity spans in the sentence;

[0039] Subsequently, using ENIoU as a scale factor, the loss function of the recognition task in the multi-task framework is replaced by a dynamically scaled cross entropy loss, and the loss function is:

[0040]

[0041] Among them, δ and ENIoU determine the scaling factor, δ∈[0,1] is the balancing factor to solve the class imbalance, and δ<0.5 needs to be set to emphasize fewer positive samples; for negative samples, the higher the ENIoU, the greater the loss, so that the model pays more attention to hard negative samples during training;

[0042] For the rest of the multi-task framework, no further modifications are made in the entity recognition stage, and the loss of the entity recognition stage is recorded as L1;

[0043] Relation extraction, unlike the entity recognition stage, which directly uses the span representation layer output as input, the relation extraction stage makes some adjustments to the input information. For those spans that are classified as "NA" in the entity recognition multi-task stage, they will be filtered out; we only consider candidate span pairs that have been preliminarily identified as entities, select the local information between the candidate span pairs as their context, and obtain the contextual representation by fusing their BERT embeddings using maxpooling;

[0044]

[0045] For adjacent candidate entity pairs, set v(s1,s2) = 0; In addition, we observe that the Logits in the entity recognition stage may contain useful semantic information;

[0046] Therefore, Logits can be further embedded from the entity recognition stage to enrich the input information; finally, the multi-task input of the relation extraction layer is represented as follows:

[0047]

[0048] Where p(s) represents the Logits of the entity recognition stage; considering that the relationship between s1 and s2 is usually asymmetric, therefore:

[0049]

[0050] For the multi-task framework used in the relation extraction stage, the loss of the relation extraction stage is L2.

[0051] Preferably, the entity relationship extraction framework also includes a joint training loss: a joint training method for entity recognition and relationship extraction, and the loss is defined as follows: L=L1+L2.

[0052] Preferably, the entity relationship extraction framework also includes a prediction stage. In the prediction stage, in order to avoid error propagation, only the class scores obtained by the multi-task framework are used, denoted as score c , while the binary recognition task is only used to optimize the network parameters;

[0053] Given a span (pair), the predicted class probability P is calculated as follows:

[0054]

[0055] where θ is a hyperparameter threshold; if the score of each class is lower than θ, the span (pair) is predicted as a non-entity or irrelevant relation; otherwise, the span (pair) is assigned to the class with the highest score.

[0056] Preferably, the node classification model in step 4 includes: a HyperBERT layer, a hypergraph-aware pre-training task, and fine-tuning of downstream tasks;

[0057] The HyperBERT layer explicitly mixes the semantic information obtained by each BERT transformer block with the structural information obtained by the Hypergraph Neural Network (HGNN) block;

[0058] The hypergraph-aware pre-training task leverages the inherent hypergraph knowledge in TAHG and applies it to semantic and structural representations;

[0059] Fine-tuning of downstream tasks,After pre-training is completed, freeze the parameters of HyperBERT and use it to calculate the representation of each text node. The calculated representation can be further used to fine-tune separate models on different downstream tasks, and use cross entropy loss to train linear projections from node features to category labels for node classification.

[0060] Preferably, the nodes are classified into several classification methods:

[0061] Disease classification: classify medical record text into different disease categories;

[0062] Symptom classification: classify medical record text into different symptoms or syndromes;

[0063] Treatment plan classification: Classify medical record text into different treatment plans or treatment methods.

[0064] The present invention provides a method for analyzing electronic medical record text based on a hypergraph. Compared with the prior art, it has the following beneficial effects:

[0065] 1. Provide an electronic medical record text processing technology that aims to improve the impact of negative samples on model performance in entity recognition and relationship extraction tasks. By utilizing multi-task learning methods in span-based joint entity relationship extraction, the problem of performance degradation of current models when processing non-entity spans or irrelevant span pairs is solved.

[0066] 2. Provide a span-based multi-task learning method to handle negative samples in the span-based joint entity relationship extraction task. This method introduces multi-task learning to alleviate the impact of negative samples on entity and relationship classifiers, and further improve the performance and robustness of the model.

[0067] 3. Provide a node classification technology on hypergraphs based on text attributes, aiming to overcome the difficulty of existing methods in capturing both hypergraph structural information and rich language attributes in node attributes, thereby improving the effect and generalization ability of node classification. By using the pre-trained BERT model and introducing a dedicated hypergraph perception layer, the model's ability to understand high-order structural information on the hypergraph is further enhanced.

[0068] 4. Improve electronic medical record text processing technology so that it can better cope with negative sample problems in entity recognition and relationship extraction tasks, and improve the performance and robustness of the model. BRIEF DESCRIPTION OF THE DRAWINGS

[0069] Figure 1 It is a schematic diagram of the overall process of the present invention;

[0070] Figure 2 This is the entity relationship extraction framework diagram of the present invention. DETAILED DESCRIPTION

[0071] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0072] See also Figure 1 , the present application provides a method for analyzing electronic medical record text based on a hypergraph, which specifically includes the following steps:

[0073] Step 1. First, you need to determine the source of data collection. For electronic medical record text processing technology, data sources may include the hospital's electronic health record system, diagnostic conversation system, and other related medical information systems. Automatically collect medical conversation records by communicating with the interface or API of the data source. Before processing any personal health information, the patient's consent must be obtained. This includes a clear explanation of the purpose and scope of data collection and how the data will be used. In order to protect patient privacy, the collected data needs to be anonymized to remove all information that may identify individuals, such as name, address, social security number, etc. During the data collection process, implement quality control measures to ensure the accuracy and consistency of the data. Store the collected data securely in a database or data warehouse for subsequent processing and analysis. Ensure that data storage complies with industry standards and regulatory requirements.

[0074] Step 2: Data preprocessing: data cleaning, formatting standards, deduplication, data segmentation, feature extraction, data conversion, data enhancement and sensitive information desensitization;

[0075] Data cleaning:

[0076] In the data cleaning stage, the collected medical conversation data needs to be carefully checked to remove irrelevant information, such as conversation content with non-medical terms, advertising information, etc. At the same time, spelling errors and grammatical errors in the data should also be corrected. The purpose of this step is to ensure the purity and availability of the data.

[0077] Format standardization:

[0078] Since the collected data may come from different information systems, their formats and codes may differ. All data need to be converted into a unified format, including date and time format, medical terminology standardization, data coding consistency, etc., which will facilitate subsequent data processing and analysis.

[0079] Deduplication operation:

[0080] There may be duplicate records in the data set, and these duplicates need to be checked and merged or deleted to ensure the uniqueness of the data. This can not only reduce the size of the data set, but also improve the accuracy of subsequent analysis.

[0081] Data segmentation:

[0082] The dataset can be further divided into smaller units based on requirements, such as by patient, condition, or conversation text type, etc. This helps to conduct in-depth analysis and processing of specific categories of data.

[0083] Missing value handling:

[0084] There will inevitably be some missing values ​​in the data set, which need to be handled in an appropriate way, such as filling, deleting or interpolating. This step ensures the integrity of the data and lays the foundation for subsequent analysis.

[0085] Feature extraction:

[0086] From the original medical text data, features that are helpful for model training need to be extracted, such as medical terms, symptom descriptions, drug names, etc. These features will be used as input to train the medical record text processing model.

[0087] Data conversion:

[0088] After feature extraction, the data can also be transformed using some mathematical and statistical methods, such as normalization or standardization, to improve the efficiency and accuracy of model training.

[0089] Data Augmentation:

[0090] In order to improve the generalization ability of the model, some enhancement operations can be performed on the data set, such as synonym replacement, sentence reorganization, etc. These techniques can artificially create more diverse training samples to make up for the shortcomings of the original data.

[0091] Sensitive information desensitization:

[0092] When processing medical data containing personal privacy information, desensitization is required to ensure that the patient's sensitive information is not leaked in subsequent analysis and processing, thereby protecting the patient's privacy.

[0093] These preprocessing steps help improve the quality and consistency of text sentences to facilitate subsequent text entity relationship extraction and classification diagnosis tasks. At the same time, ensure that patient privacy and data security are protected throughout the preprocessing process.

[0094] Step 3: Input the preprocessed data into the entity relationship extraction framework to realize the entity relationship recognition and extraction of medical record text, and complete the automatic recording of the diagnosis dialogue system and electronic medical record (EMR);

[0095] The entity relationship extraction framework includes vector representation, span representation, entity recognition and relationship extraction, and the entity recognition and relationship extraction are integrated to form a multi-task framework;

[0096] The vector representation layer uses fine-tuned pre-trained BERT to extract contextual information. Figure 2 As shown in Figure 1, the input sentence is byte-pair encoded (BPE) and segmented into a sequence of n tokens. BPE encoding uses common subwords (such as "pre" and "train") to represent uncommon words (such as "pretrain"), thereby constraining the vocabulary and effectively handling out-of-vocabulary (OOV) and rare words. The BPE tokens are propagated through BERT's internals to produce an embedding sequence E of length n+1: E = (e [CLS] ,e1,e2,...,e n ), where e [CLS] Represents the embedding representation of the entire sentence context, each embedding vector (where d1 represents the embedding dimension);

[0097] The span representation layer uses the embedding of tokens generated by BERT to represent spans. Figure 2 As shown, in order to maintain a consistent representation dimension s in different spans: = (e i ,e i+1 ,...,e j ), apply a fusion process to s. Use maximum pooling in the fusion process:

[0098]

[0099] Based on prior knowledge, longer spans are less likely to effectively represent meaningful entities. Therefore, the maximum span length L is set for the model mainly to reduce complexity. In addition, a width embedding matrix is ​​needed to incorporate the width information w (0≤w≤L) into the fused span representation s. The guiding idea of ​​this approach is that spans of different widths contribute differently to the representation:

[0100]

[0101] in, represents the concatenation of vectors, w k Derived from the width embedding matrix obtained by training the model.

[0102] The category of the entity in a sentence is likely to be related to the overall context of the sentence. For example, in the medical record, "the patient took antibiotics in the past few days and felt that his sore throat and cough symptoms were relieved", where "antibiotics" can strongly indicate the entity class "drug". Therefore, we also need to extend the context embedding information [CLS] to span representation:

[0103]

[0104] Recognition task, the recognition task is used to determine whether the current entity or entity pair is indeed an entity or whether there is a certain relationship; binary cross entropy is selected as the loss function, which is defined as follows:

[0105]

[0106] Among them, q∈{0,1} represents the true category of the span or span pair (0 represents a negative sample and 1 represents a positive sample), and p∈[0,1] is the model's estimated probability for the label q=1 category;

[0107] Therefore, the loss for the recognition task is calculated as follows:

[0108]

[0109] In order to enhance the diversity of multi-task learning loss patterns and prevent the two tasks from degenerating into a single task, the pairwise ranking loss function is selected as the loss function for the classification task. This loss function has the same task objective as the cross entropy loss, but has a different optimization direction.

[0110] Given a span (pair) representation s and a set of entity or relation classes C, the score of the class label x∈C is computed using the dot product:

[0111] score c =s T [W classes ] c ;

[0112] Where W classes is the matrix to be learned, and the number of columns is the number of classes. is a column vector corresponding to class c, whose dimension is equal to the dimension of s.

[0113] For a span (pair), where y + is the correct label, y - no, and They are defined as + and - The calculation formula of rank loss is:

[0114]

[0115] where γ is the scaling factor, m + and m - For non-entity classes or irrelevant entity pairs, only L is calculated. - to penalize incorrect predictions. During the training step, the ranking loss selects only the error class with the highest score among all the error classes. Then, the pairwise ranking loss is optimized:

[0116] Loss2=∑(L + +L - );

[0117] Finally, the loss function of the multi-task framework used is expressed as:

[0118] Loss = αLoss1 + βLoss2;

[0119] The entity recognition layer directly uses the output of the span representation layer as input and exploits the multi-task framework to extract entity categories from spans. In this section, we fine-tune the multi-task framework described in Section 3.3.

[0120] In the recognition task of the entity recognition multi-task framework, the IoU (Intersection over Union) metric is used to introduce the position information between spans. Formally, the calculation of IoU is as follows:

[0121]

[0122] Where s(i,j) represents the span space with left and right indices i and j in the sentence.

[0123] Calculate and use the maximum IoU (intersection / union) between span s and all entity spans in the sentence, defined as ENIoU(s). Its calculation formula is:

[0124] ENIoU(s)=max(IoU(s,en),en∈E);

[0125] Where E represents the set consisting of all entity spans in the sentence.

[0126] Subsequently, using ENIoU as a scale factor, the loss function of the recognition task in the multi-task framework is replaced by a dynamically scaled cross entropy loss. The loss function is:

[0127]

[0128] Among them, δ and ENIoU determine the scaling factor. δ∈[0,1] is a balancing factor to solve the class imbalance, and it is necessary to set δ<0.5 to emphasize fewer positive samples. For negative samples, the higher the ENIoU, the greater the loss, so that the model pays more attention to hard negative samples during training.

[0129] For the rest of the multi-task framework, no further modifications are made in the entity recognition stage, and the loss of the entity recognition stage is recorded as L1;

[0130] Relation extraction, unlike the entity recognition stage, which directly uses the span representation layer output as input, the relation extraction stage makes some adjustments to the input information. For those spans that are classified as "NA" in the entity recognition multi-task stage, they will be filtered out; we only consider candidate span pairs that have been preliminarily identified as entities, select the local information between the candidate span pairs as their context, and obtain the contextual representation by fusing their BERT embeddings using maxpooling;

[0131]

[0132] For adjacent candidate entity pairs, set v(s1,s2) = 0; In addition, we observe that the Logits in the entity recognition stage may contain useful semantic information;

[0133] Therefore, Logits can be further embedded from the entity recognition stage to enrich the input information; finally, the multi-task input of the relation extraction layer is represented as follows:

[0134]

[0135] Where p(s) represents the Logits of the entity recognition stage; considering that the relationship between s1 and s2 is usually asymmetric, therefore:

[0136]

[0137] For the multi-task framework used in the relation extraction stage, the loss of the relation extraction stage is L2.

[0138] We learn the parameters of the span width embedding w and the parameters of the entity / relation multi-task classifier, while fine-tuning BERT in the process. For the joint training method of entity recognition and relation extraction, the loss is defined as follows: L = L1 + L2;

[0139] In the prediction stage, in order to avoid error propagation, only the class scores obtained by the multi-task framework are used, denoted as score c , while the binary recognition task is only used to optimize network parameters;

[0140] Given a span (pair), the predicted class probability P is calculated as follows:

[0141]

[0142] Where θ is a hyperparameter threshold; if the score of each category is lower than θ, the span (pair) is predicted as a non-entity or irrelevant relationship; otherwise, the span (pair) is assigned to the class with the highest score;

[0143] Through the above model, the entity relationship extraction of medical record text is completed, preparing for the text classification task of the subsequent model.

[0144] Step 4: After the text entity relationship extraction, the identified entities and extracted relationships are input into the node classification model on the hypergraph based on text attributes. According to the characteristics of the medical record text and task requirements, the entities are used as nodes of the hypergraph and the relationships are used as hyperedges of the hypergraph. The results of entity recognition and relationship extraction are integrated into the hypergraph. The hyperedges connect multiple nodes to reflect the association relationship between nodes and complete the text classification task.

[0145] HyperBERT Layers

[0146] The HyperBERT layer explicitly mixes the semantic information obtained by each BERT Transformer block with the structural information obtained by the Hypergraph Neural Network (HGNN) block.

[0147] Semantic representation. The semantic representation of the node text attributes is encoded through the BERT encoder. Specifically, BERT consists of alternating multi-head self-attention (MHA) and fully connected feedforward network (FFN) blocks, just like the original Transformer architecture. Before each block, layer normalization (LN) is applied, and residual connections are added after each block. More formally, in the first In the layer encoder, the hidden state is represented as where N is the maximum length of the input. First, the MHA block maps X to the query matrix Key Matrix Sum Matrix Where m is the number of query vectors and n is the number of key / value vectors. Then, the formula for calculating the attention vector is as follows:

[0148] Attention(Q,K,V)=softmax(A)V,

[0149]

[0150] In practice, the MHA block computes self-attention through h heads, where each head i consists of and Independently parameterized, the input embedding χ is mapped into query and key-value pairs. Then, the attention of each head is calculated and concatenated as follows:

[0151] Head i =Attent(QW i Q ,KW i K ,VW i V )

[0152]

[0153] in, is a trainable parameter matrix. Next, to obtain the semantic hidden state of the input, a FFN block is applied as follows:

[0154]

[0155] in, and is a linear weight matrix. Finally, layer normalization and residual connections are applied as follows:

[0156]

[0157] Therefore, after L encoder layers, we have the semantic representation of the text description of a node as

[0158] Hypergraph structure representation. Therefore, in each HyperBERT layer, a hypergraph neural network (HGNN) is used to represent the node-centered context hypergraph G. i The hypergraph is defined as a sub-hypergraph containing only the hyperedges to which node i belongs, and has its association matrix H i Formally, we need to formulate the HGNN block as follows to obtain hypergraph node embeddings:

[0159]

[0160] Where D and B are the degree matrices of vertices and hyperedges in the hypergraph, respectively. σ(·) is a nonlinear activation function, such as ReLU. It is Layer and The learnable weight matrix between layers. Therefore, after L hyperlayers, we represent the structure of the node as

[0161] Text-hypergraph joint representation. After computing the representations in the semantic space and the hypergraph structure space, the lth HyperBERT layer computes the mixed text-hypergraph representation as follows:

[0162]

[0163] in, It contains a mixture of semantic information and hypergraph structure information to facilitate information flow between the two modalities.

[0164] Hypergraph-aware pre-training tasks

[0165] In order to improve the learning ability of HyperBERT without using any manually annotated labels, a novel hypergraph-aware knowledge alignment pre-training algorithm based on contrastive learning loss is used. The hypergraph-aware pre-training task used exploits the hypergraph knowledge inherent in TAHG and applies it to both semantic and structural representations.

[0166] Semantic contrast loss. Based on the semantic representation of node i For other nodes N(i) belonging to the same hyperedge set and the mini-batch instances B(i) excluding node i, the semantic contrast loss target can be defined as follows:

[0167]

[0168] Among them, τ represents the temperature parameter and e(·) represents the exponential function. Here, for node i, we can express its semantics as is considered as a query instance. The positive sample is the representation of the hyperedge member of node i Meanwhile, negative samples are representations of other text nodes excluding node i in the same mini-batch

[0169] Structural contrast loss. Similar to semantic representation, it is also necessary to apply the contrastive learning algorithm to the hypergraph structural feature space representation of node i, expressed as Formally, the structural contrast loss is expressed as follows:

[0170]

[0171] in, is the query instance. The positive sample is Negative samples are

[0172] Therefore, our semantic and structural contrastive learning losses ensure that nodes belonging to the same hyperedge have similar representations, thus stimulating beneficial hypergraph knowledge during the learning process.

[0173] Hypergraph-Text Knowledge Alignment. In this work, we aim to learn expressive representations that simultaneously encode informative textual semantics in each text node, as well as structural information between hyperedges. However, contrastive learning in either semantic or structural space alone is insufficient due to the lack of information exchange between the two modalities. To better align the knowledge captured by the semantic and hypergraph structural layers, a hypergraph-text knowledge alignment algorithm is used for TAHG (Text-Associated Hypergraph).

[0174] Specifically, for each node i, its semantic and structural representations are and The objective of the hypergraph-text knowledge alignment loss Lalign is defined as follows:

[0175]

[0176] According to the above expression, in the first part of the knowledge alignment loss function L align1 In the example, the structure of node i needs to be represented as is regarded as a query, and then positive and negative samples are constructed based on the semantic representation. Specifically, the positive sample includes the representation of node i and the representation of the same hyperedge node as i (i.e. ), negative samples are representations of other instances in the same mini-batch (i.e. ). In the second part of the knowledge alignment loss L align2 In the semantic representation is regarded as a query, and its corresponding positive and negative samples are constructed in the same way as in the first part. Therefore, the L used align The alignment loss encourages the representations of the same nodes learned in two independent feature spaces, semantic and structural, to be brought closer together in the embedding space.

[0177] Learning Objective. In order to better use the hypergraph-aware language model, it is necessary to jointly optimize the proposed semantic, structural, and hypergraph-text knowledge alignment losses. Specifically, the overall training loss objective is defined as follows:

[0178] L=λ1L semantic +λ2L structural +λ3L align ;

[0179] where λ1,λ2,λ3∈R. In practice, it has been found that setting the value of λ1=λ2=λ3=1 produces good experimental results.

[0180] Fine-tuning of game tasks

[0181] Once pre-training is complete, we need to freeze the parameters of HyperBERT and use it to compute representations for each text node. These computed representations can then be further used to fine-tune separate models on different downstream tasks. Specifically, we need to train a linear projection from node features to class labels using a cross entropy loss for node classification.

[0182] After the data processing of the above model, the classification task of medical record text is completed. The model output result is the classification label of the medical record text, which indicates the category to which the text belongs. The following are several classification methods.

[0183] Disease classification: Classify medical record text into different disease categories, such as heart disease, cancer, diabetes, etc.

[0184] Symptom classification: Classify medical record text into different symptoms or syndromes, such as cough, fever, headache, etc.

[0185] Treatment plan classification: Classify medical record text into different treatment plans or treatment methods, such as surgery, drug therapy, radiotherapy, etc.

[0186] Here is further explanation:

[0187] Entity recognition is an important technique in the field of natural language processing, which aims to identify named entities appearing in text and classify them into predefined categories.

[0188] The goal of entity recognition is to identify entities with specific meanings from text. These entities can be specific people, places, organizations, etc., or abstract time, date, currency, etc. The basic task of entity recognition is to find the boundaries of entities in a given text and classify them into predefined categories.

[0189] Entity recognition technology uses a variety of methods and techniques. One common method is the rule-based method, which matches entities in the text through pre-defined rules and patterns. These rules can be designed based on information such as part of speech, syntactic structure, and context. Another common method is the statistical learning-based method, in which machine learning algorithms are used to learn the characteristics and context information of entities from a large amount of labeled training data, and then these models are applied to new texts for entity recognition.

[0190] In the process of entity recognition, the following aspects usually need to be considered:

[0191] (1) Entity boundary identification: Determine the starting and ending positions of an entity in a text. This usually involves processing information such as part of speech, punctuation, and spaces.

[0192] (2) Entity classification: Classify the identified entities into predefined categories, such as names of people, places, and organizations. This can be done through rule matching, machine learning algorithms, or deep learning models.

[0193] (3) Context processing: In the process of entity recognition, context information is very important for accurately identifying entities. For example, for a given entity, the context can provide clues about whether it is a person’s name or a place name.

[0194] Relation extraction is an important technology in the field of natural language processing, which aims to identify the relationship or association between entities from text. The goal of relation extraction is to extract the semantic relationship between entities from text, which can be binary or more complex multi-dimensional relationships.

[0195] The task of relation extraction is to find and identify the relationships between entities in a given text. These entities can be named entities with specific meanings, such as people, places, and organizations. The goal of relation extraction is to identify semantic relationships between entities from text, such as "X is the founder of Y", "X is located in Y", etc.

[0196] Relation extraction technology usually needs to solve the following problems:

[0197] (1) Entity recognition: Before relation extraction, it is necessary to identify entities in the text and determine their boundaries and categories. Entity recognition technology can be implemented using rules, statistical learning, or deep learning methods.

[0198] (2) Relationship extraction: After identifying entities, it is necessary to further identify the relationships between entities. Relationship extraction can be implemented based on rules, machine learning, or deep learning methods. Among them, machine learning and deep learning methods usually require a large amount of labeled training data.

[0199] (3) Context understanding: In the process of relation extraction, context information is very important for accurately identifying relations. For example, the context can provide information such as the part of speech, syntactic structure, and semantics of the sentence in which the relation is located, helping to determine the type and meaning of the relation.

[0200] 3. Hypergraph

[0201] Hypergraph is an extended form of graph theory, which is widely used in mathematics, computer science and artificial intelligence. Unlike the graph in traditional graph theory, the edges in hypergraph (called hyperedges) can connect multiple vertices, not just two vertices. The following is a detailed description of hypergraph:

[0202] A hypergraph consists of a set of vertices and a set of hyperedges. Vertices represent objects or entities, and hyperedges represent relationships or connections between objects. Unlike edges in traditional graph theory that connect two vertices, hyperedges can connect multiple vertices, forming a relationship between a hyperedge and multiple vertices. In a hypergraph, a hyperedge is a set of multiple vertices. These vertices are called endpoints or vertex sets of the hyperedge. The size of a hyperedge can be arbitrary, and it can connect two vertices or multiple vertices (more than two). Hyperedges can be undirected, indicating that there is no directionality between the connected vertices, or directed, indicating that there is directionality between the connected vertices. Hypergraphs can be used to express and process complex relationships and connection patterns. Compared with traditional binary relationship graphs, hypergraphs can more intuitively represent the association relationship between multiple objects. For example, in knowledge graphs, hypergraphs can be used to represent complex relationships between entities, such as multi-dimensional relationships, attribute relationships, etc. Hypergraphs have a wide range of applications in computer science and artificial intelligence. In tasks such as knowledge graphs, relationship extraction, and recommendation systems, hypergraphs can effectively represent and process complex relationships between entities. Hypergraphs also play an important role in machine learning and data mining. For example, in graph neural networks, hypergraphs can be used as a representation of input data to learn and reason about complex relational patterns.

[0203] Some of the data in the above formulas are dimensionless and numerically calculated. Meanwhile, the contents not described in detail in this specification belong to the prior art known to those skilled in the art.

[0204] The above embodiments are only used to illustrate the technical method 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 method of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical method of the present invention.

Claims

1. A hypergraph-based electronic medical record text analysis method, characterized in that: The specific steps include: Step 1: Data collection: Determine the source of data collection, automatically collect medical conversation records through the interface or API of the data source, and store the collected data securely in a database or data warehouse; Step 2: Data preprocessing: data cleaning, formatting standards, deduplication, data segmentation, feature extraction, data conversion, data enhancement and sensitive information desensitization; Step 3: Input the preprocessed data into the entity relationship extraction framework to realize the entity relationship recognition and extraction of medical record text, and complete the automatic recording of the diagnosis dialogue system and electronic medical record (EMR); Step 4. After text entity relationship extraction, the identified entities and extracted relationships are input into the node classification model on the hypergraph based on text attributes. According to the characteristics of the medical record text and task requirements, the entities are used as nodes of the hypergraph and the relationships are used as hyperedges of the hypergraph. The results of entity recognition and relationship extraction are integrated into the hypergraph. The hyperedges connect multiple nodes to reflect the association relationship between nodes and complete the text classification task.

2. The method for analyzing electronic medical record text based on a hypergraph according to claim 1, characterized in that: The entity relationship extraction framework includes vector representation, span representation, entity recognition and relationship extraction, and the entity recognition and relationship extraction are integrated to form a multi-task framework; Vector representation: The vector representation layer uses a fine-tuned pre-trained BERT to extract context information. The input sentence is byte-pair encoded by BPE and split into a sequence of n tokens. The BPE tokens are propagated through the internal BERT to generate an embedding sequence E of length n+1: E = (e [CLS] ,e1,e2,...,e n ), where e [CLS] Represents the embedding representation of the entire sentence context, each embedding vector Where d1 represents the embedding dimension; Span representation: The span representation layer uses the embedding of the tokens generated by BERT to represent the span, maintaining a consistent representation dimension s in different spans: = (e i ,e i+1 ,...,e j ), apply a fusion process to s, using max pooling in the fusion process: The model sets the maximum span length L. In order to reduce complexity, the width embedding matrix is ​​used to merge the width information w (0≤w≤L) into the fused span representation s. Spans of different widths contribute differently to the representation: Among them, ° represents the splicing of vectors, w k Derived from the width embedding matrix obtained from the training model; The multi-task framework includes recognition tasks and classification tasks: Recognition task, the recognition task is used to determine whether the current entity or entity pair is indeed an entity or whether there is a certain relationship; binary cross entropy is selected as the loss function, which is defined as follows: Among them, q∈{0,1} represents the true category of the span or span pair (0 represents a negative sample and 1 represents a positive sample), and p∈[0,1] is the model's estimated probability for the label q=1 category; Therefore, the loss for the recognition task is calculated as follows: Classification task, in order to enhance the diversity of multi-task learning loss pattern and prevent the two tasks from degenerating into a single task, the pairwise ranking loss function is selected as the loss function of the classification task; this loss function has the same task goal as the cross entropy loss, but has a different optimization direction; Given a span (pair) representation s and a set of entity or relation classes C, the score of the class label x∈C is computed using the dot product: score c =s T [W classes ] c ; Where W classes is the matrix to be learned, the number of columns is the number of classes, is the column vector corresponding to class c, whose dimension is equal to the dimension of s; For a span (pair), where y + is the correct label, y - no, and They are defined as + and - The score of ; then the calculation formula of rank loss is: L + =log(1+exp(γ(m + -scores y+ ))); L - =log(1+exp(γ(m - -scores y- ))); where γ is the scaling factor, m + and m - is the margin. For non-entity classes or irrelevant entity pairs, only L is calculated. - to penalize incorrect predictions; in the training step, the ranking loss selects only the error class with the highest score among all error classes; then, the pairwise ranking loss is optimized: Loss2=∑(L + +L - ); Finally, the loss function of the multi-task framework used is expressed as: Loss = αLoss1 + βLoss2; Entity Recognition,The entity recognition layer directly uses the output of the span representation layer as input and uses a multi-task framework to extract entity categories from spans; In the recognition task of the entity recognition multi-task framework, the IoU (Intersection over Union) metric is used to introduce the position information between spans; formally, the IoU is calculated as follows: Where s(i,j) represents the span space with left and right indexes i and j in the sentence; Calculate and utilize the maximum IoU (intersection / union) between span s and all entity spans in the sentence, defined as ENIoU(s), which is calculated as: ENIoU(s)=max(IoU(s,en),en∈E); Where E represents the set of all entity spans in the sentence; Subsequently, using ENIoU as a scale factor, the loss function of the recognition task in the multi-task framework is replaced by a dynamically scaled cross entropy loss, and the loss function is: Among them, δ and ENIoU determine the scaling factor, δ∈[0,1] is the balancing factor to solve the class imbalance, and δ<0.5 needs to be set to emphasize fewer positive samples; for negative samples, the higher the ENIoU, the greater the loss, so that the model pays more attention to hard negative samples during training; For the rest of the multi-task framework, no further modifications are made in the entity recognition stage, and the loss of the entity recognition stage is recorded as L1; Relation extraction, unlike the entity recognition stage, which directly uses the span representation layer output as input, the relation extraction stage makes some adjustments to the input information. For those spans that are classified as "NA" in the entity recognition multi-task stage, they will be filtered out; we only consider candidate span pairs that have been preliminarily identified as entities, select the local information between the candidate span pairs as their context, and obtain the contextual representation by fusing their BERT embeddings using maxpooling; For adjacent candidate entity pairs, set v(s1,s2) = 0; In addition, we observe that the Logits in the entity recognition stage may contain useful semantic information; Therefore, Logits can be further embedded from the entity recognition stage to enrich the input information; finally, the multi-task input of the relation extraction layer is represented as follows: Where p(s) represents the Logits of the entity recognition stage; considering that the relationship between s1 and s2 is usually asymmetric, therefore: For the multi-task framework used in the relation extraction stage, the loss of the relation extraction stage is L2.

3. The method for analyzing electronic medical record text based on a hypergraph according to claim 2, characterized in that: The entity relationship extraction framework also includes a joint training loss: a joint training method for entity recognition and relationship extraction, and the loss is defined as follows: L=L1+L2.

4. The method for analyzing electronic medical record text based on a hypergraph according to claim 1, characterized in that: The entity relationship extraction framework also includes a prediction stage. In the prediction stage, in order to avoid error propagation, only the class scores obtained by the multi-task framework are used, denoted as score c , while the binary recognition task is only used to optimize the network parameters; Given a span (pair), the predicted class probability P is calculated as follows: where θ is a hyperparameter threshold; if the score of each class is lower than θ, the span (pair) is predicted as a non-entity or irrelevant relation; otherwise, the span (pair) is assigned to the class with the highest score.

5. The method for analyzing electronic medical record text based on hypergraph according to claim 1, characterized in that: The node classification model in step 4 includes: HyperBERT layer, hypergraph-aware pre-training tasks, and fine-tuning of downstream tasks; The HyperBERT layer explicitly mixes the semantic information obtained by each BERT transformer block with the structural information obtained by the Hypergraph Neural Network (HGNN) block; The hypergraph-aware pre-training task leverages the inherent hypergraph knowledge in TAHG and applies it to semantic and structural representations; Fine-tuning of downstream tasks,After pre-training is completed, freeze the parameters of HyperBERT and use it to calculate the representation of each text node. The calculated representation can be further used to fine-tune separate models on different downstream tasks, and use cross entropy loss to train linear projections from node features to category labels for node classification.

6. The method for analyzing electronic medical record text based on a hypergraph according to claim 5, characterized in that: The nodes are classified into several categories: Disease classification: classify medical record text into different disease categories; Symptom classification: classify medical record text into different symptoms or syndromes; Treatment plan classification: Classify medical record text into different treatment plans or treatment methods.

Citation Information

Patent Citations

  • Text entity generation method, model training method and device

    CN113569572A

  • Tax-related law text-oriented named entity recognition dependency enhancement method

    CN116050413A

  • Nested named entity recognition method based on dynamic graph convolution

    CN116595982A

  • Object matching method and device, equipment, storage medium and program product

    CN117012321A

  • Two-stage named entity recognition method based on prompt learning

    CN117236335A

Cited By

  • Hospital discharge nodule generation system based on hypergraph

    CN121565357A

  • A hypergraph-based discharge summary generation system

    CN121565357B