Clinical prediction methods, systems, devices, and media based on electronic health records

By using the LOCF method and personalized missing mask matrix imputation of the PIPER layer, combined with time and variable attention mechanisms and self-supervised pre-training, the problem of insufficient utilization of missing data in existing technologies is solved, and more accurate health status prediction is achieved.

CN119560155BActive Publication Date: 2025-10-31QILU UNIVERSITY OF TECHNOLOGY (SHANDONG ACADEMY OF SCIENCES) +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411633731.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-15
Publication Date
2025-10-31
Estimated Expiration
2044-11-15

AI Technical Summary

Technical Problem

Existing methods for imputing missing values ​​fail to fully utilize the informational value of missing data when processing electronic health record data, and fail to effectively consider the relationship between the frequency of physiological data measurements and the patient's health status, resulting in insufficient accuracy in predicting health status in personalized healthcare.

Method used

We employ a LOCF-based method for initial imputation, combined with a personalized missing mask matrix and a temporal and variable attention mechanism in the PIPER layer. Through self-supervised pre-training and fine-tuning, we generate personalized patient health representations for predicting tasks such as inpatient mortality.

Benefits of technology

It improves the accuracy of patient health status prediction, enhances the ability to handle missing data, and improves the generalization performance and prediction effect of the model in practical applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119560155B_ABST
    Figure CN119560155B_ABST
Patent Text Reader

Abstract

This invention discloses a clinical prediction method, system, device, and medium based on electronic health records (EHRs), belonging to the field of natural language processing technology. The technical problem this invention aims to solve is how to personalize EHR data to improve the accuracy of clinical predictions of patient health status. The technical solution adopted is as follows: Acquiring EHR data: Constructing a visit sequence matrix and a corresponding missing mask matrix to acquire patient EHR data; Initial imputation and personalized adjustment; Randomly generating a mask matrix; Feature encoding; PIPER feature fusion: Using the time attention and variable attention mechanisms of the PIPER layer, feature fusion is performed on the time and feature dimensions of the initial feature representation to generate a patient health representation; Pre-training: The patient health representation is reconstructed, and the error between the reconstructed value and the actual observed value is calculated using the MIT loss function, thereby optimizing the imputation capability of the PIPER layer; Fine-tuning: The health status prediction task is performed using a task-specific decoder.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of natural language processing technology, specifically to a clinical prediction method, system, device, and medium based on electronic health records. Background Technology

[0002] Personalized healthcare is a medical model that provides customized prevention, diagnosis, treatment, and health management based on individual patients' unique biometrics, lifestyles, and health conditions. Electronic Health Records (EHRs) have become an indispensable part of personalized healthcare, providing a rich source of data for recording patient medical history. With the continuous advancement of "Internet + Healthcare," more and more digital tools and intelligent technologies are being applied to personalized healthcare, making it possible to extract useful clinical information from massive amounts of EHR data. However, EHR data is often diverse, highly missing, and irregularly sampled. These characteristics limit its comprehensive utilization. Therefore, the effective implementation of personalized medicine largely depends on how to represent and process EHR data based on time-varying physiological characteristics, treatment processes, and missing values ​​in the data, thereby ensuring that the model can fully capture the patient's dynamic health status and provide more accurate support for clinical decision-making.

[0003] With the accelerated digital transformation of the healthcare field, EHR databases are constantly being enriched and improved, leading researchers to propose numerous methods for imputing missing values. Existing imputation methods can be broadly categorized into three types: The first type is typical statistical EHR imputation methods, including naive zero imputation, mean imputation, median imputation, and Last Observation Carried Forward (LOCF). Although statistical EHR imputation methods are computationally simple, require no complex algorithms or models, and are easy to implement, they have limitations in handling missing values ​​in longitudinal EHR data, failing to fully consider the dynamic characteristics of time series. The second type is imputation methods based on traditional machine learning, including matrix factorization (MF) and k-nearest neighbor (KNN) methods. The third type is imputation methods based on deep learning, such as variational autoencoders (VAEs) and generative adversarial networks (GANs).

[0004] While most missing value imputation methods have achieved excellent performance in clinical prediction studies, they still have some limitations. First, existing methods largely emphasize the use of observable data while neglecting the personalization and informativeness of unobserved data. In fact, missing data can provide valuable information reflecting a patient's underlying health condition. This oversight limits the model's potential in real-world personalized healthcare applications. Furthermore, in real-world healthcare applications, the frequency of physiological data measurements is often correlated with a patient's health status and the severity of their condition. For example, frequent monitoring of blood glucose levels may indicate that a physician is closely monitoring changes in a diabetic patient's condition or is concerned about potential complications. Conversely, infrequent measurements may indicate a stable patient condition or that the physician believes the risk of complications is low. Despite their significance, the frequency of such physiological measurements has been largely overlooked in existing research.

[0005] Therefore, how to personalize and supplement EHR data to improve the accuracy of predicting patients' health status in clinical practice is a technical problem that urgently needs to be solved. Summary of the Invention

[0006] The technical objective of this invention is to provide a clinical prediction method, system, device, and medium based on electronic health records (EHRs) to address the problem of how to personalize and supplement EHR data, thereby improving the accuracy of clinical predictions of patient health status.

[0007] The technical objective of this invention is achieved as follows: a clinical prediction method based on electronic health records, the specific method of which is as follows:

[0008] Obtaining EHR data: Constructing a visit sequence matrix and the corresponding missing mask matrix to obtain patient EHR data;

[0009] Preliminary imputation and personalized adjustment: The LOCF method (Last Observation Carried Forward) is used to perform preliminary imputation on the missing data to obtain the imputed matrix. The personalized missingness mask (IMM) matrix is ​​calculated based on the feature observation frequency. The personalized missingness mask matrix and the imputed matrix are then multiplied by a dot product to obtain the personalized imputation result.

[0010] Randomly generate a mask matrix: randomly select a portion of the data for masking, and obtain the masked matrix A. masked and the corresponding mask matrix M masked It is used to simulate data loss in real-world scenarios and uses occluded data as the reconstruction target, enabling better learning of high-level representations and reconstruction of data in the latent space;

[0011] Feature encoding: The masked data A is encoded by inputting it into the encoder. masked and the corresponding mask matrix M masked Projected onto a low-dimensional latent space, generating initial feature representations;

[0012] PIPER Feature Fusion: By using the temporal attention mechanism and variable attention mechanism of the PIPER layer, the temporal dimension and feature dimension of the initial feature representation are fused to generate a more accurate patient health representation;

[0013] Pre-training: The patient's health representation is reconstructed, and the error between the reconstructed value and the true observation value is calculated through the MIT loss function, thereby optimizing the interpolation capability of the PIPER layer;

[0014] Fine-tuning: Predicting health status through task-specific decoders, such as predicting hospital mortality rates.

[0015] As a preferred option, the EHR data is obtained as follows:

[0016] Define the patient visit sequence matrix as A, as follows:

[0017]

[0018] Where T represents the number of patient visits; F represents the number of features; Let f represent the value of the f-th feature of the patient at the t-th visit; a special CLS vector a is introduced at the beginning of the patient's visit sequence. CLS ∈R F To better learn global information and improve the performance of clinical prediction tasks;

[0019] The missing data mask matrix is ​​defined as M, which represents the missing information in patient access data, as follows:

[0020]

[0021] Among them, when If missing, then like If observed, then m CLS Is with a CLS The corresponding mask is 1 by default;

[0022] Each patient has a corresponding label representing the predicted pathological outcome, represented by a label matrix B, as follows:

[0023] B = [b1, b2, ..., b T ]∈{0,1} T

[0024] Among them, b t =0 indicates that at the t-th visit, the pathology result was non-pathological (or normal / negative), meaning no pathological abnormalities were found; b t =1 indicates that a pathological abnormality (i.e., pathological / positive) was detected at the t-th visit;

[0025] The patient's EHR data are represented as (A, B, M).

[0026] As a preferred option, the initial interpolation and personalized adjustments are as follows:

[0027] The LOCF method is used to impute missing data: for each feature, when a value is missing at any time point, it is filled with the value of the last observation, generating the imputed matrix A. LOCF ;

[0028] Calculate the IMM matrix: Calculate the personalized missing mask matrix A based on the observation frequency of each feature. IMM If any feature is observed at any time point, the value of IMM is 1; otherwise, it is calculated based on the observation frequency of the corresponding feature throughout the entire time series. The formula for calculating IMM is as follows:

[0029]

[0030] in, This represents the binary missing value mask for feature f on the t-th visit;

[0031] Personalized Missing Mask Matrix A IMM With the interpolated matrix A LOCF Dot product: the interpolated matrix A LOCF With personalized missing mask matrix A IMM Element-wise dot product is used to generate personalized interpolation results, ensuring that the interpolation results can better reflect the impact of feature observation frequency.

[0032] The feature encoding is as follows:

[0033] The masked matrix A masked and the corresponding mask matrix M masked Combine and capture the occluded matrix A masked and the corresponding mask matrix M masked The interaction between them forms the input matrix;

[0034] Unlike variable-independent recursive models, linear projection is used to encode data, keeping the entire encoding process parallel and preventing the accumulation of noise from past accesses. A variable-independent input encoder maps the input matrix to a low-dimensional latent space D via linear projection, generating an initial latent representation H∈R. (T+1)×F×dWhere d represents the dimension of the latent space D; the variable-independent encoding strategy allows for efficient parallel computation while capturing the independent patterns of each feature, avoiding the noise accumulation problem common in traditional recursive methods; at the same time, directly combining observations and masks helps the model automatically learn patterns from missing data, ensuring that the latent representation still has stable performance even with incomplete data, thereby effectively improving the accuracy of downstream prediction tasks.

[0035] More specifically, the PIPER feature fusion is as follows:

[0036] The initial latent representation is processed by layer normalization to obtain standardized data, which ensures the stability and consistency of the data in subsequent calculations.

[0037] Capturing the correlations between different time steps using standardized data through a time attention mechanism and obtaining attention results from the time attention mechanism can help to more accurately grasp the interactions and dependencies between time steps.

[0038] The attention results from the temporal attention mechanism are added to the standardized data through a residual connection and then normalized to obtain the normalized result. This preserves the original information of the input features, enhances the effect of the temporal attention mechanism, and further improves its stability.

[0039] By using a variable attention mechanism, we can capture variable relationships from a holistic perspective of the patient and obtain attention results in the feature dimension.

[0040] The attention results on the feature dimension are added to the attention results on the temporal attention mechanism again through residual connection and normalized to obtain the result of the second normalization process. This process not only preserves the content of the original features but also improves the representation effect of variable attention, ensuring more accurate modeling of interactions between features.

[0041] The result of the re-normalization process is processed by two layers of linear transformation and nonlinear activation function (e.g., ReLU) of the feedforward neural network to further extract and enhance the nonlinear representation capability of the features, obtain the nonlinear representation of the enhanced features, learn more complex feature patterns, and enrich the feature representation.

[0042] The nonlinear representation of the enhanced features is then subjected to layer normalization to obtain a smooth representation of patient health.

[0043] More preferably, the standardized data is captured through a time attention mechanism to capture the correlation between different time steps, and the attention results obtained from the time attention mechanism are as follows:

[0044] Following the conventions of the self-attention mechanism, queries, keys, and values ​​are generated through linear transformations, denoted as Q1, K1, and V1, respectively.

[0045] When processing real-world datasets containing missing data, directly using these matrices may lead to inaccurate attention assignment. To further mitigate the impact of missing data on representation learning, a temporal attention bias matrix Z∈R is constructed to account for data missingness. (T+1)×(T +1)×F, embedding missing information to enhance the attention weights of existing observations; specifically: combining a fixed True value with a mask vector spliced ​​together to form a new vector Ensuring consistency in the vector structure helps to more accurately capture the unique missing information in HER data, thereby improving prediction accuracy; the splicing method is as follows:

[0046]

[0047] Here, [,] denotes matrix concatenation, placing a fixed True value in the matrix. A new vector is formed in front of it. This represents a mask vector, which is the observation state of the c-th variable (e.g., heart rate, blood pressure, etc.) at t time steps. Each element in the mask vector may be True or False, indicating whether the data of the corresponding variable has been observed at the corresponding time step.

[0048] Define the elements of the bias matrix The calculation method, element of the meta-bias matrix The value of depends on the mask values ​​of variable c during the p-th and q-th accesses. and The existence of the condition is shown in the following formula:

[0049]

[0050] The temporal attention weights, AttentionWeights, are calculated using the following formula:

[0051]

[0052] More preferably, by using a variable attention mechanism to capture variable relationships from a global perspective of the patient, the attention results on the feature dimensions are obtained as follows:

[0053] The attention result based on the time-attention mechanism is H. * ∈R (T+1)×F×d To retrieve the query Q2, key K2, and value V2, the specific formula is as follows:

[0054]

[0055] V2 = Linear(H *);

[0056] The latent representation obtained at the first time step Perform a linear transformation to obtain the query vector Q2, the vector at the first time step. This is also the position of the CLS vector; the key vector K2 is obtained by averaging all observed access embeddings to minimize the impact of missing data in the accesses; through a linear transformation, the latent representations of all accesses are converted into the value vector V2; then the time-invariant correlation between variables is calculated, and the variable attention output VariableAttentionWeights is obtained, as shown in the following formula:

[0057]

[0058] VariableAttentionWeights outputs attention results along the feature dimension, which helps to understand the relationships between features in EHR data.

[0059] As a preferred option, the pre-training process is as follows:

[0060] A self-supervised pre-training method is employed, which involves partially occluding observations and reconstructing them in the hidden space: the encoder and PIPER layer generate the reconstructed target Z by embedding the original data (A, M). obs Augmented data (A) masked M masked The patient's health representation Z is generated through the encoder and PIPER layer. health ; decoder with Z health As input, reconstructed data Z is generated. actual Furthermore, the Masked Imputation Task Loss (MIT Loss) is used to measure the error between the imputed value and the original true value, reducing the loss caused by randomly masking some data. The formula for MIT Loss is as follows:

[0061]

[0062] Among them, Z actual Z represents the observations reconstructed from the PIPER layer. obs represents the actual observed value; K represents the number of masked observed values.

[0063] A clinical prediction system based on electronic health records, the system being used to implement the clinical prediction method based on electronic health records as described above; the system includes:

[0064] The acquisition unit is used to construct the patient visit sequence matrix and the corresponding missing mask matrix to acquire the patient's EHR data;

[0065] The interpolation unit is used to perform preliminary interpolation on missing data using the LOCF method (Last Observation Carried Forward) to obtain the interpolated matrix. It also calculates the Individualized Missingness Mask (IMM) matrix based on the feature observation frequency and performs a dot product between the IMM and the interpolated matrix to obtain the personalized interpolation result.

[0066] The generation unit is used to randomly select a portion of the data for masking and obtain the masked matrix A. masked and the corresponding mask matrix M masked It is used to simulate data loss in real-world scenarios and uses occluded data as the reconstruction target, enabling better learning of high-level representations and reconstruction of data in the latent space;

[0067] Encoding unit, used to input the masked data A to the encoder. masked and the corresponding mask matrix M masked Projected onto a low-dimensional latent space, generating initial feature representations;

[0068] The fusion unit is used to fuse the temporal and feature dimensions of the initial feature representation through the temporal and variable attention mechanisms of the PIPER layer, thereby generating a more accurate patient health representation.

[0069] The pre-trained unit is used to reconstruct the patient's health representation and calculate the error between the reconstructed value and the true observation value through the MIT loss function, thereby optimizing the interpolation capability of the PIPER layer;

[0070] Fine-tuning unit for health status prediction tasks, such as hospital mortality prediction, using a task-specific decoder.

[0071] An electronic device includes: a memory and at least one processor;

[0072] The memory contains computer programs;

[0073] The at least one processor executes the computer program stored in the memory, causing the at least one processor to perform the clinical prediction method based on electronic health records as described above.

[0074] A computer-readable storage medium storing a computer program that can be executed by a processor to implement the above-described clinical prediction method based on electronic health records.

[0075] The clinical prediction method, system, device, and medium based on electronic health records of the present invention have the following advantages:

[0076] (i) This invention uses a personalized missing value mask based on feature measurement frequency to perform personalized missing value imputation on EHR data. By calculating the measurement frequency of each feature in the time series, a personalized mask matrix is ​​generated, which can effectively capture the individualized missing patterns of patients. Using the personalized missing value mask, not only can the missing information in the data be processed more accurately, but the imputation strategy can also be optimized according to the observation frequency of the features, thereby improving the imputation effect and the prediction accuracy of subsequent tasks.

[0077] (ii) To enhance the ability of missing value imputation and representation learning, this invention proposes a self-supervised pre-training method, which is achieved by occluding part of the observations and reconstructing their representations in the hidden space. After pre-training, the model is fine-tuned for specific clinical prediction tasks, such as hospital mortality prediction. Extensive experiments on two real-world datasets show that the PIPER provided by this invention has good generalization performance compared with various baseline methods.

[0078] (III) The personalized imputation of EHR data in this invention is used to predict patient health status, which improves the prediction accuracy. Specifically, this invention designs a personalized missingness mask (IMM). The personalized missingness mask is based on the measurement frequency of each patient feature, which enables PIPER to effectively generate personalized imputation values.

[0079] (iv) This invention adopts a variable-independent encoding strategy, which embeds multivariate time series into the latent space through an input encoder, and uses time attention mechanism and variable attention mechanism to capture the interaction of data in the time dimension and variable dimension.

[0080] (v) The present invention adopts a training strategy that combines self-supervised pre-training and fine-tuning. First, the model is pre-trained through a data reconstruction task so that it can infer missing data. Then, the model is fine-tuned to perform specific clinical tasks, such as mortality prediction, to further enhance the predictive effect of the model in practical applications. Attached Figure Description

[0081] The invention will be further described below with reference to the accompanying drawings.

[0082] Appendix Figure 1 This is a schematic diagram of a clinical prediction method based on electronic health records.

[0083] Appendix Figure 2 This is a comparison chart of binary mask and IMM in EHR data. Detailed Implementation

[0084] The clinical prediction method, system, device, and medium based on electronic health records of the present invention will be described in detail below with reference to the accompanying drawings and specific embodiments.

[0085] Example 1:

[0086] As attached Figure 1 and 2 As shown in the figure, this embodiment provides a clinical prediction method based on electronic health records, which is as follows:

[0087] S1. Obtain EHR data: Construct the visit sequence matrix and the corresponding missing mask matrix to obtain the patient's EHR data;

[0088] S2. Preliminary imputation and personalized adjustment: The LOCF method (Last Observation Carried Forward) is used to perform preliminary imputation on the missing data to obtain the imputed matrix. The personalized missingness mask (IMM) matrix is ​​calculated based on the feature observation frequency. The personalized missingness mask matrix and the imputed matrix are then multiplied by a dot product to obtain the personalized imputation result.

[0089] S3. Randomly generate a mask matrix: Randomly select a portion of the data for masking, and obtain the masked matrix A. masked and the corresponding mask matrix M masked It is used to simulate data loss in real-world scenarios and uses occluded data as the reconstruction target, enabling better learning of high-level representations and reconstruction of data in the latent space;

[0090] S4. Feature Encoding: The masked data A is encoded by inputting it into the encoder. masked and the corresponding mask matrix M masked Projected onto a low-dimensional latent space, generating initial feature representations;

[0091] S5, PIPER Feature Fusion: By using the temporal attention mechanism and variable attention mechanism of the PIPER layer, the temporal dimension and feature dimension of the initial feature representation are fused to generate a more accurate patient health representation;

[0092] S6. Pre-training: The patient's health representation is reconstructed, and the error between the reconstructed value and the true observation value is calculated through the MIT loss function, thereby optimizing the interpolation capability of the PIPER layer.

[0093] S7. Fine-tuning: Predicting health status through task-specific decoders, such as predicting hospital mortality rates.

[0094] The specific steps for obtaining EHR data in step S1 of this embodiment are as follows:

[0095] S101. Define the patient visit sequence matrix as A, as follows:

[0096]

[0097] Where T represents the number of patient visits; F represents the number of features; Let f represent the value of the f-th feature of the patient at the t-th visit; a special CLS vector a is introduced at the beginning of the patient's visit sequence. CLS ∈R F To better learn global information and improve the performance of clinical prediction tasks;

[0098] S102. Define the missing mask matrix as M to represent the missing information in patient access data, as follows:

[0099]

[0100] Among them, when If missing, then like If observed, then m CLS Is with a CLS The corresponding mask is 1 by default;

[0101] S103. Each patient has a corresponding label representing the predicted pathological outcome, represented by a label matrix B, as follows:

[0102] B = [b1, b2, ..., b T ]∈{0,1} T

[0103] Among them, b t =0 indicates that at the t-th visit, the pathology result was non-pathological (or normal / negative), meaning no pathological abnormalities were found; b t =1 indicates that a pathological abnormality (i.e., pathological / positive) was detected at the t-th visit;

[0104] S104. The patient's EHR data are represented as (A, B, M).

[0105] The preliminary interpolation and personalized adjustment in step S2 of this embodiment are as follows:

[0106] S201. Imputing missing data using the LOCF method: For each feature, when a value at any time point is missing, it is filled with the value of the last observation, generating the imputed matrix A. LOCF ;

[0107] Features used in the PhysioNet Challenge 2012 dataset: Albumin, ALP, ALT, AST, Bilirubin, BUN, Cholesterol, Creatinine, DiasABP, FiO2, Glasgow Coma Scale (GCS), Glucose, HCO3, HCT, HR, K, Lactate, Mg, MAP, MechV ENT: Mechanical ventilation; Na: Sodium; NIDIAsABP: Non-invasive diastolic blood pressure; NIMAP: Non-invasive mean arterial pressure; NISysABP: Non-invasive systolic blood pressure; PaCO2: Partial pressure of carbon dioxide in arterial blood; PaO2: Partial pressure of oxygen in arterial blood; pH: Acidity / alkalinity; Platelets: Platelets; RespRate: Respiratory rate; SaO2: Arterial oxygen saturation; SysABP: Systolic blood pressure; Temp: Body temperature; Troponin I: Troponin I; Troponin T: Troponin T; Urine: Urine output; WBC: White blood cells; Weight: Body weight. These indicators are commonly used to monitor a patient's health status, especially in an ICU setting.

[0108] Features used in the MimicIII dataset: Capillary refill rate; Diastolic blood pressure; Friction-induced oxygen (FiO2); Glasgow Coma Scale eye opening; Glasgow Coma Scale motor response; Glasgow Coma Scale total; Glasgow Coma Scale verbal response; Glucose; Heart Rate; Height; Mean blood pressure; Oxygen saturation; Respiratory rate; Systolic blood pressure; Temperature; Weight; pH.

[0109] S202. Calculate the IMM matrix: Calculate the personalized missing mask matrix A based on the observation frequency of each feature. IMM If any feature is observed at any time point, the value of IMM is 1; otherwise, it is calculated based on the observation frequency of the corresponding feature throughout the entire time series. The formula for calculating IMM is as follows:

[0110]

[0111] in, This represents the binary missing value mask for feature f on the t-th visit;

[0112] S203, Personalized Missing Mask Matrix A IMM With the interpolated matrix A LOCF Dot product: the interpolated matrix A LOCF With personalized missing mask matrix A IMM Element-wise dot products are used to generate personalized interpolation results, ensuring that the interpolation results can better reflect the impact of feature observation frequency.

[0113] The feature encoding in step S4 of this embodiment is as follows:

[0114] S401, the masked matrix A masked and the corresponding mask matrix M masked Combine and capture the occluded matrix A masked and the corresponding mask matrix M masked The interaction between them forms the input matrix;

[0115] S402. Unlike variable-independent recursive models, this approach uses linear projection to encode data, keeping the entire encoding process parallel and preventing the accumulation of noise from past accesses. Utilizing a variable-independent input encoder, the input matrix is ​​mapped to a low-dimensional latent space D via linear projection, generating an initial latent representation H∈R. (T+1)×F×d Where d represents the dimension of the latent space D; the variable-independent encoding strategy allows for efficient parallel computation while capturing the independent patterns of each feature, avoiding the noise accumulation problem common in traditional recursive methods; at the same time, directly combining observations and masks helps the model automatically learn patterns from missing data, ensuring that the latent representation still has stable performance even with incomplete data, thereby effectively improving the accuracy of downstream prediction tasks.

[0116] The PIPER feature fusion in step S5 of this embodiment is as follows:

[0117] S501. The initial latent representation is processed by layer normalization to obtain standardized data, ensuring the stability and consistency of the data in subsequent calculations.

[0118] S502. By using the time attention mechanism to capture the correlation between different time steps and obtain the attention results of the time attention mechanism, it is helpful to more accurately grasp the interaction and dependence between time steps.

[0119] S503. The attention results of the temporal attention mechanism are added to the standardized data through residual connection and normalized to obtain the normalized result. The original information of the input features is preserved, while the effect of the temporal attention mechanism is enhanced, and the stability is further improved.

[0120] S504. By using the variable attention mechanism, capture the relationship between variables from the patient's global perspective and obtain attention results in the feature dimension;

[0121] S505. The attention results on the feature dimension are added to the attention results on the temporal attention mechanism again through residual connection and normalized to obtain the result of the second normalization process. This not only preserves the content of the original features but also improves the representation effect of variable attention, ensuring more accurate modeling of interactions between features.

[0122] S506. The result of the re-normalization process is processed by two layers of linear transformation and nonlinear activation function (e.g., ReLU) of the feedforward neural network to further extract and enhance the nonlinear representation capability of the features, obtain the nonlinear representation of the enhanced features, learn more complex feature patterns, and enrich the feature representation.

[0123] S507. Perform layer normalization again on the nonlinear representation of the enhanced features to obtain a smooth patient health representation.

[0124] In this embodiment, step S502, which involves capturing the correlation between different time steps using a time attention mechanism to obtain the attention results from the time attention mechanism, is as follows:

[0125] S50201. Following the convention of self-attention mechanism, a query, key, and value are generated through linear transformation, denoted as Q1, K1, and V1, respectively.

[0126] S50202. When processing real-world datasets containing missing data, directly using these matrices may lead to inaccurate attention allocation. To further mitigate the impact of missing data on representation learning, a temporal attention bias matrix Z∈R is constructed based on the data missingness situation. (T+1)×(T +1)×F, embedding missing information to enhance the attention weights of existing observations; specifically: combining a fixed True value with a mask vector spliced ​​together to form a new vector Ensuring consistency in the vector structure helps to more accurately capture the unique missing information in HER data, thereby improving prediction accuracy; the splicing method is as follows:

[0127]

[0128] Here, [,] denotes matrix concatenation, placing a fixed True value in the matrix. A new vector is formed in front of it. This represents a mask vector, which is the observation state of the c-th variable (e.g., heart rate, blood pressure, etc.) at t time steps. Each element in the mask vector may be True or False, indicating whether the data of the corresponding variable has been observed at the corresponding time step.

[0129] S50203, Define the elements of the bias matrix The calculation method, element of the meta-bias matrix The value of depends on the mask values ​​of variable c during the p-th and q-th accesses. and The existence of the condition is shown in the following formula:

[0130]

[0131] S50204. Calculate the temporal attention weights, AttentionWeights, using the following formula:

[0132]

[0133] In this embodiment, step S504 involves capturing variable relationships from a global perspective of the patient through a variable attention mechanism to obtain attention results on the feature dimension, as detailed below:

[0134] S50401, The attention result through the time-attention mechanism is H. * ∈R (T+1)×F×d To retrieve the query Q2, key K2, and value V2, the specific formula is as follows:

[0135]

[0136] V2 = Linear(H * );

[0137] S50402, Latent representation obtained at the first time step Perform a linear transformation to obtain the query vector Q2, the vector at the first time step. This is also the position of the CLS vector; the key vector K2 is obtained by averaging all observed access embeddings to minimize the impact of missing data in the accesses; through a linear transformation, the latent representations of all accesses are converted into the value vector V2; then the time-invariant correlation between variables is calculated, and the variable attention output VariableAttentionWeights is obtained, as shown in the following formula:

[0138]

[0139] S50403, Variable Attention Weights, is the attention result along the feature dimension, which helps to understand the relationship between features in EHR data.

[0140] The pre-training in step S6 of this embodiment is as follows:

[0141] A self-supervised pre-training method is employed, which involves partially occluding observations and reconstructing them in the hidden space: the encoder and PIPER layer generate the reconstructed target Z by embedding the original data (A, M). obs Augmented data (A) masked M masked The patient's health representation Z is generated through the encoder and PIPER layer. health ; decoder with Z health As input, reconstructed data Z is generated. actual Furthermore, the Masked Imputation Task Loss (MIT Loss) is used to measure the error between the imputed value and the original true value, reducing the loss caused by randomly masking some data. The formula for MIT Loss is as follows:

[0142]

[0143] Among them, Z actual Z represents the observations reconstructed from the PIPER layer. obs represents the actual observed value; K represents the number of masked observed values.

[0144] The purpose of pre-training is to reconstruct missing data, thereby helping the model to better learn the true distribution of the data and thus improve the accuracy of imputation.

[0145] In the fine-tuning stage of step S7 of this embodiment, the decoder is replaced with a task-specific decoder, such as a label decoder. Parameters are updated using a task-specific loss (e.g., cross-entropy for classification). During the first few rounds of training, the parameters of other modules are frozen, and only the label decoder is updated to preserve the pre-trained parameters.

[0146] To validate the effectiveness of PIPER, this embodiment uses the PhysioNet Challenge 2012 and MIMIC-III datasets to evaluate the PIPER layer. The PhysioNet Challenge 2012 dataset contains 37 vital signs and biomarkers describing patients' cardiac, medical, surgical, and trauma ICU status after admission. Each record contains sparse measurements within the first 48 hours after admission. Observation times are aligned to the hour. After preprocessing, there are 11,988 patients, representing an observation rate of 24.7%. The prediction objective is to predict in-hospital mortality based on data from the 48 hours prior to ICU admission, with 13.8% of the samples belonging to the positive class. The MIMIC-III dataset is a widely used database of critical care medical information, including continuous features such as heart rate, blood pressure, and body temperature. Two clinical tasks were performed on the MIMIC-III dataset: in-hospital mortality prediction and decompensation prediction. Preprocessing included 17 laboratory test features. Detailed information about the datasets is shown in Table 1.

[0147] Table 1 Statistical information of the dataset

[0148]

[0149] To illustrate the superiority of this embodiment, the PIPER layer is compared with state-of-the-art models. Existing methods for processing EHR data can be categorized into the following three paradigms:

[0150] (1) EHR-specific model

[0151] The following methods are specifically designed for EHR data, with a focus on personalized health status embedding:

[0152] • AdaCare: This model uses a multi-scale dilated convolution module to capture long-term and short-term historical changes.

[0153] StageNet: Refines the design of LSTM by incorporating personalized disease stage development.

[0154] ConCare: This model uses a multi-channel GRU and time-aware attention mechanism to extract clinical features and re-encodes clinical information by capturing the interdependencies between features.

[0155] • GRASP: This model utilizes information extracted from similar patients and GNNs to enhance representation learning.

[0156] (2) Interpolation-based methods

[0157] RainDrop: This model uses graph structures to capture complex dependencies in time-series data and enhances representation learning for irregular clinical data through graph neural networks.

[0158] • Warpformer: This model uses multi-scale modeling and dynamic time warping techniques to handle irregular time series data, and effectively captures feature changes across multiple time scales by combining an attention mechanism.

[0159] (3) Self-supervised pre-training method

[0160] PrimeNet: This model utilizes time-sensitive contrastive learning and data reconstruction tasks to perform self-supervised pre-training on irregular multivariate time series.

[0161] • Smart: This model handles missing values ​​in EHR data through self-supervised pre-training and a missing value awareness mechanism.

[0162] The experimental results are shown in Table 2:

[0163] Table 2 Results of the Clinical Predictive Task Experiment

[0164]

[0165]

[0166] Table 2 presents the experimental results of the PIPER layer and other baseline models on the MIMIC-III and PhysioNet Challenge2012 datasets. The results show that the PIPER layer achieved the best performance across all evaluation metrics, with the most significant improvement in AUPRC, the most informative and important evaluation metric. Specifically, the PIPER layer's AUPRC was on average 6.05% higher than the best-performing baseline model SMART, with a 12.89% improvement in F1 Score, a 4.96% improvement in min(Se,P+), and a 1.67% increase in AUROC. These results demonstrate the PIPER layer's strong ability to handle missing data in electronic health records and predict patient health status. In contrast, AdaCare performed the worst among all baseline models, possibly because its convolutional structure primarily focuses on recent visit data and fails to effectively handle missing records. Furthermore, the PIPER layer exhibited higher stability across different clinical scenarios, with a significantly lower standard deviation than other models. This stability, combined with the model's excellent generalization ability, indicates that the PIPER layer has great potential for broader clinical applications, especially demonstrating significant advantages when dealing with complex medical data scenarios.

[0167] Example 2:

[0168] This embodiment provides a clinical prediction system based on electronic health records, which is used to implement the clinical prediction method based on electronic health records in Embodiment 1; the system includes:

[0169] The acquisition unit is used to construct the patient visit sequence matrix and the corresponding missing mask matrix to acquire the patient's EHR data;

[0170] The interpolation unit is used to perform preliminary interpolation on missing data using the LOCF method (Last Observation Carried Forward) to obtain the interpolated matrix. It also calculates the individualized Missingness Mask (IMM) matrix based on the feature observation frequency and performs a dot product between the individualized Missingness Mask matrix and the interpolated matrix to obtain the individualized interpolation result.

[0171] The generation unit is used to randomly select a portion of the data for masking and obtain the masked matrix A. masked and the corresponding mask matrix M masked It is used to simulate data loss in real-world scenarios and uses occluded data as the reconstruction target, enabling better learning of high-level representations and reconstruction of data in the latent space;

[0172] Encoding unit, used to input the masked data A to the encoder. masked and the corresponding mask matrix M masked Projected onto a low-dimensional latent space, generating initial feature representations;

[0173] The fusion unit is used to fuse the temporal and feature dimensions of the initial feature representation through the temporal and variable attention mechanisms of the PIPER layer, thereby generating a more accurate patient health representation.

[0174] The pre-trained unit is used to reconstruct the patient's health representation and calculate the error between the reconstructed value and the true observation value through the MIT loss function, thereby optimizing the interpolation capability of the PIPER layer;

[0175] Fine-tuning unit for health status prediction tasks, such as hospital mortality prediction, using a task-specific decoder.

[0176] Example 3:

[0177] This embodiment also provides an electronic device, including: a memory and a processor;

[0178] The memory stores the instructions executed by the computer.

[0179] The processor executes computer execution instructions stored in the memory, causing the processor to perform the clinical prediction method based on electronic health records in any embodiment of the present invention.

[0180] The processor can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), off-the-shelf programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The processor can be a microprocessor or any conventional processor.

[0181] Memory is used to store computer programs and / or modules. The processor implements various functions of the electronic device by running or executing the computer programs and / or modules stored in the memory, and by accessing data stored in the memory. Memory can mainly include a program storage area and a data storage area. The program storage area can store the operating system, at least one application program required for a function, etc.; the data storage area can store data created based on the use of the terminal, etc. In addition, memory can also include high-speed random access memory, and can also include non-volatile memory, such as hard disks, RAM, plug-in hard disks, smart memory cards (SMC), secure digital cards (SD cards), flash memory cards, at least one disk storage device, flash memory devices, or other volatile solid-state storage devices.

[0182] Example 4:

[0183] This embodiment also provides a computer-readable storage medium storing a plurality of instructions, which are loaded by a processor to cause the processor to execute the clinical prediction method based on electronic health records according to any embodiment of the present invention. Specifically, a system or apparatus equipped with a storage medium storing software program code that implements the functions of any of the above embodiments can be provided, and the computer (or CPU or MPU) of the system or apparatus can read and execute the program code stored in the storage medium.

[0184] In this case, the program code read from the storage medium can itself implement the function of any of the above embodiments, and therefore the program code and the storage medium storing the program code constitute part of the present invention.

[0185] Storage media embodiments for providing program code include floppy disks, hard disks, magneto-optical disks, optical disks (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RYM, DVD-RW, DVD+RW), magnetic tapes, non-volatile memory cards, and ROMs. Alternatively, program code can be downloaded from a server computer via a communication network.

[0186] Furthermore, it should be clear that not only can the program code read by the computer be executed, but also the operating system or other components operating on the computer can be instructed based on the program code to perform some or all of the actual operations, thereby realizing the function of any of the embodiments described above.

[0187] Furthermore, it is understood that the program code read from the storage medium is written to the memory set in the expansion board inserted into the computer or to the memory set in the expansion unit connected to the computer. Then, based on the instructions of the program code, the CPU or other components installed on the expansion board or expansion unit execute some and all of the actual operations, thereby realizing the function of any of the embodiments described above.

[0188] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A clinical prediction method based on electronic health records, characterized in that, The method is as follows: Obtaining EHR data: Constructing a visit sequence matrix and the corresponding missing mask matrix to obtain patient EHR data; Preliminary imputation and personalized adjustment: The LOCF method is used to perform preliminary imputation on the missing data to obtain the imputed matrix. A personalized missing mask matrix is ​​calculated based on the feature observation frequency. The personalized missing mask matrix and the imputed matrix are then multiplied by a dot product to obtain the personalized imputation result. Randomly generate a mask matrix: randomly select a portion of the data for masking, and obtain the masked matrix A. masked and the corresponding mask matrix M masked This is used to simulate data loss in real-world scenarios. Feature encoding: The masked data A is encoded by inputting it into the encoder. masked and the corresponding mask matrix M masked Projected onto a low-dimensional latent space, generating initial feature representations; PIPER Feature Fusion: The temporal and variable attention mechanisms of the PIPER layer are used to fuse the temporal and feature dimensions of the initial feature representation to generate a patient health representation. Pre-training: The patient's health representation is reconstructed, and the error between the reconstructed value and the true observation value is calculated through the MIT loss function, thereby optimizing the interpolation capability of the PIPER layer; Fine-tuning: Predicting health status using a task-specific decoder; The PIPER feature fusion is as follows: The initial latent representation is processed through layer normalization to obtain standardized data; Standardized data is captured using a time attention mechanism to identify the correlations between different time steps and obtain the attention results from the time attention mechanism. The attention results from the temporal attention mechanism are added to the standardized data via residual connections and then normalized to obtain the normalized result. By using a variable attention mechanism, we can capture variable relationships from a holistic perspective of the patient and obtain attention results in the feature dimension. The attention results on the feature dimension are added to the attention results on the temporal attention mechanism again through residual connections, and then normalized to obtain the result of the second normalization process. The result of the re-normalization process is processed by two layers of linear transformation and nonlinear activation function of feedforward neural network to further extract and enhance the nonlinear representation capability of features and obtain the nonlinear representation of enhanced features. The nonlinear representation of the enhanced features is then subjected to layer normalization to obtain a smooth patient health representation; The pre-training process is as follows: A self-supervised pre-training method is employed, which involves partially occluding observations and reconstructing them in the hidden space: the encoder and PIPER layer generate the reconstructed target Z by embedding the original data (A, M). obs Augmented data (A) masked M masked The patient's health representation Z is generated through the encoder and PIPER layer. health ; decoder with Z health As input, reconstructed data Z is generated. actual Furthermore, the MIT Loss algorithm employs a masked interpolation task loss to measure the error between the interpolated value and the original true value, reducing the loss caused by randomly masking some data. The formula for MIT Loss is as follows: Among them, Z actual Z represents the observations reconstructed from the PIPER layer. obs represents the actual observed value; K represents the number of masked observed values.

2. The clinical prediction method based on electronic health records according to claim 1, characterized in that, The specific steps to obtain EHR data are as follows: Define the patient visit sequence matrix as A, as follows: Where T represents the number of patient visits; F represents the number of features; Let f represent the value of the f-th feature of the patient at the t-th visit; a special CLS vector a is introduced at the beginning of the patient's visit sequence. CLS ∈R F ; The missing data mask matrix is ​​defined as M, which represents the missing information in patient access data, as follows: Among them, when If missing, then like If observed, then m CLS Is with a CLS The corresponding mask is 1 by default; Each patient has a corresponding label representing the predicted pathological outcome, represented by a label matrix B, as follows: B=[b1,b2,...,b T ]∈{0,1} T Among them, b t =0 indicates that at the t-th visit, the pathology result was non-pathological, i.e., no pathological abnormalities were found; b t =1 indicates that a pathological abnormality was detected during the t-th visit; The patient's EHR data are represented as (A, B, M).

3. The clinical prediction method based on electronic health records according to claim 1, characterized in that, The preliminary interpolation and personalized adjustments are detailed below: The LOCF method is used to impute missing data: for each feature, when a value is missing at any time point, it is filled with the value of the last observation, generating the imputed matrix A. LOCF ; Calculate the IMM matrix: Calculate the personalized missing mask matrix A based on the observation frequency of each feature. IMM If any feature is observed at any time point, the value of IMM is 1; otherwise, it is calculated based on the observation frequency of the corresponding feature throughout the entire time series. The formula for calculating IMM is as follows: in, This represents the binary missing value mask for feature f on the t-th visit; Personalized Missing Mask Matrix A IMM With the interpolated matrix A LOCF Dot product: the interpolated matrix A LOCF With personalized missing mask matrix A IMM Element-wise dot product is used to generate personalized interpolation results; The feature encoding is as follows: The masked matrix A masked and the corresponding mask matrix M masked Combine and capture the occluded matrix A masked and the corresponding mask matrix M masked The interaction between them forms the input matrix; Using a variable-independent input encoder, the input matrix is ​​mapped to a low-dimensional latent space D through linear projection, generating an initial latent representation H∈R. (T+1)×F×d ; where d represents the dimension of the latent space D.

4. The clinical prediction method based on electronic health records according to claim 1, characterized in that, The standardized data is used to capture the correlation between different time steps through a temporal attention mechanism, and the attention results obtained from the temporal attention mechanism are as follows: Following the conventions of the self-attention mechanism, queries, keys, and values ​​are generated through linear transformations, denoted as Q1, K1, and V1, respectively. Construct the time attention bias matrix Z∈R based on the case of missing data. (T+1)×(T+1)×F Embed missing information to enhance the attention weights of existing observations; Specifically, it involves: combining a fixed True value with a mask vector. spliced ​​together to form a new vector Ensuring consistency in the vector structure helps to more accurately capture the unique missing data in EHR data, thereby improving prediction accuracy; the splicing method is as follows: Here, [,] denotes matrix concatenation, placing a fixed True value in the matrix. A new vector is formed in front of it. This represents a mask vector, which is the observation state of the c-th variable at time step t. Each element in the mask vector may be True or False, indicating whether the data of the corresponding variable has been observed at the corresponding time step. Define the elements of the bias matrix The calculation method, element of the meta-bias matrix The value of depends on the mask values ​​of variable c during the p-th and q-th accesses. and The existence of the condition is shown in the following formula: The temporal attention weights, AttentionWeights, are calculated using the following formula:

5. The clinical prediction method based on electronic health records according to claim 1, characterized in that, By using a variable attention mechanism to capture variable relationships from a global perspective of the patient, the attention results on the feature dimensions are obtained as follows: The attention result based on the time-attention mechanism is H. * ∈R (T+1)×F×d To retrieve the query Q2, key K2, and value V2, the specific formula is as follows: V2=Linear(H * ); The latent representation obtained at the first time step Perform a linear transformation to obtain the query vector Q2, the vector at the first time step. It is also the position of the CLS vector; the key vector K2 is obtained by averaging all observed access embeddings to minimize the impact of missing data in the access. Through linear transformation, all accessed latent representations are converted into value vectors V2; then, the time-invariant correlations between variables are calculated, and the variable attention output VariableAttentionWeights is obtained, as shown in the following formula: VariableAttentionWeights outputs attention results along the feature dimension, which helps to understand the relationships between features in EHR data.

6. A clinical prediction system based on electronic health records, characterized in that, This system is used to implement the clinical prediction method based on electronic health records as described in any one of claims 1 to 5; the system comprises: The acquisition unit is used to construct the patient visit sequence matrix and the corresponding missing mask matrix to acquire the patient's EHR data; The interpolation unit is used to perform preliminary interpolation on missing data using the LOCF method, obtain the interpolated matrix, calculate the personalized missing mask matrix based on the feature observation frequency, and perform dot product calculation between the personalized missing mask matrix and the interpolated matrix to obtain the personalized adjusted interpolation result. The generation unit is used to randomly select a portion of the data for masking and obtain the masked matrix A. masked and the corresponding mask matrix M masked This is used to simulate data loss in real-world scenarios. Encoding unit, used to input the masked data A to the encoder. masked and the corresponding mask matrix M masked Projected onto a low-dimensional latent space, generating initial feature representations; The fusion unit is used to fuse the temporal and feature dimensions of the initial feature representation through the temporal and variable attention mechanisms of the PIPER layer to generate a patient health representation. The pre-trained unit is used to reconstruct the patient's health representation and calculate the error between the reconstructed value and the true observation value through the MIT loss function, thereby optimizing the interpolation capability of the PIPER layer; The fine-tuning unit is used for health status prediction tasks via a task-specific decoder.

7. An electronic device, characterized in that, include: Memory and at least one processor; The memory contains computer programs; The at least one processor executes the computer program stored in the memory, causing the at least one processor to perform the clinical prediction method based on electronic health records as described in any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that can be executed by a processor to implement the clinical prediction method based on electronic health records as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Human health monitoring data time sequence prediction method for optimizing time position coding

    CN118942721A

  • Method and system of predicting a clinical outcome or characteristic

    WO2024042164A2