Associated interaction-based interpretable heart disease risk early warning method
By adopting the association interaction method in the heart disease risk warning model, the feature mining and screening of association rules is carried out, and combining Bayesian optimization and SHAP model, the problems of low prediction accuracy and insufficient interpretability on small-scale data sets are solved, and a more robust and interpretable heart disease risk warning model is achieved.
Patent Information
- Application Number
- CN202510181084.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-19
- Publication Date
- 2025-04-29
AI Technical Summary
The existing cardiac risk warning model has low prediction accuracy and insufficient interpretability on small-scale data sets, making it difficult to promote in clinical applications.
An interpretable heart disease risk warning method based on association interaction was adopted, and the cardiac disease data set disclosed by Kaggle was obtained for preprocessing, correlation rule feature mining and feature selection were performed, risk warning was performed using Bayesian-optimized random forest classifier based on TPE process, and the contribution degree and interaction of key influencing factors were analyzed through the SHAP model.
It improves the robustness and interpretability of the heart disease risk warning model, alleviates the challenge of learning related information in small-scale data sets, reduces the redundancy between the characteristics of the association rule, and enhances the generalization ability of the model.
Smart Images

Figure CN119905275A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to an interpretable heart disease risk early warning method based on association interaction. Background Art
[0002] Heart disease remains the leading cause of death worldwide, and the application of data mining technology to develop heart disease risk warning models is an emerging trend. However, improving the prediction accuracy of heart disease risk warning models on small-scale datasets remains a challenge. In addition, most existing heart disease risk warning models have limitations in their interpretability, making them difficult to promote in clinical applications.
[0003] In the issue of heart disease risk warning, the prediction model aims to establish a robust and efficient heart disease risk warning model based on the cardiovascular disease-related indicators of potential patients for early risk identification and intervention. At present, heart disease risk warning models are mainly divided into heart disease risk warning models based on ECG signals and heart disease risk warning models based on influencing factors. The ECG signal-based warning model uses image processing technology to mine high-order features from the patient's ECG for prediction. However, the samples required for this type of warning model are difficult to obtain, costly, and slow to collect.
[0004] The descriptive model aims to reveal the contribution and interaction of relevant influencing factors to the risk of heart disease, and provide interpretable analysis for the early warning model. Existing interpretability analysis methods are mainly divided into three methods: intrinsic interpretability, ex post interpretability, and model interpretation visualization. The intrinsic interpretability method refers to the results of the evaluation of influencing factors given by the prediction model during the training process, such as the regression coefficient of logistic regression. Although this method can express positive and negative correlations and the degree of influence through the sign and size of the coefficient, it is difficult to capture complex nonlinear relationships, which limits the application scenarios of this type of method. Ex post interpretability methods refer to methods that help explain complex models after the model prediction task, such as the feature importance method based on the tree structure, which quantifies the degree of influence through the information gain or impurity reduction calculated during feature segmentation, but this type of method can only provide a global explanation for the model and cannot analyze the relationship between a single feature and the sample distribution. The SHAP model is an emerging interpretable method that provides global, local and interactive explanations for the model by calculating the Shapley value of each sample. However, few studies have previously analyzed the interactive explanation of factors affecting the risk of heart disease. The model interpretation visualization method refers to directly analyzing the importance of influencing factors through visualizations such as partial dependency plots to show the degree of influence of the value of a specific feature on the model prediction. However, this method is based on the assumption that features are independent of each other, which makes it difficult to observe the interactive correlation between different features, making it difficult to implement in the field of heart disease risk interpretation.
[0005] To address the above issues, an interpretable heart disease risk warning method based on correlation interaction is provided. Summary of the invention
[0006] The purpose of the present invention is to overcome the existing defects and provide an interpretable heart disease risk warning method based on association interaction, which can effectively select meaningful association rule features and enhance the robustness of the final heart disease risk warning model.
[0007] The technical solution to achieve the above purpose is: An interpretable heart disease risk early warning method based on association interaction, including: Step S1, obtaining the heart disease dataset publicly available on Kaggle and preprocessing it; Step S2, performing association rule feature mining and feature selection respectively according to whether there are two categories of heart disease risk; Step S3, using the random forest classifier optimized by Bayesian optimization based on the TPE process for risk warning, and further calibrating the prediction results using rank-preserving regression; Step S4, using the SHAP (machine learning model explanation visualization tool) model to analyze the contribution of key influencing factors and their interactions on the risk of heart disease.
[0008] Preferably, in step S1, the heart disease dataset disclosed by Kaggle (dataset platform) includes five public sub-datasets: Cleveland, Hungarian, Switzerland, Long Beach VA and Stalog; In the step S1, the continuous features of the heart disease data set are preprocessed by equal-width binning.
[0009] Preferably, in step S2, the two categories are: those with heart disease risk and those without heart disease risk, and association rule feature mining and feature selection are performed respectively, including: Use Aprior algorithm to mine association rules and construct binary variables as association rule features; Next, the SuSIE model is used to screen the association rule features.
[0010] Preferably, in step S2, association rule mining belongs to an unsupervised learning algorithm in machine learning, and an association rule can be defined as follows: ; In the formula, represents the antecedent of the association rule, represents the subsequent term of the association rule, Represents an item set; The goal of association rule mining is to find Under the premise that there are item sets in the , a certain strength threshold can be met to predict the next item The rules for the occurrence of middle itemsets; In association rule mining, three indicators, support, confidence, and lift, are often used to evaluate the strength and relevance of these rules, namely: Support is defined as the number of items in the dataset that contain both the antecedents. and the latter The ratio is expressed as follows: ; In the formula, Indicates that it also includes the preceding item and the latter The number of Represents the total number of itemsets in the data set; Confidence is defined as the antecedent Under the premise of existence, the latter The proportion of occurrence is expressed as follows: ; The lift is defined as the latter term The appearance of The degree of improvement is expressed as follows: ; If the lift is greater than 1, it means that the previous and the latter Positive correlation, less than 1 means the former and the latter Negative correlation.
[0011] Preferably, in step S2, the SuSIE (sum of single effects regression) model is based on the SER (single effect regression) model, assuming that the SuSIE model is a multiple regression model, Only one of the explanatory variables has a non-zero regression coefficient, namely the effect variable. In the SER model, it is assumed that the residual variance , the prior variance of the effect variable and the prior inclusion probability , the SER model can be defined as follows: ; ; ; ; ; In the formula, yes dimensional target variable, express Samples The exogenous variable matrix of dimensions, represents the coefficient of the effect variable, express The indicator variable of the dimension is used to indicate the Whether a variable is an effect variable, express dimensional regression coefficient vector, represents the error vector, The class probability is Multinomial distribution of ; level The credible set is defined as the set containing at least one effect variable with a probability of at least The posterior inclusion probability is used in Bayesian regression variable selection. To express the probability of each variable being selected in the credible set, as shown below: ; In a given and After that, the posterior inclusion probability vector can be derived from the single effect regression ,in The calculation method is as follows: ; Based on the above SER model and the credible set principle, multiple single effect vectors are introduced , and the overall effect vector Constructed as the sum of these single effects, SuSIE: ; ; ; ; ; ; In the formula, To select feature parameters.
[0012] Preferably, in step S3, the core idea of random forest is to use a group of decision trees to train and predict the input data; the results of all trees are aggregated to make the final prediction, and each decision tree These are all bootstrap samples extracted from the original data set. The training is done on , and at each node, a subset of features is randomly selected to partition the data, thus introducing variability between trees; For a given input The prediction of is obtained by aggregating the predictions of all decision trees in the forest. For classification tasks, the final prediction result is determined by majority voting, which can be expressed as follows: ; In the formula, Indicates input No. The prediction of a decision tree, is the total number of trees in the forest, and in majority voting, the predicted class is the class that received the most votes in all trees.
[0013] Preferably, in step S3, the Bayesian optimization algorithm based on the TPE process performs hyperparameter optimization on the random forest classifier, including: Each hyperparameter is set to follow a Gaussian distribution with mean 0 and then sampled from this distribution; Random sampling Group Hyperparameters , and calculate the corresponding model true loss when applying these hyperparameters ; Set the TPE (Tree-based Bayesian Optimization) process to the surrogate function fitting ,right Divide as follows: ; ; According to this division, we can get: ; for Selection, setting hyperparameters To express The quantile of , so the above formula is simplified as follows: ; The EI (expected improvement) function is selected as the acquisition function to evaluate the acquisition points. The EI function represents the average improvement relative to a given threshold; For the collection point set Each collection point in calculate , and select the best one from the collection points Substitute the model to calculate the actual loss , the formula of the EI function is as follows: ; The value of the EI function is inversely proportional to its denominator, and the size of the denominator depends on the ratio , so the best collection point is the point that maximizes this ratio; Will Add to collection Form a new , and repeat the above steps until the maximum number of iterations is reached to complete the hyperparameter optimization of the random forest classifier.
[0014] Preferably, in step S3, rank-preserving regression is a technique for fitting a free-form line to a series of observations, so that the fitted line is monotonic at any position and as close as possible to the observations; The established rank-preserving regression model is solved using the PAV algorithm. This method has only one constraint, that is, the function space is a monotonically increasing function space. The main steps are as follows: Assume that each observed variable Follows a normal distribution , and when Time Satisfaction ; Using the previous step as a monotonicity constraint, identify the points that violate the constraint and form a monotonic sequence with their neighboring points. Assuming that the points in this range follow the same distribution, when When, order Points within the range satisfy the normal distribution ; If the newly constructed distribution violates the monotonicity constraint in subsequent comparisons, such as In the case of Points within the range will satisfy ; Repeat the above steps until the distribution stabilizes and no longer violates the monotonicity constraint, thereby completing further calibration of the prediction results.
[0015] Preferably, in step S4, the SHAP model is Will Map to , to create a simplified input; based on , original model A linear function that can be approximated as a binary variable is as follows: ; In the formula, , is the number of input features, , Represents the contribution value of the feature, which is calculated as follows: ; ; In the formula, yes The non-zero set of inputs in , yes Exclude A subset of features, is a unified measure of additive feature attributes, namely the SHAP value, Represents the output probability of the prediction model.
[0016] The beneficial effects of the present invention are: The present invention constructs association rule features for whether there are two categories of heart disease risk, and enriches the data set by mining the associated interactive information. This method alleviates the challenge that traditional models are difficult to learn relevant information from small-scale heart disease data sets; The present invention uses the SuSIE algorithm to screen association rule features. Compared with the traditional feature screening method, the algorithm can make the best selection from multiple highly correlated association rule features through a credible set to reduce the redundancy between association rule features and effectively alleviate overfitting. The present invention uses a random forest classifier tuned by the TPE process to predict risk, and uses rank-preserving regression to calibrate the prediction results to enhance the robustness of the final heart disease risk warning model; The present invention uses the SHAP model to perform interpretability analysis on the heart disease risk warning model, and explores the contribution degree of key influencing factors to heart disease risk and the size and direction of their interaction. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 It is a flow chart of an interpretable heart disease risk early warning method based on association interaction of the present invention; Figure 2 It is an overall framework diagram of the interpretable heart disease risk warning model in the present invention; Figure 3 It is a schematic diagram of the ROC curve of the original method on the data set; Figure 4 It is a schematic diagram of the ROC curve of the method proposed in the present invention on the data set; Figure 5 This is a diagram of the confusion matrix of the original method on the dataset; Figure 6 It is a schematic diagram of the confusion matrix of the method proposed in the present invention on the data set; Figure 7 It is a SHAP summary diagram drawn by the SHAP model based on random forest in the present invention; Figure 8It is a SHAP bee colony diagram drawn by the SHAP model based on random forest in the present invention; Fig. 9 is the interactive dependency graph of ST_Slope on Cholesterol, Oldpeak and MaxHR in the present invention; Fig.10 is the interactive dependency graph of Cholesterol on ST_Slope, Oldpeak and MaxHR in the present invention; Fig.11 is the interaction dependency graph of Oldpeak on ST_Slope, Cholesterol and MaxHR in the present invention; Fig.12 It is the interactive SHAP dependency graph of MaxHR on ST_Slope, Cholesterol and Oldpeak in the present invention. DETAILED DESCRIPTION
[0018] The technical solution of the present invention will be described clearly and completely below in conjunction with the accompanying drawings. In the description of the present invention, it should be noted that the terms "center", "up", "down", "left", "right", "vertical", "horizontal", "inside", "outside" and the like indicate directions or positional relationships based on the directions or positional relationships shown in the accompanying drawings, which are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific direction, be constructed and operated in a specific direction, and therefore cannot be understood as a limitation on the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance.
[0019] The present invention will be further described below in conjunction with the accompanying drawings.
[0020] like Figure 1 As shown in Figure 1, an interpretable heart disease risk warning method based on association interaction is divided into three stages, namely, feature engineering stage, association rule feature mining and feature screening stage, risk warning and interpretability analysis stage. The overall architecture of the model is shown in Figure 1. Figure 2 As shown, including: Feature engineering stage: Step S1, obtain the heart disease dataset publicly available on Kaggle and preprocess it.
[0021] In the embodiment, the heart disease dataset disclosed by Kaggle includes five public sub-datasets: Cleveland, Hungarian, Switzerland, Long Beach VA, and Stalog.
[0022] In the embodiment, equal-width binning preprocessing is performed on the continuous features of the heart disease dataset.
[0023] Association rule feature mining and feature screening stage: Step S2, performing association rule feature mining and feature selection respectively based on whether there are two categories of heart disease risks.
[0024] In the embodiment, the two categories are: those with heart disease risk and those without heart disease risk, and association rule feature mining and feature selection are performed respectively, including: Use Aprior algorithm to mine association rules and construct binary variables as association rule features; Next, the SuSIE model is used to screen the association rule features.
[0025] In the embodiment, association rule mining belongs to an unsupervised learning algorithm in machine learning, which reveals the correlation between data based on support and confidence. Association rule mining can not only be used to explain the relationship between the antecedent and the consequent, but also to perform feature engineering on the data set by constructing binary variables to enhance the information content of the heart disease data set. An association rule can be defined as follows: ; In the formula, represents the antecedent of the association rule, represents the subsequent term of the association rule, Represents an item set; The goal of association rule mining is to find Under the premise that there are item sets in the , a certain strength threshold can be met to predict the next item The rules for the occurrence of middle itemsets; In association rule mining, three indicators, support, confidence, and lift, are often used to evaluate the strength and relevance of these rules, namely: Support is defined as the number of items in the dataset that contain the preceding item. and the latter The ratio is expressed as follows: ; In the formula, Indicates that it also includes the preceding item and the latter The number of Represents the total number of itemsets in the data set; Confidence is defined as the antecedent Under the premise of existence, the latter The proportion of occurrence is expressed as follows: ; The lift is defined as the latter term The appearance of The degree of improvement is expressed as follows: ; If the lift is greater than 1, it means that the previous and the latter Positive correlation, less than 1 means the former and the latter Negative correlation.
[0026] The present invention uses the Apriori algorithm to mine association rules for whether there are two types of samples of heart disease risk from the data set after equal-width binning, and uses support and confidence indicators to evaluate the importance and strength of the extracted rules, and retains the rules that meet the predefined support and confidence thresholds. Finally, different binary variables, namely association rule features, are constructed for whether there are two types of association rules for heart disease risk.
[0027] In the embodiment, the SuSIE model is based on the SER model. Assume that the SuSIE model is a multiple regression model. Only one of the explanatory variables has a non-zero regression coefficient, namely the effect variable. In the SER model, it is assumed that the residual variance , the prior variance of the effect variable and the prior inclusion probability , the SER model can be defined as follows: ; ; ; ; ; In the formula, yes dimensional target variable, express Samples The exogenous variable matrix of dimensions, represents the coefficient of the effect variable, express The indicator variable of the dimension is used to indicate the Whether a variable is an effect variable, express dimensional regression coefficient vector, represents the error vector, The class probability is Multinomial distribution of ; level The credible set is defined as the set containing at least one effect variable with a probability of at least The posterior inclusion probability is used in Bayesian regression variable selection. To express the probability of each variable being selected in the credible set, as shown below: ; In a given and After that, the posterior inclusion probability vector can be derived from the single effect regression ,in The calculation method is as follows: ; Based on the above SER model and the credible set principle, multiple single effect vectors are introduced , and the overall effect vector Constructed as the sum of these single effects, SuSIE: ; ; ; ; ; ; In the formula, To select feature parameters, in the present invention, the maximum selected feature parameter is specified is 10.
[0028] Risk warning and explainability analysis stage: In step S3, a random forest classifier based on Bayesian optimization of the TPE process is used for risk warning, and the prediction results are further calibrated using rank-preserving regression.
[0029] In the embodiment, the core idea of random forest is to use a set of decision trees to train and predict the input data; the results of all trees are aggregated to make the final prediction, and each decision tree These are all bootstrap samples extracted from the original data set. The training is done on , and at each node, a subset of features is randomly selected to partition the data, thus introducing variability between trees; For a given input The prediction of is obtained by aggregating the predictions of all decision trees in the forest. For classification tasks, the final prediction result is determined by majority voting, which can be expressed as follows: ; In the formula, Indicates input No. The prediction of a decision tree, is the total number of trees in the forest, and in majority voting, the predicted class is the class that received the most votes in all trees.
[0030] In the present invention, each tree of the constructed random forest is a CART tree, which is characterized by being able to capture the nonlinear relationship between features. The splitting criterion of the constructed CART tree leaf nodes is the Gini coefficient, and the samples are split by calculating the decrease in the impurity of the node, which can better cope with the binary classification task.
[0031] In the embodiment, Bayesian optimization is a method for optimizing the objective function by establishing a probabilistic model that links hyperparameters to performance. By continuously observing the evaluation results of the objective function, the posterior probability distribution is updated to make a more informed choice of the next hyperparameter to be evaluated. Commonly used proxy models in Bayesian optimization include Gaussian processes and TPE processes. The Bayesian optimization algorithm based on the TPE process performs hyperparameter optimization on the random forest classifier, including: Each hyperparameter is set to follow a Gaussian distribution with mean 0 and then sampled from this distribution; Random sampling Group Hyperparameters , and calculate the corresponding model true loss when applying these hyperparameters ; Set the TPE process to the surrogate function fitting ,right Divide as follows: ; ; According to this division, we can get: ; for Selection, setting hyperparameters To express The quantile of , the present invention will The value is set to 0.25, so the above formula is simplified as follows: ; The EI function is selected as the acquisition function to evaluate the acquisition points. The EI function represents the average improvement relative to a given threshold; For the collection point set Each collection point in calculate , and select the best one from the collection points Substitute the model to calculate the actual loss , the formula of the EI function is as follows: ; The value of the EI function is inversely proportional to its denominator, and the size of the denominator depends on the ratio , so the best collection point is the point that maximizes this ratio; Will Add to collection Form a new , and repeat the above steps until the maximum number of iterations is reached to complete the hyperparameter optimization of the random forest classifier.
[0032] In the embodiment, in the traditional classification prediction, the probability of the model output is often easy to deviate from the true probability of the sample category. This deviation between the model output and the actual result will have a significant impact on the early warning of heart disease risk. In order to solve this problem, the present invention uses rank-preserving regression as a post-processing technology. Rank-preserving regression is a technology that fits a free-form line to a series of observations so that the fitted line is monotonic at any position and as close to the observed value as possible.
[0033] The established rank-preserving regression model is solved using the PAV algorithm. This method has only one constraint, that is, the function space is a monotonically increasing function space. The main steps are as follows: Assume that each observed variable Follows a normal distribution , and when Time Satisfaction ; Using the previous step as a monotonicity constraint, identify the points that violate the constraint and form a monotonic sequence with their neighboring points. Assuming that the points in this range follow the same distribution, when When, order Points within the range satisfy the normal distribution ; If the newly constructed distribution violates the monotonicity constraint in subsequent comparisons, such as In the case of Points within the range will satisfy ; Repeat the above steps until the distribution stabilizes and no longer violates the monotonicity constraint, thereby completing further calibration of the prediction results.
[0034] Step S4, analyzing the contribution of key influencing factors and their interactions on the risk of heart disease through the SHAP model.
[0035] In the embodiment, the SHAP model is Will Map to , thereby creating a simplified input; based on , original model A linear function that can be approximated as a binary variable is as follows: ; In the formula, , is the number of input features, , Represents the contribution value of the feature, which is calculated as follows: ; ; In the formula, yes The non-zero set of inputs in , yes Exclude A subset of features, is a unified measure of additive feature attributes, namely the SHAP value, Represents the output probability of the prediction model.
[0036] The five cardiac data sets used in the present invention are Cleveland, Hungarian, Switzerland, Long Beach VA and Stalog, which can all be obtained from the Kaggle platform. There are 11 attributes in the used data sets, and the attribute information is shown in Table 1.
[0037] Table 1 Attribute information of the dataset The data set used in the present invention has a total of 918 non-repetitive samples. In order to verify the effectiveness of the proposed method, 33% of the samples were randomly selected as the test set, and the remaining samples were used as the training set. When optimizing the hyperparameters of the random forest, the TPE process performed a ten-fold cross validation in the training set. The target variable of the data set is heart disease, which is a binary variable. A value of 1 indicates the presence of a heart disease risk, accounting for 55.34%; 0 indicates no heart disease risk, accounting for 44.66%. For age and gender characteristics, they represent the basic information of the patients. In the data set, the age is mainly middle-aged and elderly, and the gender is mainly male. ChestPainType, FastingBS, RestingECG, ExerciseAngina and ST_Slope are discrete variables, and RestingBP, Cholesterol, MaxHR and Oldpeak are continuous variables. These variables contain potential information about the patient's diabetes risk, cardiovascular risk and metabolic function. Most patients in the data set are at risk of early heart disease and mild ischemia.
[0038] The present invention uses various metrics to evaluate the performance of the proposed model in different prediction models. These metrics are used to evaluate the effectiveness of binary classification tasks as described below.
[0039] Accuracy: Accuracy is the ratio of the number of instances correctly predicted by the model to the total number of predictions. It is calculated as the ratio of the total number of true positive and false positive samples to all samples: ; Precision: Precision is the ratio of correctly predicted positive instances to all instances predicted as positive. The accuracy of the class is calculated using the following formula: ; Recall: Recall is the ratio of correctly predicted positive examples to all actual positive examples. The recall of a class is calculated as follows: ; F1-Score: The F1-Score is the harmonic mean of precision and recall. The F1 score is calculated by: ; AUC-ROC: The area under the receiver operating characteristic curve (AUC-ROC) is a performance measure for classification problems. It reveals the trade-off between the true positive rate and the false positive rate and is calculated using the following formula: ; Among them, the true positive rate (TP) refers to the instances correctly predicted as the positive class; the true negative rate (TN) refers to the instances correctly predicted as the negative class; the false positive rate (FP) refers to the instances incorrectly predicted as the positive class; and the false negative rate (FN) refers to the instances incorrectly predicted as the negative class.
[0040] The key to mining association rules is the generation of frequent item sets and the filtering of strong rules. Frequent item sets are defined as item sets that meet the minimum support threshold. Strong rules are defined as rules in frequent item sets that meet the minimum confidence threshold. The present invention mines association rules for two types of samples of heart disease risk, and the support threshold and confidence threshold of the two categories are set to 0.2 and 0.6 respectively.
[0041] In order to meet the data requirements of the Aprior algorithm, the present invention performs equal-width binning on the continuous variables of the data set. The binning results are shown in Table 2.
[0042] Table 2 Binning boundaries of continuous variables The Apriori algorithm was applied to the two categories of whether the risk of heart disease exists, and a total of 50 association rules for the absence of the risk of heart disease and 48 association rules for the presence of the risk of heart disease were obtained. Some association rules obtained from the data set are shown in Tables 3 and 4. Table 3 Association rules for the absence of heart disease risk Table 4 Association rules for the risk of heart disease By constructing binary variables for the above association rules, features with associated interactions can be introduced. However, the number of constructed association rule features is as high as 98, which will cause overfitting in model training, so feature selection is required.
[0043] After mining the association rules, binary variables are constructed, which are called association rule features. For the association rule features indicating that the risk of heart disease does not exist, samples that meet the prerequisite are assigned a value of 1; otherwise, they are assigned a value of 0. For the association rule features indicating that the risk of heart disease does not exist, samples that meet the prerequisite are assigned a value of 3, otherwise they are assigned a value of 2. After processing, the data set used in the present invention consists of three parts: the original features in the data set (hereinafter referred to as influencing factors), the association rule features of the presence of heart disease risk, and the association rule features of the absence of heart disease risk.
[0044] In order to improve the generalization ability of the model and select the features that contribute most to the dependent variable, the present invention uses SuSIE to perform feature screening on the three components of the data set in turn. The selection of influencing factors, association rule features of the absence of heart disease risk, and association rule features of the presence of heart disease risk is shown in Table 5.
[0045] Table 5 Results of selecting three components of the dataset Among them, variable represents the name of the screened variable, variable_prob represents the probability that the variable is a variable with significant effect, that is, the marginal posterior inclusion probability, cs represents the index of the credible set to which the variable belongs, and cs_log10bf represents the logarithm of the Bayes factor of the credible set, which is used to measure the importance of the set.
[0046] After completing the construction and selection of association rule features, the random forest classifier is used to optimize the hyperparameters through the TPE process with the maximum accuracy as the objective function. Finally, the prediction probability is calibrated using rank-preserving regression.
[0047] In order to have a comprehensive understanding of the performance improvement of the binary classification task on the data set, the method proposed in this invention is compared with the original method that only performs TPE parameter adjustment. Table 6 summarizes the key performance indicators of the two methods.
[0048] Table 6 Performance comparison before and after applying the proposed method on the dataset As shown in Table 6, the generalization ability of the proposed method on the dataset is significantly better than that of the original method. Specifically, the precision, recall and F1 value of the proposed method in the category of heart disease risk absence are improved by more than 5%, and in the category of heart disease risk presence, they are improved by more than 3%.
[0049] By constructing association rules for the risk categories of heart disease-free and diseased, the random forest classifier is more balanced in dealing with the two types of risks. Specifically, the accuracy and ROC AUC of the proposed method on the dataset were improved by 4.95% and 2.81%, respectively, indicating that the proposed method greatly improved the detection performance of the classifier. In order to further analyze the generalization ability of the proposed method, the ROC curves and confusion matrices of the original method and the proposed method on the UCI dataset are shown in Figure 2. Figure 3 and Figure 4 shown.
[0050] In the original method, the ROC curve showed significant fluctuations and lack of smoothness, which indicated unstable prediction performance. In contrast, the proposed method significantly improved the prediction performance of the random forest classifier, making the curve smoother and larger in area. This improvement highlights the enhanced early warning ability of the proposed method when facing the problem of heart disease risk identification. In addition, in order to further verify the classifier's ability to distinguish between the two types of samples with and without heart disease risk, Figure 5 and Figure 6 The confusion matrices of the original method and the proposed method on the dataset are given respectively. It provides the results of the confusion matrix based on whether heart disease is a risk classification. The confusion matrix is color normalized to ensure that the color intensity of the two categories is consistent, allowing for a fair and intuitive representation of the importance of each category. The proposed method adds 5 correctly predicted instances in the category without heart disease risk and 10 correctly predicted instances in the category with heart disease risk. In summary, the proposed method shows significant superiority on the dataset.
[0051] The present invention presents the overall results of ablation experiments using random forest as a heart disease risk warning model on a data set. The experiments are divided into 7 groups: the original method, only building association rule features, filtering original features without filtering association rule features, filtering original features and association rule features, filtering association rule features without filtering original features, post-processing based on both filtering and the proposed method.
[0052] As shown in Table 7, the reason why the classification effect is better after the association rule features are constructed is that the interaction between the original features is considered when constructing these features. Admittedly, the effect of not further screening the original features is better than that of further screening. This may be because the number of features in the data set is small, and selecting the original features will lose the information of its data set. Finally, the combination of association rule feature construction, SuSIE feature screening of association rule features only, and rank-preserving regression post-processing achieved the best heart disease risk prediction effect, verifying the effectiveness of the proposed method.
[0053] Table 7 Ablation analysis results on the dataset The present invention evaluates the performance of different machine learning models under the original method and the proposed method. Table 8 shows the performance of various mainstream classifiers on the data set and uses different classification metrics for evaluation. The experimental results on the data set show that compared with the original method, the proposed method improves the performance of almost all mainstream classifiers, and the performance of random forest under both methods is better than other mainstream models.
[0054] Table 8 Comparative analysis of the mainstream classifiers of the original method and the proposed method on the dataset It is worth noting that although logistic regression performed the best in the original method, after applying this method, the performance improvement of the three classification models, namely logistic regression, K nearest neighbor and multi-layer perceptron, was significantly lower than that of decision tree, support vector machine and random forest. This difference may be due to their limitations in capturing nonlinear features. The increase in the amount of data may make it more difficult for the model to extract useful information.
[0055] The present invention comprehensively evaluates the performance of various feature selection methods. Table 9 shows the classification performance of these methods as random forest classifiers on the data set. The experimental results on the data set show that except for the correlation filtering method, which has a slight decrease in accuracy, the other methods have improved the performance of the model.
[0056] Among them, the poor performance of correlation filtering is due to the fact that correlation filtering cannot accurately identify which feature is the best when faced with a large number of highly correlated association rule features. The enhancement effects of elastic network and random forest are more significant. In the experiment, a regularization factor of 0.5 and a threshold of 0.02 were set to filter redundant features. In contrast, SuSIE can make more accurate judgments in the small sample association rule feature selection task due to the setting of the credible set, which makes it possible to consider how to accurately select between highly correlated features during the feature selection process.
[0057] Table 9 Comparative analysis of SuSIE feature selection method and other feature selection techniques Feature contribution analysis: In order to evaluate and verify the analysis results from the perspective of feature contribution, the SHAP summary diagram and SHAP bee colony diagram were drawn based on the SHAP model of random forest. The absolute impact of a feature on the risk of heart disease is represented by its average absolute SHAP value over all instances, as shown in Figure 7 as shown; Figure 8 As shown, the SHAP beeswarm plot illustrates the distribution and positive and negative influence of the SHAP values of all instances of each feature.
[0058] By comparing the SHAP value distributions of the 10 most influential features in the random forest model, we can determine the differences in the contributions of these features in the random forest model's identification of heart disease risk.
[0059] Figure 7 The mean absolute SHAP value for each feature across all instances is shown, representing the average effect of each feature on the estimated risk of heart disease. Figure 8 The SHAP value of each risk factor for each data point is displayed, revealing the directional influence of each feature value on the model output.
[0060] Take the association rule feature rule_1 as an example, which represents the scenario where Oldpeak is in the range of -0.84-0.92 and ST_Slope is tilted upward. There are relatively few samples that meet this association rule, but they show a large positive contribution to the risk of heart disease. However, in the instances that meet the conditions, the distribution of negative effects is wider, which may be due to the dependence on other feature values.
[0061] Taking the influencing factor Cholestelor as an example, most instances were in the range of 173-223 mg / dl, which had only a moderate negative effect on heart disease risk. However, both increasing and decreasing cholesterol levels had a positive effect on risk. It is worth noting that in some cases, when cholesterol levels were below 100 mg / dl, the SHAP value of this feature with heart disease risk exceeded 0.3. This suggests that low serum cholesterol and underlying malnutrition or liver disease are strongly associated with heart disease risk.
[0062] Interaction effect analysis: Depend on Figure 7 , 8 It can be seen that ST_Slope, Cholesterol, Oldpeak and MaxHR are the four factors affecting the risk of heart disease with the highest importance, so the present invention conducts an interactive dependency analysis on them.
[0063] The interactive effects of these four characteristics on heart disease risk are as follows Figure 9-12 For each feature, the color of the scatter points depends on the other three features, thus reflecting the impact of these three features on the SHAP value of the current feature. A positive SHAP value has a positive impact on the risk of heart disease, and a negative SHAP value has a negative impact on the risk of heart disease.
[0064] Fig. 9 In Figure 1, A1, A2, and A3 are SHAP dependency graphs of ST_Slope, which are colored according to Cholesterol, Oldpeak, and MaxHR, respectively, to show the effects of Cholesterol, Oldxpeak, and MaxHR on the SHAP value of ST_Slope. When ST_Slope is upward sloping, the SHAP value is negative, and when it is flat or downward sloping, the SHAP value is positive. Fig. 9 In Figure 1, A1 shows that when ST_Slope is upward sloping and serum cholesterol levels are between 150-300 mg / dl, the risk of heart disease is the lowest. In contrast, when ST_Slope is flat and serum cholesterol levels are between 250 and 300 mg / dl, the risk is highest. In addition, when ST_Slope is downward sloping, the distribution of Oldpeak is wider, indicating a higher risk of heart disease.
[0065] Fig.10 In the figure, B1, B2, and B3 are SHAP dependency graphs of Cholesterol, which are colored according to ST_Slope, Oldpeak, and MaxHR, respectively, to show the effects of ST_Slope, Oldpeak, and MaxHR on the SHAP value of Cholesterol. When the Cholesterol level is between 150 and 300 mg / dl, the risk of heart disease increases with the increase in Cholesterol level, and begins to play a positive role at 200 mg / dl. Fig.10 As shown in B1, when the risk of heart disease is negative, ST_Slope mostly shows an upward trend, while when the risk of heart disease is positive, ST_Slope begins to show a downward trend and gradually transitions to a flat state, and this process is accompanied by an increase in Cholesterol levels.
[0066] Fig.11 In the figure, C1, C2, and C3 are the SHAP dependency graphs of Oldpeak, which are colored according to ST_Slope, Cholesterol, and MaxHR, respectively, to show the influence of ST_Slope, Cholesterol, and MaxHR on the SHAP value of Oldpeak. When Oldpeak is between 0 and 2, it usually reflects a negative impact. Fig.11 As shown in C1, as Oldpeak increases, ST_Slope gradually transitions from an upward slope to a downward slope and a flat slope; as shown in sub-figure C3, when Oldpeak is low, MaxHR is high, and as Oldpeak increases, MaxHR decreases.
[0067] Fig.12 In the figure, D1, D2, and D3 are the SHAP dependency graphs of MaxHR, which are colored according to ST_Slope, Cholesterol, and Oldpeak, respectively, to show the effects of ST_Slope, Cholesterol, and Oldpeak on the SHAP value of MaxHR. As the maximum heart rate increases, the risk of heart disease decreases significantly. It is worth noting that, Fig.12 As shown in D1, when MaxHR is less than 125, ST_Slope is generally flat, and as MaxHR increases, more ST_Slope gradually tilts upward; as shown in sub-figure D3, as MaxHR increases, Oldpeak is in the range of 0 to 1.771.
[0068] in conclusion: The present invention mines association rules for those without heart disease risk and those with heart disease risk respectively, effectively overcoming the limitation of the limited number of features in small data sets. Then, SuSIE is used to screen association rule features, and the credible set is used to consider the mutual influence between features, thereby improving the traditional feature selection method. Experimental results show that this method can effectively select meaningful association rule features. Rank-preserving regression is used for post-processing of the random forest model, significantly calibrating the classification probability to produce more reliable results. The interpretability of the model is enhanced by calculating the SHAP value of each feature and instance. The bee swarm diagram is used to visualize the contribution of each feature to the classification process, while the dependency diagram is used to illustrate the interaction between any two features and their influence on the model results. The effectiveness of the method is verified using a heart disease risk dataset, and ablation studies and comparative experiments further demonstrate the robustness and adaptability of the model in heart disease risk identification.
[0069] Although the model successfully warned of heart disease risk on the dataset, a key challenge remains: correctly identifying instances close to the boundary of heart disease risk. When the feature values are similar, the classifier may still make classification errors, highlighting the need for more accurate association rule mining. In order to further improve the accuracy of the heart disease risk warning model, future work will focus on designing an improved association rule mining algorithm that can mine potential and marginal association information in small heart disease datasets. At the same time, the antecedent form of the association rule is improved to an interval form, no longer limited to the traditional equal sign form. This will allow for more accurate extraction and selection of association rules, thereby further developing a heart disease risk warning model with enhanced risk identification capabilities.
[0070] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that the technical solutions described in the above embodiments may still be modified, or some or all of the technical features may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. An interpretable heart disease risk early warning method based on association interaction, characterized in that: include: Step S1, obtaining the heart disease dataset publicly available on Kaggle and preprocessing it; Step S2, performing association rule feature mining and feature selection respectively according to whether there are two categories of heart disease risk; Step S3, using the random forest classifier optimized by Bayesian optimization based on the TPE process for risk warning, and further calibrating the prediction results using rank-preserving regression; Step S4, analyzing the contribution of key influencing factors and their interactions on the risk of heart disease through the SHAP model.
2. The interpretable heart disease risk early warning method based on association interaction according to claim 1, characterized in that: In step S1, the heart disease dataset publicly available on Kaggle includes five public sub-datasets: Cleveland, Hungarian, Switzerland, Long Beach VA, and Stalog; In the step S1, the continuous features of the heart disease data set are preprocessed by equal-width binning.
3. The interpretable heart disease risk early warning method based on association interaction according to claim 1, characterized in that: In step S2, the two categories are: those with heart disease risk and those without heart disease risk, and association rule feature mining and feature selection are performed respectively, including: Use Aprior algorithm to mine association rules and construct binary variables as association rule features; Next, the SuSIE model is used to screen the association rule features.
4. The interpretable heart disease risk early warning method based on association interaction according to claim 3, characterized in that: In step S2, association rule mining belongs to the unsupervised learning algorithm in machine learning. An association rule can be defined as follows: ; In the formula, represents the antecedent of the association rule, represents the subsequent term of the association rule, Represents an item set; The goal of association rule mining is to find Under the premise that there are item sets in the , a certain strength threshold can be met to predict the next item The rules for the occurrence of middle itemsets; In association rule mining, three indicators, support, confidence, and lift, are often used to evaluate the strength and relevance of these rules, namely: Support is defined as the number of items in the dataset that contain both the antecedents. and the latter The ratio is expressed as follows: ; In the formula, Indicates that it also includes the preceding item and the latter The number of Represents the total number of itemsets in the data set; Confidence is defined as the antecedent Under the premise of existence, the latter The proportion of occurrence is expressed as follows: ; The lift is defined as the latter term The appearance of The degree of improvement is expressed as follows: ; If the lift is greater than 1, it means that the previous and the latter Positive correlation, less than 1 means the former and the latter Negative correlation.
5. The interpretable heart disease risk early warning method based on association interaction according to claim 3, characterized in that: In step S2, the SuSIE model is based on the SER model. Assume that the SuSIE model is a multiple regression model. Only one of the explanatory variables has a non-zero regression coefficient, namely the effect variable. In the SER model, it is assumed that the residual variance , the prior variance of the effect variable and the prior inclusion probability , the SER model can be defined as follows: ; ; ; ; ; In the formula, yes dimensional target variable, express Samples The exogenous variable matrix of dimensions, represents the coefficient of the effect variable, express The indicator variable of the dimension is used to indicate the Whether a variable is an effect variable, express dimensional regression coefficient vector, represents the error vector, The class probability is Multinomial distribution of ; level The credible set is defined as the set containing at least one effect variable with a probability of at least The posterior inclusion probability is used in Bayesian regression variable selection. To express the probability of each variable being selected in the credible set, as shown below: ; In a given and After that, the posterior inclusion probability vector can be derived from the single effect regression ,in The calculation method is as follows: ; Based on the above SER model and the credible set principle, multiple single effect vectors are introduced , and the overall effect vector Constructed as the sum of these single effects, SuSIE: ; ; ; ; ; ; In the formula, To select feature parameters.
6. The interpretable heart disease risk early warning method based on association interaction according to claim 1, characterized in that: In step S3, the core idea of random forest is to use a set of decision trees to train and predict the input data; the results of all trees are aggregated to make the final prediction, and each decision tree These are all bootstrap samples extracted from the original data set. The training is done on , and at each node, a subset of features is randomly selected to partition the data, thus introducing variability between trees; For a given input The prediction of is obtained by aggregating the predictions of all decision trees in the forest. For classification tasks, the final prediction result is determined by majority voting, which can be expressed as follows: ; In the formula, Indicates input No. The prediction of a decision tree, is the total number of trees in the forest, and in majority voting, the predicted class is the class that received the most votes in all trees.
7. The interpretable heart disease risk early warning method based on association interaction according to claim 6, characterized in that: In step S3, the Bayesian optimization algorithm based on the TPE process performs hyperparameter optimization on the random forest classifier, including: Each hyperparameter is set to follow a Gaussian distribution with mean 0 and then sampled from this distribution; Random sampling Group Hyperparameters , and calculate the corresponding model true loss when applying these hyperparameters ; Set the TPE process to the surrogate function fitting ,right Divide as follows: ; ; According to this division, we can get: ; for Selection, setting hyperparameters To express The quantile of , so the above formula is simplified as follows: ; The EI function is selected as the acquisition function to evaluate the acquisition points. The EI function represents the average improvement relative to a given threshold; For the collection point set Each collection point in calculate , and select the best one from the collection points Substitute the model to calculate the actual loss , the formula of the EI function is as follows: ; The value of the EI function is inversely proportional to its denominator, and the size of the denominator depends on the ratio , so the best collection point is the point that maximizes this ratio; Will Add to collection Form a new , and repeat the above steps until the maximum number of iterations is reached to complete the hyperparameter optimization of the random forest classifier.
8. The interpretable heart disease risk early warning method based on association interaction according to claim 7, characterized in that: In step S3, rank-preserving regression is a technique for fitting a free-form line to a series of observations so that the fitted line is monotonic at any position and as close as possible to the observations; The established rank-preserving regression model is solved using the PAV algorithm. This method has only one constraint, that is, the function space is a monotonically increasing function space. The main steps are as follows: Assume that each observed variable Follows a normal distribution , and when Time Satisfaction ; Using the previous step as a monotonicity constraint, identify the points that violate the constraint and form a monotonic sequence with their neighboring points. Assuming that the points in this range follow the same distribution, when When, order Points within the range satisfy the normal distribution ; If the newly constructed distribution violates the monotonicity constraint in subsequent comparisons, such as In the case of Points within the range will satisfy ; Repeat the above steps until the distribution stabilizes and no longer violates the monotonicity constraint, thereby completing further calibration of the prediction results.
9. The interpretable heart disease risk early warning method based on association interaction according to claim 1, characterized in that: In step S4, the SHAP model is Will Map to , thereby creating a simplified input; based on , original model A linear function that can be approximated as a binary variable is as follows: ; In the formula, , is the number of input features, , Represents the contribution value of the feature, which is calculated as follows: ; ; In the formula, yes The non-zero set of inputs in , yes Exclude A subset of features, is a unified measure of additive feature attributes, namely the SHAP value, Represents the output probability of the prediction model.
Citation Information
Patent Citations
Heart disease prediction method based on dual feature selection and XGBoost algorithm
CN111243751A
Deep learning-based diagnosis and referral of diseases and disorders using natural language processing
CN113015977A
Disease factor data processing method based on double-rule causal feature selection
CN117352162A
Construction method of urinary calculus postoperative recurrence risk prediction and evaluation model
CN118538418A
Method and system for predicting risk of cardiovascular and cerebrovascular diseases
CN118711822A