Diabetes classification prediction method based on improved Stacking strategy

By improving the Stacking strategy, building multiple basic learners and combining Bootstrap sampling and K-fold cross-validation, the problems of low diabetes classification prediction accuracy and overfitting in the existing technology have been solved, and higher prediction accuracy and Robustness.

CN118609795AInactive Publication Date: 2024-09-06HANGZHOU NORMAL UNIVERSITY

Patent Information

Application Number
CN202410698568.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-31
Publication Date
2024-09-06
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing diabetes classification prediction method based on the stacking strategy has poor prediction accuracy and is prone to errors due to the poor diversity and small difference of the base learner, the low information content of the meta-learner training feature space data, and the failure to consider the accuracy of the base learner. The problem of overfitting.

Method used

Using an improved Stacking strategy, we build four independent basic learners (Logistic regression, random forest, support vector machine and extreme gradient boosting tree) and improve the robustness of the basic learners through Bootstrap sampling and K-fold cross-validation, combining different The weight of the learner is assigned different weight factors to build a strong learner to reduce the risk of over-fitting and improve generalization ability.

Benefits of technology

It significantly improves the accuracy of diabetes classification prediction and the generalization ability of the model, reduces the risk of overfitting, and improves the accuracy and robustness of prediction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118609795A
    Figure CN118609795A
Patent Text Reader

Abstract

The invention discloses a diabetes classification prediction method based on an improved Stacking strategy, and the method comprises the steps: obtaining different training sets through Bootstrap sampling; then training and constructing a base learning device based on a Logistic regression algorithm, a base learning device based on a random forest algorithm, a base learning device based on a support vector machine algorithm and a base learning device based on an extreme gradient boosting tree algorithm by using K-fold cross validation; then, a K-fold cross validation base learner precision mean value is used as a weight factor, weights are distributed to the base learners, outputs of the base learners are spliced, and a new feature space is obtained; training element learners by using the training set, and finally, carrying out weighted splicing on the two layers of learners to obtain a strong learner; according to the method, by introducing the Boostrap technology, the difference between basic learners is increased, and the generalization ability of the model is improved; the weight coefficient of the basic learner is added, and the accuracy of the basic learner is considered, so that the accuracy of the classification prediction model is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of machine learning and data mining, and relates to a diabetes classification prediction method based on an improved Stacking strategy. Background Art

[0002] Diabetes is one of the major health problems currently faced by many countries in the world. According to relevant data, diabetes may cause more than 160 complications, posing a huge threat to human health. Diabetes can be further divided into type 1 diabetes, type 2 diabetes and gestational diabetes. Type 1 diabetes is a condition in which the body cannot produce insulin to maintain normal body functions. It is an autoimmune disease in which the beta cells in the body are damaged, resulting in insulin deficiency. Type 2 diabetes is caused by the body's inability to form the required insulin normally or the body's inability to use insulin normally, which is also called insulin resistance. It is one of the most common types of high blood sugar and can be detected in 90% of patients.

[0003] The management of diabetes in my country is mainly based on prevention. Generally, patients are already in the middle and late stages when diagnosed, resulting in a high mortality rate. Therefore, it is particularly important to predict the risk of early illness for diabetic patients and reduce complications caused by diabetes. In the era of big data, the emphasis is on using data to solve real problems, and data mining and deep learning are effective research methods. According to the classification models in data mining, such as neural networks, random forests and other methods, diabetes data is classified, and supervised learning methods are used to classify diabetes data sets. In the process of selecting the model, the model needs to be accurately adjusted and tested to obtain the prediction results of diabetes classification. According to the data, binary classification is realized. For the methods in data mining, most scholars previously used a single multiple classification method to establish a diabetes prediction model, such as KNN model, LDA model, SVM model, naive Bayes model, etc. for comparison, and selected the best model for prediction. For complex problems, a single classifier cannot capture different features and patterns in the data, so it is easy to have overfitting problems.

[0004] The existing methods based on the Stacking strategy have low prediction accuracy due to the poor diversity and small differences of the base learners, the low amount of data information in the training feature space of the meta-learner, and the failure to consider the accuracy of the base learners. In order to solve the problems existing in the prior art, the present invention proposes a diabetes classification prediction method based on an improved Stacking strategy, which can capture information from different angles and features, reduce the risk of overfitting, improve generalization ability, and accurately predict diabetes classification. Summary of the invention

[0005] The purpose of the present invention is to propose a diabetes classification prediction method based on an improved Stacking strategy.

[0006] The present invention specifically comprises the following steps:

[0007] Step 1, obtaining population health census data to form a data set; the population health census data includes age, diabetes spectrum function, body mass index, diastolic blood pressure, triceps skin thickness, number of pregnancies, insulin concentration, blood sugar content and diabetes category;

[0008] Step 2: Preprocess the data samples obtained in step 1; specifically, check and delete false data, invalid data and duplicate data, fill missing data with the mean or median, and perform PCA dimensionality reduction on high-dimensional data;

[0009] Step 3: Build four independent basic learners, specifically:

[0010] (1) Construct a base learner based on the Logistic regression algorithm. The model uses the Sigmoid function to normalize the output. By importing the training set samples, the optimal parameters are obtained to obtain the optimal base learner.

[0011] The specific construction process is as follows:

[0012] i. After the training set samples are divided, they are imported into the base learner and the missing values ​​are filled using the median interpolation method;

[0013] ii. Using F1-score as the model evaluation indicator, retrieve the enumeration value of each parameter through the network and traverse all enumeration value combinations;

[0014] iii. Traverse all parameter combinations to obtain the maximum value of the F1-score indicator, and finally select the most appropriate model parameters based on this value;

[0015] IV. After obtaining the best model, substitute the test data set into it to obtain the LR-based base learner.

[0016] (2) Construct a base learner based on the random forest algorithm, extract data samples through Bootstrap sampling to build a decision tree, and then obtain the prediction result Outcome by using the principle of minority obeys majority voting;

[0017] It is mainly divided into two stages, the first stage is used to build a decision tree, and the second stage is used for prediction.

[0018] The first stage is to extract data samples through Bootstrap sampling to build a decision tree. The specific steps are as follows:

[0019] ① Randomly select k eigenvectors from the m eigenvectors in the sample space (k <m);

[0020] ②, calculate the best segmentation method in the k feature vector subsets;

[0021] ③ Use the best splitting method to divide the node into sub-nodes;

[0022] ④. Repeat the first three steps until all nodes become leaf nodes and have only one attribute;

[0023] ⑤. Repeat the first four steps and train N times to obtain N decision trees to form a random forest model;

[0024] The second stage is mainly to train the random forest model constructed in the first stage, and use the majority voting principle to link the N decision trees obtained in the first stage together to output the prediction results.

[0025] (3) Construct a base learner based on the support vector machine algorithm. By creating a support vector machine model based on the radial basis function, importing the training set samples, and using the grid search method to obtain the normalization parameter and kernel function parameter γ RBF The best parameter set is obtained, and finally the base learner based on the support vector machine algorithm is obtained by using the best parameter set.

[0026] The specific construction process is as follows:

[0027] By training sample data, we can obtain the hyperplane (w SVM , b SVM ), the expression is as follows:

[0028] w SVM τ x+b SVM =0;

[0029] where w SVM is the normal vector (i.e., the weight vector, where w SVM τ w SVM The transpose of , determines the direction of the hyperplane; x is the sample; b SVM is the bias term, which represents the intercept of the decision function. To obtain the optimal classifier, it is necessary to make the support vector γ SVM Maximize, that is, the hyperplane (w SVM , b SVM ) and the distance between the nearest sample:

[0030]

[0031] where ||w SVM || is the weight vector w SVMTherefore, the classification problem is transformed into a mathematical problem, and the problem description is as follows:

[0032]

[0033] where y i (w SVM τ x i +b SVM )≥1 is a restriction condition for the hyperplane to be correctly classified. In order to solve the optimization problem of support vector machine (SVM) more efficiently, and to use kernel function to deal with nonlinear separable situations, it is necessary to construct Lagrangian function to transform the model training problem into a dual problem. The transformed problem is described as follows:

[0034]

[0035] where α i is the Lagrangian operator, which represents the weight of each sample in the optimization problem; y j is the support vector x j The category label of is the sample feature vector x i , x j The inner product of , the problem is transformed into solving the optimal Lagrangian operator α * In order to solve the nonlinear separability problem of the above dual problem, the model uses the radial basis function (RBF) to project the sample space into another high-dimensional feature space. The expression is as follows:

[0036] K(x i , x j )=exp(-γ RBF ||x i -x j || 2 );

[0037] in The bandwidth parameter σ controls the width of the Gaussian kernel function. i , x j ) instead The sample space can be transformed into a high-dimensional space, which improves the generalization ability and flexibility of the model. Finally, the dual problem is solved to obtain the optimal Lagrangian operator α * Then, the optimal parameter set is obtained by the following formula and the final bias term

[0038]

[0039] in is the optimal Lagrangian operator for the i-th training sample; K(x i , x j ) is the sample x i and the support vector x j The kernel function value of is the bias term corresponding to support vector j. Then, the average value of the bias terms of all support vectors is taken as the final bias term

[0040] (4) Construct a base learner based on the extreme gradient boosting tree algorithm. First, one-hot encode the discrete training set samples, and then introduce the processed training data to obtain the base learner based on the extreme gradient boosting tree algorithm under the optimal parameters.

[0041] The specific construction process is as follows:

[0042] (1) Perform one-hot encoding on discrete variables and set parameter ranges;

[0043] (ii) Grid search method is used to select parameter combinations, and negative log-likelihood loss function is used as the evaluation index to find the optimal parameter combination through K-fold cross validation;

[0044] (3) Bring the test set into the best model and output the Precision value, Recall value, F1-score value and AUC value.

[0045] Step 4: Build a diabetes classification prediction model based on the improved Stacking strategy. First, different training sets are obtained through Bootstrap sampling, and then all base learners constructed in step 3 are trained using K-fold cross validation. Then, the mean accuracy of the base learners in K-fold cross validation is used as a weight factor to assign weights to the base learners, and the outputs of the base learners are spliced ​​to obtain a new feature space. Then, the meta learner is trained using this as a training set, and finally the two layers of learners are weightedly spliced ​​to obtain a strong learner.

[0046] The meta-learner used is a model based on the Logistic regression algorithm, and its input is a new feature space composed of the weighted outputs of the base learners.

[0047] The training process of the base learner is as follows:

[0048] First, multiple training subsets are generated through Bootstrap sampling. Suppose the original data set is:

[0049] D={(x1, y1), (x2, y2),..., (x m ,y m )};

[0050] where xm is an n-dimensional feature vector, y m is the feature vector x m The label of m is the number of samples. Bootstrap sampling uses sampling with replacement to randomly select samples from the training set and replace them each time, and repeat this process n times to generate a data set D with the same size as the original data set. t , t=1,2,3,4. where each D t The dimension n is consistent with the original data set D. Then, different data sets are used to train the four base learners described in step 3 to obtain the optimal learner h t (x), t=1, 2, 3, 4.

[0051] The training process of the meta-learner is as follows:

[0052] First, reconstruct the feature space and combine the weights W trained by the accuracy pt of each base learner t , base learner h t (x) in sample x i The output is z it =W t Sigmoid(h t (x i )), i = 1, ..., m; t = 1, 2, 3, 4; then by combining the outputs z of the four base learners i1 , z i2 , z i3 , z i4 Get the new feature vector X i , to reconstruct the new feature space, the expression is as follows: X i =[z i1 , z i2 , z i3 , z i4 ]; D′={(X1, y1),..., (X m ,y m )};

[0053] Finally, the meta-learner H(X) is trained in the reconstructed feature space D′.

[0054] Step 5: Input any valid feature data covering the data type in step 1 into the strong learner trained in step 4, and output the corresponding diabetes type.

[0055] Compared with the prior art, the significant advantages of the present invention are: in order to minimize the impact of individual learners on model training due to differences, Bootstrap sampling (sampling with replacement) is used to ensure that each data subset is composed of different data samples, thereby improving the robustness of the base learner and improving the versatility of the model; according to the performance of different learners, different weight factors are assigned to individual learners through comparative analysis, and the training results of the base learners are weighted in the process of model fusion, introducing consideration of the accuracy of each base learner, thereby improving the accuracy of the entire model, and accurately predicting the classification of diabetes. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] Figure 1 Implementing procedures for random forests;

[0057] Figure 2 Improved Stacking algorithm flowchart; DETAILED DESCRIPTION

[0058] The present invention is described in detail below with reference to the accompanying drawings and specific implementation steps.

[0059] Step 1: Obtain population health survey data. Specifically, health data includes age (Age), diabetes spectrum function (pedi), body mass index (BMI), diastolic blood pressure (Blood PTessure), triceps skin thickness (Skin Thickness), number of pregnancies (Pregnancies), insulin concentration (Insulin), blood sugar content (Gluscose) and diabetes category (Outcome), which constitute the sample x i and label O i (1≤i≤m, m is the number of samples), each x i It contains 8 dimensions, corresponding to 8 attributes: age, diabetes spectrum function, body mass index, blood pressure, triceps skin thickness, number of pregnancies, insulin concentration, and blood glucose content. i is a scalar, 1 represents diabetes and 0 represents no diabetes; all sample data form a sample set S and a label set O;

[0060] Step 2: Preprocess the data samples obtained in step 1, including checking and deleting false data, invalid data and duplicate data, filling missing data with the mean or median, and performing PCA dimensionality reduction on high-dimensional data;

[0061] The data preprocessing step in this embodiment mainly includes the following steps:

[0062] 1) Delete samples with bad or abnormal data noise;

[0063] 2) For sample x i If there is invalid data in the input data field, that is, it does not match the valid value in the input data field, it will be deleted or replaced with the average or median value of the field;

[0064] 3) For duplicate sample data, delete the duplicate samples;

[0065] 4) For high-dimensional sample data, principal component analysis (PCA) is used to reduce the dimension.

[0066] Through the above processing, the maximum effective set of the data set can be effectively extracted, thereby ensuring the accuracy and versatility of the model.

[0067] Step 3: Construct 4 independent base learners as follows:

[0068] (1) Construct a base learner based on the Logistic Regression (LR) algorithm. The model uses the Sigmoid function to normalize the output. By importing the training set samples, the optimal parameters are obtained to obtain the optimal base learner.

[0069] In detail, the Logistic regression algorithm does not standardize the range of output values, so it is necessary to use the Sigmoid algorithm for normalization, as shown in the following formula:

[0070]

[0071] This formula maps any real value of the input to the interval [0, 1] and converts the linear output into probability. Combined with the Sigmoid function, the logistic regression formula is:

[0072]

[0073] where h1(x) is the LR Based on this formula and the maximum likelihood estimation principle, we can derive the parameter w. LR The iterative update expression of is:

[0074]

[0075] in, is the parameter set w LR The jth component of , a is the learning rate, m is the sample size, is the jth feature value of the i-th sample, y i is the diabetes classification label of the i-th sample.

[0076] Based on the above principles, the steps to construct a base learner are as follows:

[0077] i. After the training set samples are divided, they are imported into the base learner and the missing values ​​are filled using the median interpolation method;

[0078] ii. Using F1-score as the model evaluation indicator, retrieve the enumeration value of each parameter through the network and traverse all enumeration value combinations;

[0079] iii. Traverse all parameter combinations to obtain the maximum value of the F1-score indicator, and finally select the most appropriate model parameters based on this value;

[0080] IV. After obtaining the best model, substitute the test data set into it to obtain the LR-based base learner.

[0081] (2) Construct a base learner based on the random forest algorithm (RF), extract data samples through Bootstrap sampling (sampling with replacement) to build a decision tree, and then obtain the prediction result Outcome by using the principle of majority voting;

[0082] In detail, Figure 1 As shown in the figure, the base learner based on the random forest algorithm (RF) is mainly divided into two stages. The first stage is used to build a decision tree, and the second stage is used for prediction. The first stage mainly extracts data samples through Bootstrap sampling (sampling with replacement) to build a decision tree. The specific steps are as follows:

[0083] ① Randomly select k eigenvectors from the m eigenvectors in the sample space (k <m);

[0084] ②, calculate the best segmentation method among k feature subsets;

[0085] ③ Use the best splitting method to divide the node into sub-nodes;

[0086] ④. Repeat the first three steps until all nodes become leaf nodes and have only one attribute;

[0087] ⑤. Repeat the first four steps and train N times to obtain N decision trees to form a random forest model;

[0088] The second stage mainly trains the random forest model constructed in the first stage, and links the N decision trees obtained in the first stage together using the majority voting principle, thereby outputting the prediction results. The optimal parameter set obtained through experiments in this embodiment is shown in Table 1.

[0089] Table 1 Optimal parameters of base learners based on random forest algorithm (RF)

[0090]

[0091] (3) Construct a base learner based on the support vector machine algorithm (SVM). By creating a support vector machine model based on the radial basis function (RBF), importing training set samples, and using the grid search method to obtain the normalization parameter and kernel function parameter γ RBF The best parameter set is obtained, and finally the base learner based on the support vector machine algorithm (SVM) is obtained by using the best parameter set.

[0092] The specific process is as follows:

[0093] By training sample data, we can obtain the hyperplane (w SVM , b SVM ), the expression is as follows:

[0094]

[0095] where w SVM is the normal vector (i.e., the weight vector, where w SVM τ w SVM The transpose of , determines the direction of the hyperplane; x is the sample; b SVM is the bias term, which represents the intercept of the decision function. To obtain the optimal classifier, it is necessary to make the support vector γ SVM Maximize, that is, the hyperplane (w SVM , b SVM ) and the distance between the nearest sample:

[0096]

[0097] where ||w SVM || is the weight vector w SVM Therefore, the classification problem is transformed into a mathematical problem, and the problem description is as follows:

[0098]

[0099] where y i (w SVM τ x i +b SVM )≥1 is a restriction condition for the hyperplane to be correctly classified. In order to solve the optimization problem of support vector machine (SVM) more efficiently, and to use kernel function to deal with nonlinear separable situations, it is necessary to construct Lagrangian function to transform the model training problem into a dual problem. The transformed problem is described as follows:

[0100]

[0101] where α i is the Lagrangian operator, which represents the weight of each sample in the optimization problem; y j is the support vector x j The category label of is the sample feature vector x i , x j The inner product of , the problem is transformed into solving the optimal Lagrangian operator α * In order to solve the nonlinear separability problem of the above dual problem, the model uses the radial basis function (RBF) to project the sample space into another high-dimensional feature space. The expression is as follows:

[0102] K(x i , x j )=exp(-γ RBF ||x i -x j || 2 );

[0103] in The bandwidth parameter σ controls the width of the Gaussian kernel function. i , x j ) replace x i , x j The inner product of The sample space can be transformed into a high-dimensional space, which improves the generalization ability and flexibility of the model. Finally, the dual problem is solved to obtain the optimal Lagrangian operator α * Then, the optimal parameter set is obtained by the following formula and the final bias term

[0104]

[0105] in is the optimal Lagrangian operator for the i-th training sample; K(x i , x j ) is the sample x i and the support vector x j The kernel function value of is the bias term corresponding to support vector j. Then, the average value of the bias terms of all support vectors is taken as the final bias term Through the above calculations, a base learner based on the support vector machine algorithm (SVM) is constructed.

[0106] (4) Construct a base learner based on the extreme gradient boosting tree algorithm (XGBoost). First, one-hot encode the discrete training set samples, and then introduce the processed training data to obtain the base learner based on the extreme gradient boosting tree algorithm (XGBoost) under the optimal parameters.

[0107] In detail, XGBoost is a gradient boosting method in ensemble learning, which builds a more powerful model by combining multiple weak classifiers (decision trees in this example). The XGBoost model first determines the objective function:

[0108]

[0109] in is the true value y of the classifier at iteration cycle c i With training model The loss function between is the output model of c-1 iterations, f c (x i ) is the weak decision tree added in the cth iteration, constant is a constant; Ω(f c ) is a regularization term, where γ XG To control the minimum gain of the split node, λ XG is the regularization parameter, is the leaf node weight. Then the loss function is approximated by Taylor quadratic expansion Thus we get the new objective function expression:

[0110]

[0111] in Final Order The objective function can be expressed as:

[0112]

[0113] From this formula, the optimal weight can be calculated And the objective function result:

[0114]

[0115] According to the above principles, the construction of the base learner based on the extreme gradient boosting tree algorithm (XGBoost) can be divided into the following steps:

[0116] (1) Perform one-hot encoding on discrete variables and set parameter ranges;

[0117] (ii) Grid search method is used to select parameter combinations, and negative log-likelihood loss function is used as the evaluation index to find the optimal parameter combination through K-fold cross validation;

[0118] (3) Bring the test set into the best model and output the Precision value, Recall value, F1-score value and AUC value.

[0119] Step 4: Build a diabetes classification prediction model based on the improved Stacking strategy, such as Figure 2 As shown in the figure, firstly, different training sets are obtained by Bootstrap sampling (sampling with replacement), and then all base learners constructed in step 3 are trained using K-fold cross validation; then, the mean accuracy of the base learners is used as a weight factor to assign weights to the basic learners, and a new feature space is obtained by splicing the outputs of the base learners; then, the meta learner is trained using this as a training set, and finally, the two-layer learners are weightedly spliced ​​to obtain a strong learner, thereby obtaining a learning model based on the improved Stacking strategy.

[0120] The meta-learner used is a model based on the Logistic Regression algorithm (LR). In addition to the input being the new feature space composed of the output of the base learner and sample data, its principle logic and training method are consistent with the LR base learner in step 3 (1). Its logistic regression formula is:

[0121]

[0122] Among them, X is the input in the new feature space, and θ is the weight parameter of the meta-learner H(X).

[0123] In detail: the output h of the four base learners obtained in step 3 t (x) is fused, t = 1, 2, 3, 4. The probability r is obtained by normalization t :

[0124] r t =sigmoid(h t (x));

[0125] In order to fuse the four base learners with reasonable weights, the classification accuracy p of K-fold cross validation is calculated. The weight formula is as follows:

[0126]

[0127] where p tk represents the accuracy of the kth cycle of the base learner t, p t Represents the overall accuracy of the base learner t. Finally, the final output Output is obtained through the LR meta-learner model H(X):

[0128]

[0129] Where X i is the feature vector of the new feature space, X i The fusion of 4 base learners t in the feature vector x i The output of

[0130] The training of the model is mainly divided into two parts: one is the training of the base learner, and the other is the training of the meta learner.

[0131] (1) Training of base learners: First, multiple training subsets are generated through Bootstrap sampling. Suppose the original data set is:

[0132] D={(x1, y1), (x2, y2),..., (x m ,y m )};

[0133] where x m is an n-dimensional feature vector, y m is the feature vector x m The Bootstrap sampling is a random sampling with replacement, which randomly extracts samples from the training set and replaces them each time, and repeats this process m times to generate a dataset D with the same size as the original dataset. t , t=1,2,3,4. where each D t The dimension n is consistent with the original data set D. Then, different data sets are used to train the LR, RF, SVM, and XGBoost base learners described in step 3 to obtain the optimal learner h t (x), t = 1, 2, 3, 4;

[0134] (2) Meta-learner training: First, reconstruct the feature space and combine it with the accuracy-based weight W t , then the base learner h t (x) in sample x i The output of the following is

[0135] z it =W t r t (x i ), i=1,...,m; t=1, 2, 3, 4.

[0136] Among them, r t (x i ) refers to the sample x i The normalized output probability of the base learner t is then combined by merging the outputs z of the four base learners.i1 , z i2 , z i3 , z i4 Get the new feature vector X i , to reconstruct the new feature space, the expression is as follows,

[0137] X i =[z i1 , z i2 , z i3 , z i4 ];

[0138] D′={(X1,y1),...,(X m ,y m )};

[0139] Finally, in the reconstructed feature space D′, the meta-learner H(X) is trained using the training steps of h1(x) in step 3(1).

[0140] Step 5: Input any valid feature data x covering the data type in step 1 into the strong learner H(x) trained in step 4, and output the corresponding diabetes type.

[0141] Through the above steps, a diabetes classification prediction model based on the improved Stacking strategy can be obtained. As shown in Table 2, the proposed model is significantly better than other classifiers in terms of AUC, precision, recall, and F1-score. And as shown in Table 3, under 5-fold cross validation, the value of the same evaluation index in each fold is basically in a stable state, and the mean of F1 reaches 0.735, and the mean of AUC reaches 0.824, indicating that the improved Stacking fusion model of the present invention has strong robustness and good model generalization ability.

[0142] Table 2 Comparison of classification performance of each classifier

[0143]

[0144] Table 3 Improved Staking model under 5-fold cross validation

[0145]

[0146] The specific implementation modes of the present invention are described in detail above in conjunction with the accompanying drawings, but the present invention is not limited to the above implementation modes, and various changes can be made within the knowledge scope of ordinary technicians in this field without departing from the purpose of the present invention.

Claims

1. A diabetes classification prediction method based on an improved Stacking strategy, characterized by: Step 1, obtaining population health census data to form a data set; the population health census data includes age, diabetes spectrum function, body mass index, diastolic blood pressure, triceps skin thickness, number of pregnancies, insulin concentration, blood sugar content and diabetes category; Step 2: preprocess the data samples obtained in step 1; Step 3: Build four independent basic learners, specifically: (1) Construct a base learner based on the Logistic regression algorithm. The model uses the Sigmoid function to normalize the output. By importing the training set samples, the optimal parameters are obtained to obtain the optimal base learner. (2) Construct a base learner based on the random forest algorithm, extract data samples through Bootstrap sampling to build a decision tree, and then obtain the prediction result Outcome by using the principle of minority obeys majority voting; (3) Construct a base learner based on the support vector machine algorithm. By creating a support vector machine model based on the radial basis function, importing the training set samples, and using the grid search method to obtain the normalization parameter and kernel function parameter γ RBF The best parameter set is obtained, and finally the base learner based on the support vector machine algorithm is obtained by using the best parameter set; (4) Constructing a base learner based on the extreme gradient boosting tree algorithm. First, the discrete training set samples are one-hot encoded, and then the processed training data is introduced to obtain the base learner based on the extreme gradient boosting tree algorithm under the optimal parameters. Step 4: Build a diabetes classification prediction model based on the improved Stacking strategy. First, different training sets are obtained through Bootstrap sampling, and then all base learners constructed in step 3 are trained using K-fold cross validation. Then, the mean accuracy of the base learners in K-fold cross validation is used as a weight factor to assign weights to the base learners, and the outputs of the base learners are spliced ​​to obtain a new feature space. Then, the meta learner is trained using this as a training set, and finally the two layers of learners are weightedly spliced ​​to obtain a strong learner. The meta-learner used is a model based on the Logistic regression algorithm, and its input is a new feature space composed of the weighted outputs of the base learners. Step 5: Input any valid feature data covering the data type in step 1 into the strong learner trained in step 4, and output the corresponding diabetes type.

2. The diabetes classification prediction method based on the improved Stacking strategy according to claim 1, characterized in that: The preprocessing operation of the data samples described in step 2 specifically includes: checking and deleting false data, invalid data and duplicate data, filling missing data with the mean or median, and performing PCA dimensionality reduction on high-dimensional data.

3. The diabetes classification prediction method based on the improved Stacking strategy according to claim 1, characterized in that: The base learner based on the Logistic regression algorithm is constructed as follows: i. After the training set samples are divided, they are imported into the base learner and the missing values ​​are filled using the median interpolation method; ii. Using F1-score as the model evaluation indicator, retrieve the enumeration value of each parameter through the network and traverse all enumeration value combinations; iii. Traverse all parameter combinations to obtain the maximum value of the F1-score indicator, and finally select the most appropriate model parameters based on this value; IV. After obtaining the best model, substitute the test data set into it to obtain the LR-based base learner.

4. The diabetes classification prediction method based on the improved Stacking strategy according to claim 1, characterized in that: The base learner based on the random forest algorithm is mainly divided into two stages, the first stage is used to build a decision tree, and the second stage is used for prediction; The first stage is to extract data samples through Bootstrap sampling to build a decision tree. The specific steps are as follows: ①, randomly select k features from the m features in the sample space, k <m; ②, calculate the best segmentation method among k feature subsets; ③ Use the best splitting method to divide the node into sub-nodes; ④. Repeat the first three steps until all nodes become leaf nodes and have only one attribute; ⑤. Repeat the first four steps and train N times to obtain N decision trees to form a random forest model; The second stage is mainly to train the random forest model constructed in the first stage, and use the majority voting principle to link the N decision trees obtained in the first stage together to output the prediction results.

5. The diabetes classification prediction method based on the improved Stacking strategy according to claim 1, characterized in that: The base learner construction process based on the support vector machine algorithm is as follows: By training sample data, we can obtain the hyperplane (w SVM ,b SVM ), the expression is as follows: w SVM τ x+b SVM =0; where w SVM is the normal vector, that is, the weight vector, where w SVM τ w SVM The transpose of determines the direction of the hyperplane; x is the sample vector; b SVM is the bias term, which represents the intercept of the decision function; in order to obtain the optimal classifier, it is necessary to make the support vector γ SVM Maximize, that is, the hyperplane (w SVM ,b SVM ) and the distance between the nearest sample: where ‖w SVM ‖ is the weight vector w SVM norm; therefore, the classification problem is transformed into a mathematical problem, and the problem description is as follows: where y i (w SVM τ x i +b SVM )≥1 is a restriction condition for the hyperplane to be correctly classified; in order to solve the optimization problem of support vector machine (SVM) more efficiently, and to use kernel function to deal with nonlinear separable situations; it is necessary to transform the model training problem into a dual problem by constructing Lagrangian function. The transformed problem is described as follows: Among them+ i is the Lagrangian operator, which represents the weight of each sample in the optimization problem; y0 is the category label of the support vector x0; is the sample feature vector x i , the inner product of x0, the problem is transformed into solving the optimal Lagrangian operator + * ; In order to solve the nonlinear separability problem of the above dual problem, the model uses the radial basis function (RBF) to project the sample space into another high-dimensional feature space, and the expression is as follows: 23x i ,x04=exp8-γ RBF 9:x i -x0:9 2 ;; in The bandwidth parameter controls the width of the Gaussian kernel function; by using 23x i ,x04 replacement The sample space can be transformed into a high-dimensional space, which improves the generalization ability and flexibility of the model; finally, the dual problem is solved to obtain the optimal Lagrangian operator + * Then, the optimal parameter set is obtained by the following formula and the final bias term in is the optimal Lagrangian operator for the $th training sample; 23x i ,x04 is the sample x i and the kernel function value of the support vector x0; is the bias term corresponding to the support vector @; then, the average value of the bias terms of all support vectors is taken as the final bias term 6. The diabetes classification prediction method based on the improved Stacking strategy according to claim 1, characterized in that: The base learner construction process based on the extreme gradient boosting tree algorithm is as follows:

1. Perform one-hot encoding on discrete variables and set parameter ranges; 2. Use grid search method to select parameter combinations, use negative log-likelihood loss function as evaluation index, and use K-fold cross validation to find the optimal parameter combination; 3. Bring the test set into the best model and output the Precision value, Recall value, F1-score value and AUC value.

7. The diabetes classification prediction method based on the improved Stacking strategy according to claim 1, characterized in that: The training process of the base learner is as follows: First, multiple training subsets are generated through Bootstrap sampling; let the original data set be: A=B(x . ,y . ),(x2,y2),…,(x , ,y , )C; where x , is an n-dimensional feature vector, and m is the number of samples; Bootstrap sampling uses sampling with replacement to randomly extract samples from the training set each time and replace them, and repeat this process m times to generate a data set A with the same size as the original data set E ,t=1,2,3,4. Each A E The dimension D is consistent with the original data set A; then the four base learners described in step 3 are trained using different data sets to obtain the optimal learner h E (x),t=1,2,3,4.

8. The diabetes classification prediction method based on the improved Stacking strategy according to claim 1, characterized in that: The training process of the meta-learner is as follows: First, reconstruct the feature space, combining the accuracy of each base learner I E The weight J obtained by training E , base learner h E (x) in sample x i The normalized output under K iE =J E L$MmN$O(h E (x i )),$=1,…,m;t=1,2,3,4; Then, by combining the outputs K of the four base learners i. ,K i2 ,K iP ,K iQ Get the new feature vector R i , to reconstruct the new feature space, the expression is as follows: R i =SK i. ,K i2 ,K iP ,K iQ T; A ′ =B(R . ,y . ),…,(R , ,y , )C; Finally, the meta-learner V(R) is trained in the reconstructed feature space AU.

Citation Information

Patent Citations

  • Feature selection method based on Stacking framework

    CN113535694A

  • Breast cancer diagnosis method based on improved Stacking framework

    CN118072939A

Cited By

  • Colorectal cancer postoperative venous thromboembolism risk prediction method and system

    CN119581026A

  • Multi-model fusion bone mineral density value prediction method and system

    CN119724553A

  • A multi-model fusion bone density value prediction method and system

    CN119724553B

  • Object classification method, classification model training method, related equipment and program product

    CN120257024A

  • Method for predicting intestinal preparation quality of diabetic patient based on SHAP

    CN121122679A