Diabetes risk prediction method based on attention-enhanced deep belief network
By introducing the methods of generative adversarial networks and attention-enhanced deep belief networks, the problems of data imbalance, feature selection and model structure limitations in diabetes risk prediction are solved, efficient diabetes risk prediction is achieved, the missed diagnosis rate is reduced and the accuracy and reliability of the model are improved.
Patent Information
- Application Number
- CN202510852373.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-24
- Publication Date
- 2025-10-03
AI Technical Summary
Existing diabetes risk prediction technologies perform poorly when dealing with highly imbalanced data, with insufficient feature selection and importance, and limitations in model structure and loss function, leading to high false negative rates and missed diagnosis rates.
A method based on attention-enhanced deep belief networks is adopted to generate synthetic data through generative adversarial networks. The feature selection methods of chi-square test, mutual information gain and variance threshold are combined, and the model is optimized using a hybrid loss function to dynamically allocate feature weights and improve model performance.
It significantly improves the model's ability to identify minority samples, reduces the missed diagnosis rate, dynamically screens out key features, achieves a good balance between recall rate and precision rate, enhances the ability to process high-dimensional data, and improves the accuracy and reliability of diabetes risk prediction.
Smart Images

Figure CN120748719A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of medical health technology, and specifically to a diabetes risk prediction method based on attention-enhanced deep belief networks. The method aims to improve the accuracy and reliability of diabetes risk prediction through deep learning technology, and provide support for the early prevention and treatment of diabetes. Background Art
[0002] Currently, diabetes risk prediction technologies primarily include methods based on deep learning models and hybrid approaches. Deep Belief Networks (DBNs) and Generative Adversarial Networks (GANs) are two commonly used deep learning models. A DBN is a deep learning architecture based on a probabilistic generative model, consisting of a stack of multiple Restricted Boltzmann Machines (RBMs). Each RBM is a two-layer neural network consisting of a visible layer (input layer) and a hidden layer. In diabetes risk prediction, DBNs, through layer-by-layer feature extraction, are capable of processing high-dimensional data and capturing complex feature relationships. For example, DBNs can identify associations between features such as polyuria and polydipsia and diabetes. In diabetes risk prediction, GANs can be used to generate synthetic data for the minority class (diabetes-positive cases) to balance the dataset. The generator receives random noise as input and generates synthetic diabetes-positive case data, while the discriminator receives both real and synthetic data and determines their authenticity. Through continuous iterative training, the data generated by the generator becomes increasingly realistic, allowing it to be used to expand the dataset and improve the model's ability to discriminate against the minority class.
[0003] In addition, a hybrid approach combines gradient boosting methods such as LightGBM and XGBoost with deep learning models. Gradient boosting methods are used to address feature selection and data imbalance, while deep learning models are used to handle complex feature relationships. In diabetes risk prediction, hybrid approaches are also used to improve the predictive power and robustness of models through feature selection, data augmentation, and model optimization.
[0004] The defects of the existing technology include: 1. Data imbalance: Most existing diabetes risk prediction technologies perform poorly when dealing with highly imbalanced data. In diabetes datasets, non-diabetes cases typically make up the majority, while diabetes-positive cases are the minority. This imbalance causes traditional machine learning models (such as decision trees, random forests, and k-nearest neighbors) to perform well on the majority class (non-diabetes cases) but poorly on the minority class (diabetes-positive cases). This leads to high false negative rates and can delay early intervention for high-risk diabetes patients.
[0005] 2. Feature Selection and Importance: Existing technologies often use traditional feature selection methods (such as the chi-square test, mutual information gain, and variance thresholding) to reduce data dimensionality and retain key features. However, these methods can lose potentially valuable information and fail to dynamically adjust feature importance. Traditional methods are unable to dynamically assign feature weights, making it difficult to effectively identify and prioritize key features related to diabetes. For example, features such as polyuria and polydipsia are crucial in diabetes prediction, but traditional methods may not fully highlight their importance.
[0006] 3. Limitations of Model Architecture: Traditional machine learning models (such as random forests) may perform poorly when processing high-dimensional data and have limited performance on imbalanced datasets. While deep learning models excel in some areas, they still struggle with imbalanced data, especially when the number of minority class samples is small. Traditional models may require extensive feature engineering when processing high-dimensional data, increasing model complexity and training difficulty.
[0007] 4. Limitations of Loss Functions: Most existing technologies use the traditional cross-entropy loss function to optimize models. However, cross-entropy loss tends to favor the majority class when dealing with imbalanced data, resulting in poor classification performance for the minority class. The cross-entropy loss function places a higher weight on easy-to-classify samples and a lower weight on difficult-to-classify samples, causing the model to pay insufficient attention to minority class samples during training, thus affecting overall classification performance. Summary of the Invention
[0008] In response to the shortcomings of the existing technology, the present invention provides a diabetes risk prediction method based on attention-enhanced deep belief network to address the defects of the existing technology in processing highly unbalanced data, feature selection and importance, model structure and loss function, and improve the accuracy and reliability of diabetes risk prediction.
[0009] The present invention achieves the above-mentioned purpose through the following technical solutions: A diabetes risk prediction method based on attention-enhanced deep belief network, comprising: Original data collection step: collecting characteristic information of normal people and diabetic patients, wherein the characteristic information includes at least age, gender and at least one clinical characteristic; Data preprocessing step: preprocess the collected raw data, including at least processing missing values, outliers, feature encoding and feature normalization; Feature selection step: A voting ensemble feature selection method combining chi-square test, mutual information gain, and variance threshold was used to screen key features highly correlated with diabetes risk prediction from the preprocessed data; GAN-based data enhancement step: Generate synthetic data based on the minority class data of the selected key features using the Generative Adversarial Network (GAN) to balance the dataset. Feature weighting step: Perform attention mechanism weighting on the GAN-enhanced feature data, calculate the attention score of each feature, and convert the attention score into attention weight to generate a weighted context vector; Deep Belief Network Step: The weighted context vector is input into a deep belief network composed of multiple stacked restricted Boltzmann machines. The input data is processed through the forward propagation mechanism and the probability of diabetes is output. Hybrid loss function guides the training steps: During the training process, a hybrid loss function is formed by combining cross entropy loss and focal loss to guide the parameter adjustment of DBN module and attention module; Output result step: Output diabetes risk prediction results based on the output of the DBN module.
[0010] According to a diabetes risk prediction method based on attention-enhanced deep belief network provided by the present invention, the preprocessing of the collected raw data includes: Processing missing values sub-step: For missing values in the collected original data, use the mean, median or mode filling method to complete the data, or directly remove the rows containing missing values; Outlier processing sub-step: detect and process outliers on age features; Feature encoding sub-step: Encode the categorical features in the data into binary variables; among them, the gender feature is encoded as male = 1, female = 0; other categorical features are encoded as yes = 1, no = 0; at the same time, the symptom feature is also encoded as a binary variable, positive = 1, negative = 0; Feature normalization sub-step: For the age feature, the minimum-maximum normalization method is used to process the age value and map it to the interval [0,1]. The minimum-maximum normalization method is expressed as the following formula:
[0011] in, and are the minimum and maximum values of the feature in the dataset.
[0012] According to a diabetes risk prediction method based on an attention-enhanced deep belief network provided by the present invention, in the feature selection step, the chi-square test is used to evaluate the correlation between the feature and the target variable, the mutual information gain is used to measure the mutual information of the feature to the target variable, the variance threshold is set to remove features with variance lower than the threshold, and the key features are screened out through a voting mechanism, that is, when a feature has significant correlation in the chi-square test, a large information contribution in the mutual information gain, and a variance higher than the set threshold, the feature is voted as a key feature, and finally a feature set that plays an important role in diabetes risk prediction is screened out.
[0013] According to a diabetes risk prediction method based on attention-enhanced deep belief network provided by the present invention, the chi-square test formula is used to evaluate the correlation between each feature and the target variable, which is expressed as:
[0014] in, O i is the actual observed frequency, E i The expected frequency is calculated by calculating the chi-square value to quantify the correlation strength between the feature and the target variable. The larger the chi-square value, the stronger the correlation between the feature and the target variable. The mutual information gain formula is used to measure the mutual information of the feature to the target variable, which is expressed as:
[0015] in, H ( Y ) is the target variable Y The entropy of H ( Y ∣ X ) is the given feature X The target variable under the condition Y The conditional entropy of the mutual information gain is greater, which means that the feature contributes more to the information of the target variable. By setting a variance threshold, calculating the variance of each feature, and removing features with variance lower than the threshold, the variance calculation formula is expressed as:
[0016] in, n is the sample size, x i For the i The characteristic values of the samples, μ Characterized by X The smaller the mean and variance, the more concentrated the eigenvalues are and the weaker the ability to distinguish the target variable is.
[0017] According to a diabetes risk prediction method based on attention-enhanced deep belief network provided by the present invention, the generative adversarial network GAN includes a generator G and a discriminator. The generator G receives preprocessed data. X , generates synthetic minority class samples through its internal network structure ; Discriminator D receives real data X and generate data , through its internal neural network to determine whether the received data is real data X and generate data .
[0018] According to a diabetes risk prediction method based on an attention-enhanced deep belief network provided by the present invention, the generative adversarial network (GAN) performs a minimax game through adversarial training between the generator G and the discriminator D to generate high-quality synthetic samples. The game goal can be expressed as:
[0019] in, V ( D , G ) is the value function of GAN, E x~pdan(x) [log D ( x )] represents the discriminant ability of the discriminator to the real data, E z~pz(z) [log(1- D ( G ( z )))] represents the discriminator's ability to discriminate generated data; p dan ( x ) is the real data distribution, p z ( z ) is the generator input noise distribution, D ( x ) is the discriminator for the real data X The probability of judgment, D ( G ( z )) is the probability of the discriminator to generate data G(z), the generator G The goal is to minimize the value function, that is, to generate synthetic data to deceive the discriminator; the discriminator D The goal is to maximize the value function and distinguish between real data and generated data.
[0020] According to a diabetes risk prediction method based on attention-enhanced deep belief network provided by the present invention, in the feature weighting step, the method is used to receive GAN-enhanced data. And calculate its attention score, for each feature , calculate the attention score , expressed as the following formula:
[0021] in, is a learnable weight matrix, is the bias vector; Then, the softmax function is used to convert the attention scores Convert to attention weight , expressed as the following formula:
[0022] Finally, the attention weights are used to generate the weighted context vector c as DBN input:
[0023] According to the present invention, a diabetes risk prediction method based on an attention-enhanced deep belief network is provided. The DBN module includes three sequentially stacked restricted Boltzmann machines (RBMs), each of which includes a visible layer and a hidden layer. That is, the DBN module includes an input layer, three hidden layers, and an output layer. The input layer is used to receive a feature vector c weighted by the attention mechanism feature, and the feature vector c contains key information related to diabetes risk prediction. The input layer forward propagates the received feature vector c to the first hidden layer. Each hidden layer performs a nonlinear transformation on the data it receives and extracts higher-level feature representations. After being processed by the three hidden layers, the data is passed to the output layer; the output layer uses an activation function to process the data and outputs a probability value between 0 and 1, which represents the patient's risk of developing diabetes; that is, the diabetes probability output by the output layer is used to quantitatively assess the possibility of a patient developing diabetes.
[0024] According to a diabetes risk prediction method based on attention-enhanced deep belief network provided by the present invention, in the hybrid loss function guided training step, the cross entropy loss formula is as follows:
[0025] in, is the true label, is the predicted probability.
[0026] The focal loss formula is as follows:
[0027] Here, t = 0 or 1, indicating the diabetes-negative and -positive categories, respectively; is the probability that the model predicts that it belongs to class t; is the focusing parameter; therefore, the hybrid loss formula is as follows:
[0028] in, is the weighting parameter; The training is guided by the loss function to adjust the parameters of the DBN and attention modules.
[0029] According to the present invention, a diabetes risk prediction method based on attention-enhanced deep belief network also includes a model evaluation step, which specifically uses the following method to comprehensively evaluate the classification performance of the model: Precision, recall, F1-score, and AUC were used as evaluation metrics to comprehensively measure the performance of the model in the diabetes risk prediction task; Among them, the precision is used to evaluate the proportion of samples that are actually positive in the samples predicted by the model. The calculation formula is: Precision = TP / TP + FP , where TP represents the number of samples that are actually positive and correctly predicted as positive by the model, and FP represents the number of samples that are actually negative but incorrectly predicted as positive by the model; Among them, the recall rate is used to evaluate the proportion of positive samples that the model can correctly predict to all actual positive samples. The calculation formula is: Recall = TP / TP + FN ,in, FN Indicates the number of samples that are actually positive but are mistakenly predicted as negative by the model; F1-score is the harmonic mean of precision and recall, which is used to comprehensively evaluate the precision and recall of the model. The calculation formula is: F 1- score =2× Precision × Recall / Precision + Recall ; AUC is the area under the receiver operating characteristic curve, which is used to evaluate the classification performance of the model at different thresholds; Based on the calculation results of multiple evaluation indicators, the classification performance of the model was comprehensively evaluated to determine the effectiveness and reliability of the model in the diabetes risk prediction task.
[0030] It can be seen that compared with the existing technology, the diabetes risk prediction method based on attention-enhanced deep belief network proposed in the present invention has the following beneficial effects: This paper introduces a generative adversarial network (GAN) to generate synthetic data for the minority class (diabetes-positive cases), effectively balancing the dataset and significantly improving the model's ability to identify minority samples. Through GAN data augmentation, the model learns more characteristics of diabetes-positive cases, allowing it to more accurately identify high-risk individuals during predictions and reduce missed diagnoses.
[0031] This paper uses a voting ensemble feature selection method that combines the chi-square test, mutual information gain, and variance thresholds to dynamically select the features most relevant to diabetes risk prediction, avoiding the potential loss of potentially valuable information in traditional methods. By weighting the selected features through an attention mechanism, the model dynamically assigns feature weights, effectively identifying and prioritizing key features related to diabetes, and improving the model's predictive accuracy and reliability.
[0032] Test results of this method on the public Early Stage Diabetes Risk Prediction Dataset demonstrate a 95% recall rate and 98% precision rate, significantly outperforming other traditional machine learning models (such as decision trees, random forests, and logistic regression). It also surpasses the next-best k-nearest neighbor method by 7% in recall and 7% in precision. By combining a hybrid loss function with cross-entropy loss and focal loss, the model prioritizes identifying minority samples while focusing on majority class samples, achieving a good balance between recall and precision.
[0033] The DBN module of this invention is composed of three stacked restricted Boltzmann machines (RBMs), which enhances the model's ability to process high-dimensional data and capture feature relationships. Through a deep learning architecture and optimization strategies, this invention demonstrates greater robustness when processing complex and unbalanced data, making it suitable for diabetes risk prediction in various scenarios.
[0034] In summary, the diabetes risk prediction method based on attention-enhanced deep belief network proposed in the present invention shows significant advantages in processing unbalanced data, optimizing feature selection and importance, improving model structure performance, and optimizing loss function. It effectively improves the accuracy and reliability of diabetes risk prediction, provides strong support for the early prevention and treatment of diabetes, and has significant social benefits and application value.
[0035] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 This is a flowchart of an embodiment of a diabetes risk prediction method based on attention-enhanced deep belief network of the present invention.
[0037] Figure 2 This is a schematic diagram of an embodiment of a diabetes risk prediction method based on an attention-enhanced deep belief network of the present invention.
[0038] Figure 3 This is a schematic diagram of a DBN module in an embodiment of a diabetes risk prediction method based on an attention-enhanced deep belief network of the present invention. DETAILED DESCRIPTION
[0039] To make the objectives, technical solutions, and advantages of the present invention more clear, the technical solutions of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the embodiments described are only some of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts shall fall within the scope of protection of the present invention.
[0040] References herein to "embodiments" mean that a particular feature, structure, or characteristic described in connection with the embodiments may be included in at least one embodiment of the present application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it constitute an independent or alternative embodiment that is mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0041] See also Figure 1 and Figure 2 This embodiment provides a diabetes risk prediction method based on attention-enhanced deep belief network, including: Raw data collection step S1: collecting characteristic information of normal people and diabetic patients, wherein the characteristic information includes at least age, gender and at least one clinical characteristic; Data preprocessing step S2: preprocessing the collected raw data, including at least processing missing values, outliers, feature encoding, and feature normalization; Feature selection step S3: Using a voting ensemble feature selection method that combines the Chi-Square test, mutual information gain, and variance threshold, key features highly correlated with diabetes risk prediction are screened from the preprocessed data; GAN-based data enhancement step S1: Generate synthetic data for the minority class data in the selected key features using the generative adversarial network GAN to balance the dataset; Feature weighting step S4: Perform attention mechanism weighting processing on the GAN-enhanced feature data, calculate the attention score of each feature, and convert the attention score into attention weight to generate a weighted context vector; Deep Belief Network Step S5: Input the weighted context vector into a deep belief network composed of multiple stacked restricted Boltzmann machines, process the input data through the forward propagation mechanism, and output the probability of diabetes; Hybrid loss function guides training step S6: During the training process, a hybrid loss function is formed by combining cross entropy loss and focal loss to guide the parameter adjustment of DBN module and attention module; Output result step S7: Output diabetes risk prediction result according to the output of the DBN module.
[0042] During the initial data collection process, 16 characteristics were collected for both healthy individuals and patients with diabetes, including age, sex, and clinical characteristics: the presence of polyuria, polydipsia, significant short-term weight loss, fatigue, polyphagia, a history of vulvitis, blurred vision, itchy skin, irritability, slow wound healing, partial limb paralysis, muscle stiffness, abnormal hair loss, and signs of obesity. The age field was a continuous variable, recording the actual age in years; sex was coded as a binary categorical variable (male / female); and clinical characteristics were represented by Boolean values (yes / no), recording the presence or absence of the corresponding symptom.
[0043] In the above data preprocessing step, the collected raw data is preprocessed, including: Processing missing values sub-step: For missing values in the collected original data, use the mean, median or mode filling method to complete the data, or directly remove the rows containing missing values; Outlier processing sub-step: Detect outliers on the age feature, identify outliers by setting reasonable thresholds or using statistical methods, and process outliers by correction, replacement, or deletion to eliminate the interference of outliers on model training; Feature encoding sub-step: Encode the categorical features in the data into binary variables; among them, the gender feature is encoded as male = 1, female = 0; other categorical features are encoded as yes = 1, no = 0; at the same time, the symptom feature is also encoded as a binary variable, positive = 1, negative = 0; Feature normalization sub-step: For the age feature, the minimum-maximum normalization method is used to process it, mapping the age value to the interval [0,1] to ensure that all features are on the same scale. This prevents the large scale of the age feature from dominating the model training process, affecting the role of other features and the overall performance of the model. The minimum-maximum normalization method is expressed as the following formula:
[0044] in, and are the minimum and maximum values of the feature in the dataset.
[0045] In the above feature selection steps, the chi-square test is used to evaluate the correlation between the feature and the target variable, the mutual information gain is used to measure the mutual information of the feature on the target variable, and the variance threshold is set to remove features with variance lower than the threshold. The key features are screened out through a voting mechanism. That is, when a feature has a significant correlation in the chi-square test, a large information contribution in the mutual information gain, and a variance higher than the set threshold, the feature is voted as a key feature, and finally a feature set that plays an important role in diabetes risk prediction is screened out.
[0046] Specifically, the chi-square test formula is used to evaluate the correlation between each feature and the target variable, which is expressed as:
[0047] in, O i is the actual observed frequency, E i The expected frequency is calculated by calculating the chi-square value to quantify the correlation strength between the feature and the target variable. The larger the chi-square value, the stronger the correlation between the feature and the target variable. The mutual information gain formula is used to measure the mutual information of the feature to the target variable, which is expressed as:
[0048] in, H ( Y ) is the target variable Y The entropy of H ( Y ∣ X ) is the given feature X The target variable under the condition Y The conditional entropy of the mutual information gain is greater, which means that the feature contributes more to the information of the target variable. By setting a variance threshold, calculating the variance of each feature, and removing features with variance lower than the threshold, the variance calculation formula is expressed as:
[0049] in, n is the sample size, x i For the i The characteristic values of the samples, μ Characterized by X The smaller the mean and variance, the more concentrated the eigenvalues are and the weaker the ability to distinguish the target variable is.
[0050] Combining the results of the chi-square test, mutual information gain, and variance threshold, a voting mechanism was used to identify key features. Specifically, if a feature showed significant correlation in the chi-square test, contributed significantly to the mutual information gain, and had a variance above a set threshold, it was voted as a key feature. This ultimately resulted in a set of features that were crucial for diabetes risk prediction. For example, the voting mechanism identified eight of the most important features: gender, polyuria, polydipsia, significant weight loss over a short period of time, fatigue, polyphagia, muscle stiffness, and abnormal hair loss.
[0051] In the above GAN-based data enhancement step, the Generative Adversarial Network (GAN) includes a generator G and a discriminator. The generator G receives the preprocessed data. X , generates synthetic minority class samples through its internal network structure ; Discriminator D receives real data X and generate data , through its internal neural network to determine whether the received data is real data X and generate data .
[0052] In this embodiment, the Generative Adversarial Network (GAN) generates high-quality synthetic samples by conducting a minimax game through adversarial training between the generator G and the discriminator D, thereby improving the model's ability to recognize minority classes, and finally obtaining enhanced data through the GAN module. Among them, the game goal can be expressed as:
[0053] in, V ( D , G ) is the value function of GAN, E x~pdan(x) [log D ( x )] represents the discriminant ability of the discriminator to the real data, E z~pz(z) [log(1- D ( G ( z )))] represents the discriminator's ability to discriminate generated data; p dan (x ) is the real data distribution, p z ( z ) is the generator input noise distribution, D ( x ) is the discriminator for the real data X The probability of judgment, D ( G ( z )) is the probability of the discriminator to generate data G(z), the generator G The goal is to minimize the value function, that is, to generate synthetic data to deceive the discriminator; the discriminator D The goal is to maximize the value function and distinguish between real data and generated data.
[0054] Through adversarial training between the generator G and the discriminator D, the generator G continuously optimizes its generation ability and generates high-quality synthetic samples. These synthetic samples are similar to the real minority class samples in feature distribution, but the specific values are different, thereby increasing the number and diversity of minority class samples; the synthetic minority class samples generated by the generator G are combined with the majority class samples in the original dataset to form a balanced dataset, thereby improving the model's recognition ability for minority class samples; finally, an enhanced dataset is obtained through the GAN module. This dataset is more balanced in sample number and category distribution, which is conducive to the subsequent training and optimization of the deep belief network model.
[0055] In the above feature weighting step, it is used to receive GAN enhanced data And calculate its attention score, for each feature , calculate the attention score , expressed as the following formula:
[0056] in, is a learnable weight matrix, is the bias vector; Then, the softmax function is used to convert the attention scores Convert to attention weight , expressed as the following formula:
[0057] Finally, the attention weights are used to generate the weighted context vector c as DBN input:
[0058] like Figure 3As shown, the DBN module includes three sequentially stacked restricted Boltzmann machines (RBMs), each of which includes a visible layer and a hidden layer. That is, the DBN module includes an input layer, three hidden layers, and an output layer. The input layer is used to receive a feature vector c weighted by the attention mechanism, and the feature vector c contains key information related to diabetes risk prediction. The input layer forward propagates the received feature vector c to the first hidden layer. Each hidden layer performs a nonlinear transformation on the data it receives and extracts higher-level feature representations. Specifically, the number of units in the three hidden layers is set to 250, 250, and 500, respectively, to ensure that the complex patterns and relationships in the data can be fully captured. After being processed by the three hidden layers, the data is passed to the output layer; the output layer uses an activation function (such as the sigmoid function) to process the data and outputs a probability value between 0 and 1, which represents the patient's risk of developing diabetes; that is, the diabetes probability output by the output layer is used to quantitatively assess the possibility of a patient developing diabetes.
[0059] In the above hybrid loss function guided training step, the cross entropy loss formula is as follows:
[0060] in, is the true label, is the predicted probability.
[0061] The focal loss formula is as follows:
[0062] Here, t = 0 or 1, indicating the diabetes-negative and -positive categories, respectively; is the probability that the model predicts that it belongs to class t; is the focusing parameter; therefore, the hybrid loss formula is as follows:
[0063] in, is the weighting parameter; The training is guided by the loss function to adjust the parameters of the DBN and attention modules.
[0064] This embodiment also includes a model evaluation step, which specifically uses the following method to comprehensively evaluate the classification performance of the model: Precision, recall, F1-score, and AUC (Area Under the Curve) are used as evaluation metrics to comprehensively measure the performance of the model in the diabetes risk prediction task. Among them, the precision is used to evaluate the proportion of samples that are actually positive in the samples predicted by the model. The calculation formula is: Precision = TP / TP + FP , where TP (True Positive) represents the number of samples that are actually positive and correctly predicted as positive by the model, and FP (False Positive) represents the number of samples that are actually negative but incorrectly predicted as positive by the model; Among them, the recall rate is used to evaluate the proportion of positive samples that the model can correctly predict to all actual positive samples. The calculation formula is: Recall = TP / TP + FN ,in, FN (False Negative) indicates the number of samples that are actually positive but are mistakenly predicted as negative by the model; F1-score is the harmonic mean of precision and recall, which is used to comprehensively evaluate the precision and recall of the model. The calculation formula is: F 1- score =2× Precision × Recall / Precision + Recall ; AUC is the area under the receiver operating characteristic curve (ROC curve), which is used to evaluate the classification performance of the model at different thresholds. The closer the AUC value is to 1, the better the classification performance of the model; Based on the calculation results of the above evaluation indicators, the classification performance of the model was comprehensively evaluated to determine the effectiveness and reliability of the model in the diabetes risk prediction task.
[0065] In practical applications, based on the public dataset Early Stage Diabetes Risk Prediction Dataset, the present invention is compared with existing baseline technologies (decision tree, random forest, logistic regression, support vector machine, k-nearest neighbor). The results are shown in Table 1 below: Table 1: Comparison results between the present invention and existing baseline technology
[0066] As shown in Table 1, our method achieved excellent performance with a recall rate of 95% and a precision rate of 98%, significantly outperforming other traditional machine learning models. It surpassed the next-best k-nearest neighbor method by 7% in recall and 7% in precision. Our method demonstrates significant advantages in handling imbalanced data and feature importance, achieving excellent results in balancing recall and precision.
[0067] In summary, traditional diabetes risk prediction techniques perform poorly when dealing with highly imbalanced data, especially when diabetes-positive cases are in the minority, where traditional models are prone to high false negative rates. This invention introduces a generative adversarial network (GAN) to generate synthetic data for the minority class (diabetes-positive cases), effectively balancing the dataset and significantly improving the model's ability to identify minority samples. Through GAN data augmentation, the model learns more features related to diabetes-positive cases, enabling more accurate identification of high-risk individuals during predictions and reducing missed diagnoses.
[0068] Furthermore, the present invention employs a voting ensemble feature selection method that combines the chi-square test, mutual information gain, and variance thresholds to dynamically select the features most relevant to diabetes risk prediction, avoiding the potential loss of potentially valuable information in traditional methods. By weighting the selected features through an attention mechanism, the model dynamically assigns feature weights, effectively identifying and prioritizing key features related to diabetes, and improving the model's predictive accuracy and reliability.
[0069] Furthermore, test results on the public Early Stage Diabetes Risk Prediction Dataset demonstrate a 95% recall rate and 98% precision rate, significantly outperforming other traditional machine learning models (such as decision trees, random forests, and logistic regression). The model surpasses the next-best k-nearest neighbor technique by 7% in recall and 7% in precision. By combining a hybrid loss function with cross-entropy loss and focal loss, the model prioritizes the identification of minority class samples while focusing on majority class samples, achieving a good balance between recall and precision.
[0070] Furthermore, the DBN module of this invention is composed of three stacked restricted Boltzmann machines (RBMs), which enhances the model's ability to process high-dimensional data and capture feature relationships. Through a deep learning architecture and optimization strategies, this invention demonstrates greater robustness when processing complex and unbalanced data, making it suitable for diabetes risk prediction in various scenarios.
[0071] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0072] The above embodiments are only preferred embodiments of the present invention and cannot be used to limit the scope of protection of the present invention. Any non-substantial changes and replacements made by technicians in this field on the basis of the present invention fall within the scope of protection required by the present invention.
Claims
1. A diabetes risk prediction method based on attention-enhanced deep belief network, characterized in that: include: Original data collection step: collecting characteristic information of normal people and diabetic patients, wherein the characteristic information includes at least age, gender and at least one clinical characteristic; Data preprocessing step: preprocess the collected raw data, including at least processing missing values, outliers, feature encoding and feature normalization; Feature selection step: A voting ensemble feature selection method combining chi-square test, mutual information gain, and variance threshold was used to screen key features highly correlated with diabetes risk prediction from the preprocessed data; GAN-based data enhancement step: Generate synthetic data based on the minority class data of the selected key features using the Generative Adversarial Network (GAN) to balance the dataset. Feature weighting step: Perform attention mechanism weighting on the GAN-enhanced feature data, calculate the attention score of each feature, and convert the attention score into attention weight to generate a weighted context vector; Deep Belief Network Step: The weighted context vector is input into a deep belief network composed of multiple stacked restricted Boltzmann machines. The input data is processed through the forward propagation mechanism and the probability of diabetes is output. Hybrid loss function guides the training steps: During the training process, a hybrid loss function is formed by combining cross entropy loss and focal loss to guide the parameter adjustment of DBN module and attention module; Output result step: Output diabetes risk prediction results based on the output of the DBN module.
2. The method according to claim 1, characterized in that The preprocessing of the collected raw data includes: Processing missing values sub-step: For missing values in the collected original data, use the mean, median or mode filling method to complete the data, or directly remove the rows containing missing values; Outlier processing sub-step: detect and process outliers on age features; Feature encoding sub-step: Encode the categorical features in the data into binary variables; among them, the gender feature is encoded as male = 1, female = 0; other categorical features are encoded as yes = 1, no = 0; at the same time, the symptom feature is also encoded as a binary variable, positive = 1, negative = 0; Feature normalization sub-step: For the age feature, the minimum-maximum normalization method is used to process the age value and map it to the interval [0,1]. The minimum-maximum normalization method is expressed as the following formula: in, and are the minimum and maximum values of the feature in the dataset.
3. The method according to claim 1, wherein: In the feature selection step, the chi-square test is used to evaluate the correlation between the feature and the target variable, the mutual information gain is used to measure the mutual information of the feature on the target variable, and the variance threshold is set to remove features with variance lower than the threshold. The key features are screened out through a voting mechanism. That is, when a feature has a significant correlation in the chi-square test, a large information contribution in the mutual information gain, and a variance higher than the set threshold, the feature is voted as a key feature, and finally a feature set that plays an important role in diabetes risk prediction is screened out.
4. The method according to claim 3, wherein: The chi-square test formula is used to evaluate the correlation between each feature and the target variable, which is expressed as: in, O i is the actual observed frequency, E i The expected frequency is calculated by calculating the chi-square value to quantify the strength of the correlation between the feature and the target variable. The larger the chi-square value, the stronger the correlation between the feature and the target variable. The mutual information gain formula is used to measure the mutual information of the feature to the target variable, which is expressed as: in, H ( Y ) is the target variable Y The entropy of H ( Y ∣ X ) is the given feature X The target variable under the condition Y The conditional entropy of the mutual information gain is greater, which means that the feature contributes more to the information of the target variable. By setting a variance threshold, calculating the variance of each feature, and removing features with variance lower than the threshold, the variance calculation formula is expressed as: in, n is the sample size, x i For the i The characteristic values of the samples, μ Features X The smaller the mean and variance, the more concentrated the eigenvalues are and the weaker the ability to distinguish the target variable is.
5. The method according to claim 1, wherein: The generative adversarial network GAN includes a generator G and a discriminator. The generator G receives the preprocessed data. X , generates synthetic minority class samples through its internal network structure ; The discriminator D receives real data X and generate data , through its internal neural network to determine whether the received data is real data X and generate data .
6. The method according to claim 5, characterized in that: The generative adversarial network GAN performs a minimax game through adversarial training between the generator G and the discriminator D to generate high-quality synthetic samples. The game goal can be expressed as: in, V ( D , G ) is the value function of GAN, E x~pdan(x) [log D ( x )] represents the discriminant ability of the discriminator to the real data, E z~pz(z) [log(1- D ( G ( z )))] represents the discriminator's ability to discriminate generated data; p dan ( x ) is the real data distribution, p z ( z ) is the generator input noise distribution, D ( x ) is the discriminator for the real data X The probability of judgment, D ( G ( z )) is the probability of the discriminator to generate data G(z), the generator G The goal is to minimize the value function, that is, to generate synthetic data to deceive the discriminator; the discriminator D The goal is to maximize the value function and distinguish between real data and generated data.
7. The method according to any one of claims 1 to 6, characterized in that: In the feature weighting step, it is used to receive GAN enhanced data And calculate its attention score, for each feature , calculate the attention score , expressed as the following formula: in, is a learnable weight matrix, is the bias vector; Then, the attention score is converted into Convert to attention weight , expressed as the following formula: Finally, the attention weights are used to generate the weighted context vector c as DBN input:
8. The method according to any one of claims 1 to 6, characterized in that: The DBN module includes three stacked restricted Boltzmann machines (RBMs), each of which includes a visible layer and a hidden layer. Specifically, the DBN module includes an input layer, three hidden layers, and an output layer. The input layer is configured to receive a feature vector c weighted by an attention mechanism, wherein the feature vector c contains key information related to diabetes risk prediction. The input layer forward propagates the received feature vector c to the first hidden layer. Each hidden layer performs a nonlinear transformation on the data it receives and extracts higher-level feature representations. After being processed by the three hidden layers, the data is passed to the output layer; the output layer uses an activation function to process the data and outputs a probability value between 0 and 1, which represents the patient's risk of developing diabetes; that is, the diabetes probability output by the output layer is used to quantitatively assess the possibility of a patient developing diabetes.
9. The method according to any one of claims 1 to 6, characterized in that: In the hybrid loss function guided training step, the cross entropy loss formula is as follows: in, is the true label, is the predicted probability. The focal loss formula is as follows: Where t = 0 or 1, indicating the diabetes negative and positive categories, respectively; is the probability that the model predicts that it belongs to class t; is the focusing parameter; therefore, the hybrid loss formula is as follows: in, is the weighting parameter; The loss function is used to guide the training and adjust the parameters of the DBN and attention modules.
10. The method according to any one of claims 1 to 6, characterized in that It also includes a model evaluation step, which comprehensively evaluates the classification performance of the model in the following ways: Precision, recall, F1-score, and AUC were used as evaluation metrics to comprehensively measure the performance of the model in the diabetes risk prediction task; Among them, the precision is used to evaluate the proportion of samples that are actually positive in the samples predicted by the model. The calculation formula is: Precision = TP / TP + FP , where TP represents the number of samples that are actually positive and correctly predicted as positive by the model, and FP represents the number of samples that are actually negative but incorrectly predicted as positive by the model; Among them, the recall rate is used to evaluate the proportion of positive samples that the model can correctly predict to all actual positive samples. The calculation formula is: Recall = TP / TP + FN ,in, FN Indicates the number of samples that are actually positive but are mistakenly predicted as negative by the model; F1-score is the harmonic mean of precision and recall, which is used to comprehensively evaluate the precision and recall of the model. The calculation formula is: F 1- score =2× Precision × Recall / Precision + Recall ; AUC is the area under the receiver operating characteristic curve, which is used to evaluate the classification performance of the model at different thresholds; Based on the calculation results of multiple evaluation indicators, the classification performance of the model was comprehensively evaluated to determine the effectiveness and reliability of the model in the diabetes risk prediction task.
Citation Information
Cited By
Method and system for optimizing diabetic complication prediction model
CN121768690A