A method and system for predicting adverse events in heart failure based on a time-series model

By combining Bi-LSTM and attention mechanism with a contrastive loss function, the problems of data fusion and imbalance in the prediction of adverse events in heart failure are solved, and efficient prediction results are achieved.

CN116230224BActive Publication Date: 2026-04-03YANGZHOU UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-29
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

Existing technologies, when predicting adverse events of heart failure, cannot effectively integrate multiple medical information, ignore the interrelationships between heterogeneous data, and cannot effectively solve the problem of data imbalance, thus affecting prediction performance.

Method used

A Bi-LSTM model was used in conjunction with an attention mechanism and a contrastive loss function. Missing data values ​​were filled in using the Fancyimpute tool, the patient's temporal information was learned, and important information was captured using a location-based attention mechanism. The contrastive loss function was used to solve the data imbalance problem.

Benefits of technology

It has achieved the ability to accurately predict multiple tasks such as admission mortality and readmission of heart failure patients without the assistance of medical experts, thus improving the predictive ability of the model and solving the problems of data sparsity and class imbalance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116230224B_ABST
    Figure CN116230224B_ABST
Patent Text Reader

Abstract

This invention discloses a method and system for predicting adverse events in heart failure based on a time-series model. First, patient data for heart failure is extracted. Then, the extracted patient data is preprocessed to extract the necessary variables. Missing values ​​are imputed using the Fancyimpute tool. A Bi-LSTM is used to train the imputed data to learn the patient's temporal information. An attention mechanism is used to learn the importance of different variables in each patient visit. A contrastive loss function is used as the training loss function to address the data imbalance problem, thus achieving the prediction of adverse events in heart failure patients. This invention addresses data imbalance and missing values ​​by handling data loss and using contrastive loss, thereby obtaining a better representation of the patient, improving the model's predictive performance, and better learning the temporal information and relationships between variables in each visit of heart failure patients, improving the system's interpretability, and providing a reliable basis for doctors' judgment of adverse events.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of computer technology, specifically relating to a method and system for predicting adverse events of heart failure based on a time-series model. Background Technology

[0002] Heart failure (HF) is a disease characterized by structural or functional abnormalities of the heart. It represents the end stage of various heart diseases, manifesting as a complex set of clinical symptoms. These include impaired ventricular filling, reduced ejection capacity, ventricular dysfunction, insufficient cardiac output, pulmonary and / or systemic congestion, and inadequate blood perfusion to organs and tissues. Dyspnea, fatigue, pulmonary congestion, and peripheral edema are the main clinical manifestations of HF. As one of the world's recognized chronic cardiovascular diseases, HF is characterized by high prevalence, high medical costs, and poor prognosis. Therefore, HF has become a major public health problem worldwide.

[0003] Assessing the 5-year mortality rate of heart failure patients based on their specific circumstances, and using this assessment to guide doctors in developing more rational and scientific prognostic improvement plans, is an important means to prevent the condition from worsening, improve patient outcomes, positively impact patients' quality of life, and ultimately reduce medical expenses.

[0004] Current research has used CNNs to predict adverse patient events, employing general health status representation learning models and using dilated convolutions with multi-scale receptive fields to extract multi-temporal-scale clinical features. While CNNs effectively preserve the neighborhood relationships and spatial locality of the input, their limitations in temporal data mining stem from the loss of partial-to-whole correlations. Furthermore, most existing CNN-based methods assume that medical events during hospital visits are recorded strictly in chronological order, which is typically not the case in real-world electronic medical records. This further impacts the overall performance of these methods. Some studies have begun modeling different types of medical sequences to construct sequence hidden states and modeling the interrelationships between them and hidden neurons. While these methods consider the differences between different types of medical data, the interrelationships between heterogeneous data remain insufficiently explored. Moreover, most methods fail to effectively fuse multifaceted medical information because they simply concatenate relevant feature vectors from different types of data to construct the final patient representation. Summary of the Invention

[0005] Purpose of the invention: To address the problems existing in the prior art, the present invention provides a method and system for predicting adverse events of heart failure based on a time-series model.

[0006] Technical Solution: This invention proposes a method for predicting adverse events in heart failure based on a time-series model, specifically including the following steps:

[0007] (1) Extract patient data diagnosed with heart failure from the public dataset MIMIC-III, and preprocess the data to extract the required information;

[0008] (2) Use the Biscaler tool in Fancyimpute to fill in missing values ​​in the extracted data;

[0009] (3) Use Bi-LSTM to train the amended data to learn the patient’s temporal information;

[0010] (4) Learning the importance of different variables in each patient visit based on attention mechanisms;

[0011] (5) Use the contrastive loss function as the training loss function to solve the data imbalance problem and realize the prediction of adverse events in patients with heart failure.

[0012] Furthermore, the process of preprocessing the data to extract the required information in step (1) is as follows:

[0013] Extract demographic information, laboratory test results, medication use, surgery, and ICU stay duration and frequency that are closely related to heart failure;

[0014] By introducing major disease categories, surgeries, and extracting only the most relevant laboratory tests, relevant disease information, medication information, and surgical information can be extracted.

[0015] Based on the patient's ICD9 code, the patient's major disease category is assigned a value of 1, forming a 66-dimensional user information.

[0016] Furthermore, the implementation process of step (3) is as follows:

[0017] By combining the patient's demographic information, diagnostic information, medication information, surgical information, ICU stay information, and laboratory test results, a 66-dimensional information matrix x is generated. i ;

[0018] By utilizing a calibrated linear unit and a linear mapping function to obtain the access representation, patient information is embedded as a low-dimensional vector representation v. i The calculation formula is as follows:

[0019] v i =ReLU(W v x i +b c )

[0020] Among them, W v∈R m×L It is a weight matrix that can rank the importance of each medical code, where m is the embedding vector v. i Size;

[0021] Using each patient's visit information as input, Bi-LSTM is used to learn the patient's time-series information. Each feedforward LSTM unit has a storage unit state S. i It is controlled by three Sigmoid gates: the forget gate F i Input gate i and output gate O i Forgot the door F i It is used to determine what should be retrieved from storage unit S. i Which information is discarded during input, and what information is discarded during input? i It is used to determine which information will be stored; Output gate O i This will determine the output battery state S i Information; the hidden state of the forward LSTM unit through these three gates. The calculation formula is as follows:

[0022] F i =σ(W f [h i-1 ;v i ]+b f )

[0023] I i =σ(W i [h i-1 ;v i ]+b i )

[0024] O i =σ(W o [h i-1 ;v i ]+b o )

[0025]

[0026]

[0027] Among them, [h i-1 ;v i ]∈R q+m It is the previous hidden state h i-1 and the current access embedding vector v i The connection is q represents each hidden state h. i The dimension of W f W i W o W s ∈Rq×(q+m) For the weight matrix to be learned, b f b i b o b s ∈R q Let σ be the bias vector, and σ be the logistic sigmoid function. This represents an element-wise multiplication operation, which similarly yields the hidden state of a backward LSTM unit. Then, the hidden state h of a Bi-LSTM cell is obtained. i The calculation formula is as follows:

[0028]

[0029] Furthermore, the implementation process of step (4) is as follows:

[0030] A location-based attention mechanism is used to derive a context vector C. t :

[0031]

[0032] Among them, h i Let α represent the hidden state during the i-th visit. ti From the current hidden state h i A vector that captures the weights; α ti Calculated using the following formula:

[0033] α ti =W α h i +b α

[0034] α t =softmax([α t1 α t2 , ..., α t(t-1) ])

[0035] Among them, W α ∈R q and b α ∈R are the parameters to be learned, representing the weights and biases, respectively;

[0036] By aggregating temporal information and patient visit pattern information through attention mechanisms and Bi-LSTM, the patient's final representation is obtained. The calculation formula is as follows:

[0037]

[0038] Furthermore, the implementation process of step (5) is as follows:

[0039] The final patient representation vector is fed into the contrastive loss function, which divides patients into two classes. The loss function is as follows:

[0040]

[0041] in, The Euclidean distance between two sample features X1 and X2 is represented by P, which represents the feature dimension of the sample. Y is the label indicating whether the two samples match, where Y=1 means the two samples are similar or match, and Y=0 means they do not match. m is the set threshold, and N is the number of samples.

[0042] Based on the same inventive concept, the present invention also provides a heart failure adverse event prediction system based on a time-series model, comprising:

[0043] The information extraction module collects a dataset of heart failure patients from the MIMIC-III dataset, preprocesses the data, and extracts the patients' demographic information, laboratory test information, related disease information, medication information, surgical information, and ICU stay information.

[0044] The information completion module uses the Biscaler tool in Fancyimpute to complete the missing values ​​of the extracted heart failure patient information.

[0045] The adverse event prediction module for heart failure patients uses Bi-LSTM to train and learn the temporal information of patients by supplementing good data; it uses an attention mechanism to learn the importance of different variables in each patient visit; and it uses a contrastive loss function as the training loss function to solve the data imbalance problem and achieve the prediction of adverse events for heart failure patients.

[0046] Beneficial Effects: Compared with existing technologies, the beneficial effects of this invention are as follows: 1. By considering time-series information and comprehensively taking into account patient demographics, laboratory tests, inpatient diagnostic results, patient observation records, medication use during hospitalization, surgical information during hospitalization, ICU stay information, etc., it can accurately predict multiple tasks such as mortality rate, readmission, and intubation of heart failure patients at different time windows of admission without the assistance of any medical experts; 2. By using BiScaler to obtain a double normalized matrix through iterative estimation of column mean and standard deviation, the data sparsity problem is solved and the predictive ability of the model is improved; 3. This invention uses contrastive learning to perform unsupervised learning, dividing the samples into two classes without needing to classify patients based on labels, thereby solving the serious class imbalance problem in heart failure patients. Attached Figure Description

[0047] Figure 1 This is a flowchart of a time-series model-based method for predicting adverse events in heart failure.

[0048] Figure 2 This is a schematic diagram of the structure of a time-series model-based adverse event prediction system for heart failure. Detailed Implementation

[0049] The present invention will now be described in further detail with reference to the accompanying drawings.

[0050] This invention proposes a method for predicting adverse events in heart failure based on a time-series model, such as... Figure 1 As shown, it includes the following steps:

[0051] Step 1: Extract patient data diagnosed with heart failure from the public dataset MIMIC-III; preprocess the extracted heart failure patient data to extract the necessary information.

[0052] The MIMIC-III dataset is a multivariate time series dataset composed of sparse and irregularly sampled physiological signals. It mainly consists of two types of basic data: one type is clinical data extracted from EHRs, including patients' demographic characteristics, diagnostic information, laboratory test information, medical imaging information, vital signs, etc.; the second type of data is waveform data and related vital sign parameters and event records collected by bedside monitoring equipment.

[0053] First, determine the ICD-9 code corresponding to heart failure in the MIMIC-III dataset. Then, use Pandas to extract the corresponding heart failure patients from the MIMIC-III dataset as the initial dataset.

[0054] The extracted dataset of heart failure patients includes patient demographics, laboratory tests, inpatient diagnosis results, patient observation records, medications used during hospitalization, surgical information during hospitalization, and ICU stay information. Since the prediction is for adverse events in heart failure patients, it is necessary to extract demographic information, laboratory tests, medications, surgeries, and ICU stay time and frequency that are closely related to heart failure.

[0055] Since there are over 2000 ICD codes for diseases and nearly 2000 for surgeries and medications, retaining all of them would lead to dimensionality explosion and data sparsity issues when using one-hot encoding. Therefore, this approach involves introducing broad disease categories, surgeries, and extracting only the most relevant laboratory tests. This implementation extracts 26 relevant diseases, including: cardiomyopathy, myocarditis, pericardial disease, Class I coronary artery disease, diabetes, renal failure, congenital cardiovascular disease, drug abuse, hyperthyroidism, connective tissue disease, hyperlipidemia, other heart diseases, arrhythmias, valvular heart disease, endocarditis, pulmonary circulatory disorders, respiratory failure, peripheral vascular disease, hypertension, kidney disease, cardiac structural abnormalities, obesity, alcoholism, cardiac arrest and sudden cardiac death, smoking, and Class II coronary artery disease. Seven categories of medications are also included: ACE inhibitors, ARBs, beta-blockers, calcium channel blockers, digitalis, diuretics, and nitrates. Six types of surgery: heart transplantation, cardiac resynchronization therapy, implantable cardioverter defibrillator, left ventricular assist device, coronary artery surgery, and valve surgery.

[0056] Since diseases and surgeries are represented using ICD9 codes, which computers cannot recognize, it is necessary to assign a value of 1 to the patient's major disease category based on the patient's ICD9 code, thus forming a 66-dimensional user information.

[0057] Step 2: Use the Biscaler tool in Fancyimpute to fill in missing values ​​in the extracted data.

[0058] Directly using the heart failure patient data extracted above will cause problems such as data sparsity, preventing the model from learning useful features and reducing predictive performance. Therefore, missing values ​​need to be imputed. Currently, most imputation methods replace missing entries with the mean or median of each column, but this results in a lack of data individuality; each patient's test information is identical, and the deep learning model cannot learn unique features. Figure 2 As shown, this invention uses BiScaler from the Fancyimpute toolkit for data population.

[0059] Step 3: Use Bi-LSTM to train and complete the data to learn the patient's temporal information.

[0060] The model is trained using the data filled in above. First, the patient's diagnosis information, medication information, surgical information, ICU stay information, and laboratory test information are concatenated to generate a 66-dimensional information x. i .

[0061] By utilizing a rectified linear unit (ReLU) and a linear mapping function to obtain the access representation, patient information is embedded as a low-dimensional vector representation v. i The calculation formula is as follows:

[0062] v i =ReLU(W v x i +b c )

[0063] Among them, W v ∈R m×L It is a weight matrix that can rank the importance of each medical code, where m is the embedding vector v. i Size.

[0064] Using each patient's visit information as input, Bi-LSTM is used to learn the patient's time-series information. Each feedforward LSTM unit has a storage unit state S. i It is controlled by three Sigmoid gates: the forget gate F i Input gate i and output gate O i Forgot Door F i It is used to determine what should be retrieved from storage unit S. i Which information is discarded during input, and what information is discarded during input? i It is used to determine which information will be stored. Finally, output gate O... i Will determine the output power

[0065] Pool State S i The information. Through these three gates, the hidden state of the forward LSTM unit is... The calculation formula is as follows:

[0066] F i =σ(W f [h i-1 ;v i ]+b f )

[0067] I i =σ(W i [h i-1 ;v i ]+b i )

[0068] O i =σ(W o [h i-1 ;v i ]+b o )

[0069]

[0070]

[0071] Among them, [h i-1 ;v i]∈R q+m It is the previous hidden state h i-1 and the current access embedding vector v i The connection is q, where q represents each hidden state h. i The dimension of W. f W i W o W s ∈R q×(q+m) For the weight matrix to be learned, b f ,b i ,b o ,b s ∈R q Let σ be the bias vector. σ is a logistic sigmoid function. This represents element-wise multiplication. Similarly, we can also obtain the hidden state of a backward LSTM unit. Then, the hidden state h of a Bi-LSTM cell can be obtained. i The calculation formula is as follows:

[0072]

[0073] Step 4: Use attention mechanisms to learn the importance of different variables in each patient visit.

[0074] Using only Bi-LSTM ignores some pattern information between visits. Introducing an attention mechanism improves the model's interpretability. This paper uses a position-based attention mechanism to derive a context vector C. t This helps capture more information for high-risk prediction tasks and achieves higher performance in processing time-series EHR data. The context vector C in the model used in this paper... t The calculation method is as follows:

[0075]

[0076] Where h i Let α represent the hidden state during the i-th visit. ti From the current hidden state h i A vector that captures the weights. α ti It can be calculated using the following formula:

[0077] α n =W α h i +b α

[0078] α t =softmax([α t1 α t2 , ..., α t(t-1) ])

[0079] Among them, W α ∈R q and b α ∈R are the parameters to be learned, which represent the weights and biases, respectively.

[0080] By aggregating temporal information and patient visit pattern information through attention mechanisms and Bi-LSTM, the patient's final representation is obtained. The calculation formula is as follows:

[0081]

[0082] Step 5: Use the contrastive loss function as the training loss function to solve the data imbalance problem and achieve the prediction of adverse events in patients with heart failure.

[0083] The final patient representation vector is fed into the contrastive loss function to divide patients into two or more classes, thus addressing the imbalanced sample problem. The loss function is as follows:

[0084]

[0085] in, The Euclidean distance (norm 2) between two sample features X1 and X2 is represented by P, which represents the feature dimension of the sample. Y is the label indicating whether the two samples match. Y=1 means that the two samples are similar or match, and Y=0 means that they do not match. m is the set threshold, and N is the number of samples.

[0086] like Figure 2 As shown, this invention also provides a heart failure adverse event prediction system based on a time-series model, comprising: an information extraction module, which collects a heart failure patient dataset from the MIMIC-III dataset, preprocesses the data, and extracts the patient's demographic information, laboratory test information, related disease information, medication information, surgical information, and ICU stay information; an information completion module, which uses the Biscaler tool in Fancyimpute to complete the extracted heart failure patient information by filling in missing values; and a heart failure patient adverse event prediction module, which uses Bi-LSTM to train the completed data to learn the patient's time-series information; uses an attention mechanism to learn the importance of different variables in each patient visit; and uses a contrastive loss function as the training loss function to solve the data imbalance problem and achieve the prediction of adverse events in heart failure patients.

[0087] There are many methods and approaches to implement this technical solution, and the above are only preferred embodiments of this invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principle of this invention, and these improvements and modifications should also be considered within the scope of protection of this invention.

Claims

1. A method for predicting adverse events in heart failure based on a time-series model, characterized in that, Includes the following steps: (1) Extract patient data diagnosed with heart failure from the public dataset MIMIC-III, and preprocess the data to extract the required information; (2) Use the Biscaler tool in Fancyimpute to fill in missing values ​​in the extracted data; (3) Use Bi-LSTM to train the amended data to learn the patient’s temporal information; (4) Learning the importance of different variables in each patient visit based on attention mechanisms; (5) Use the contrastive loss function as the training loss function to solve the data imbalance problem and realize the prediction of adverse events in patients with heart failure; The implementation process of step (3) is as follows: By combining the patient's demographic information, diagnostic information, medication information, surgical information, ICU stay information, and laboratory test results, a 66-dimensional information matrix x is generated. i ; By utilizing a calibrated linear unit and a linear mapping function to obtain the access representation, patient information is embedded as a low-dimensional vector representation v. i The calculation formula is as follows: v i =ReLU(W v x i +b c ) Among them, W v ∈R m×L It is a weight matrix that can rank the importance of each medical code, where m is the embedding vector v. i Size; Using each patient's visit information as input, Bi-LSTM is used to learn the patient's time-series information. Each feedforward LSTM unit has a storage unit state S. i It is controlled by three Sigmoid gates: the forget gate F i Input gate i and output gate O i Forgot the door F i It is used to determine which memory cell S should be used. i Which information is discarded during input, and what information is used for input gate? i It is used to determine which information will be stored; Output gate O i This will determine the output battery state S i Information; the hidden state of the forward LSTM unit through these three gates. The calculation formula is as follows: F i =σ(W f [h i-1 ;v i ]+b f ) I i =σ(W i [h i-1 ;v i ]+b i ) The i =σ(W o [h i-1 ;v i ]+b o ) Among them, [h i-1 ;v i ]∈R q+m It is the previous hidden state h i-1 and the current access embedding vector v i The connection is q represents each hidden state h. i The dimension of W f W i W o W s ∈R q×(q+m) For the weight matrix to be learned, b f ,b i ,b o ,b s ∈R q Let σ be the bias vector, and σ be the logistic sigmoid function. This represents an element-wise multiplication operation, which similarly yields the hidden state of a backward LSTM unit. Then, the hidden state h of a Bi-LSTM cell is obtained. i The calculation formula is as follows: The implementation process of step (4) is as follows: A location-based attention mechanism is used to derive a context vector C. t : Among them, h i Let α represent the hidden state during the i-th visit. ti From the current hidden state h i A vector that captures the weights; α ti Calculated using the following formula: a ti =W α h i +b α a t =softmax([a t1 ,a t2 ,…,a t(t-1) ]) Among them, W α ∈R q and b α ∈R are the parameters to be learned, representing the weights and biases, respectively; By aggregating temporal information and patient visit pattern information through attention mechanisms and Bi-LSTM, the patient's final representation is obtained. The calculation formula is as follows: The implementation process of step (5) is as follows: The final patient representation vector is fed into the contrastive loss function, which divides patients into two classes. The loss function is as follows: in, The Euclidean distance between two sample features X1 and X2 is represented by P, which represents the feature dimension of the sample. Y is the label indicating whether the two samples match, where Y=1 means the two samples are similar or match, and Y=0 means they do not match. m is the set threshold, and N is the number of samples.

2. The method for predicting adverse events in heart failure based on a time-series model according to claim 1, characterized in that, The process of preprocessing the data to extract the required information in step (1) is as follows: Extract demographic information, laboratory test results, medication use, surgery, and ICU stay duration and frequency that are closely related to heart failure; By introducing major disease categories, surgeries, and extracting only the most relevant laboratory tests, relevant disease information, medication information, and surgical information can be extracted. Based on the patient's ICD9 code, the patient's major disease category is assigned a value of 1, forming a 66-dimensional user information.

3. A time-series model-based adverse event prediction system for heart failure using the method described in any one of claims 1 to 2, characterized in that, include: The information extraction module collects a dataset of heart failure patients from the MIMIC-III dataset, preprocesses the data, and extracts the patients' demographic information, laboratory test information, related disease information, medication information, surgical information, and ICU stay information. The information completion module uses the Biscaler tool in Fancyimpute to complete the missing values ​​of the extracted heart failure patient information. The adverse event prediction module for heart failure patients uses Bi-LSTM to train and learn the temporal information of patients by supplementing good data; it uses an attention mechanism to learn the importance of different variables in each patient visit; and it uses a contrastive loss function as the training loss function to solve the data imbalance problem and achieve the prediction of adverse events for heart failure patients.

Citation Information

Patent Citations

  • Prediction device for adverse cardiovascular event based on attention mechanism

    CN109493933A

  • Diagnosis prediction method of bidirectional recurrent neural network based on attention

    CN109887606A