Cardiovascular disease prediction model interpretable method based on SHAP

By using SHAP algorithm and multi-source data analysis in the cardiovascular disease prediction model, the problem of insufficient interpretability of the existing model is solved, the transparency and credibility of the model are improved, and more targeted treatment plans are provided.

CN119811643AInactive Publication Date: 2025-04-11李锦涛
View PDF 0 Cites 5 Cited by

Patent Information

Application Number
CN202411894992.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-21
Publication Date
2025-04-11
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing machine learning models have insufficient interpretability in cardiovascular disease prediction, resulting in a lack of trust from clinicians.

Method used

Using a cardiovascular disease prediction model based on SHAP, by obtaining multi-source medical data, combining Boruta algorithm, XGBoost algorithm and SHAP value analysis, important feature variables were selected, the impact of each feature on the prediction results was quantified and visualized, and the interaction effects between features were explored.

Benefits of technology

It improves the transparency and credibility of cardiovascular disease prediction models, helps clinicians understand the impact of different factors on patients' cardiovascular health, provides more targeted treatment options, and promotes early diagnosis and risk assessment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119811643A_ABST
    Figure CN119811643A_ABST
Patent Text Reader

Abstract

The invention discloses an explainable method of a cardiovascular disease prediction model based on SHAP, and aims to construct an accurate cardiovascular disease prediction model and provide explainable analysis by combining multi-source medical data. The method comprises the following steps: acquiring medical data related to cardiovascular diseases, performing data preprocessing and feature engineering coding, and establishing a cardiovascular disease data set; carrying out importance evaluation on the features by using a Boruta algorithm, screening out features which play an important role in cardiovascular disease prediction in combination with a random forest, and completing the division of a training set and a test set; adopting a grid search algorithm to adjust and optimize hyper-parameters, and optimizing the performance of the model; training the training set data by using an XGBoost algorithm, establishing a cardiovascular disease prediction model, and outputting feature importance; and inputting the data set into the trained model, outputting a prediction result of each patient, visualizing the prediction results by using an SHAP interpretation tool, and analyzing the interaction effect of characteristic variables and the contribution of a single characteristic. According to the technical method, accurate prediction and analysis support can be provided for clinic, doctors are helped to formulate effective prevention measures, and therefore the early diagnosis and treatment effect of cardiovascular diseases is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of medical data analysis and disease prediction, and more specifically, relates to an interpretable method for a cardiovascular disease prediction model based on SHAP, aiming to improve the accuracy and interpretability of cardiovascular disease prediction through machine learning and interpretability analysis. Technical Background

[0002] Cardiovascular disease (CVD) is one of the major health threats in the world. Early and effective prediction and preventive measures can significantly reduce its morbidity and mortality. With the development of big data technology, more and more medical data are being used to predict cardiovascular disease. However, existing machine learning methods have a "black box" problem in disease prediction, that is, they cannot provide sufficient explanatory power, which makes clinicians lack sufficient trust when using these models. To overcome this problem, methods based on explanatory artificial intelligence (XAI), especially the SHAP (Shapley Additive Explanations) algorithm, have become important tools for explaining model outputs. SHAP can provide a transparent and understandable explanation for the prediction results of each patient by quantifying the contribution of each feature to the model's prediction results. Based on this, the cardiovascular disease prediction model combined with the SHAP algorithm can help doctors understand the impact of different features on disease prediction, thereby improving the credibility of diagnosis and treatment decisions. Summary of the invention

[0003] The problem to be solved by the present invention is to overcome the problem of insufficient interpretability of machine learning models in the prior art, and to provide an interpretable method for a cardiovascular disease prediction model combined with the SHAP algorithm, which can quantify and visualize the impact of each feature variable on the cardiovascular disease prediction results, and explore the interaction effects between features to improve the transparency and credibility of the model.

[0004] In order to solve the above technical problems, at least according to one aspect of the present invention, an interpretable method for a cardiovascular disease prediction model based on SHAP is provided, comprising the following steps:

[0005] S1. Obtain medical data related to cardiovascular diseases, perform joint preprocessing and feature engineering coding for multi-source medical data, and establish a cardiovascular disease mining and analysis data set. The medical data includes the patient's basic information, disease history, lifestyle, physical sign data, etc. These multi-source data are jointly preprocessed. First, data cleaning is performed to deal with missing values, outliers, and noise data; then standardization and normalization techniques are applied to process numerical features to ensure that different feature scales are consistent; for categorical data, unique hot encoding and label encoding and other techniques are used for feature conversion, and finally a complete cardiovascular disease data set D is constructed to provide a basis for subsequent analysis.

[0006] S2. Evaluate the importance of data features using the Boruta algorithm, build a feature selection model using random forests, screen out the most important variables for cardiovascular disease prediction, retain features with strong correlation with the target variable, and finally divide the training set and test set. The Boruta algorithm evaluates feature importance by introducing shadow variables, compares each feature with the shadow variable, retains features with significantly higher feature importance than the shadow variable, and quantifies the importance of features using the Gini index in random forests (Formula 1), and ensures that the final retained feature set has good predictive ability. Divide the data set into a training set and a test set, where the training set is used for model training and the test set is used for model evaluation.

[0007]

[0008] Among them, ΔGini t (j) represents the reduction of Gini impurity caused by feature j in the t-th tree, and T is the total number of trees in the random forest.

[0009] S3. Use the grid search algorithm principle to debug the hyperparameters (Formula 2) to obtain a relatively optimal algorithm hyperparameter combination. Grid search comprehensively searches every possible combination of hyperparameters, evaluates the model performance of each combination, and finally selects the hyperparameter combination with the best performance. This process calculates the performance indicators of the classification model, selects the optimal parameter combination, and uses it for subsequent model training. The grid search method can effectively improve the accuracy of the model and avoid the tedious process of manually debugging hyperparameters.

[0010]

[0011] Here, f(x) is usually the classification error or mean square error.

[0012] S4. Use the XGBoost algorithm to train the training set data and build a cardiovascular disease prediction model. The XGBoost model is based on the additive model to accumulate multiple weak classifiers. Formula 3 is the loss function:

[0013]

[0014] y i is the true label, is the predicted value, and K is the number of weak classifiers.

[0015] When building a regression tree, a greedy algorithm is used to calculate the gain of the split point:

[0016]

[0017] Among them, G L , G RRespectively represent the gradient sum of the left and right child nodes after splitting, H L , are the corresponding second-order derivatives and, λ,γ are regularization parameters.

[0018] The trained cardiovascular disease prediction model is applied to the cardiovascular disease prediction and analysis dataset to output the prediction results for each patient. The SHAP interpretation tool is used to transform the model output results, calculate and visualize the SHAP value, so as to reveal the contribution of each feature variable to the prediction results. The calculation formula of the SHAP value is 5:

[0019]

[0020] Where N represents the full set of features, S represents the feature subset, and f(S) represents the model prediction value of subset S;

[0021] The calculation formula of the interaction effect SHAP is 6:

[0022]

[0023] Among them, φ i,j Represents the interaction effect value between feature i and feature j.

[0024] According to another aspect of the present invention, there is provided a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, can implement the steps in the interpretable method of the SHAP-based cardiovascular disease prediction model as described in any one of claims 1 to 5.

[0025] According to another aspect of the present invention, there is provided a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps in the interpretable method of the SHAP-based cardiovascular disease prediction model as described in any one of claims 1 to 5 can be implemented.

[0026] Compared with the prior art, the present invention has at least the following beneficial effects:

[0027] The interpretable method of the cardiovascular disease prediction model based on SHAP of the present invention establishes an efficient and interpretable cardiovascular disease prediction model by acquiring multi-source medical data and combining the Boruta algorithm, XGBoost algorithm and SHAP value analysis. This method quantifies the impact of each feature on the prediction results by screening out the characteristic variables most relevant to the risk of cardiovascular disease, and deeply explores the interaction effect between the features. Through the visual analysis of the SHAP value, the contribution of each feature in the individual prediction results can be clearly displayed, helping clinicians understand the impact of different factors on the patient's cardiovascular health. This method not only improves the accuracy and transparency of the cardiovascular disease prediction model, but also provides patients with more targeted treatment options, helps early diagnosis and risk assessment, and provides a scientific basis for public health management and personalized medicine.

[0028] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings of the embodiments will be briefly introduced below. Obviously, the drawings in the following description only relate to some embodiments of the present invention, but are not intended to limit the present invention.

[0029] Figure 1 A flow chart of the method of the present invention is shown. Specific implementation steps

[0031] To make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the embodiments of the present invention will be described clearly and completely in conjunction with the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them.

[0032] Unless otherwise defined, technical or scientific terms used herein shall have the same meaning as commonly understood by one of ordinary skill in the art to which the invention belongs.

[0033] Embodiment 1:

[0034] An interpretable approach to cardiovascular disease prediction models based on SHAP, such as Figure 1 As shown, the following steps are included:

[0035] S1. Data collection related to cardiovascular disease: collect multi-source health data D1 from hospitals, health examination centers and public health data. From January 2015 to December 2023, health data of more than 5,000 patients were collected, including basic information such as age, gender, weight, eating habits, and exercise. Further data D2 on lifestyle, genetic factors and clinical examinations related to cardiovascular disease were collected. Combined with indicators such as blood pressure, blood sugar, and blood lipids, a cardiovascular disease analysis data set D3 was established. These multi-source data were jointly processed, and data fusion was performed using patient ID to ensure data integrity and accuracy. Data set D3 was preprocessed to fill in missing values, remove outliers, and perform standardization to ensure the stability of model training.

[0035] S2. The importance of data features was evaluated using the Boruta algorithm, and a feature selection model was constructed using random forest to screen out the most important variables for predicting cardiovascular diseases, such as resting blood pressure, serum cholesterol, maximum heart rate, exercise-induced angina, etc., and the training set and test set were divided into two sets at a ratio of 0.8.

[0037] S3. Use the grid search algorithm principle to debug the hyperparameters and obtain a relatively optimal algorithm hyperparameter combination {'learning_rate':0.05,'max_depth':5,'n_estimators':100}

[0038] S4. Use the XGBoost algorithm to train the training set data, determine the heart disease prediction model based on evaluation indicators such as accuracy, and output the feature importance; the logarithmic loss of the evaluation indicator of the model output result is 0.4072775835, and the obtained feature importance is: cp (0.68), thalamus (0.67), ca (0.55)..., fbs (0.01)

[0039] The cardiovascular disease prediction and analysis dataset was input into the trained classification model, and the cardiovascular disease prediction results for each patient were output. The SHAP interpretation tool was used to convert the output results of the classification model into SHAP values ​​for visual analysis, and to explore the interaction effects between feature variables and the contribution of a single feature to the model prediction results under independent action.

[0040] The feature importance results of the output of the cardiovascular disease prediction model based on SHAP show that factors such as age, gender, body mass index (BMI), blood pressure, cholesterol level, blood sugar, electrocardiogram indicators, and lifestyle habits are key features that affect the prediction of cardiovascular disease. Patients with higher BMI values ​​show a higher risk of cardiovascular disease, especially obese patients, whose predicted SHAP values ​​of cardiovascular disease are positive, indicating that BMI has a significant positive effect on the output of the prediction model. Age is one of the most important features affecting the prediction of cardiovascular disease. Elderly patients have a higher risk of cardiovascular disease, and older patients have a positive SHAP value for the predicted results of cardiovascular disease. Gender also plays an important role. Male patients have a higher risk of cardiovascular disease prediction. Blood pressure and cholesterol levels are important factors affecting high-risk cardiovascular disease, especially patients with hypertension, with higher SHAP values, indicating that hypertension has a significant negative impact in the cardiovascular disease prediction model.

[0041] The results of the characteristic interaction effects output by the SHAP-based cardiovascular disease prediction model show that there is a positive correlation between BMI and blood sugar, and the increase in blood sugar levels will lead to a stronger effect of BMI on the prediction results of cardiovascular disease. The interaction effect between hypertension and cholesterol levels shows that the combination of these two will increase the predicted risk of cardiovascular disease, especially when the blood pressure is high and the cholesterol level is abnormal, the predicted value shows a significant increase. The interaction effect between gender and age also shows a significant impact, especially for older men, whose predicted risk of cardiovascular disease is higher than other groups. Lifestyle habits, such as the interaction effect of smoking and drinking, also have an impact on the model output results. Patients who smoke and drink show a higher risk of cardiovascular disease, especially in the middle-aged and elderly groups. Environmental and socioeconomic factors, such as the interaction effect of socioeconomic status and medical conditions, have a certain regulatory effect on the prediction model of cardiovascular disease.

[0042] Embodiment 2:

[0043] The computer-readable storage medium of this embodiment stores a computer program thereon, and when the program is executed by a processor, the steps in the interpretable method of the SHAP-based cardiovascular disease prediction model of Example 1 are implemented.

[0045] The computer-readable storage medium of this embodiment may be an internal storage unit of the terminal, such as a hard disk or memory of the terminal; the computer-readable storage medium of this embodiment may also be an external storage device of the terminal, such as a plug-in hard disk, a smart memory card, a secure digital card, a flash memory card, etc. equipped on the terminal; further, the computer-readable storage medium may also include both an internal storage unit of the terminal and an external storage device.

[0046] The computer-readable storage medium of this embodiment is used to store computer programs and other programs and data required by the terminal. The computer-readable storage medium can also be used to temporarily store data that has been output or is to be output.

[0047] Embodiment 3:

[0048] The computer device of this embodiment includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the steps in the interpretable method of the SHAP-based cardiovascular disease prediction model of Example 1 are implemented.

[0049] In this embodiment, the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors, application-specific integrated circuits (ASICs), field programmable gate arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc. The memory may include a read-only memory (ROM) and a random access memory (RAM), and provide instructions and data to the processor. A portion of the memory may also include a non-volatile random access memory (NVRAM). For example, the memory may also store information about the device type.

[0050] Those skilled in the art will appreciate that the disclosed content of the embodiments may be provided as methods, systems, or computer program products. Therefore, the present solution may adopt the form of hardware embodiments, software embodiments, or embodiments combining software and hardware. Moreover, the present solution may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) containing computer-usable program codes.

[0051] The present solution is described with reference to the flowchart and / or block diagram of the method and computer program product according to the embodiment of the present solution. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions; these computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0052] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0053] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0054] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing related hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.

[0055] The examples described in the present invention are merely descriptions of the preferred implementation modes of the present invention, and are not intended to limit the concept and scope of the present invention. Without departing from the design concept of the present invention, various modifications and improvements made to the technical solutions of the present invention by engineers and technicians in this field should all fall within the protection scope of the present invention.

Claims

1. An interpretable method for the SHAP-based cardiovascular disease prediction model, characterized in that: The steps include: S1. Obtain medical data related to cardiovascular diseases, perform preprocessing and feature engineering coding on multi-source medical data, and establish a cardiovascular disease mining and analysis dataset; S2. Evaluate the importance of data features using the Boruta algorithm, build a feature selection model using random forest, screen out the most important variables for cardiovascular disease prediction, retain features with strong correlation with the target variable, and finally divide the training set and test set; S3. Use the grid search algorithm principle to debug hyperparameters and obtain relatively optimal algorithm hyperparameter combinations; S4. Use the XGBoost algorithm to train the training set data, determine the heart disease prediction model based on evaluation indicators such as accuracy, and output feature importance; S5. Input the cardiovascular disease prediction and analysis dataset into the trained classification model, output the cardiovascular disease prediction results for each patient, use the SHAP interpretation tool to convert the output results of the classification model into SHAP values ​​for visual analysis, and explore the interaction effects between feature variables and the contribution of a single feature to the model prediction results under independent action.

2. The method according to claim 1, characterized in that The feature importance screening of the Boruta algorithm in step S2 includes the following calculation process: Shadow variables are introduced into the training data set, and the importance of feature variables and shadow variables is compared. Features with significantly higher feature importance than shadow variables are retained. At the same time, the Gini index in the random forest model is used to quantitatively evaluate the feature importance. The specific calculation formula is as follows: Among them, ΔGini t (j) represents the reduction in Gini purity caused by feature j in the tth tree, and T is the total number of trees in the random forest.

3. The method according to claim 1, characterized in that The implementation of the grid search algorithm in step S3 is as follows: By setting the hyperparameter search range {x1, x2, ..., x n }, for each set of hyperparameter combinations (x1, ..., x n ) Calculate the performance index f(x) of the classification model to obtain the parameter combination with the best performance Here, f(x) is usually the classification error or mean square error.

4. The method according to claim 1, characterized in that The training process of the XGBoost model in step S4 includes the following steps: Based on the additive model, the weak classifiers are accumulated and the loss function L and the regularization term Ω are defined: Among them, y i is the true label, is the predicted value, K is the number of weak classifiers; Use the greedy algorithm to construct the regression tree and calculate the gain of the split point: Among them, G L , G R Respectively represent the gradient sum of the left and right child nodes after splitting, H L , are the corresponding second-order derivatives and, λ,γ are regularization parameters.

5. The method according to claim 1, characterized in that The calculation formula of the SHAP explanation tool in step S5 is as follows: SHAP value of a single eigenvalue: Where N represents the full set of features, S represents the feature subset, and f(S) represents the model prediction value of subset S; SHAP value of interaction effect: Among them, φ i,j Represents the interaction effect value between feature i and feature j.

6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps in the interpretable method of the SHAP-based cardiovascular disease prediction model as described in any one of claims 1 to 5 are implemented.

7. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps in the interpretable method of the SHAP-based cardiovascular disease prediction model according to any one of claims 1 to 5 are implemented.

Citation Information

Cited By

  • Interpretable visualization method and system based on chronic disease dynamic prediction

    CN120108739A

  • Liver function prediction method and device, electronic equipment and medium

    CN120473187A

  • Multi-dimensional slow tracking performance analysis method and device, equipment and storage medium

    CN120632661A

  • Dynamic prognosis evaluation AI modeling method for explaining RA treatment effect by SHAP value

    CN121617650A

  • Shap value explains the ra treatment efficacy dynamic prognosis evaluation ai modeling method

    CN121617650B