Clinical prediction method, system and equipment based on electronic health record and medium

By introducing the LOCF method and personalized missing mask in the EHR data interpolation method, and combining the attention mechanism of the PIPER layer for feature fusion, the limitations of EHR data processing in the prior art are solved, and more efficient clinical prediction accuracy is achieved.

CN119560155AActive Publication Date: 2025-03-04QILU UNIVERSITY OF TECHNOLOGY (SHANDONG ACADEMY OF SCIENCES) +1

Patent Information

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

AI Technical Summary

Technical Problem

The existing missing value interpolation method is difficult to fully consider the dynamic characteristics of the time series when processing electronic health record (EHR) data, and ignores the personalization and informational nature of the unobserved data, limiting the effective implementation of personalized medical care.

Method used

The preliminary interpolation method based on LOCF method and personalized missing masks is adopted, combined with the time attention mechanism and variable attention mechanism of the PIPER layer, personalized adjustment and feature fusion of EHR data, and optimized interpolation capabilities through self-supervised pre-training and fine-tuning.

Benefits of technology

Improve the accuracy of clinical predictions, which can better capture changes in individualized loss patterns and physiological measurement frequency in patients, thereby providing more accurate health status prediction support.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119560155A_ABST
    Figure CN119560155A_ABST
Patent Text Reader

Abstract

The invention discloses a clinical prediction method, system and equipment based on electronic health records and a medium, belongs to the technical field of natural language processing, and aims to solve the technical problem of how to individually fill EHR data and improve the clinical prediction precision of the health condition of a patient. According to the technical scheme, the method comprises the following steps: obtaining EHR data: constructing a doctor-seeing sequence matrix and a corresponding missing mask matrix, and obtaining the EHR data of a patient; performing preliminary interpolation and personalized adjustment; randomly generating a mask matrix; feature coding; carrying out PIPER feature fusion: carrying out feature fusion on the time dimension and the feature dimension of the initial feature representation through a time attention mechanism and a variable attention mechanism of a PIPER layer, and generating a patient health representation; pre-training: reconstructing the health representation of the patient, and calculating an error between a reconstruction value and a real observation value through an MIT loss function, so that the interpolation capability of a PIPER layer is optimized; and fine tuning: performing a health state prediction task through a task-specific decoder.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of natural language processing technology, and in particular to a clinical prediction method, system, device and medium based on electronic health records. Background Art

[0002] Personalized healthcare is a medical model that provides customized prevention, diagnosis, treatment, and health management based on individual patients' unique biological characteristics, lifestyle, and health status. Electronic Health Records (EHR) have become an indispensable part of personalized healthcare, providing a rich source of data to record patients' 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 EHR data. However, EHR data are often multivariate, highly missing, and irregularly sampled. These characteristics limit their full utilization. Therefore, the effective implementation of personalized medicine depends largely on how to represent and process EHR data based on time-varying physiological characteristics, treatment processes, and missing values ​​in the data, so as to ensure that the model can fully capture the patient's dynamic health status and provide more accurate support for clinical decision-making.

[0003] As the digital transformation process in the medical field accelerates, the EHR database continues to be enriched and improved, and researchers have proposed many missing value interpolation methods. Existing missing value interpolation methods can be roughly divided into three categories, specifically: the first category is the typical statistical-based EHR interpolation method, including naive zero interpolation, mean interpolation, median interpolation, and the Last Observation Carried Forward (LOCF). Although the statistical-based EHR interpolation method is simple to calculate, does not require complex algorithms or models, and is easy to implement, it has limitations when dealing with missing values ​​in longitudinal EHR data, and it is difficult to fully consider the dynamic characteristics of time series. The second category is the interpolation method based on traditional machine learning, including matrix factorization (MF) and k-nearest neighbors (KNN). The third category is the interpolation method based on deep learning, such as variational autoencoder (VAE) and generative adversarial network (GAN).

[0004] Although most missing value imputation methods have achieved excellent performance in clinical prediction research, they still have some limitations. First, most of the existing missing value imputation methods emphasize the utilization of observable data, while ignoring the personalized and informative nature of unobserved data. In fact, missing data can also provide valuable information that reflects the patient's underlying health status. This oversight limits the potential of the model in practical personalized healthcare applications. In addition, in real-world healthcare applications, the frequency of physiological data measurements is often related to the patient's health status and the severity of the condition. For example, frequent monitoring of blood glucose levels may indicate that the doctor is closely observing changes in the condition of a diabetic patient or is concerned about potential complications. On the contrary, infrequent measurements may indicate that the patient's condition is stable or that the doctor believes that the risk of complications is low. Despite its significance, the frequency of such physiological measurements has also been largely ignored in existing studies.

[0005] Therefore, how to personalize and fill in EHR data and improve the accuracy of clinical predictions of patient health status is a technical problem that needs to be solved urgently. Summary of the invention

[0006] The technical task of the present invention is to provide a clinical prediction method, system, device and medium based on electronic health records to solve the problem of how to personalize and fill in EHR data and improve the accuracy of clinical prediction of patient health status.

[0007] The technical task of the present invention is achieved in the following manner: a clinical prediction method based on electronic health records, the method is as follows:

[0008] Obtain EHR data: construct the visit sequence matrix and the corresponding missing mask matrix to obtain the patient's EHR data;

[0009] Preliminary interpolation and personalized adjustment: Use the LOCF method (Last Observation Carried Forward) to preliminarily interpolate the missing data, obtain the interpolated matrix, and calculate the individualized missingness mask (IMM) matrix according to the characteristic observation frequency. Perform dot product calculation on the individualized missingness mask matrix and the interpolated matrix to obtain the interpolation result of personalized adjustment;

[0010] Randomly generate a mask matrix: randomly select part of the data for masking, and obtain the masked matrix A masked And the corresponding mask matrix M masked , which is used to simulate the data missing situation in real scenes; and takes the masked data as the reconstruction target, which can better learn high-level representations and reconstruct data in the latent space;

[0011] Feature encoding: The masked data A is converted into masked And the corresponding mask matrix M masked Projecting into a low-dimensional latent space to generate initial feature representation;

[0012] PIPER feature fusion: The time dimension and feature dimension of the initial feature representation are fused through the time attention mechanism and variable attention mechanism of the PIPER layer to generate a more accurate patient health representation;

[0013] Pre-training: reconstruct the patient's health representation and calculate the error between the reconstructed value and the true observation value through the MIT loss function, so that the PIPER layer optimizes the interpolation ability;

[0014] Fine-tuning: Perform health status prediction tasks such as hospital mortality prediction through a task-specific decoder.

[0015] Preferably, the EHR data is obtained as follows:

[0016] The visit sequence matrix is ​​defined as A, as follows:

[0017]

[0018] Where T represents the number of visits of the patient; F represents the number of features; represents the value of the fth feature of the patient at the tth visit; a special CLS vector a is introduced at the beginning of the patient's visit sequence CLS ∈R F , better learn global information and improve the performance of clinical prediction tasks;

[0019] The missing mask matrix is ​​defined as M, which is used to represent the missing status of patient access data as follows:

[0020]

[0021] Among them, when When missing, like is observed, then m CLS is with a CLS The corresponding mask, the default value is 1;

[0022] Each patient has a corresponding label, indicating the predicted pathological result, which is represented by the label matrix B as follows:

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

[0024] Among them, b t =0 means that at the tth visit, the pathological result was non-pathological (or normal / negative), that is, no pathological abnormality was found; b t =1 means that pathological abnormality was detected at the tth visit (i.e., pathological / positive);

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

[0026] As a preferred option, preliminary interpolation and personalized adjustment are as follows:

[0027] Use the LOCF method to interpolate missing data: For each feature, when the value at any time point is missing, use the last observed value to fill it in and generate the interpolated 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 according to the observation frequency of the corresponding feature in the entire time series; the calculation formula of IMM is as follows:

[0029]

[0030] in, represents the binary missing value mask of feature f at the tth visit;

[0031] Personalized missing mask matrix A IMM And the interpolated matrix A LOCF Dot product: The interpolated matrix A LOCF With the personalized missing mask matrix A IMM Element-by-element dot product to generate personalized interpolation results, ensuring that the interpolation results can better reflect the influence of feature observation frequency;

[0032] The feature encoding is as follows:

[0033] The masked matrix A masked And the corresponding mask matrix M masked Combined, captures the masked matrix A masked And the corresponding mask matrix M masked The interaction between them forms the input matrix;

[0034] Different from the variable-independent recurrent model, linear projection is used to encode data, so that the entire encoding process remains parallelized and does not accumulate noise from past accesses; using the variable-independent input encoder, the input matrix is ​​mapped into a low-dimensional latent space D through linear projection to generate the 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 efficient parallel computation while capturing the independent pattern of each feature, avoiding the noise accumulation problem common in traditional recursive methods; at the same time, the direct combination of observations and masks helps the model automatically learn the pattern of missing data, ensuring that the latent representation still has stable performance capabilities when the data is incomplete, thereby effectively improving the accuracy of downstream prediction tasks.

[0035] Preferably, PIPER feature fusion is as follows:

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

[0037] Capturing the correlation between different time steps through the temporal attention mechanism on the standardized data and obtaining the attention results on the temporal attention mechanism can help to more accurately grasp the interaction and dependency between time steps;

[0038] The attention result of the temporal attention mechanism is added to the standardized data through residual connection and normalized to obtain the normalized result, retaining the original information of the input features, while enhancing the effect of the temporal attention mechanism and further improving stability;

[0039] The variable attention mechanism is used to capture the variable relationship from the patient's global perspective and obtain the attention results on the feature dimension.

[0040] The attention result on the feature dimension is added to the attention result on the temporal attention mechanism through residual connection again, and normalized to obtain the normalized result again, which not only retains the content of the original feature, but also improves the representation effect of the variable attention, ensuring more accurate modeling of the interaction between features;

[0041] The result of the re-normalization is processed through two layers of linear transformation and nonlinear activation function (such as ReLU) of the feedforward neural network to further extract and enhance the nonlinear representation ability 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 layer-normalized again to obtain a smooth patient-healthy representation.

[0043] Preferably, the normalized data is passed through the temporal attention mechanism to capture the correlation between different time steps, and the attention results of the temporal attention mechanism are as follows:

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

[0045] When dealing with 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, we construct the temporal attention bias matrix Z∈R in combination with the missing data. (T+1)×(T +1)×F, embed missing information and enhance the attention weight of existing observations; specifically: add a fixed True value to the mask vector Stitch together to form a new vector Ensuring the consistency of the vector structure helps to more accurately capture the individual missing information of HER data, thereby improving the accuracy of prediction; the splicing method is as follows:

[0046]

[0047] Among them, [,] represents the concatenation of matrices, placing a fixed True value in In front of it, a new vector is formed Represents a mask vector, that is, the observation status of the cth variable (for example, features such as heart rate and blood pressure) at t time steps. Each element in the mask vector may be True or False, indicating whether the data of the corresponding variable is observed at the corresponding time step;

[0048] Define the bias matrix elements The calculation method of the element bias matrix is The value of depends on the mask value of variable c at the pth access and the qth access. and If there is a situation, the formula is as follows:

[0049]

[0050] Calculate the time attention weight AttentionWeights, the formula is as follows:

[0051]

[0052] More optimally, the variable attention mechanism is used to capture the variable relationship from the patient's global perspective, and the attention results on the feature dimension are obtained as follows:

[0053] The attention result of the temporal attention mechanism is H * ∈R (T+1)×F×d Get the query Q2, key K2 and value V2. The specific formula is as follows:

[0054]

[0055] V2=Linear(H *);

[0056] The latent representation obtained for the first time step Perform a linear transformation to obtain the query vector Q2, the vector of 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; the potential representation of all accesses is converted into a value vector V2 through linear transformation; the time-invariant correlation between variables is calculated, and the variable attention output VariableAttentionWeights is obtained, the formula is as follows:

[0057]

[0058] The variable attention output VariableAttentionWeights is the attention result on the feature dimension, which helps to grasp the correlation between features in EHR data.

[0059] As a preference, the pre-training is specifically as follows:

[0060] A self-supervised pre-training method is used to occlude some observations and reconstruct the occluded observations in the hidden space: the encoder and PIPER layers generate the reconstructed target Z by embedding the original data (A, M) obs ; Enhanced data (A masked , M masked ) generates the patient health representation Z through the encoder and PIPER layer health ; The decoder uses Z health As input, generate the reconstruction data Z actual ; And the Masked Imputation Task Loss (MIT Loss) is used to measure the error between the interpolated value and the original true value, reducing the loss caused by randomly masking part of the data; the formula of MIT Loss is as follows:

[0061]

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

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

[0064] An acquisition unit, used to construct a visit sequence matrix and a corresponding missing mask matrix to obtain patient EHR data;

[0065] An interpolation unit is used to preliminarily interpolate missing data using the Last Observation Carried Forward (LOCF) method to obtain an interpolated matrix, and calculate an Individualized Missingness Mask (IMM) matrix according to the characteristic observation frequency, and perform a dot product calculation on the Individualized Missingness Mask matrix and the interpolated matrix to obtain an individually adjusted interpolation result;

[0066] The generation unit is used to randomly select part of the data for masking and obtain the masked matrix A masked And the corresponding mask matrix M masked , which is used to simulate the data missing situation in real scenes; and takes the masked data as the reconstruction target, which can better learn high-level representations and reconstruct data in the latent space;

[0067] The encoding unit is used to convert the masked data A into masked And the corresponding mask matrix M masked Projecting into a low-dimensional latent space to generate initial feature representation;

[0068] The fusion unit is used to fuse the time dimension and feature dimension of the initial feature representation through the time attention mechanism and variable attention mechanism of the PIPER layer to generate a more accurate patient health representation;

[0069] The pre-training 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, so that the PIPER layer optimizes the interpolation ability;

[0070] Fine-tune the unit for health status prediction tasks, such as in-hospital mortality prediction, through a task-specific decoder.

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

[0072] Wherein, the memory stores a computer program;

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

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

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

[0076] (I) The personalized missing mask based on the feature measurement frequency of the present invention is used to perform personalized missing value interpolation 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 individual missing pattern of the patient; using the personalized missing mask, not only can the missing information in the data be processed more accurately, but also the interpolation strategy can be optimized according to the observation frequency of the feature, thereby improving the interpolation effect and the prediction accuracy of subsequent tasks;

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

[0078] (III) The personalized imputed EHR data of the present invention is used for predicting the health status of patients, which better improves the prediction accuracy; specifically, the present invention designs a personalized missingness mask (IMM), which is based on the measurement frequency of each patient's characteristics, so that PIPER can effectively generate personalized imputed values;

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

[0080] (V) The present invention adopts a training strategy that combines self-supervised pre-training with fine-tuning. First, the model is pre-trained through data reconstruction tasks so that it can infer missing data. Subsequently, the model is fine-tuned to perform specific clinical tasks, such as mortality prediction, to further enhance the prediction effect of the model in practical applications. BRIEF DESCRIPTION OF THE DRAWINGS

[0081] The present invention is further described below in conjunction with the accompanying drawings.

[0082] Attached Figure 1 It is a schematic diagram of the structure of the clinical prediction method based on electronic health records;

[0083] Attached Figure 2 Comparison of binary mask and IMM in EHR data. DETAILED DESCRIPTION

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

[0085] Embodiment 1:

[0086] As attached Figure 1 and 2 As shown, this embodiment provides a clinical prediction method based on electronic health records, and the method is specifically 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 interpolation and personalized adjustment: Use the LOCF method (Last Observation Carried Forward) to preliminarily interpolate the missing data, obtain the interpolated matrix, and calculate the Individualized Missingness Mask (IMM) matrix according to the characteristic observation frequency. Perform dot product calculation on the individualized missingness mask matrix and the interpolated matrix to obtain the interpolation result of personalized adjustment;

[0089] S3. Randomly generate a mask matrix: randomly select part of the data for masking, and obtain the masked matrix A masked And the corresponding mask matrix M masked , which is used to simulate the data missing situation in real scenes; and takes the masked data as the reconstruction target, which can better learn high-level representations and reconstruct data in the latent space;

[0090] S4, feature encoding: The masked data A is encoded by the input encoder masked And the corresponding mask matrix M masked Projecting into a low-dimensional latent space to generate initial feature representation;

[0091] S5, PIPER feature fusion: The time dimension and feature dimension of the initial feature representation are fused through the time attention mechanism and variable attention mechanism of the PIPER layer to generate a more accurate patient health representation;

[0092] S6, pre-training: reconstruct the patient's health representation and calculate the error between the reconstructed value and the true observation value through the MIT loss function, so that the PIPER layer optimizes the interpolation ability;

[0093] S7. Fine-tuning: Perform health status prediction tasks, such as hospital mortality prediction, through task-specific decoders.

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

[0095] S101. Define the medical consultation sequence matrix as A, as follows:

[0096]

[0097] Where T represents the number of visits of the patient; F represents the number of features; represents the value of the fth feature of the patient at the tth visit; a special CLS vector a is introduced at the beginning of the patient's visit sequence CLS ∈R F , better learn global information and improve the performance of clinical prediction tasks;

[0098] S102, define the missing mask matrix as M, which is used to represent the missing status of patient access data, as follows:

[0099]

[0100] Among them, when When missing, like is observed, then m CLS is with a CLS The corresponding mask, the default value is 1;

[0101] S103. Each patient has a corresponding label, which indicates the predicted pathological result, and is represented by the label matrix B, as follows:

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

[0103] Among them, b t =0 means that at the tth visit, the pathological result was non-pathological (or normal / negative), that is, no pathological abnormality was found; b t =1 means that pathological abnormality was detected at the tth visit (i.e., pathological / positive);

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

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

[0106] S201. Use the LOCF method to interpolate missing data: For each feature, when the value at any time point is missing, use the last observed value to fill it in and generate the interpolated matrix A LOCF ;

[0107] Features used in the PhysioNet Challenge 2012 dataset: Albumin: albumin, ALP: alkaline phosphatase, ALT: alanine aminotransferase, AST: aspartate aminotransferase, Bilirubin: bilirubin, BUN: blood urea nitrogen, Cholesterol: cholesterol, Creatinine: creatinine, DiasABP: diastolic blood pressure, FiO2: inspired oxygen concentration, GCS: Glasgow Coma Score, Glucose: blood sugar, HCO3: bicarbonate, HCT: hematocrit, HR: heart rate, K: potassium, Lactate: lactate, Mg: magnesium, MAP: mean arterial pressure, 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: arterial carbon dioxide partial pressure, PaO2: arterial oxygen partial pressure, pH: pH, Platelets: platelets, RespRate: respiratory rate, SaO2: arterial oxygen saturation, SysABP: systolic blood pressure, Temp: body temperature, TroponinI: troponin I, TroponinT: troponin T, Urine: urine volume, WBC: white blood cells, Weight: weight. These indicators are often used to monitor the health status of patients, especially in the ICU environment.

[0108] Features used in the MimicIII dataset: Capillary refill rate: capillary refill rate; Diastolic blood pressure: diastolic blood pressure; Fraction inspired oxygen (FiO2): inspired oxygen concentration; Glasgow coma scale eye opening: Glasgow Coma Scale-eye opening response; Glasgow coma scale motor response: Glasgow Coma Scale-motor response; Glasgow coma scale total: Glasgow Coma Scale-total score; Glasgow coma scale verbal response: Glasgow Coma Scale-verbal response; Glucose: blood sugar; Heart Rate: heart rate; Height: height; Mean blood pressure: mean blood pressure; Oxygensaturation: oxygen saturation; Respiratory rate: respiratory rate; Systolic blood pressure: systolic blood pressure; Temperature: body temperature; Weight: weight; pH: acidity and alkalinity.

[0109] S202, calculate the IMM matrix: calculate the personalized missing mask matrix A according to 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 according to the observation frequency of the corresponding feature in the entire time series; the calculation formula of IMM is as follows:

[0110]

[0111] in, represents the binary missing value mask of feature f at the tth visit;

[0112] S203, personalized missing mask matrix A IMM And the interpolated matrix A LOCF Dot product: The interpolated matrix A LOCF With the 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 influence of feature observation frequency.

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

[0114] S401, the masked matrix A masked And the corresponding mask matrix M masked Combined, captures the masked matrix A masked And the corresponding mask matrix M masked The interaction between them forms the input matrix;

[0115] S402. Different from the variable-independent recursive model, linear projection is used to encode data, so that the entire encoding process remains parallelized and does not accumulate noise from past accesses; using the variable-independent input encoder, the input matrix is ​​mapped into a low-dimensional latent space D through linear projection to generate 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 efficient parallel computation while capturing the independent pattern of each feature, avoiding the noise accumulation problem common in traditional recursive methods; at the same time, the direct combination of observations and masks helps the model automatically learn the pattern of missing data, ensuring that the latent representation still has stable performance capabilities when the data is incomplete, thereby effectively improving the accuracy of downstream prediction tasks.

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

[0117] S501, obtaining standardized data by performing layer normalization processing on the initial potential representation to ensure the stability and consistency of the data in subsequent calculations;

[0118] S502, capturing the correlation between different time steps through the time attention mechanism of the standardized data, and obtaining the attention result of the time attention mechanism, which helps to more accurately grasp the interaction and dependency between the time steps;

[0119] S503, adding the attention result of the temporal attention mechanism to the standardized data through a residual connection, and performing normalization processing to obtain a normalized processing result, retaining the original information of the input feature, while enhancing the effect of the temporal attention mechanism and further improving stability;

[0120] S504, capturing variable relationships from the patient's global perspective through a variable attention mechanism, and obtaining attention results on feature dimensions;

[0121] S505, adding the attention result on the feature dimension to the attention result on the temporal attention mechanism through a residual connection again, and performing normalization processing to obtain a normalized result again, which not only retains the content of the original feature, but also improves the representation effect of the variable attention, ensuring more accurate interaction modeling between features;

[0122] S506, the result of the re-normalization processing is processed by a two-layer linear transformation and a nonlinear activation function (such as ReLU) of a feedforward neural network to further extract and enhance the nonlinear representation ability of the feature, obtain the nonlinear representation of the enhanced feature, and learn more complex feature patterns to enrich the feature representation;

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

[0124] In step S502 of this embodiment, the correlation between different time steps is captured by the time attention mechanism for the standardized data, and the attention result of the time attention mechanism is obtained as follows:

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

[0126] S50202. When dealing with 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, we construct a temporal attention bias matrix Z∈R based on the missing data. (T+1)×(T +1)×F, embed missing information and enhance the attention weight of existing observations; specifically: add a fixed True value to the mask vector Stitch together to form a new vector Ensuring the consistency of the vector structure helps to more accurately capture the individual missing information of HER data, thereby improving the accuracy of prediction; the splicing method is as follows:

[0127]

[0128] Among them, [,] represents the concatenation of matrices, placing a fixed True value in In front of it, a new vector is formed Represents a mask vector, that is, the observation status of the cth variable (for example, features such as heart rate and blood pressure) at t time steps. Each element in the mask vector may be True or False, indicating whether the data of the corresponding variable is observed at the corresponding time step;

[0129] S50203, define bias matrix elements The calculation method of the element bias matrix is The value of depends on the mask value of variable c at the pth access and the qth access. and If there is a situation, the formula is as follows:

[0130]

[0131] S50204. Calculate the time attention weight AttentionWeights. The formula is as follows:

[0132]

[0133] In step S504 of this embodiment, the variable relationship is captured from the global perspective of the patient through the variable attention mechanism, and the attention result on the feature dimension is obtained as follows:

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

[0135]

[0136] V2=Linear(H * );

[0137] S50402, potential representation obtained for the first time step Perform a linear transformation to obtain the query vector Q2, the vector of 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; the potential representation of all accesses is converted into a value vector V2 through linear transformation; the time-invariant correlation between variables is calculated, and the variable attention output VariableAttentionWeights is obtained, the formula is as follows:

[0138]

[0139] S50403, variable attention output VariableAttentionWeights is the attention result on the feature dimension, which helps to grasp the correlation between features in EHR data.

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

[0141] A self-supervised pre-training method is used to occlude some observations and reconstruct the occluded observations in the hidden space: the encoder and PIPER layers generate the reconstructed target Z by embedding the original data (A, M) obs ; Enhanced data (A masked , M masked ) generates the patient health representation Z through the encoder and PIPER layer health ; The decoder uses Z health As input, generate the reconstruction data Z actual ; And the Masked Imputation Task Loss (MIT Loss) is used to measure the error between the interpolated value and the original true value, reducing the loss caused by randomly masking part of the data; the formula of MIT Loss is as follows:

[0142]

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

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

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

[0146] To verify 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' hospitalization in cardiac, medical, surgical, and trauma ICUs, and each record contains sparse measurements within the first 48 hours after admission. The observation time is aligned to hours. After preprocessing, there are 11,988 patients with an observation rate of 24.7%. The prediction goal is to predict hospital mortality based on the data within the first 48 hours of ICU admission, of which 13.8% of the samples belong 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. Prediction of two clinical tasks, including hospital mortality prediction and decompensation prediction, is performed on the MIMIC-III dataset. After preprocessing, it contains 17 laboratory test features. See Table 1 for detailed information about the dataset.

[0147] Table 1 Statistics of the dataset

[0148]

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

[0150] (1) EHR-specific models

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

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

[0153] StageNet: Improves the design of LSTM by incorporating personalized disease stage progression.

[0154] ConCare: This model extracts clinical features using multi-channel GRU and time-aware attention mechanism, and re-encodes clinical information by capturing the interdependencies between features.

[0155] GRASP: This model leverages 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 of irregular clinical data through graph neural networks.

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

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

[0160] PrimeNet: This model uses time-sensitive contrastive learning and data reconstruction tasks for self-supervised pre-training of irregular multivariate time series.

[0161] Smart: The model handles missing values ​​in EHR data through self-supervised pre-training and missing-aware mechanisms.

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

[0163] Table 2 Experimental results of clinical prediction tasks

[0164]

[0165]

[0166] Table 2 shows 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 achieves the best performance in all evaluation indicators, especially in AUPRC, which is the most informative and important evaluation indicator. Specifically, the AUPRC of the PIPER layer is 6.05% higher than the best performing baseline model SMART on average, the F1 Score is improved by 12.89%, min(Se,P+) is improved by 4.96%, and AUROC is increased by 1.67%. These results show that the PIPER layer has a strong ability to deal with missing data in electronic health records and predict patient health status. In contrast, AdaCare performs the worst among all baseline models, which may be due to its convolutional structure that mainly focuses on the most recent visit data and fails to effectively handle missing visit records. In addition, the PIPER layer shows higher stability in different clinical scenarios, and its standard deviation is significantly lower than that of other models. This stability, combined with the excellent generalization ability of the model, indicates that the PIPER layer has great potential in a wider range of clinical applications, especially when dealing with complex medical data scenarios.

[0167] Embodiment 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] An acquisition unit, used to construct a visit sequence matrix and a corresponding missing mask matrix to obtain patient EHR data;

[0170] An interpolation unit is used to preliminarily interpolate the missing data using the Last Observation Carried Forward (LOCF) method to obtain an interpolated matrix, and calculate an Individualized Missingness Mask (IMM) matrix according to the characteristic observation frequency, and perform a dot product calculation on the Individualized Missingness Mask matrix and the interpolated matrix to obtain an individually adjusted interpolation result;

[0171] The generation unit is used to randomly select part of the data for masking and obtain the masked matrix A masked And the corresponding mask matrix M masked , which is used to simulate the data missing situation in real scenes; and takes the masked data as the reconstruction target, which can better learn high-level representations and reconstruct data in the latent space;

[0172] The encoding unit is used to convert the masked data A into masked And the corresponding mask matrix M masked Projecting into a low-dimensional latent space to generate initial feature representation;

[0173] The fusion unit is used to fuse the time dimension and feature dimension of the initial feature representation through the time attention mechanism and variable attention mechanism of the PIPER layer to generate a more accurate patient health representation;

[0174] The pre-training 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, so that the PIPER layer optimizes the interpolation ability;

[0175] Fine-tune the unit for health status prediction tasks, such as in-hospital mortality prediction, through a task-specific decoder.

[0176] Embodiment 3:

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

[0178] Wherein, the memory stores computer-executable instructions;

[0179] The processor executes the computer-executable instructions stored in the memory, so that the processor executes the clinical prediction method based on electronic health records in any embodiment of the present invention.

[0180] The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The processor may be a microprocessor or any conventional processor, etc.

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

[0182] Embodiment 4:

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

[0184] In this case, the program code itself read from the storage medium can realize the function of any one of the above-mentioned embodiments, and thus the program code and the storage medium storing the program code constitute a part of the present invention.

[0185] The storage medium embodiments for providing the program code include a floppy disk, a hard disk, a magneto-optical disk, an optical disk (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RYM, DVD-RW, DVD+RW), a magnetic tape, a non-volatile memory card, and a ROM. Alternatively, the program code can be downloaded from a server computer via a communication network.

[0186] In addition, it should be clear that the functions of any of the above embodiments can be implemented not only by executing the program code read by the computer, but also by enabling an operating system operating on the computer to complete part or all of the actual operations based on instructions from the program code.

[0187] In addition, it can be understood that the program code read from the storage medium is written to a memory provided in an expansion board inserted into the computer or written to a memory provided in an expansion unit connected to the computer, and then based on the instructions of the program code, a CPU installed on the expansion board or the expansion unit is enabled to perform part or all of the actual operations, thereby realizing the functions of any of the above-mentioned embodiments.

[0188] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements 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: Obtain EHR data: construct the visit sequence matrix and the corresponding missing mask matrix to obtain the patient's EHR data; Preliminary interpolation and personalized adjustment: Use the LOCF method to preliminarily interpolate the missing data, obtain the interpolated matrix, and calculate the personalized missing mask matrix based on the characteristic observation frequency. Perform dot product calculation on the personalized missing mask matrix and the interpolated matrix to obtain the personalized adjusted interpolation result; Randomly generate a mask matrix: randomly select part of the data for masking, and obtain the masked matrix A masked And the corresponding mask matrix M masked , used to simulate data missing situations in real scenarios; Feature encoding: The masked data A is converted into masked And the corresponding mask matrix M masked Projecting into a low-dimensional latent space to generate initial feature representation; PIPER feature fusion: The time dimension and feature dimension of the initial feature representation are fused through the time attention mechanism and variable attention mechanism of the PIPER layer to generate the patient health representation; Pre-training: reconstruct the patient's health representation and calculate the error between the reconstructed value and the true observation value through the MIT loss function, so that the PIPER layer optimizes the interpolation ability; Fine-tuning: Perform health state prediction task via task-specific decoder.

2. The clinical prediction method based on electronic health records according to claim 1, characterized in that: The details of obtaining EHR data are as follows: The visit sequence matrix is ​​defined as A, as follows: Where T represents the number of visits of the patient; F represents the number of features; represents the value of the fth feature of the patient at the tth visit; a special CLS vector a is introduced at the beginning of the patient's visit sequence CLS ∈R F ; The missing mask matrix is ​​defined as M, which is used to represent the missing status of patient access data as follows: Among them, when When missing, like is observed, then m CLS is with a CLS The corresponding mask, the default value is 1; Each patient has a corresponding label, indicating the predicted pathological result, which is represented by the label matrix B as follows: B=[b1,b2,...,b T ]∈{0,1} T Among them, b t =0 means that at the tth visit, the pathological result was non-pathological, that is, no pathological abnormality was found; b t =1 means that pathological abnormality was detected at the tth visit; The patient's EHR data is 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 as follows: Use the LOCF method to interpolate missing data: For each feature, when the value at any time point is missing, use the last observed value to fill it in and generate the interpolated 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 according to the observation frequency of the corresponding feature in the entire time series; the calculation formula of IMM is as follows: in, represents the binary missing value mask of feature f at the tth visit; Personalized missing mask matrix A IMM And the interpolated matrix A LOCF Dot product: The interpolated matrix A LOCF With the personalized missing mask matrix A IMM Element-wise dot product to generate personalized interpolation results; The feature encoding is as follows: The masked matrix A masked And the corresponding mask matrix M masked Combined, captures the masked matrix A masked And the corresponding mask matrix M masked The interaction between them forms the input matrix; Using the variable-independent input encoder, the input matrix is ​​mapped into a low-dimensional latent space D by linear projection to generate the 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 any one of claims 1 to 3, characterized in that: PIPER feature fusion is as follows: The initial potential representation is processed by layer normalization to obtain standardized data; The standardized data is used through the temporal attention mechanism to capture the correlation between different time steps and obtain the attention results of the temporal attention mechanism; The attention result of the temporal attention mechanism is added to the standardized data through a residual connection, and normalized to obtain the normalized result; The variable attention mechanism is used to capture the variable relationship from the patient's global perspective and obtain the attention results on the feature dimension. The attention result on the feature dimension is added to the attention result on the temporal attention mechanism through a residual connection again, and normalized to obtain a normalized result. The result of the re-normalization is processed through two layers of linear transformation and nonlinear activation function of the feedforward neural network to further extract and enhance the nonlinear representation ability of the features and obtain the nonlinear representation of the enhanced features; The nonlinear representation of the enhanced features is layer-normalized again to obtain a smooth patient-healthy representation.

5. The clinical prediction method based on electronic health records according to claim 4, characterized in that: The standardized data is used to capture the correlation between different time steps through the temporal attention mechanism, and the attention results of the temporal attention mechanism are obtained as follows: Following the convention of the self-attention mechanism, the query, key, and value are generated through linear transformation, denoted as Q1, K1, and V1 respectively; Combined with the missing data, construct the temporal attention bias matrix Z∈R (T+1)×(T +1)×F, embed missing information and enhance the attention weight of existing observations; Specifically: a fixed True value and the mask vector Stitch together to form a new vector Ensuring the consistency of the vector structure helps to more accurately capture the individual missing information of EHR data, thereby improving the accuracy of prediction; the splicing method is as follows: Among them, [,] represents the concatenation of matrices, placing a fixed True value in In front of it, a new vector is formed Represents a mask vector, that is, the observation status of the cth variable at the t time step. Each element in the mask vector may be True or False, indicating whether the data of the corresponding variable is observed at the corresponding time step; Define the bias matrix elements The calculation method of the element bias matrix is The value of depends on the mask value of variable c at the pth access and the qth access. and If there is a situation, the formula is as follows: Calculate the time attention weight AttentionWeights, the formula is as follows:

6. The clinical prediction method based on electronic health records according to claim 4, characterized in that: The variable attention mechanism is used to capture the variable relationship from the patient's global perspective, and the attention results on the feature dimension are obtained as follows: The attention result of the temporal attention mechanism is H * ∈R (T+1)×F×d Get the query Q2, key K2 and value V2. The specific formula is as follows: V2=Linear(H * ); The latent representation obtained for the first time step Perform a linear transformation to obtain the query vector Q2, the vector of 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 potential representations are converted into value vectors V2; then the time-invariant correlations between variables are calculated, and the variable attention output VariableAttentionWeights is obtained. The formula is as follows: The variable attention output VariableAttentionWeights is the attention result on the feature dimension, which helps to grasp the correlation between features in EHR data.

7. The clinical prediction method based on electronic health records according to claim 1, characterized in that: The pre-training is as follows: A self-supervised pre-training method is used to occlude some observations and reconstruct the occluded observations in the latent space: the encoder and PIPER layers generate the reconstructed target Z by embedding the original data (A, M) obs ; Enhanced data (A masked , M masked ) generates the patient health representation Z through the encoder and PIPER layer health ; The decoder uses Z health As input, generate the reconstruction data Z actual ; And the mask interpolation task loss is used to measure the error between the interpolated value and the original true value, reducing the loss caused by randomly masking part of the data; the formula of MIT Loss is as follows: Among them, Z actual represents the observation value reconstructed by the PIPER layer; Z obs represents the actual observation value; K represents the number of masked observation values.

8. A clinical prediction system based on electronic health records, characterized in that: The system is used to implement the clinical prediction method based on electronic health records as described in any one of claims 1 to 7; the system comprises: An acquisition unit, used to construct a visit sequence matrix and a corresponding missing mask matrix to obtain patient EHR data; An interpolation unit, used to perform preliminary interpolation of missing data using the LOCF method, obtain an interpolated matrix, calculate a personalized missing mask matrix according to the characteristic observation frequency, and perform a dot product calculation between the personalized missing mask matrix and the interpolated matrix to obtain a personalized adjusted interpolation result; The generation unit is used to randomly select part of the data for masking and obtain the masked matrix A masked And the corresponding mask matrix M masked , used to simulate data missing situations in real scenarios; The encoding unit is used to convert the masked data A into masked And the corresponding mask matrix M masked Projecting into a low-dimensional latent space to generate initial feature representation; A fusion unit is used to fuse the time dimension and feature dimension of the initial feature representation through the time attention mechanism and variable attention mechanism of the PIPER layer to generate a patient health representation; The pre-training 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, so that the PIPER layer optimizes the interpolation ability; Fine-tune the unit for the health state prediction task via a task-specific decoder.

9. An electronic device, characterized in that: include: memory and at least one processor; Wherein, the memory stores a computer program; The at least one processor executes the computer program stored in the memory, so that the at least one processor performs the clinical prediction method based on electronic health records according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which 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 7.

Citation Information

Patent Citations

  • Medical missing data interpolation method based on table learning

    CN116913445A

  • Time series data reconstruction method based on multi-head attention mechanism

    CN116992224A

  • Personalized representation learning model method for electronic health records

    CN117457228A

  • 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

Cited By

  • Deep learning-based lower respiratory tract hospital infection risk prediction method and system

    CN119993512A

  • Joint error correction method and system for health archives of crowds in super-large area

    CN120407639A

  • Multivariable time series data completion method and device and electronic equipment

    CN120763489A