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

By using an SHAP-based method to predict the quality of bowel preparation in diabetic patients, and leveraging ensemble learning algorithms and the SHAP framework, this method addresses the shortcomings of relying on physician experience and traditional models in predicting the quality of bowel preparation in diabetic patients. It achieves higher accuracy and stability in prediction and provides personalized optimization solutions.

CN121122679AActive Publication Date: 2025-12-12THE FIRST AFFILIATED HOSPITAL OF XIAMEN UNIV

Patent Information

Application Number
CN202511648036.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-12
Publication Date
2025-12-12
Estimated Expiration
2045-11-12

AI Technical Summary

Technical Problem

In existing technologies, the prediction of bowel preparation quality in diabetic patients relies on physician experience and is easily affected by individual differences, resulting in insufficient consistency in judgment. Traditional machine learning models have limited accuracy and stability when dealing with complex clinical features and cannot clearly present the impact of various clinical indicators on the prediction results.

Method used

We adopted a SHAP-based method for predicting the quality of bowel preparation in diabetic patients. By collecting and preprocessing clinical feature data, we constructed an ensemble learning algorithm model and introduced the SHAP interpretable artificial intelligence framework to quantitatively output the degree of influence of each clinical feature on the prediction results.

Benefits of technology

It significantly improves the accuracy and stability of predictions, enhances the interpretability and transparency of the model, can accurately locate key influencing factors, provides personalized gut preparation optimization solutions, and ensures the long-term stability of prediction results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121122679A_ABST
    Figure CN121122679A_ABST
Patent Text Reader

Abstract

The invention discloses a diabetic intestinal preparation quality prediction method based on SHAP, and relates to the technical field of medical artificial intelligence, and the method comprises the following steps: collecting clinical feature data of a diabetic, and carrying out the preprocessing of the clinical feature data; constructing a diabetic intestinal preparation quality prediction model, taking the preprocessed clinical feature data as model input, and taking the intestinal preparation qualification rate as output; and an SHAP interpretable artificial intelligence framework is introduced to analyze and attribut the prediction model. According to the method for predicting the intestinal preparation quality of the diabetic patient, the prediction model is constructed by integrating multi-dimensional clinical data and applying an ensemble learning algorithm, so that the prediction accuracy and stability are remarkably improved, the limitation that the traditional method depends on doctor experience is broken through, the judgment inconsistency caused by individual difference and diagnosis and treatment pressure is reduced, and the prediction accuracy and stability are improved. The interaction between the features is displayed through a visualization tool, and the interpretability and transparency of the model are enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of medical artificial intelligence, in particular to a SHAP-based method for predicting the quality of intestinal preparation of diabetic patients. BACKGROUND

[0002] When diabetic patients undergo gastrointestinal diagnostic and treatment projects such as colonoscopy, the quality of intestinal preparation is a key prerequisite for affecting the accuracy of the examination and reducing the risk of missed diagnosis. Whether it is qualified or not is directly related to the accurate formulation of the subsequent diagnosis and treatment plan. At present, the prediction of the quality of intestinal preparation of diabetic patients in the clinic is mainly based on the clinical experience of doctors, combined with the basic information of the patient's blood sugar level, medication, and disease duration for comprehensive evaluation. Some scenes also try to introduce simple data statistics or single machine learning models to assist in judgment, aiming to improve prediction efficiency through data support, but the overall lack of a systematic quantitative analysis framework for the physiological characteristics and disease specificity of diabetic patients makes it difficult to fully integrate multi-dimensional clinical data to achieve stable prediction.

[0003] Although the existing prediction methods have played a certain role in clinical practice, there is still room for optimization. The evaluation relying on the experience of doctors is easily affected by individual experience differences, pressure of diagnosis and treatment scenes, etc., resulting in insufficient consistency in the judgment of different medical personnel. Although traditional machine learning models can handle some structured data, they often have limited prediction accuracy and stability when facing the complex clinical characteristics of diabetic patients due to unreasonable feature weight distribution. Moreover, the models have a "black box" property, which makes it difficult for clinicians to trace the decision basis, establish trust, and accurately locate key factors for targeted intervention. Therefore, we propose a SHAP-based method for predicting the quality of intestinal preparation of diabetic patients. SUMMARY

[0004] To solve the above technical problems, the SHAP-based method for predicting the quality of intestinal preparation of diabetic patients is provided. The technical solution solves the problems of relying on the experience of doctors, which is easily affected by individual differences and pressure of diagnosis and treatment scenes, resulting in insufficient consistency in judgment. Traditional machine learning models have limited accuracy and stability when dealing with complex clinical characteristics of patients, and due to the "black box" property, it is difficult for doctors to trace the decision basis and accurately locate key factors for intervention.

[0005] To achieve the above purposes, the technical solution adopted by the present application is as follows: The SHAP-based method for predicting the quality of intestinal preparation of diabetic patients includes the following steps: Collecting clinical feature data of diabetic patients and preprocessing the clinical feature data; A quality prediction model of intestinal preparation of diabetic patients is constructed, the preprocessed clinical feature data is taken as the input of the model, and the intestinal preparation qualified rate is taken as the output; The SHAP explainable artificial intelligence framework is introduced to analyze and attribute the prediction model; The quality prediction model outputs the qualified prediction result of intestinal preparation of diabetic patients, and the SHAP framework quantitatively outputs the influence degree of each clinical feature on the individual prediction result.

[0006] Preferably, the clinical feature data includes physiological index data, medication-related data, disease course data, and intestinal preparation-related data of the patient. The physiological index data includes blood glucose-related indicators, liver and kidney function indicators, electrolyte levels, and body mass index. The medication-related data includes the type, dosage, duration of use of diabetes treatment drugs, and the use of intestinal preparation drugs. The disease course data includes the duration of diabetes diagnosis, complication occurrence, and disease control. The intestinal preparation-related data includes the start time of intestinal preparation, diet control during preparation, and defecation. The above clinical feature data is collected through the hospital electronic medical record system, laboratory test result input, and patient special information collection form filling, and the patient's personal information is desensitized in accordance with the relevant regulations of medical data privacy protection.

[0007] Preferably, the pre-processing of the clinical feature data specifically includes: Data cleaning is performed on repeated records and logically contradictory data in the clinical feature data, and the logically contradictory data are mutually conflicting clinical feature data recorded at the same time point for the same patient. At least 3 clinical features with the highest correlation coefficient are selected by calculating the correlation coefficient of the missing feature and other complete clinical features to construct an interpolation model for filling the missing values. Values that exceed the range set by the box plot and do not conform to clinical routines are determined as outliers, and the sliding average method of adjacent time point clinical feature data is used for outlier correction. For outliers without adjacent time point data, the clinical basic information and disease progression rules of the patient are combined for correction. Z-score standardization method is used for data standardization, and all clinical feature data is converted into standardized data with a mean of 0 and a standard deviation of 1.

[0008] Preferably, before constructing the quality prediction model, a clinical feature selection step is further included, and a combination of filter selection and embedded selection is used. The filtering selection removes clinical features with a correlation coefficient absolute value lower than a set threshold by calculating the correlation coefficient between each clinical feature and the intestinal preparation qualification rate, and the correlation coefficient is calculated using a Pearson correlation coefficient or a Spearman rank correlation coefficient, and the calculation method is selected according to the data type of the clinical feature; The embedded selection is performed synchronously during the training of the integrated learning model, and the clinical features with high contribution to the prediction result are automatically selected by the weight distribution of each clinical feature during the model training process, and the redundant features with low contribution are removed; After the feature selection is completed, the selected clinical features are subjected to redundancy test, the variance inflation factor between any two clinical features is calculated, and the clinical features with a variance inflation factor higher than a set threshold are removed.

[0009] Preferably, the quality prediction model is constructed using an integrated learning algorithm; The integrated learning algorithm includes a base learner and an integrated strategy, and the base learner selects a gradient boosting decision tree, a random forest and an extreme gradient boosting tree, and each base learner is independently trained; During the training process of the gradient boosting decision tree, a weak learner is added step by step, each new weak learner is fitted to the residual of the previous round of model training, and the learning rate is adjusted according to the validation set accuracy; During the training process of the random forest, a bootstrap sampling method is used to extract multiple sub-datasets from the original clinical feature dataset, each sub-dataset corresponds to a trained decision tree, and during the construction process of the decision tree, only the optimal split feature is selected from the randomly selected part of the clinical features when each node is split; During the training process of the extreme gradient boosting tree, a regularization term is introduced to suppress model overfitting, and a parallel computing method is used; The integrated strategy adopts a weighted voting method, the weight of each base learner on the validation set is determined according to the prediction accuracy, and the final prediction model output result is obtained by weighted summation.

[0010] Preferably, the quality prediction model, the training and verification process of which includes data set division, hyperparameter optimization and model performance evaluation; The data set is divided into a training set, a validation set and a test set according to a preset proportion, the training set is used for model parameter learning, the validation set is used for hyperparameter optimization and model selection, and the test set is used for final model performance evaluation; The hyperparameter optimization adopts a grid search combined with cross-validation method, sets the search range of the hyperparameters of each base learner, traverses all hyperparameter combinations through cross-validation, and selects the hyperparameter combination with the highest validation set accuracy as the optimal hyperparameters; The model performance evaluation adopts accuracy, precision, recall, F1 score and area under ROC curve as indexes.

[0011] Preferably, the SHAP explainable artificial intelligence framework includes a model global analysis and individual prediction attribution process. The model global analysis determines the global importance of each clinical feature on the prediction result by calculating the mean of the absolute value of the SHAP value of all clinical features. The individual prediction attribution calculates the SHAP value of each clinical feature of a single patient, where the positive and negative SHAP values represent the promotion or inhibition of the clinical feature on the intestinal preparation quality prediction result of the patient, and the absolute value of the SHAP value represents the strength of the effect. During the analysis process, the SHAP framework displays the nonlinear relationship between a single clinical feature and the prediction result through a feature dependency graph, and analyzes the influence of the synergistic effect between two clinical features on the prediction result through an interaction effect graph.

[0012] Preferably, the influence degree of each clinical feature on the individual prediction result quantitatively output by the SHAP framework is presented in a visual manner, including a SHAP summary graph, a dependency graph, a waterfall chart and a force-directed graph. The SHAP summary graph displays the SHAP value distribution of each clinical feature of all patients in the form of a scatter plot. The dependency graph displays the relationship between the value of a single clinical feature and the corresponding SHAP value in the form of a curve graph. The waterfall chart displays the SHAP value accumulation process of each clinical feature in order according to the influence degree of the clinical feature on the prediction result for a single patient. The force-directed graph displays the interaction relationship between the clinical features and the comprehensive influence on the prediction result.

[0013] Preferably, after the establishment of the prediction model, the model optimization iteration step is further included, and the model is incrementally trained by continuously collecting the clinical feature data and intestinal preparation quality results of newly added diabetic patients. During the incremental training process, a sliding window mechanism is adopted to retain the latest historical data and newly added data to form a training set. The prediction performance of the model is re-evaluated regularly, and if the evaluation index decreases, the model is updated by re-optimizing the hyperparameters or adjusting the combination of the basic learners. Combined with the changes in the key clinical features obtained by the SHAP framework analysis, if a new feature that affects the intestinal preparation quality appears in the newly added clinical data, it is included in the clinical feature data set and the model is retrained.

[0014] Preferably, the clinical application process of the prediction result and the SHAP framework analysis result comprises result interpretation, scheme formulation and effect feedback. The result interpretation is performed by a clinician in combination with the specific clinical condition of the patient to professionally interpret the qualified probability of bowel preparation output by the prediction model and the influence degree of each clinical feature. The scheme formulation is based on the interpretation result, and an optimization scheme is formulated for the key clinical features affecting the quality of bowel preparation of the patient, including adjusting the use scheme of the bowel preparation drug, optimizing the diet control suggestion, and adjusting the blood glucose control target. The effect feedback is achieved by tracking the actual bowel preparation result of the patient, comparing the difference between the prediction result and the actual result, analyzing the implementation effect of the scheme, and further adjusting the optimization scheme if the actual bowel preparation quality does not meet the expectation in combination with the attribution analysis result of the SHAP framework.

[0015] Compared with the prior art, the beneficial effects of the present application are as follows: The prediction method for the quality of bowel preparation of diabetic patients provided by the present application significantly improves the accuracy and stability of prediction by integrating multi-dimensional clinical data and using an ensemble learning algorithm to construct a prediction model, breaks through the limitations of traditional reliance on doctor's experience, reduces the inconsistency of judgment caused by individual differences and diagnosis and treatment pressure, introduces the SHAP explainability framework, not only reveals the specific influence degree of each clinical feature on the prediction result, but also intuitively displays the interaction between the features through a visualization tool, enhances the explainability and transparency of the model, can more clearly understand the prediction basis, accurately locate the key influencing factors, and develop individualized bowel preparation optimization scheme accordingly, the model can adapt to the changes of clinical data in time, ensure the long-term stability and reliability of the prediction effect, and provide more scientific and accurate bowel preparation guidance for diabetic patients. BRIEF DESCRIPTION OF DRAWINGS

[0016] Figure 1 The method flowchart of the present application. DETAILED DESCRIPTION

[0017] The following description is used to disclose the present application so that those skilled in the art can implement the present application. The preferred embodiments in the following description are only as examples, and other obvious modifications can be thought of by those skilled in the art.

[0018] Referring to Figure 1 As shown in the figure, the SHAP-based prediction method for the quality of bowel preparation of diabetic patients comprises the following steps: Collecting the clinical feature data of diabetic patients and pre-processing the clinical feature data; Constructing a prediction model for the quality of bowel preparation of diabetic patients, using the pre-processed clinical feature data as the input of the model, and using the qualified rate of bowel preparation as the output. Introducing the SHAP explainable artificial intelligence framework to analyze and attribute the prediction model; Outputting the qualified prediction result of intestinal preparation of the diabetic patient through the quality prediction model, and quantitatively outputting the influence degree of each clinical feature on the individual prediction result through the SHAP framework.

[0019] The clinical feature data includes physiological index data, medication-related data, disease course data, and intestinal preparation-related data of the patient; The physiological index data includes blood glucose-related indicators, liver and kidney function indicators, electrolyte levels, and body mass index; The medication-related data includes the type of diabetes treatment drugs, the medication dosage, the medication duration, and the use of intestinal preparation drugs; The disease course data includes the duration of diabetes diagnosis, the occurrence of complications, and the disease control situation; The intestinal preparation-related data includes the start time of intestinal preparation, the diet control situation during the preparation process, and the defecation situation; The above clinical feature data is extracted through the hospital electronic medical record system, laboratory test result input, and patient special information collection form filling method. The hospital electronic medical record system mainly extracts the patient's basic demographic information, diabetes diagnosis time, complication diagnosis record, and past medication history. Laboratory test results are input into the system by laboratory personnel within 24 hours after testing, including the original test values and reference ranges of blood glucose, liver and kidney function, electrolyte, etc. The patient special information collection form is filled out by nursing staff 3 days before intestinal preparation, covering diet control execution, defecation habit, and intestinal preparation drug allergy history, etc. All data collection processes are arranged for special personnel to check the accuracy of the data to ensure that each data point is traceable. The collection process complies with the relevant regulations for medical data privacy protection and desensitizes the patient's personal information.

[0020] The pre-processing of the clinical feature data specifically includes: Data cleaning of repeated records and logically contradictory data in the clinical feature data. The logically contradictory data refers to the mutually conflicting clinical feature data recorded at the same time point for the same patient. The identification criteria for logically contradictory data include: there is no reasonable difference between the fasting blood glucose and the 2-hour postprandial blood glucose values recorded at the same time point, the creatinine and estimated glomerular filtration rate in the liver and kidney function indicators are positively correlated, and the same test item appears multiple identical test results within the same time period but with different report times. The identified logically contradictory data needs to be reviewed by a clinician, and after confirmation, the authoritative test report or re-collected data is used for correction. Those that cannot be corrected are marked and excluded. By calculating the correlation coefficients between missing features and other complete clinical features, at least three clinical features with the highest correlation coefficients are selected to construct an interpolation model to impute missing values. The specific construction steps are as follows: calculate the pairwise correlation coefficients of all clinical features, excluding features that are self-correlated or have meaningless associations; then sort them by absolute value of correlation coefficient from largest to smallest, select the top three features as input variables, use complete samples of missing features as training data, and construct an interpolation model using linear regression or random forest algorithms. For continuous missing features, linear regression is used, and for discrete missing features, random forest is used; after the model is constructed, it is first tested on a subset of complete samples to ensure that the prediction error is below a set threshold, such as a mean squared error of less than 10% of the standard deviation of the feature. Then, the qualified model is used to predict and impute missing values. After imputation, the consistency between the imputed value and other clinical indicators of the patient needs to be verified to avoid clinically unreasonable values. Values ​​exceeding the boxplot range and not conforming to clinical norms are considered outliers. The boxplot range is set from quartile Q1 minus 1.5 times the interquartile range to quartile Q3 plus 1.5 times the interquartile range. Here, Q1 is the 25th percentile of all samples for this feature, Q3 is the 75th percentile, and the interquartile range is the difference between Q3 and Q1. Criteria for determining outliers that do not conform to clinical norms are based on clinical practice guidelines. Meanwhile, special cases are excluded based on the patient's medical history. For example, hyperglycemia in patients with diabetic ketoacidosis is within the clinically reasonable range and is not considered an abnormal value. The abnormal value is corrected using the moving average method of clinical characteristic data at adjacent time points. The specific application of the moving average method is as follows: determine the time point corresponding to the abnormal value, extract three consecutive and normal time points before and after that time point. If there are fewer than three adjacent time points, take all existing data and calculate the arithmetic mean of these data. Use this average to replace the abnormal value. If there is no adjacent time point data for the abnormal value, such as when the patient is admitted for the first time and there are no previous examination records, the correction is made by referring to the conventional range of the same indicator for similar patients, taking into account the patient's age, gender, duration of diabetes and complications. For example, the abnormal value of serum creatinine in elderly patients with diabetic nephropathy can be adjusted according to the reference range of serum creatinine corresponding to their renal function stage. After correction, the rationality needs to be confirmed by a clinical pharmacist or physician. For abnormal values ​​without adjacent time point data, the correction is made by taking into account the patient's basic clinical information and disease progression pattern. Data standardization employs the Z-score standardization method, converting all clinical feature data into standardized data with a mean of 0 and a standard deviation of 1. The Z-score is calculated based on all sample data for that clinical feature, with the mean being the arithmetic mean of all sample values ​​for that feature and the standard deviation being the overall standard deviation of all sample values ​​for that feature. The standardized value for each sample is obtained by subtracting the mean from the original value and then dividing by the standard deviation. During the conversion process, a backup of the original data is retained so that the standardized data can be restored to the original indicator values ​​that are clinically understandable during subsequent model interpretation.

[0021] Before building the quality prediction model, a clinical feature selection step is also included, which uses a combination of filtered selection and embedded selection. The filtering selection method calculates the correlation coefficient between each clinical feature and the bowel preparation pass rate, and removes clinical features whose absolute correlation coefficient is lower than a set threshold. The threshold for the correlation coefficient is set based on the following criteria: referring to the threshold range used in bowel preparation-related studies of diabetic patients published in the past 5 years, combined with the number and distribution characteristics of features in this dataset, and selecting a value that ensures the number of retained features accounts for 50%-70% of the initial total number of features and that there are no obviously low-correlation features as the threshold by drawing a histogram of the correlation coefficient distribution. It is usually set to 0.1. If there are some clusters of highly correlated features in the dataset, the threshold can be appropriately reduced to 0.08 to avoid prematurely removing potentially useful features. After the threshold is determined, the predictive effectiveness of the retained features needs to be verified by cross-validation to ensure that the removal is not performed. The model performance did not significantly decrease after lowering the threshold features. The correlation coefficient was calculated using either Pearson correlation coefficient or Spearman rank correlation coefficient. The calculation method was selected based on the data type of the clinical feature. The specific selection criteria were as follows: For continuous clinical features, the Shapiro-Wilk test was first used to determine whether they conformed to a normal distribution. If the p-value was greater than 0.05, they were considered to conform to a normal distribution, and Pearson correlation coefficient was used to calculate linear correlation. If the p-value was less than or equal to 0.05, or the feature was discrete, such as drug type, complication occurrence, or ordered categorical variable such as disease control status, Spearman rank correlation coefficient was used to calculate monotonic correlation. Both coefficients were assessed for significance using a two-tailed test. Only correlation coefficients with a p-value less than 0.05 were included in the threshold determination. Embedded selection is performed synchronously during the training of the ensemble learning model. By assigning weights to each clinical feature during model training, clinical features that contribute significantly to the prediction results are automatically selected, while redundant features with low contributions are eliminated. The specific calculation mechanism varies depending on the type of base learner: In random forests, feature weights are calculated by summing the information gain (e.g., the reduction in Gini coefficient) of each feature across all decision tree splits, and then dividing the sum by the total number of decision trees to obtain the average information gain of the feature, which is used as the weight value. In extreme gradient boosting trees, feature weights comprehensively consider the reduction in loss function brought about by each split and the proportion of samples in which the feature participates in the split to the total number of samples. The calculation method is to multiply the split gain by the coverage and then normalize it. In gradient boosting decision trees, the split importance of the feature in all weak learners is calculated, and the total weight is obtained by summing the weights of all base learners. The average of the feature weights of all base learners is taken, and features with weight values ​​lower than 50% of the average weight of all features are judged to have low contributions and are eliminated. After feature selection, a redundancy test is performed on the selected clinical features. The variance inflation factor between any two clinical features is calculated, and clinical features with variance inflation factors higher than a set threshold are removed. The principle for determining the variance inflation factor threshold is based on statistical standards and clinical practice, and is usually set to 10. When the variance inflation factor is greater than 10, it indicates that there is serious multicollinearity between the two features, which will affect the stability of the model parameter estimation. If multiple features have high variance inflation factors, a stepwise removal strategy is adopted. First, the feature with the largest variance inflation factor is removed, and the variance inflation factor of the remaining features is recalculated. This process is repeated until the variance inflation factor of all features is less than or equal to 10. For clinically relevant features such as fasting blood glucose and glycated hemoglobin, if the variance inflation factor is slightly higher than 10 but lower than 15, and both make significant contributions to the prediction results, the redundancy can be reduced by calculating the ratio of the two features through feature combination, rather than direct removal.

[0022] The quality prediction model is constructed using an ensemble learning algorithm; The ensemble learning algorithm includes: a base learner and an ensemble strategy. The base learner is selected from gradient boosting decision tree, random forest and extreme gradient boosting tree. Each base learner is trained independently. In the training process of the gradient boosting decision tree, a gradual addition of weak learners is adopted. The specific addition strategy is as follows: In the initial stage, a decision tree with a depth of 1 is constructed as the first weak learner. This learner is used to predict the training set, and the residual between the predicted value and the actual value is calculated. Then, a second weak learner is constructed, and the residual is used as the target variable for fitting. The prediction result of the second learner is multiplied by the learning rate and added to the prediction result of the first learner to obtain the new model prediction value. The above process is repeated. After each addition of a weak learner, the accuracy of the validation set is calculated. When the accuracy of the validation set does not improve or decreases after 5 consecutive additions of weak learners, the addition of weak learners is stopped. The total number of weak learners at this time is the optimal number. The learning rate is initially set to 0.1. If the accuracy of the validation set is lower than 80%, the learning rate is reduced to 0.05. If there is still no improvement, it is further reduced to 0.01, and the number of weak learners is increased accordingly to ensure that the model maintains high performance while reducing the risk of overfitting. Each newly added weak learner is fitted to the residual of the previous round of model training, and the learning rate is adjusted according to the accuracy of the validation set. During the training of the random forest, the bootstrap sampling method is used to extract multiple subsets from the original clinical feature dataset. Specifically, the bootstrap sampling ratio is set to 70% of the original dataset's sample size, and the sample size of each subset is the same as the original dataset. Sampling with replacement is allowed during repeated selection of samples to ensure that the sample distribution of each subset is similar to that of the original dataset. When constructing each decision tree, the number of candidate features randomly selected during the node splitting stage is 1 / 3 of the total number of features. If the total number of features is small, such as less than 20, then 1 / 2 of the total number of features is selected. The selection of candidate features is achieved by randomly shuffling the feature order and then truncating the first N features. No pruning is performed during decision tree construction; the tree is allowed to grow naturally until the sample size of each leaf node is less than or equal to 5 or cannot split further, to retain sufficient model complexity. Simultaneously, the risk of overfitting is reduced through the ensemble of multiple trees. Each subset corresponds to one training decision tree. During the construction of the decision tree, the optimal splitting feature is selected only from a randomly selected subset of clinical features when splitting at each node. During the training of extreme gradient boosting trees, regularization terms are introduced to suppress model overfitting. Specific regularization settings include: adding a tree complexity regularization term, which consists of two parts: a leaf node number penalty term, controlled by the hyperparameter `gamma` (a larger `gamma` value results in a heavier penalty for the number of leaf nodes), and an L2 penalty term for the leaf node weights, controlled by the hyperparameter `lambda` (a larger `lambda` value results in a heavier penalty for the square of the leaf node weights). Simultaneously, a learning rate decay factor is set, where the learning rate gradually decreases by a fixed percentage as the number of weak learners increases. The initial learning rate is set to 0.1, and it decays by 10% for every 100 weak learners added. Furthermore, the maximum depth of the decision tree is limited by the hyperparameter `max_depth`, typically set to 3-10, to avoid excessive complexity in a single tree. The specific parameter values ​​of the regularization terms are determined through grid search combined with cross-validation to ensure that overfitting metrics on the validation set, such as the difference between the accuracy of the training and validation sets, are less than 5%. Parallel computation is also employed. The ensemble strategy employs a weighted voting method, determining the weight of each base learner based on its prediction accuracy on the validation set. Specifically, the weights are calculated as follows: First, the prediction accuracies of the gradient boosting decision tree, random forest, and extreme gradient boosting tree are calculated on the validation set, denoted as A1, A2, and A3 respectively. The accuracy is calculated as the number of correctly predicted samples indicating adequate or inadequate gut preparation divided by the total number of samples in the validation set. Then, the weight of each base learner is calculated, equal to its accuracy divided by the sum of the accuracies of the three learners, ensuring the sum of the three weights equals 1. The final prediction result is calculated by multiplying the probability of adequate gut preparation by its corresponding weight, and then summing the three products to obtain the final prediction probability of the ensemble model. A final prediction probability greater than 0.5 indicates adequate gut preparation; otherwise, it indicates inadequacy. The final prediction model output is obtained through weighted summation.

[0023] The training and validation process of the quality prediction model includes dataset partitioning, hyperparameter optimization, and model performance evaluation. The dataset is divided into training, validation, and test sets according to a preset ratio: 70% for training, 20% for validation, and 10% for test. Before partitioning, all patient data must be sorted by admission time. Then, stratified random sampling is used to ensure that the proportion of patients with adequate and inadequate bowel preparation in the training, validation, and test sets is consistent with the original dataset, avoiding model bias due to uneven sample distribution. A fixed random seed, such as 2024, is used during sampling to ensure the partitioning results are repeatable, facilitating comparison during subsequent model optimization and validation. At the same time, the patient data in the test set must not overlap with the training and validation sets, and the admission time of patients in the test set must be later than that of patients in the training and validation sets, simulating the model application scenario in real clinical settings. The training set is used for model parameter learning, the validation set is used for hyperparameter optimization and model selection, and the test set is used for final model performance evaluation. Hyperparameter optimization employs a grid search combined with cross-validation. The hyperparameter search ranges for each base learner are defined as follows: For gradient boosting decision trees, hyperparameters include: number of weak learners (100, 200, 300, 400, 500), learning rate (0.01, 0.05, 0.1, 0.15, 0.2), maximum decision tree depth (3, 5, 7, 10), and minimum sample size for each node split (2, 5, 10). For random forests, hyperparameters include: number of decision trees (100, 150, 200, 250, 300), maximum decision tree depth (5, 8, 10, 12, 15), number of candidate features per node split (1 / 4, 1 / 3, 1 / 2 of the total number of features), and minimum sample size for each leaf node (1, 3, 5). For extreme gradient boosting trees, hyperparameters include: The parameters include the number of weak learners (200, 300, 400, 500, 600), learning rate (0.01, 0.05, 0.1), regularization penalty coefficient (lambda) (0.1, 1, 5, 10), leaf node penalty term (gamma) (0, 0.1, 0.5, 1), and maximum decision tree depth (3, 5, 7, 10). The cross-validation folds are set to 5 folds, which means dividing the training set into 5 non-overlapping subsets. Each time, 4 subsets are selected as the training subset and 1 subset is selected as the validation subset. The model is trained and the validation accuracy is calculated. After repeating this process 5 times, the average validation accuracy of this hyperparameter combination is obtained. By traversing all hyperparameter combinations through cross-validation, the combination with the highest validation accuracy and the smallest difference between the training set accuracy and the validation set accuracy is selected as the optimal hyperparameter. Model performance is evaluated using accuracy, precision, recall, F1 score, and area under the ROC curve. The formulas for each metric are as follows: Accuracy is the number of correctly predicted samples divided by the total number of samples in the validation or test set, where correctly predicted samples include those predicted as qualified and actually qualified, and those predicted as unqualified and actually unqualified; Precision is the number of qualified samples divided by the total number of all qualified samples, reflecting the accuracy of the model's predictions; Recall is the number of qualified samples divided by the total number of all qualified samples. The actual number of qualified samples reflects the comprehensiveness of the model in identifying qualified samples; the F1 score is the harmonic mean of precision and recall, calculated by multiplying 2 by precision and recall, and then dividing by the sum of precision and recall, used to comprehensively measure the model's precision and comprehensiveness; the area under the ROC curve is obtained by plotting the ROC curve with false positive rate on the horizontal axis and true positive rate on the vertical axis, and calculating the area under the curve. The closer the area is to 1, the stronger the model's discriminative ability. All indicators are calculated based on the model's prediction results on the test set to ensure the objectivity and reliability of the evaluation.

[0024] The analysis and attribution process of the SHAP interpretability AI framework includes: global model analysis and individual prediction attribution. The specific mathematical principle of SHAP value calculation is based on the Shapley value concept in game theory, treating the model's prediction result for a single sample as the result of a 'game' involving all clinical features. The SHAP value of each feature represents the average marginal contribution of that feature to the prediction result among all possible feature subset combinations. In the calculation process, firstly, all possible feature subsets containing the feature are enumerated. For each subset, the difference between the model prediction value when the feature is included and the model prediction value when the feature is not included is calculated, which is the marginal contribution. Then, the weight is determined according to the subset size. When the subset size is k, k is the number of features in the subset, and the weight is (k!*(nk)!) / n!, where n is the total number of features. This weight reflects the probability of the subset appearing. Finally, the marginal contributions corresponding to all subsets containing the feature are multiplied by their respective weights, and the sum is obtained to obtain the SHAP value of the feature, ensuring that the sum of the SHAP values ​​of all features equals the difference between the model prediction value and the average prediction value of all samples. The global analysis of the model determines the global importance ranking of each clinical feature to the prediction results by calculating the mean of the absolute values ​​of the SHAP values ​​of all clinical features. Individual predictive attribution is achieved by calculating the SHAP value of each clinical characteristic of a single patient. The sign of the SHAP value indicates whether the clinical characteristic promotes or inhibits the patient's qualified prediction of bowel preparation, and the absolute value of the SHAP value indicates the strength of the effect. During the analysis process, the SHAP framework constructs a feature dependency graph to demonstrate the non-linear relationship between a single clinical feature and the prediction result. The steps for generating the feature dependency graph are as follows: First, select a target feature from all clinical features and extract the value of this feature in all samples and its corresponding SHAP value; then, sort the values ​​of the target feature in ascending order, and plot a scatter plot with the sorted feature values ​​on the horizontal axis and the corresponding SHAP values ​​on the vertical axis, where each scatter point represents a sample; next, use a locally weighted regression algorithm such as LOESS to fit the scatter points and generate a smooth curve. The trend of the curve reflects the non-linear relationship between the target feature value and the SHAP value. If the curve shows an upward trend, it indicates that the larger the feature value, the stronger the promoting effect on proper bowel preparation; conversely, the weaker the feature value, the stronger the inhibitory effect. The interaction effect plot was used to analyze the synergistic effect between two clinical features on the prediction results. The steps to generate the interaction effect plot were as follows: Select two clinical features with potential interaction, such as blood glucose level and bowel preparation drug dosage, denoted as feature X and feature Y; Divide the value of feature Y into three groups (high, medium, and low) according to the ternary digits and mark them with different colors; For each group of data, plot a curve with the value of feature X on the horizontal axis and the corresponding SHAP value on the vertical axis; By comparing the trend differences of the three groups of curves, the synergistic effect of features X and Y was analyzed. For example, when feature Y is at a high level, an increase in the value of feature X significantly increases the SHAP value, while when feature Y is at a low level, an increase in the value of feature X has a smaller impact on the SHAP value, indicating that there is a positive synergistic effect between the two, which jointly promotes qualified bowel preparation.

[0025] The impact of each clinical feature quantitatively output by the SHAP framework on individual prediction results is presented through visualization. These visualizations include: SHAP summary plots, dependency plots, waterfall plots, and force-directed plots. The drawing methods and technical implementations of each graph are as follows: SHAP summary plots are drawn using Python's matplotlib or seaborn library. The vertical axis represents the clinical feature name, sorted from largest to smallest by the mean absolute value of all samples' SHAP values ​​according to feature importance. The horizontal axis represents the SHAP value, with each feature corresponding to multiple scatter points. The color of the scatter points represents the magnitude of the feature's value; darker colors indicate larger values. The distribution of the scatter points allows observation of the direction and dispersion of the feature's influence on the prediction results. Dependency plots are also implemented using matplotlib. First, a scatter plot of feature values ​​versus SHAP values ​​is drawn, then... Outlier Factor models from the scikit-learn library are used to remove outliers. Then, a locally weighted regression curve is fitted using the lowess function from the statsmodels library. The smoothness of the curve is controlled by adjusting the span parameter, typically set to 0.8. The waterfall plot is generated using the waterfall_plot function from the SHAP library. Starting with the baseline prediction value (the average predicted value of all samples), it displays the SHAP value of each feature in descending order of absolute SHAP value. Red bars indicate that the feature promotes the prediction result (positive SHAP value), and blue bars indicate that the feature inhibits the prediction result (negative SHAP value). The actual predicted value for the sample is obtained by summing these values. The feature name and value are labeled below each bar. The force-directed plot uses the force function from the SHAP library. The `plot` function generates a horizontal bar chart. The left side shows the baseline predicted value, the right side shows the final predicted value, and the middle shows the SHAP values ​​of each feature. Red bars represent positive effects, and blue bars represent negative effects. The length of the bars is proportional to the absolute value of the SHAP values. The feature name and specific value are labeled next to the bars. Interactive viewing is supported, and more detailed numerical information can be obtained by hovering the mouse over the bar. All visualizations are saved as high-resolution images (300 dpi) for easy presentation in clinical reports and publication in academic papers. The SHAP summary plot shows the distribution of SHAP values ​​for all clinical characteristics of all patients in the form of a scatter plot; The dependency graph displays the relationship between the value of a single clinical feature and its corresponding SHAP value in the form of a curve. The waterfall chart is for a single patient, sorted by the degree of influence of clinical features on the prediction results, and sequentially shows the accumulation process of the SHAP values ​​of each clinical feature. The force-directed graph illustrates the interactions between various clinical features and their combined impact on prediction results.

[0026] After the predictive model is established, it also includes a model optimization and iteration step. This involves continuously collecting clinical characteristic data and bowel preparation quality results from newly added diabetic patients to incrementally train the model. The size of the sliding window mechanism is determined based on the rate of clinical data accumulation, typically set to include complete data from the most recent 1000 diabetic patients. When 200 new cases are added, the window is updated, removing the earliest 200 cases and retaining the latest 1000 cases to form a new training set. This ensures that the training data always reflects recent changes in patients' clinical characteristics, avoiding performance degradation due to insufficient data timeliness. Re-evaluation is scheduled every 3 months. Each evaluation uses data from patients who did not participate in model training within the last 3 months to construct a new test set with a sample size of no less than 100 cases. Accuracy, F1 score, and area under the ROC curve are calculated and compared with the indicators from the previous evaluation. The model performance trend is judged by comparing it with the baseline metrics at the time of model establishment. The specific strategy for hyperparameter adjustment is divided into two cases: if the evaluation metric decreases by less than 5% compared with the previous one, the search range is narrowed and fine-tuned around the original optimal hyperparameters. For example, the learning rate is adjusted within the range of 0.8-1.2 times the original value, the number of weak learners is adjusted within the range of ±10% of the original value, and the cross-validation fold remains unchanged at 5 fold. If the metric decreases by more than or equal to 5%, a full-range grid search is performed again. At the same time, the combination of basic learners is considered to be adjusted, such as replacing the gradient boosting decision tree with a lightweight gradient boosting machine (LightGBM), or adding a Naive Bayes as a new basic learner. After adjustment, the model is retrained and 5-fold cross-validation is performed. The model with the best performance on the validation set is selected as the updated model. The reasons and effects of hyperparameter adjustment are recorded to form a model iteration log for subsequent traceability and analysis. During incremental training, a sliding window mechanism is used to retain the latest historical data and the newly added data together to form the training set; The predictive performance of the model should be re-evaluated regularly. If the evaluation metrics decline, the model should be updated by re-optimizing the hyperparameters or adjusting the combination of the base learners. Based on the changes in key clinical features obtained from the SHAP framework, if new features that affect the quality of bowel preparation appear in the newly added clinical data, they are included in the clinical feature dataset and the model is retrained.

[0027] The clinical application process of the prediction results and SHAP framework analysis results includes: result interpretation, protocol formulation, and effect feedback; The results are interpreted by clinicians who, in conjunction with the patient’s specific clinical condition, provide a professional interpretation of the probability of successful bowel preparation output by the predictive model and the degree of influence of each clinical feature. The proposed plan is based on the interpretation results and focuses on key clinical features that affect the quality of bowel preparation in patients. The plan includes adjusting the use of bowel preparation medications, optimizing dietary control recommendations, and adjusting blood glucose control targets. The effect feedback is achieved by tracking the actual bowel preparation results of patients, comparing the difference between the predicted results and the actual results, analyzing the effectiveness of the program implementation, and further adjusting and optimizing the program if the actual bowel preparation quality does not meet expectations, based on the attribution analysis results of the SHAP framework.

[0028] This study included 50 diabetic patients scheduled for colonoscopy at the endocrinology and gastroenterology departments of a tertiary hospital. The data included the clinical data of the first 20 patients. All patients signed informed consent forms. Data collection followed medical privacy protection regulations, and personal information such as names and ID numbers were anonymized. Only the medical record number was retained for data traceability.

[0029] Clinical characteristic data collection was conducted through the hospital's electronic medical record system, extracting patient information such as gender, age, diabetic complications, history of gastrointestinal surgery, chemotherapy history, smoking and drinking history, and medication records (e.g., anticholinergic drugs, iron supplements, metformin, etc.). Laboratory testing was used to obtain BMI, hemoglobin, electrolyte levels (potassium, sodium, calcium, magnesium), serum triglycerides, and cholesterol levels. A specialized information collection form recorded patient symptoms such as intestinal obstruction, indigestion, and constipation, as well as the time interval between laxative administration and examination. The time interval from laxative administration to examination was categorized into three intervals: ≤2 hours, 2-4 hours, and ≥5 hours. Bowel preparation quality was determined by the colonoscopy physician using the Boston Bowel Preparation Rating Scale. A score ≥6 was considered satisfactory (corresponding to "Yes" in Document 1), and <6 was considered unsatisfactory (corresponding to "No" in Document 1).

[0030] The 50 collected data were preprocessed. First, data cleaning was carried out, and logical contradictions were found in the data of 2 patients. In 1 patient, the "hypokalemia" recorded at the same time point conflicted with the blood potassium value of 3.8 mmol / L in the "electrolyte test report" which is within the normal range of 3.5-5.5 mmol / L. After reviewing the electronic medical record, it was confirmed that it was a data entry error and was corrected to "no hypokalemia". Another patient was recorded as having both a history of chemotherapy and no history of malignant tumors. Based on the oncology consultation records, it was confirmed that there was no history of chemotherapy, and the erroneous record was deleted. Regarding missing values, it was found that 8 patients had missing "hemoglobin" data. The correlation coefficients between this characteristic and age, BMI, and hypoproteinemia were calculated. The highest correlation coefficient was 0.62 with hypoproteinemia, followed by BMI at 0.45 and age at 0.38.

[0031] These three features were selected to construct a random forest interpolation model to impute missing values. After imputation, the verification showed that the imputed values ​​did not contradict other clinical indicators of the patient. For example, in the 11th line of document 1, the imputed hemoglobin value of 125 g / L for a 72-year-old patient with a BMI of 22.5 is consistent with the routine level for elderly diabetic patients.

[0032] Outlier identification was performed using box plots, calculating the interquartile ranges of all continuous features. One patient had a BMI of 18.75 (see line 9 of document 1), which, although lower than Q1 - 1.5 IQR (19.2), was determined to be physiologically underweight and not an outlier, considering the patient's advanced age of 82 and lack of history of gastrointestinal disease. Another patient had a triglyceride level of 4.8 mmol / L, exceeding Q3 + 1.5 IQR (4.5), which was confirmed by laboratory testing. The patient also had a history of alcohol consumption, meeting the diagnostic criteria for hypertriglyceridemia; therefore, the original data were retained. Finally, Z-score standardization was used to convert continuous features such as BMI, age, and hemoglobin into standardized data with a mean of 0 and a standard deviation of 1, facilitating model training.

[0033] The feature selection phase employed a combination of filtering and embedded selection. Filtering calculated the correlation coefficients between each feature and the bowel preparation quality results. The absolute values ​​of the correlation coefficients from laxative to examination time (0.35), intestinal obstruction (0.32), indigestion (0.29), and hypoalbuminemia (0.27) were all higher than the set threshold of 0.1 and were retained. The correlation coefficients of education level (0.08) and alcohol consumption history (0.06) were lower than the threshold and were temporarily removed. Embedded selection was performed simultaneously during the training of the ensemble learning model. Taking random forest as an example, the average information gain of each feature was calculated during training. The results showed that intestinal obstruction (0.42), laxative to examination time (0.38), indigestion (0.35), and BMI (0.28) contributed significantly, while the previously retained hypoalbuminemia (0.09), with an information gain below the average of 0.21, was removed. Redundancy tests were performed to calculate the variance inflation factor among the remaining features. It was found that the variance inflation factor for intestinal obstruction and indigestion was 7.8, which is less than 10, indicating no serious multicollinearity. Finally, eight features were determined as input variables for the model: intestinal obstruction, indigestion, time from laxative to examination, BMI, age, history of constipation, history of chemotherapy, and use of anticholinergic drugs.

[0034] An ensemble learning prediction model was constructed, with gradient boosting decision trees, random forests, and extreme gradient boosting trees selected as the base learners. During gradient boosting decision tree training, the initial number of weak learners was set to 200, with a learning rate of 0.1. The accuracy was adjusted based on the validation set. When the number of weak learners increased to 300 and the learning rate decreased to 0.05, the validation set accuracy reached a maximum of 86%, at which point the model residuals converged. For random forests, bootstrap sampling was used to extract 5 small subsets from 35 examples in the training set (70% of the total data). 30 decision trees were trained for each subset. When splitting nodes, 50% of the four features were randomly selected, resulting in a final random forest model with 150 decision trees. The extreme gradient boosting tree introduces a regularization term, setting lambda=1 (L2 penalty) and gamma=0.1 (leaf node penalty). The maximum depth of the decision tree is 7. Parallel computing is used to accelerate training, reducing training time by 40% compared to the gradient boosting decision tree. The ensemble strategy uses a weighted voting method, determining the weights of each base learner based on the accuracy of 10 validation cases: 88% accuracy for the gradient boosting decision tree, 0.35 weight for the random forest, 85% accuracy for the extreme gradient boosting tree, and 0.35 weight for the extreme gradient boosting tree. The weighted sum is then used to obtain the final prediction result. Performance evaluation on a 5-case test set shows an accuracy of 88%, precision of 87%, recall of 89%, F1 score of 0.86, and area under the ROC curve of 0.91, meeting clinical prediction requirements.

[0035] The SHAP framework was introduced to analyze the model. Global importance analysis was performed by calculating the mean absolute values ​​of the SHAP values ​​of each feature for all patients, and the feature importance ranking was obtained as follows: time from laxative to examination mean 0.32, intestinal obstruction 0.28, indigestion 0.25, BMI 0.21, age 0.18, history of constipation 0.15, use of anticholinergic drugs 0.12, history of chemotherapy 0.09. Taking the patient in line 3 of document 1, who is 81 years old, has a BMI of 21.5, primary school education or below, no diabetic complications, no history of gastrointestinal surgery, no intestinal obstruction, has indigestion, no history of constipation, no history of chemotherapy, smoking, or alcohol consumption, has a laxative-to-examination time ≥5 hours, no hypoalbuminemia or electrolyte abnormalities, no use of anticholinergic drugs, has iron supplementation, no use of hypoglycemic drugs, and has a bowel preparation result of "yes", individual attribution was performed, and the SAP values ​​of each characteristic of this patient were calculated: laxative-to-examination time ≥5 hours SAP value 0.42, positively promoting, indicating that the extended time interval increases the probability of qualified bowel preparation; indigestion 0.21, positively promoting, possibly due to increased sensitivity to bowel preparation drugs; iron supplementation -0.18, negatively inhibiting, iron supplementation may affect intestinal peristalsis; age 81 years -0.15, negatively inhibiting, indicating weakened intestinal motility in elderly patients; the absolute values ​​of the SAP values ​​of other characteristics are all less than 0.1. The SHAP waterfall chart clearly shows that the model's baseline prediction value for the average pass rate of all patients is 0.52. After accumulating the SHAP values ​​of each feature, the final prediction value is 0.78, which is considered a pass rate for bowel preparation, consistent with the actual examination results. The dependency plot showed a positive correlation between the time from laxative administration to examination and the SHAP value. When the time interval increased from ≤2 hours to ≥5 hours, the SHAP value increased from -0.25 to 0.45, indicating that the longer the time interval, the stronger the promoting effect on a qualified result. The interaction effect plot showed a synergistic effect between intestinal obstruction and indigestion. When a patient had both intestinal obstruction and indigestion, the sum of their SHAP values ​​was 0.28 + 0.25 = 0.53, which was much higher than the effect of either condition alone.

[0036] In the clinical application phase, the attending gastroenterologist interpreted the predicted results based on the patient's clinical condition, identifying the time from laxative administration to examination as the key influencing factor, while iron supplementation and advanced age were secondary inhibitory factors. Based on this, an optimized plan was developed: the bowel preparation start time was advanced by 1 hour, ensuring the time from laxative administration to examination was controlled within the 2-4 hour range; iron supplementation was discontinued due to the patient's anemia, and after consultation with the hematology department, it was adjusted to oral vitamin B12 as a substitute; the patient was instructed to perform abdominal massage twice daily for 15 minutes three days prior to bowel preparation to promote intestinal motility. After following the plan, the bowel preparation score during colonoscopy was a satisfactory 7, consistent with the prediction. Feedback showed that after adjusting the laxative timing and discontinuing iron supplementation, the patient did not experience constipation or abdominal distension. A one-month follow-up showed no worsening of anemia symptoms, validating the safety and effectiveness of the plan.

[0037] Sixty diabetic patients scheduled for colonoscopy at this hospital between July and December 2023 were selected as the second group of study subjects. This group included the last 10 patients from Document 1, and 40 additional patients whose fasting blood glucose (mmol / L), glycated hemoglobin (%), and other blood glucose-related indicators mentioned in Document 2 were supplemented. All data collection procedures were consistent with the first embodiment, and the bowel preparation quality assessment criteria were the same. During the data preprocessing stage, duplicate records were found in 5 patients. Among them, 3 patients had their first colonoscopy appointment canceled due to inadequate bowel preparation, and their clinical data before the second appointment were retained; 2 patients had BMI errors, with 29.14 mistakenly recorded as 291.4 and 22.60 mistakenly recorded as 2.26, respectively, and these were corrected based on their physical examination reports. Regarding missing value handling, 12 patients had missing data for "glycated hemoglobin" (HbA1c). The correlation coefficients between HbA1c and fasting blood glucose were calculated to be 0.71, diabetic complications 0.43, and metformin 0.39. A linear regression interpolation model was constructed to impute the missing values. After imputation, the HbA1c value in line 17 of document 1 for a 69-year-old patient was 6.8%, consistent with the controlled level of 7.2 mmol / L for fasting blood glucose. In handling outliers, one patient had a fasting blood glucose of 13.5 mmol / L, exceeding the box plot Q3 + 1.5 IQR (11.2). Upon review, it was found that the patient had type 1 diabetes and had not injected insulin as scheduled before the test. Based on the endocrinology department's recommendation, the value was corrected to the pre-test adjusted blood glucose value of 8.9 mmol / L to ensure the data reflected the actual situation after clinical intervention. One patient had a cholesterol value of 6.2 mmol / L, which, although higher than the normal range, was considered reasonable and retained due to the patient's family history of hypercholesterolemia. Data standardization also used the Z-score method to cover newly added blood glucose-related indicators.

[0038] During feature selection, the correlation coefficients between each feature and bowel preparation quality were calculated using a filtering method. Fasting blood glucose (Pearson correlation coefficient 0.38), glycated hemoglobin (0.35), laxative-to-examination time (Spilman correlation coefficient 0.33), and constipation history (0.30) had absolute values ​​higher than the threshold of 0.12. Due to the increased number of new features, the threshold was appropriately increased, and these features were retained. Smoking history (0.07) and sulfonylurea use (0.09) had low correlation coefficients and were removed. In the embedded selection process, during extreme gradient boosting tree training, feature weight calculations revealed that fasting blood glucose (0.45), glycated hemoglobin (0.39), laxative-to-examination time (0.36), constipation history (0.32), and hypocalcemia (0.25) significantly contributed more than other features. The previously retained age weight (0.11) was lower than the average of 0.28 and was therefore removed. Redundancy tests showed that the variance expansion factor for fasting blood glucose and glycated hemoglobin was 9.2, less than 10, indicating no severe multicollinearity; the variance expansion factor for hypocalcemia and hypomagnesemia was 8.5, so both were retained. Ultimately, eight features were determined to be used as model inputs: fasting blood glucose, glycated hemoglobin, time from laxative to examination, history of constipation, hypocalcemia, intestinal obstruction, dyspepsia, and sodium-glucose cotransporter 2 inhibitor.

[0039] In the construction of the ensemble learning model, the parameters of the base learners were adjusted to adapt to the newly added features. The gradient boosting decision tree was set with 400 weak learners and a learning rate of 0.04. Through 5-fold cross-validation, it was found that the validation set accuracy was highest at 89% when the maximum depth of the decision tree was 7. The random forest used bootstrap sampling to generate 6 subsets, with 40 decision trees trained on each subset. When splitting nodes, 62.5% of the total number of features (5 features) were randomly selected to construct a model with 240 decision trees. The extreme gradient boosting tree optimized the regularization parameters, setting lambda=0.8 and gamma=0.2, with a maximum decision tree depth of 8, resulting in a 25% reduction in parallel computation time compared to the first embodiment. The ensemble weights were determined based on the accuracy of 12 validation cases: 0.38 for the gradient boosting decision tree (91% accuracy), 0.27 for the random forest (88% accuracy), and 0.35 for the extreme gradient boosting tree (92% accuracy). The weighted sum yielded the final prediction result. The model's evaluation metrics on the test set of 6 cases were: accuracy 90%, precision 92%, recall 88%, F1 score 0.89, and area under the ROC curve 0.93. The performance was improved compared to the first embodiment, which is presumably related to the addition of blood glucose-related features.

[0040] SHAP framework analysis showed that the global importance ranking was as follows: fasting blood glucose, glycated hemoglobin, time from laxative to examination, history of constipation, and hypocalcemia. Taking the patient in line 10 of document 1—an 82-year-old with a BMI of 22.66, intestinal obstruction, dyspepsia, a time from laxative to examination of 2-4 hours, no hypoproteinemia, and confirmed use of anticholinergic drugs, and a bowel preparation result of "yes"—as an example, after supplementing with new data of fasting blood glucose 8.3 mmol / L and glycated hemoglobin 7.1%, the SHAP values ​​for each feature were calculated as follows: Fasting blood glucose 8.3 mmol / L SHAP value 0.35, positively promoting, as blood glucose is controlled within a reasonable range and intestinal motility is not affected; Glycated hemoglobin 7.1% SHAP value 0.28, positively promoting, as long-term blood glucose control is satisfactory; Time from laxative to examination of 2-4 hours SHAP value 0.22, positively promoting; Intestinal obstruction -0.19, negatively inhibiting; Anticholinergic drug use -0.16, negatively inhibiting, possibly weakening intestinal peristalsis. The SHAP force-directed plot clearly shows the interaction of various features. The synergistic effect of fasting blood glucose and glycated hemoglobin results in a SHAP value of 0.35 + 0.28 = 0.63, which offsets the inhibitory effects of intestinal obstruction and anticholinergic drugs. The final predicted value is 0.81, and the baseline predicted value is 0.55, which is considered acceptable and consistent with the actual results. The dependency plot shows that when fasting blood glucose is in the range of 4.4-7.0 mmol / L, the SHAP value increases with the increase of blood glucose. After exceeding 7.0 mmol / L, the SHAP value gradually decreases, indicating that both excessively high and low blood glucose levels may affect the quality of bowel preparation.

[0041] In clinical application, the gastroenterology and endocrinology departments jointly interpreted the predicted results and concluded that the patient's well-controlled fasting blood glucose and glycated hemoglobin were key to achieving a satisfactory result, while intestinal obstruction and anticholinergic drugs were the main limiting factors. The optimized protocol included: adjusting the anticholinergic drug dosage from three times daily to once daily three days before bowel preparation, suspending it on the day of the examination to avoid excessive inhibition of intestinal motility; increasing the dosage of bowel preparation medication, polyethylene glycol 4000 powder, from 2000ml to 2500ml, divided into four doses every six hours, and instructing the patient to walk for 15 minutes after each dose, three times daily; maintaining fasting blood glucose <8 mmol / L and glycated hemoglobin <7.5%, monitoring blood glucose three times the day before the examination to ensure no significant fluctuations. After following the protocol, the patient achieved a bowel preparation score of 8 points, which was satisfactory, and no adverse reactions such as abdominal pain or distension occurred. Feedback showed that after adjusting the dosage of anticholinergic drugs, the frequency of intestinal peristalsis increased from once a day to twice a day, and the discomfort symptoms related to intestinal obstruction did not recur; blood glucose monitoring results remained stable at 7.2-7.8 mmol / L, and the safety of the regimen was confirmed.

[0042] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely principles of the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the claimed invention. The scope of protection claimed by the appended claims and their equivalents is defined.

Claims

1. A method for predicting the quality of bowel preparation in diabetic patients based on SHAP, characterized in that, Includes the following steps: Collect clinical characteristic data of diabetic patients and preprocess the clinical characteristic data; A predictive model for the quality of bowel preparation in diabetic patients was constructed, with preprocessed clinical characteristic data as input and bowel preparation pass rate as output. The quality prediction model is constructed using an ensemble learning algorithm; The ensemble learning algorithm includes: a base learner and an ensemble strategy. The base learner is selected from gradient boosting decision tree, random forest and extreme gradient boosting tree. Each base learner is trained independently. In the training process of gradient boosting decision trees, weak learners are added step by step. Each new weak learner is fitted to the residual of the previous model training, and the learning rate is adjusted according to the accuracy of the validation set. During the training of the random forest, the bootstrap sampling method is used to extract multiple subsets from the original clinical feature dataset. Each subset corresponds to a decision tree. During the construction of the decision tree, when splitting at each node, the optimal splitting feature is selected only from a randomly selected subset of clinical features. During the training of extreme gradient boosting trees, a regularization term is introduced to suppress model overfitting, and parallel computation is employed. The ensemble strategy employs a weighted voting method, determining the weight of each base learner based on its prediction accuracy on the validation set, and obtaining the final prediction model output by weighted summation. The SHAP interpretable artificial intelligence framework is introduced to analyze and attribute the quality prediction model. The quality prediction model outputs the prediction results of bowel preparation qualification for diabetic patients, and the SHAP framework is used to quantitatively output the degree of influence of each clinical feature on the individual prediction results.

2. The method for predicting bowel preparation quality in diabetic patients based on SHAP according to claim 1, characterized in that, The clinical characteristic data includes: patient physiological indicators, medication-related data, disease course data, and bowel preparation-related data; The physiological indicators include: blood glucose-related indicators, liver and kidney function indicators, electrolyte levels, and body mass index; The medication-related data includes: the types of diabetes treatment drugs, dosages, duration of medication, and the use of bowel preparation drugs; The disease course data includes: the time to diagnosis of diabetes, the occurrence of complications, and the status of disease control; The data related to bowel preparation includes: the start time of bowel preparation, dietary control during the preparation process, and bowel movement status; The aforementioned clinical characteristic data were collected through extraction from the hospital's electronic medical record system, entry of laboratory test results, and completion of patient-specific information collection forms. During the collection process, relevant regulations on medical data privacy protection were followed, and patient personal identity information was anonymized.

3. The method for predicting bowel preparation quality in diabetic patients based on SHAP according to claim 1, characterized in that, The preprocessing of clinical feature data specifically includes: Data cleaning is performed on duplicate records and logically contradictory data in clinical feature data, wherein the logically contradictory data refers to conflicting clinical feature data recorded at the same time point for the same patient. By calculating the correlation coefficient between missing features and other complete clinical features, at least three clinical features with the highest correlation coefficients are selected to construct an interpolation model to fill in the missing values. Values ​​that exceed the box plot range and do not conform to clinical norms are identified as outliers. Outlier correction is performed using a moving average of clinical characteristic data at adjacent time points. For outliers without adjacent time point data, correction is performed by combining the patient's basic clinical information and disease progression patterns. Data standardization was performed using the Z-score standardization method, which transformed all clinical feature data into standardized data with a mean of 0 and a standard deviation of 1.

4. The method for predicting the quality of bowel preparation in diabetic patients based on SHAP according to claim 1, characterized in that, Before building the quality prediction model, a clinical feature selection step is also included, which uses a combination of filtered selection and embedded selection. The filtering selection eliminates clinical features whose absolute correlation coefficients are lower than a set threshold by calculating the correlation coefficients between each clinical feature and the bowel preparation pass rate. The correlation coefficients are calculated using either Pearson correlation coefficient or Spearman rank correlation coefficient, and the calculation method is selected according to the data type of the clinical feature. Embedded selection is performed synchronously during the training of the ensemble learning model. By allocating weights to each clinical feature during model training, clinical features that contribute significantly to the prediction results are automatically selected, while redundant features with low contributions are removed. After feature selection is completed, a redundancy test is performed on the selected clinical features, the variance inflation factor between any two clinical features is calculated, and clinical features with variance inflation factors higher than a set threshold are removed.

5. The method for predicting bowel preparation quality in diabetic patients based on SHAP according to claim 1, characterized in that, The training and validation process of the quality prediction model includes dataset partitioning, hyperparameter optimization, and model performance evaluation. The dataset is divided into training set, validation set and test set according to a preset ratio. The training set is used for model parameter learning, the validation set is used for hyperparameter optimization and model selection, and the test set is used for final model performance evaluation. Hyperparameter optimization employs a grid search combined with cross-validation. The search range of hyperparameters for each basic learner is set, and all hyperparameter combinations are traversed through cross-validation. The hyperparameter combination with the highest accuracy on the validation set is selected as the optimal hyperparameter. Model performance was evaluated using accuracy, precision, recall, F1 score, and area under the ROC curve.

6. The method for predicting the quality of bowel preparation in diabetic patients based on SHAP according to claim 1, characterized in that, The parsing and attribution process of the SHAP interpretable artificial intelligence framework includes: global model parsing and individual prediction attribution; The global analysis of the model determines the global importance ranking of each clinical feature to the prediction results by calculating the mean of the absolute values ​​of the SHAP values ​​of all clinical features. Individual predictive attribution is achieved by calculating the SHAP value of each clinical characteristic of a single patient. The sign of the SHAP value indicates whether the clinical characteristic promotes or inhibits the patient's qualified prediction of bowel preparation, and the absolute value of the SHAP value indicates the strength of the effect. During the analysis process, the SHAP framework constructs a feature dependency graph to show the non-linear relationship between a single clinical feature and the prediction result, and analyzes the impact of the synergistic effect between two clinical features on the prediction result through an interaction effect graph.

7. The method for predicting bowel preparation quality in diabetic patients based on SHAP according to claim 1, characterized in that, The degree of influence of each clinical feature quantitatively output by the SHAP framework on individual prediction results is presented through visualization, including: SHAP summary diagram, dependency diagram, waterfall diagram, and force-directed diagram; The SHAP summary plot shows the distribution of SHAP values ​​for all clinical characteristics of all patients in the form of a scatter plot; The dependency graph displays the relationship between the value of a single clinical feature and its corresponding SHAP value in the form of a curve. The waterfall chart is for a single patient, sorted by the degree of influence of clinical features on the prediction results, and sequentially shows the accumulation process of the SHAP values ​​of each clinical feature. The force-directed graph illustrates the interactions between various clinical features and their combined impact on prediction results.

8. The method for predicting the quality of bowel preparation in diabetic patients based on SHAP according to claim 1, characterized in that, After the prediction model is established, it also includes a model optimization and iteration step, which involves continuously collecting clinical characteristic data and bowel preparation quality results of newly added diabetic patients to incrementally train the model. During incremental training, a sliding window mechanism is used to retain the latest historical data and the newly added data together to form the training set; The predictive performance of the model should be re-evaluated regularly. If the evaluation metrics decline, the model should be updated by re-optimizing the hyperparameters or adjusting the combination of the base learners. Based on the changes in key clinical features obtained from the SHAP framework, if new features that affect the quality of bowel preparation appear in the newly added clinical data, they are included in the clinical feature dataset and the model is retrained.

9. The method for predicting the quality of bowel preparation in diabetic patients based on SHAP according to claim 1, characterized in that, The clinical application process of the prediction results and SHAP framework analysis results includes: result interpretation, protocol formulation, and effect feedback; The results are interpreted by clinicians who, in conjunction with the patient’s specific clinical condition, provide a professional interpretation of the probability of successful bowel preparation output by the predictive model and the degree of influence of each clinical feature. The proposed plan is based on the interpretation results and focuses on key clinical features that affect the quality of bowel preparation in patients. The plan includes adjusting the use of bowel preparation medications, optimizing dietary control recommendations, and adjusting blood glucose control targets. The effect feedback is achieved by tracking the actual bowel preparation results of patients, comparing the difference between the predicted results and the actual results, analyzing the effectiveness of the program implementation, and further adjusting and optimizing the program if the actual bowel preparation quality does not meet expectations, based on the attribution analysis results of the SHAP framework.

Citation Information

Patent Citations

  • Diabetes classification prediction method based on improved Stacking strategy

    CN118609795A

  • Prediction method for intestinal preparation of patient before colonoscopy based on machine learning

    CN119541856A

  • Muscle fatty degeneration risk assessment method based on machine learning

    CN120600307A

  • Electronic medical record data patient information desensitization and inspection data standardization method

    CN120766844A

  • Method and system for predicting intestinal preparation failure risk of old hospitalized patient

    CN120878243A

Cited By

  • Donor-receptor matching prediction system based on multi-source heterogeneous data fusion

    CN122087477A