Construction method of gastric cancer operation risk prediction model, medium and device

Through the improved MICE and ADASYN algorithm combined with the XGBoost model, the missing values and a few samples in the high-dimensional, heterogeneous and unbalanced gastric cancer surgical data were solved, and an efficient and accurate gastric cancer surgical risk prediction model was constructed, which improved the accuracy and stability of the prediction, and was suitable for the evaluation of complications and prognostic risks after gastric cancer surgery.

CN120376169APending Publication Date: 2025-07-25QINGDAO UNIV +3
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510474610.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-16
Publication Date
2025-07-25

Smart Images

  • Figure QLYQS_1
    Figure QLYQS_1
  • Figure QLYQS_15
    Figure QLYQS_15
  • Figure QLYQS_26
    Figure QLYQS_26
Patent Text Reader

Abstract

The invention discloses a stomach cancer operation risk prediction model construction method, medium and device, and relates to the technical field of medical data analysis and machine learning, the method comprises the following steps: 1, obtaining source data of a stomach cancer operation patient, and carrying out deep cleaning and abnormal value discrimination on the source data; step 2, carrying out unified interpolation on missing elements; step 3, after missing value interpolation is completed, performing statistics on target label distribution in the data, and synthesizing a sampling process by using an improved self-adaptive synthesis sampling algorithm; 4, after the synthetic sample is obtained in the step 3, XGBoost modeling is carried out; the invention also provides a medium and a device carrying the model, and the method solves the risk prediction problem in a high-dimensional, heterogeneous and class-unbalanced clinical data environment, and is especially suitable for accurate evaluation of complications and prognosis risks after gastric cancer operations.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of medical data analysis and machine learning, and particularly to a method, medium and device for constructing a gastric cancer surgery risk prediction model. Background Art

[0002] The present invention relates to the technical field of medical data analysis and machine learning, and particularly to an automated learning tool for predicting the risk of gastric cancer surgery based on the improved multiple imputation by chained equations (MICE) and advanced adaptive synthetic sampling (ADASYN) algorithms. This tool is designed to handle the common problems of high dimensionality, heterogeneity and severe class imbalance in data related to gastric cancer surgery. By innovatively combining the AdvancedMICE algorithm of multi-criterion adaptive weights, multi-dimensional prediction mean matching distance metric and mutual information feature screening, and the AdvancedADASYN algorithm of kernel density estimation adaptive neighbor number adjustment, XGBoost-based feature importance weight assignment, cost-sensitive oversampling and boundary sample weighting processing, it realizes the accurate filling of missing data and the effective balance of minority class samples. Finally, combined with the efficient modeling and automated hyperparameter tuning mechanism of the XGBoost model, it provides a full-process automated solution from data preprocessing, missing value repair, sample balancing to model construction, significantly improving the accuracy, stability and clinical interpretability of gastric cancer surgery risk prediction, and meeting the urgent need of modern medical decision-making for efficient and accurate data analysis tools. Summary of the Invention

[0003] The present invention proposes a method for constructing a gastric cancer surgery risk prediction model. The method is based on the improved multiple imputation by chained equations (MICE) and advanced adaptive synthetic sampling (ADASYN) algorithms, and integrates advanced data preprocessing, missing value imputation, sample balancing and efficient modeling methods, solving the risk prediction problem in a clinical data environment with high dimensionality, heterogeneity and class imbalance, and is particularly suitable for the accurate assessment of the complications and prognosis risks after gastric cancer surgery.

[0004] The present invention is realized by the following technical solutions: A method for constructing a gastric cancer surgery risk prediction model, the method comprising: Step 1, obtaining the source data of gastric cancer surgery patients, and performing in-depth cleaning and outlier identification on the source data; Step 2, uniformly imputing the missing elements; Step 3: After completing the missing value imputation, statistically analyze the distribution of target labels in the data, and use the improved Adaptive Synthetic Sampling Algorithm (Advanced ADASYN) for the synthetic sampling process; in the improved Adaptive Synthetic Sampling Algorithm, first perform Kernel Density Estimation (KDE) on each minority class sample point to measure its local sparsity. For points with very low density, automatically increase the number of its neighbors k i ; for points that are already relatively dense, reduce the number of neighbors; based on the feature importance scores obtained by XGBoost previously, use a larger perturbation coefficient for numerical features, apply a higher neighbor class switching probability to key categorical features, and for samples at the boundary or with high clinical costs (such as severe patients with concurrent cardiovascular diseases), further increase their weights to give them additional synthetic quotas to ensure a reasonable increase in the proportion of high-risk minority class samples in the training set and obtain the final synthetic samples; after obtaining the synthetic samples, the system visualizes and statistically analyzes the distribution of the newly generated minority class samples to ensure that they are connected to the original true minority class distribution in the high-dimensional space without excessive outliers or unreasonable concentration; Step 4: After obtaining the synthetic samples in Step 3, perform XGBoost modeling; first adopt a stratified cross-validation scheme, combine the synthetic samples and clinical data into a total dataset, split the total dataset into a training set and a validation set, and use grid search or Bayesian optimization on the training set to automatically optimize the key hyperparameters of XGBoost (such as tree depth, learning rate, subsampling rate, etc.). The metrics of the validation set will be recorded for each trial, and the metrics include accuracy, precision, recall, F1 score, and AUC, with a focus on observing the recognition of positive samples; after training, the system will output the key feature importance rankings and provide local interpretability analysis tools (such as SHAP values or LIME) to visualize the impact of each metric on the final prediction.

[0005] Furthermore, the method in Step 1 includes the following steps: obtain the source data of gastric cancer surgery patients, perform in-depth cleaning and outlier identification on the source data. For the existing infinite values and extreme outliers, adopt a combination of global monitoring and threshold detection, and regard them as missing elements for subsequent unified imputation; at the same time, implement refined label encoding or one-hot encoding for all variables according to the data type and problem scope.

[0006] Furthermore, the method in Step 2 includes the following steps: Step 2.1 Initial Imputation and Mutual Information Screening: After completing data preprocessing, initially fill the missing positions (such as mean, mode, or quantile imputation), and screen out the key features with the most significant correlation with the target variable from the high-dimensional feature set based on mutual information measurement: for numerical variables, use mutual information regression measurement to quantify its global explanatory power for the target value; for categorical variables, use mutual information classification measurement to identify its contribution in classification decision-making; The mutual information measurement formula is: Formula III; Where represents the mutual information between the random variables and ; is the sum over all possible values and of and ; is the joint probability distribution of the random variables and , representing the probability that = and = occur simultaneously; represents the marginal probability distribution of the random variable , representing the probability that = ; represents the marginal probability distribution of the random variable , representing the probability that = ; is the logarithm of the ratio of the joint distribution to the marginal distribution of and , used to measure whether and are independent. If and are independent, then = , and the mutual information is 0; Step 2.2 Multiple Imputation and Multi-dimensional PMM Distance Matching: After the mutual information screening is completed and a better feature subset is obtained, enter the multiple iterative imputation stage of MICE; for each target imputation variable, fit the non-missing part of the data through a regression or classification model (depending on the variable type) to obtain the predicted distribution of the missing position. At the same time, the imputation of numerical variables also introduces the multi-dimensional PMM distance measurement (Formula II), incorporating the high-dimensional difference between the predicted value of the target variable and adjacent features into the distance calculation; Multi-dimensional PMM distance measurement formula Formula II; where is the distance metric of multi-dimensional PMM (Predictive Mean Matching), is the predicted value corresponding to the missing value, is the predicted value of the th observation; is the total number of data dimensions; is the index of the current dimension; is the predicted value of the missing value in the dimension; is the predicted value of the th observation in the dimension; Step 2.3 Multi-criterion Adaptive Weighted Fusion of Imputation Results: By calculating the convergence degree and credibility index of each round of imputation results (such as the local difference of imputed values or the model fitting quality), the difference degree for this round of results is obtained. Combining the confidence output of the imputation model and the consistency evaluation of the overall distribution, an adaptive weight is assigned to each round of imputation iteration; the final imputed value will be weighted averaged (for numerical variables) or weighted voted (for categorical variables) according to the weights of different rounds, so as to achieve balance and convergence among multiple imputations; The formula for the adaptive weight is Formula I; where is the multi-criterion combination metric; is the balance coefficient; is the difference amount between this round and the previous round of imputation matrices; is the variance of the internal imputed values in this round; is the iteration round; is the final normalized weight; Step 2.4 Iterative Update and Convergence Monitoring: In the loop process of multiple rounds of imputation iteration in Steps 2.2 - 2.3, the updated values generated in each round are fed back into the model training data of the next round, enabling the imputation model to dynamically perceive the latest filling results and gradually converge to an imputation solution that is more consistent with the original data distribution; when the missing positions of each variable do not show significant fluctuations within several rounds, it indicates that the imputation process has reached a globally optimal or locally stable state; Step 2.5 Inverse Encoding of Imputation Results and Final Output: After completing multiple rounds of imputation and determining the final estimates of all missing values, it is necessary to perform inverse transformation on the variables that were previously label or one-hot encoded to restore them to the original categories or segmented values; for numerical variables, if the variance information of each round of estimates is collected during the multiple rounds of imputation, use the variance information to construct an uncertainty evaluation index.

[0007] Furthermore, the specific method of Step 3 is as follows: Step 3.1: Minority Class Sample Preprocessing and Initial Parameter Setting First, perform in-depth cleaning and structured preprocessing on minority class samples; accurately identify and mark rare values, extreme outliers, and missing values based on medical data, and perform standardization or numerical normalization on the confirmed valid minority class samples. Combining the characteristics of the data distribution and the expectations for classification performance, set the initial key hyperparameters including the ratio parameter ratio, classification imbalance threshold, neighbor number range k_min and k_max, and kernel density estimation bandwidth; select the neighbor search algorithm according to requirements, set the distance metric method, and decide whether to enable the cost-sensitive strategy and the corresponding cost weights. Finally, according to the data characteristics, clarify the numerical and categorical feature lists to achieve the separation processing of numerical and categorical features; Step 3.2: Local Density Measure Based on KDE and Adaptive Neighbor Number k i Obtain First, use the kernel function (Gaussian kernel) to perform probability density estimation on the area near the minority class samples to obtain density(x i ). After that, complete the differential adjustment of the neighbor number k according to Formula 4 i . Minority class samples with low density and high sparsity will obtain more neighbors to strengthen the sampling of local heterogeneous regions; while samples in the high-density aggregation area will use a smaller ki to prevent excessive synthesis of similar samples and avoid too high local redundancy of the training data.

[0008] The so-called Formula 4 is: ; Among them, k i is the adaptive neighbor number of the i-th minority class sample, is the minimum value of the neighbor number (the set lower limit), is the maximum value of the neighbor number (the set upper limit), density(x i ) is the local density of the i-th minority class sample, is the highest density value in the minority class sample set, is the lowest density value in the minority class sample set, ε is a small value to prevent the denominator from being 0, which is 10 -8 ; Step 3.3: Multidimensional Synthesis Strategy with Feature Importance Weighting Convert the importance scores of numerical data type features and categorical data into synthesis perturbation coefficients. The specific formula is as follows: For numerical data: Formula 5; Among them, is the value of the new sample on the j-th feature, is the original sample i Value on feature j, λ = 0 indicates that the new sample is identical to x i is completely the same, λ = 1 indicates that the new sample is identical to the neighbor sample x i,nn is completely the same, λ takes a random value within [0.5, 1.0], tending to be close to the neighbor, is the importance weight of feature j, is the neighbor sample x i,nn value on feature j; For categorical data: Formula VI; where, is the weight of the categorical feature f (similar to the numerical feature, which can be obtained by the same process) Step 3.4 Cost-sensitive oversampling and boundary weighting processing: When the minority class or its sub-classes have high risks in business decisions, by introducing the cost function c(class_label), the weight of the samples of this class in the difficulty coefficient calculation is increased; through the difficulty coefficient r in Formula VII i , on the basis of integrating the adaptive number of neighbors, further combining the class cost information, focusing on monitoring the samples in the decision boundary area; combining the classifier output and local density analysis, accurately identifying the minority class samples that are closely related to or extremely easy to be confused with the majority class. For these "critical minority classes", the algorithm strengthens them by introducing an additional boundary weight w b ; Formula VII; where, r i is the difficulty coefficient, is the cost coefficient; Formula VIII; c(class_label) is the cost coefficient defined for a certain class, w b is the boundary weight; Step 3.5 Difficulty coefficient r i Calculation and normalization Combining the adaptive number of neighbors k i , cost coefficient c(class_label) and boundary weight w b After that, the new difficulty coefficient r i : ; r i is the difficulty coefficient, is the class label of the neighbor sample , x i is the minority class sample, I(⋅) is the indicator function, used to count the number or density of non-minority class labels among the neighbor samples, k iis the adaptive number of neighbors for the i-th minority class sample, The boundary sample weighting coefficient (greater than 1 if the sample is close to the decision boundary, otherwise 1) is used to make r i can be regarded as a probability distribution and is normalized: , where is the normalized difficulty coefficient, used to convert r i into a probability distribution for allocating the number of synthetic samples. r i is the difficulty coefficient, and ∑ j r j : the sum of the difficulty coefficients of all minority class samples.

[0009] Step 3.6 Determination and allocation of the total amount of synthetic samples According to the number M of majority class samples, the number m of minority class samples in the dataset, and the ratio coefficient preset by the user, first calculate the total number of synthetic samples to be generated: ; Subsequently, combine the obtained total synthesis amount G with the normalized difficulty coefficient r i from the previous step, and through ; is for each minority class sample allocate the number of synthetic samples it should generate; finally, generate specific synthetic samples based on the adaptive neighbor and weighted perturbation strategy and add them to the training set to complete the effective correction of global imbalance and obtain synthetic samples.

[0010] A computer-readable program medium for predicting the risk of gastric cancer surgery, the computer-readable storage medium stores a computer program, and the computer program is suitable for being loaded and executed by a processor for the method of constructing the risk prediction model of gastric cancer surgery.

[0011] A device for predicting the risk of gastric cancer surgery, the device is equipped with the model, including a data acquisition and processing module, a data interpolation module, a risk assessment module and an output module. The data acquisition and processing module is provided with a data input window. The output end of the data acquisition and processing module is connected to the input end of the data interpolation module. The output end of the data interpolation module is connected to the input end of the risk assessment module. The output end of the risk assessment module outputs the evaluation result through the output module; The data acquisition and processing module runs the above-mentioned step 1; The data interpolation module runs the above-mentioned step 2; The risk assessment module runs the model after the completion of the above-mentioned step 3 training. Detailed implementation method

[0012] The technical solution of the present invention will be further explained below through embodiments, but the protection scope of the present invention is not limited by any form of the embodiments.

[0013] Embodiment 1 A method for constructing a risk prediction model for gastric cancer surgery, the method comprising: Step 1: Obtain the source data of gastric cancer surgery patients, and perform in-depth cleaning and outlier identification on the source data; First, perform in-depth cleaning and outlier identification on the source data to construct a unified and noise-free initial data environment. For possible infinite values and extreme outliers, a combination of global monitoring and threshold detection is used to treat them as missing elements for subsequent unified imputation. At the same time, according to the data type and problem scope, refined label encoding, one-hot encoding or other appropriate conversion methods are implemented for all variables.

[0014] Step 2: Perform unified imputation on the missing elements; Step 2.1 Initial imputation and mutual information screening After completing the data preprocessing, first perform a preliminary filling on the missing positions (such as mean, mode or quantile imputation) to ensure that all variables have complete initial values before the multiple imputation process. Immediately afterwards, based on the mutual information measure (Formula Three), the key features with the most significant correlation with the target variable are screened out from the high-dimensional feature set: for numerical variables, the mutual information regression measure is used to quantify its global explanatory power for the target value; for categorical variables, the mutual information classification measure is used to identify its contribution in the classification decision.

[0015] Formula Three; Step 2.2 Multiple imputation and multi-dimensional PMM distance matching After the mutual information screening is completed and a better feature subset is obtained, enter the multiple iterative imputation stage of MICE. For each target imputation variable, in this embodiment, the non-missing part of the data is fitted through a regression or classification model (depending on the variable type) to obtain the predicted distribution of the missing positions. At the same time, the multi-dimensional PMM distance measure (Formula Two) is introduced for the imputation of numerical variables, and the high-dimensional difference between the predicted value of the target variable and adjacent features is incorporated into the distance calculation: when the distance measure is not limited to a single dimension, the imputed value can more faithfully reflect the true distribution structure of the local data and is more robust to the deviation of outliers or marginal samples.

[0016] Formula Two; Step 2.3 Multi-criterion adaptive weighted fusion of imputation results To make full use of the imputation results obtained from multiple iterations and weaken the possible abnormal fluctuations therein, a multi-criterion adaptive weight mechanism (Formula 1) is introduced in this step of this embodiment. By calculating the convergence degree and credibility index of the imputation results of each round (such as the local difference of the imputed values or the model fitting quality), the difference degree for the results of this round can be obtained. Combining the confidence output of the imputation model and the consistency evaluation of the overall distribution, an adaptive weight is assigned to each round of imputation iteration. The final imputed value will be weighted averaged (numerical variable) or weighted voted (categorical variable) according to the weights of different rounds, so as to achieve balance and convergence among multiple imputations.

[0017] Formula 1; Step 2.4 Iterative Update and Convergence Monitoring In the loop process of the above-mentioned multi-round imputation iteration, the updated values generated in each round will be fed back into the model training data of the next round, enabling the imputation model to dynamically perceive the latest filling results and gradually converge to an imputation solution that is more consistent with the original data distribution. The user can set a fixed number of iteration rounds or use convergence criteria such as the fluctuation degree of imputed values and model loss to dynamically determine when to stop the iteration. When there are no large fluctuations in the missing positions of each variable within several rounds, it indicates that the imputation process has reached a globally optimal or locally stable state.

[0018] Step 2.5 Inverse Encoding and Final Output of Imputation Results After completing multiple rounds of imputation and determining the final estimates of all missing values, it is necessary to perform inverse transformation on the variables that were previously label-encoded or one-hot encoded to restore them to the original categories or segmented values, which is convenient for intuitive visualization and subsequent statistical analysis. In addition, for numerical variables, if the variance information of the estimates of each round is collected during the multi-round imputation process, it can be further used to construct an uncertainty evaluation index.

[0019] Step 3. After completing the imputation of missing values, statistically analyze the distribution of the target labels in the data, and use the "Advanced ADASYN" synthetic sampling process. First, perform kernel density estimation (KDE) on each minority-class sample point to measure its local sparsity. For points with very low density, automatically increase the number of its neighbors k i; For points that are already relatively dense, reduce the number of neighbors; Based on the feature importance scores obtained by XGBoost previously, use a larger perturbation coefficient for numerical features, apply a higher neighbor class switching probability to key categorical features, and for samples at the boundary or with high clinical costs (such as severe patients with concurrent cardiovascular diseases), further increase their weights to give them additional synthesis quotas to ensure a reasonable increase in the proportion of high-risk minority class samples in the training set and obtain the final synthetic samples; After obtaining the synthetic samples, the system visualizes and statistically analyzes the distribution of the newly generated minority class samples to ensure that they are connected to the original true minority class distribution in the high-dimensional space and do not show excessive outliers or unreasonable concentrations; Step 3.1 Minority Class Sample Preprocessing and Initial Parameter Setting Before formally entering the adaptive synthesis stage, first perform in-depth cleaning and structured preprocessing on the minority class samples. Specifically, rare values, extreme outliers, and missing values need to be accurately identified and marked according to industry or business scenario characteristics (such as medical data, industrial inspection data, etc.), and standardization or numerical normalization processing is performed on the confirmed valid minority class samples to lay a stable numerical foundation for subsequent kernel density analysis and neighbor search. On this basis, the user can set initial proportional parameters ratio (such as 0.5), classification imbalance threshold imb_threshold (such as 0.5), neighbor number range k_min and k_max (such as 5 and 15 respectively), and kernel density estimation bandwidth noise_level (such as 0.01) and other key hyperparameters according to the data distribution characteristics and expectations for classification performance. In addition, the user can also select a neighbor search algorithm (such as 'auto' or 'kd_tree') according to needs, set the distance metric metric (such as 'euclidean'), and decide whether to enable the cost-sensitive strategy and the corresponding cost weights. Finally, according to the data characteristics, the numerical and categorical feature lists (numerical_features and categorical_features) need to be clarified to achieve separate processing of numerical and categorical features.

[0020] Step 3.2 Local Density Measure Based on KDE and Adaptive Neighbor Number k i Obtain In this embodiment, the local data distribution where each minority class sample x i is located is quantitatively analyzed through kernel density estimation (KDE) to solve the problem that traditional ADASYN is prone to insufficient synthesis in sparse regions and redundant synthesis in dense regions when the number of neighbors is fixed. Specifically, first use the kernel function (Gaussian kernel) to perform probability density estimation on this region to obtain density(x i ), and then complete the calculation of the neighbor number k according to Formula 4 iDifferential adjustment. Minority samples with low density and high sparsity will obtain more neighbors to strengthen the sampling of local heterogeneous regions; while samples in high-density aggregation areas prevent excessive synthesis of similar samples through a smaller ki to avoid excessive local redundancy in the training data.

[0021] Formula Four; Step 3.3 Multidimensional synthesis strategy with feature importance weighting After obtaining the adaptive number of neighbors, this embodiment further incorporates the feature importance measurement based on XGBoost, and explicitly emphasizes the contribution of key variables to the classification decision through a differential weighting strategy. For numerical features, the split gain of XGBoost can quantify the role of each feature in reducing the overall error of the model; for categorical features, the influence on distinguishing class differences is comprehensively judged based on the reduction of impurity or the contribution degree of gain. Finally, these importance scores are converted into synthesis perturbation coefficients (such as w in Formulas Five and Six j and w f ), and differential processing is performed when synthesizing samples. For numerical variables, the step size is dynamically adjusted according to w j during the perturbation process, making the change range of key numerical features more representative; for categorical variables, by assigning a higher neighbor category selection probability to high-importance categorical features, the ability to finely distinguish different category boundaries is enhanced.

[0022] For numerical data: Formula Five; For categorical data: Formula Six; Step 3.4 Cost-sensitive oversampling and boundary weighting processing When a minority class or its sub-class has a high risk in business decisions, this embodiment introduces a cost function c(class_label) to increase the weight of such samples in the calculation of the difficulty coefficient. This measure can specifically strengthen the oversampling intensity of high-cost classes. Through the difficulty coefficient r in Formula Seven i , on the basis of incorporating the adaptive number of neighbors, the category cost information is further combined, so that the subsequent sample synthesis allocation better meets the actual risk assessment requirements. In addition to introducing a cost-sensitive mechanism at the macro level, this embodiment also focuses on monitoring samples in the decision boundary region. Combining the classifier output and local density analysis, it accurately identifies minority samples that are closely related to the majority class boundary or are extremely easy to confuse. For these "critical minority classes", the algorithm is strengthened by introducing an additional boundary weight w b (Formula Eight), so that they can obtain more generation quotas or higher priorities in the final synthesis sample allocation.

[0023] Formula VII; Formula VIII; Step 3.5: Difficulty coefficient r i Calculation and normalization Comprehensive adaptive neighbor number k i , cost coefficient c(class_label), and boundary weight w b After that, this embodiment uses the new difficulty coefficient r i to characterize the multi-factor of the priority of the minority class sample xi during the synthesis process; ; Among them, the indicator function I(⋅) is used to count the number or density of non-minority class labels in the neighboring samples, and then measure the difficulty and potential conflict degree of the sample in the discriminant space. To make ri be regarded as a probability distribution, it is normalized: ; Step 3.6 Determination and allocation of the total number of synthetic samples According to the number M of majority class samples, the number m of minority class samples in the dataset, and the ratio coefficient preset by the user, first calculate the total number of synthetic samples to be generated: ; Subsequently, combine the obtained total synthesis amount G with the normalized difficulty coefficient r in the previous step i , and through allocate the number of synthetic samples that should be generated for each minority class sample Finally, generate specific synthetic samples based on the adaptive neighbor and weighted perturbation strategy and add them to the training set to complete the effective correction of the global imbalance and obtain synthetic samples.

[0024] At this stage, this embodiment focuses on the combination of "personalized allocation" and "global constraint": by comprehensively considering multiple factors such as sparse density, cost sensitivity, and boundary difficulty, the minority class samples with higher discriminative value or higher error risk are preferentially enhanced, rather than blindly dividing the synthesis quota among all samples. Finally, generate specific synthetic samples based on the adaptive neighbor and weighted perturbation strategy and add them to the training set to complete the effective correction of the global imbalance.

[0025] Step 4: After obtaining the synthetic samples in Step 3, perform XGBoost modeling. First, adopt a stratified cross-validation scheme to combine the synthetic samples and clinical data into a total dataset. Split the total dataset into a training set and a validation set, and use grid search or Bayesian optimization on the training set to automatically optimize the key hyperparameters of XGBoost (such as tree depth, learning rate, subsampling rate, etc.). The metrics of the validation set will be recorded for each trial, and the metrics include accuracy, precision, recall, F1 score, and AUC. Focus on observing the recognition of positive samples. After training, the system will output the ranking of key feature importance and provide local interpretability analysis tools (such as SHAP values or LIME) to visualize the impact of each metric on the final prediction.

[0026] Example 2 A device for predicting the risk of gastric cancer surgery, the device includes a data access and automatic missing value imputation module, an adaptive synthetic sampling and class distribution balancing module, and an XGBoost modeling and full-process automatic output module; The data access and automatic missing value imputation module runs the above Step 1 and Step 2: In the initial stage of the full-process automatic modeling, through a configurable data access and fusion module, synchronously extract the patient's basic information, surgical process data, and its subsequent follow-up indicators from multiple sources (such as electronic medical records, laboratory test systems, surgical record databases, and follow-up platforms). Facing the problems of high dimensionality, heterogeneity, and severe data missing commonly presented in the gastric cancer surgery scenario, the system will automatically call the AdvancedMICE algorithm in "Multi-criterion Adaptive Weight and Multi-dimensional PMM Imputation". This algorithm uses mutual information measurement for feature screening in multiple rounds of imputation, and combines a multi-criterion adaptive weight mechanism to balance the credibility of each iteration result; for numerical missing values, precise matching and filling of abnormal samples are achieved through multi-dimensional PMM distance measurement, so as to restore the potential distribution structure of the original data to the greatest extent and reduce the interference of noise and bias on subsequent analysis.

[0027] The described Adaptive Synthetic Sampling and Class Distribution Balancing Module runs Step 3: After completing missing value imputation and noise elimination, to further improve the discrimination ability for the extremely low - proportion high - risk patient group (minority class), seamlessly connect the AdvancedADASYN algorithm in the "Advanced Adaptive Synthetic Sampling Strategy" to alleviate the classification performance degradation problem caused by data imbalance. This module adaptively determines the number of neighbors through Kernel Density Estimation (KDE), enabling differential neighborhood coverage for sparse and dense regions; at the same time, combined with a weighted synthesis mechanism based on XGBoost feature gain, higher perturbation weights are assigned to key feature dimensions to assist the algorithm in generating synthetic samples with rich diversity in high - dimensional and heterogeneous attribute environments. In addition, by introducing cost - sensitive scheduling and boundary - weighted recognition, the system can take care of the clinical costs of high - risk classes at the macroscopic level and focus on synthesizing the decision - boundary regions at the microscopic level, thus ensuring that the newly synthesized samples have stronger reference value for actual high - risk scenarios.

[0028] The described XGBoost Modeling and Full - Process Automatic Output Module runs Step 4; After data imputation and synthesis are completed, this embodiment uses the gain splitting and parallel computing framework of XGBoost to construct an end - to - end adaptive automation model pipeline, which mainly covers the following three links: 1) Automatic model training and parameter tuning: Considering the high - dimensional and multi - label characteristics of gastric cancer surgery data, the system will automatically enable strategies such as cross - validation and grid search or Bayesian optimization in the initial stage to iteratively optimize the main hyperparameters in XGBoost, such as learning rate, maximum depth, and subsampling ratio, to balance training efficiency and classification accuracy. Since a large amount of noise and imbalance interference have been effectively alleviated through AdvancedMICE and AdvancedADASYN preprocessing, XGBoost can focus on learning the splitting gain of key features, greatly improving the convergence speed and generalization ability of the model.

[0029] 2) Interpretability output and multi - dimensional visualization: After training is completed, the system will generate a global feature importance report, local effect plots of key features, and a visual distribution of synthetic samples. For synthetic samples, the algorithm can identify their similarity to real minority - class samples in the projection space or feature space and highlight the sampling gain in the boundary region. Clinical researchers can combine these visualization results to clearly understand why the model highlights certain preoperative indicators and surgical factors to evaluate and predict the risks of gastric cancer surgery - related complications or poor prognosis.

[0030] 3) Full-process automated monitoring and result delivery: After the above model training and visualization steps are completed, the system will automatically build an end-to-end pipeline. In an orchestratable manner, once new batch data is accessed or existing data is updated, it can dynamically trigger the processes of missing value imputation (AdvancedMICE), sampling balancing (AdvancedADASYN), and XGBoost model retraining. Through the output of visualization reports and service interfaces, clinical staff can not only monitor the classification accuracy and key feature contribution in real time but also quickly compare the differences in the synthetic distribution of the current batch or historical batch data, ensuring the continuous improvement and traceability of gastric cancer surgery risk prediction.

[0031] Example 3 An application of a gastric cancer surgery risk prediction model, and the application method is as follows: Step 1: In this example, first, raw data of more than 2000 gastric cancer surgery patients was retrieved from the hospital information system (HIS), surgical record database, and follow-up platform, covering the patients' basic demographic information (such as age, gender, height, weight), preoperative examination indicators (such as blood routine, coagulation routine, tumor markers), surgical procedure records (such as operation duration, blood loss, specific surgical methods), and in-hospital and out-of-hospital follow-up results (such as types of postoperative complications, occurrence time, and severity). To ensure data quality, the implementers carried out detailed data cleaning and preprocessing, matching and merging data from different sources, using unique identifiers such as patient visit numbers or ID numbers to ensure accurate alignment of information. Subsequently, the implementers carried out regular naming and coding of surgical methods and pathological diagnoses, mapping different terms and synonyms to the hospital's standard naming uniformly to ensure data consistency. In terms of outlier detection, the implementers used the quantile method to analyze numerical data such as blood routine to detect whether there were extreme outliers, such as hemoglobin significantly exceeding the normal range or the operation duration far exceeding the normal range of conventional surgeries. For such abnormal data, after confirmation with clinicians, if no reasonable explanation could be obtained, they were uniformly regarded as missing. At the same time, for multiple records of the same patient, if there were conflicts in the operation dates or inconsistencies between follow-up records and hospitalization information, the implementers would verify with relevant clinicians. If no credible answer could be obtained, they were regarded as missing. In the identification of variable types, the implementers uniformly processed continuous variables such as blood sugar, blood lipids, and BMI and used the standardization method (MinMax) for data standardization. In addition, for categorical variables such as the nature of the operation, types of coexisting diseases, and pathological stages, the implementers carried out normalization processing and recorded them for subsequent imputation or synthetic sampling to provide consistent label coding.

[0032] Step 2: Since gastric cancer surgery data involves multiple hospitalization stages and follow-up stages, there are inevitably varying degrees of missing data. In this embodiment, to effectively fill these missing data, an automated script is used to call the "AdvancedMICE" algorithm for batch imputation. Before imputation, mutual information calculations are performed on all features that may be related to surgical prognosis or complications. This process aims to automatically identify and eliminate features that are almost irrelevant to the target label (such as whether a specific complication occurs). When performing imputation, for numerical missing data, the algorithm uses a multi-dimensional PMM (Predictive Mean Matching) distance matching method. In each round of imputation, the algorithm first fits an imputation model using methods such as random forest or linear model based on the observed features, and then measures the "multi-dimensional distance" between the missing data points and the observed data points in both the prediction space and several relevant feature spaces. The missing values are filled by selecting a set of observed data with the smallest distance, thereby maintaining the proximity between the imputed data and the true distribution. Compared with the traditional single-dimensional PMM method, this multi-dimensional matching method can more accurately reflect the true physiological or pathological changes of patients. To further improve the stability and accuracy of the imputation results, the algorithm introduces an adaptive weight mechanism. In multiple rounds of imputation iteration, after each round of imputation is completed, the system evaluates the differences between the newly imputed values and the overall data distribution as well as the local prediction reliability. If it is found that the imputation results of a certain round show a large deviation or have an obvious conflict with the historical imputation values, the algorithm will automatically reduce the weight of the results of that round. In this way, the algorithm can reduce the impact of unstable imputation values and obtain a smoother and better-converging imputation result through gradual iteration. After this process, the originally highly missing key variables (such as preoperative blood routine, pathological examination results, etc.) are reasonably filled. It is statistically shown that in this embodiment, when processing tens of thousands of records and hundreds of variables, it takes about 30 minutes to obtain a data copy with a high degree of integrity and low distortion.

[0033] Step 3: After completing the missing value imputation, the implementers statistically analyzed the distribution of the target labels in the data and found that in some severe complications (such as anastomotic leakage, severe infection, etc.), the positive cases only accounted for about 5% of the total sample size, while their clinical risks were extremely high. To improve the recognition ability of the prediction model for this part of rare but high-risk labels, this embodiment calls the "AdvancedADASYN" synthetic sampling process. The algorithm first performs kernel density estimation (KDE) on each minority class sample point to measure its local sparsity. For points with very low density, the number of its neighbors k is automatically increased. i, to obtain more reference samples for synthesis; for points that are already relatively dense, the number of neighbors is reduced to avoid over-generation of approximately duplicate samples. Based on the feature importance scores obtained by XGBoost previously, a larger perturbation coefficient is used for numerical features, a higher neighbor category switching probability is applied to key categorical features, and for samples at the boundary or with high clinical costs (such as severe patients with concurrent cardiovascular diseases), their weights are further increased to give them additional synthesis quotas to ensure a reasonable increase in the proportion of high-risk minority samples in the training set. After synthesis, the system conducts visualization and statistical analysis on the newly generated minority samples to ensure that they are connected to the original true minority distribution in the high-dimensional space without excessive outliers or unreasonable concentration. The implementers also jointly reviewed some synthesis records with clinical experts and verified item by item the random perturbation results of, for example, pathological stage and adjuvant treatment methods to confirm that there are no obvious conflicts in medical logic.

[0034] Step 4: After having data with imputation completed and sampling balanced, this embodiment starts XGBoost modeling and performance verification for the main clinical objectives (such as postoperative complication prediction). The system first adopts a stratified cross-validation scheme to split the data into a training set and a validation set, and uses grid search or Bayesian optimization on the training set to automatically optimize the key hyperparameters of XGBoost (such as tree depth, learning rate, subsampling rate, etc.). Each trial will record the metrics of the validation set, including accuracy, precision, recall, F1 score, and AUC, etc., and focus on observing the identification of positive samples for complications. After training, the system will output the key feature importance ranking and provide local interpretability analysis tools (such as SHAP values or LIME) to visualize the impact of each metric on the final prediction. Doctors can intuitively see, for example, how much surgery duration, hemoglobin, tumor stage, etc. play a role in discriminating high-risk patients. In the specific data of this embodiment, after applying AdvancedMICE and AdvancedADASYN, the model is significantly better than the baseline control that only performs simple imputation and the native SMOTE method in terms of recall and F1 score, demonstrating the outstanding advantages of the present invention in dealing with high-dimensional missingness and extreme imbalance. To further verify the adaptability of the model to the real scenario, the implementers selected several new patients in the hospital whose subsequent results have not been made public recently for prediction. Comparing with the actual occurrence results over time, it is found that the model has a high credibility in accurately identifying severe complication patients. Finally, the model and its related processes are embedded into the hospital's risk warning platform to realize the whole process of automatically performing missing value imputation, synthetic sampling, and model inference after new patient data arrives, providing timely risk alerts and complication prevention and treatment strategy support for the gastric cancer surgery team.

Claims

1. A method for constructing a risk prediction model for gastric cancer surgery, characterized in that, The method includes the following: Step 1: Obtain the source data of gastric cancer surgery patients, and perform in-depth cleaning and outlier identification on the source data; Step 2: Perform unified imputation on the missing elements; Step 3: After completing the missing value imputation, statistically analyze the distribution of target labels in the data, and use an improved adaptive synthetic sampling algorithm for the synthetic sampling process; in the improved adaptive synthetic sampling algorithm, first perform kernel density estimation on each minority class sample point to measure its local sparsity, and for points with very low density, automatically increase the number of its neighbors k i ; for points that are already relatively dense, reduce the number of neighbors; based on the feature importance scores previously obtained by XGBoost, use a larger perturbation coefficient for numerical feature variables, apply a higher neighbor class switching probability to key categorical feature variables, and for samples at the boundary or with high clinical costs, further increase their weights to give them additional synthetic quotas, so as to ensure a reasonable increase in the proportion of high-risk minority class samples in the training set and obtain the final synthetic samples; after completing the acquisition of synthetic samples, the system performs visualization and statistical analysis on the distribution of the newly generated minority class samples; Step 4: After obtaining the synthetic samples in Step 3, perform XGBoost modeling; first, adopt a stratified cross-validation scheme, merge the synthetic samples and clinical data into a total dataset, split the total dataset into a training set and a validation set, and use grid search or Bayesian optimization on the training set to automatically optimize the key hyperparameters of XGBoost. The metrics of the validation set will be recorded for each trial, and the metrics include accuracy, precision, recall, F1-score, and AUC, with a focus on observing the identification of positive samples; after training, the system will output the key feature importance ranking and provide a local interpretability analysis tool to visualize the impact of each metric on the final prediction.

2. The construction method of a gastric cancer surgery risk prediction model according to claim 1, characterized in that, The method of Step 1 includes the following steps: Obtain the source data of gastric cancer surgery patients, perform in-depth cleaning and outlier identification on the source data. For the existing infinite values and extreme outliers, adopt a combination of global monitoring and threshold detection, and regard them as missing elements for subsequent unified imputation; at the same time, according to the data type and problem scope, implement refined label encoding or one-hot encoding for all variables.

3. The construction method of a gastric cancer surgery risk prediction model according to claim 1, wherein, The method of Step 2 includes the following steps: Step 2.1 Initial imputation and mutual information screening: After completing data preprocessing, first perform preliminary filling on the missing positions, and screen out the key features with the most significant correlation with the target variable from the high-dimensional feature set based on mutual information measurement: For numerical feature variables, use mutual information regression measurement to quantify their global explanatory power for the target value; For categorical feature variables, use mutual information measurement to identify their contribution to classification decisions; The mutual information metric formula is as follows: Formula III; where represents the mutual information between and ; is the sum over all possible values and of and ; is the joint probability distribution of the random variables and , representing the probability that = and = occur simultaneously; is the marginal probability distribution of the random variable , representing the probability that = ; represents the marginal probability distribution of the random variable , representing the probability that = ; is the logarithm of the ratio of the joint distribution to the marginal distribution of and , used to measure whether and are independent. If and are independent, then = , and the mutual information is 0; Step 2.2 Multiple imputation and multi-dimensional PMM distance matching: After the mutual information screening is completed and a better feature subset is obtained, enter the multiple imputation stage of MICE; for each target imputation variable, fit the non-missing part of the data through a regression or classification model to obtain the predicted distribution of the missing positions. At the same time, the imputation of numerical feature variables also introduces a multi-dimensional PMM distance measurement, integrating the high-dimensional differences between the predicted values of the target variable and adjacent features into the distance calculation; Multi-dimensional PMM distance metric formula Formula 2; where is the distance metric of the multi-dimensional PMM, is the predicted value corresponding to the missing value, is the predicted value of the th observation; is the total number of data dimensions; is the index of the current dimension; is the predicted value of the missing value in the th dimension; is the predicted value of the th observation in the th dimension; Step 2.3 Multi-criterion adaptive weighted fusion of imputation results: By calculating the convergence degree and credibility index of each round of imputation results, obtain the difference degree for this round of results, and combine the confidence output of the imputation model and the consistency evaluation of the overall distribution to assign adaptive weights to each round of imputation iteration; The final imputed value will be weighted averaged or weighted voted according to the weights of different rounds, so as to achieve balance and convergence among multiple imputations; The formula for the adaptive weight is Formula 1; wherein multi-criterion combined metric; is the balance coefficient; is the difference amount between the interpolation matrix of this round and the previous round; is the variance of the internal interpolation value of this round; is the iteration round; is the final weight after normalization; Step 2.4 Iterative update and convergence monitoring: In the loop process of multiple imputation iterations in Steps 2.2 - 2.3, the updated values generated in each round will be fed back into the model training data of the next round, enabling the imputation model to dynamically perceive the latest filling results and gradually converge to an imputation solution that is more consistent with the original data distribution. When the missing positions of each variable no longer show significant fluctuations within several rounds, it indicates that the imputation process has reached a globally optimal or locally stable state; Step 2.5 Inverse Encoding of Imputation Results and Final Output: After completing multiple rounds of imputation and determining the final estimates of all missing values, it is necessary to perform inverse transformation on the variables that were previously label-encoded or one-hot encoded to restore them to their original categories or segmented values; for numerical feature variables, if variance information of each round of estimates is collected during the multiple rounds of imputation, use the variance information to construct an uncertainty assessment index.

4. The construction method of a gastric cancer surgery risk prediction model according to claim 1, characterized in that, The specific method of Step 3 is as follows: Step 3.1: Preprocessing of Minority Class Samples and Initial Parameter Setting: First, perform in-depth cleaning and structured preprocessing on the minority class samples; accurately identify and mark rare values, extreme outliers, and missing values based on medical data, and perform standardization or numerical normalization on the confirmed valid minority class samples. Combine the data distribution characteristics and the expected classification performance to set the initial key hyperparameters including the ratio parameter ratio, classification imbalance threshold, neighbor quantity range k_min and k_max, and kernel density estimation bandwidth; select the neighbor search algorithm according to requirements, set the distance metric method, and decide whether to enable the cost-sensitive strategy and the corresponding cost weights. Finally, according to the data characteristics, it is necessary to clarify the list of numerical feature variables and categorical feature variables to achieve the separation processing of numerical feature variables and categorical feature variables; Step 3.2: Local density measure based on KDE and adaptive number of neighbors k i Obtain: First, use the kernel function to estimate the probability density of the area near the minority class samples to obtain density(x i ). Then, complete the differential adjustment of the number of neighbors k i according to Formula 4; The formula four mentioned above is: ; Among them, k i is the adaptive number of neighbors of the i-th minority class sample, the minimum value of the number of neighbors, is the maximum value of the number of neighbors, density(x i ) the local density of the i-th minority class sample, is the highest density value in the minority class sample set, is the lowest density value in the minority class sample set, ε is a tiny value to prevent the denominator from being zero, and is 10 -8 ; Step 3.3: Multidimensional Synthesis Strategy with Feature Importance Weighting: Convert the importance scores of numerical feature variables and categorical feature variables into synthetic perturbation coefficients, and the specific formula is as follows: For numerical feature variables: Formula Five; wherein, is the value of the new sample on the j-th feature, is the original sample i on the feature j, λ = 0 indicates that the new sample is exactly the same as x i and λ = 1 indicates that the new sample is exactly the same as the neighbor sample x i,nn and λ takes a random value within [0.5, 1.0], tending to be closer to the neighbor, is the importance weight of the feature j, is the neighbor sample x i,nn on the feature j; For categorical feature variables: Formula VI; Among them, is the weight of the categorical feature variable f; Step 3.4 Cost-sensitive oversampling and boundary weighting processing: When the minority class or its subclasses have a high risk in business decisions, by introducing a cost function c(class_label), the weight of the samples of this class in the difficulty coefficient calculation is increased; through the difficulty coefficient r i in Formula 7, on the basis of integrating the adaptive number of neighbors, the class cost information is further combined to focus on monitoring the samples in the decision boundary area; combining the classifier output and local density analysis, accurately identify the minority class samples that are closely related to or extremely easy to be confused with the majority class. For these "critical minority class samples", the algorithm introduces an additional boundary weight w b for enhancement; Formula VII; where r i is the difficulty coefficient, and is the cost coefficient; Formula VIII; c(class_label) is the cost coefficient defined for a certain class, and w b is the boundary weight; Step 3.5 Difficulty coefficient r i Calculation and normalization: Comprehensive adaptive neighbor number k i , cost coefficient c(class_label), and boundary weight w b After that, the new difficulty coefficient r i : ; r i is the difficulty coefficient, is the neighbor sample 's class label, x i is the minority class sample, I(⋅) is the indicator function, which is used to count the number or density of non-minority class labels in the neighboring samples, k i is the adaptive number of neighbors of the i-th minority class sample, the boundary sample weighting coefficient, for r i is normalized as follows: , where is the normalized difficulty coefficient, used to convert r i into a probability distribution for allocating the number of synthetic samples, and r i is the difficulty coefficient, and ∑ j r j : the sum of the difficulty coefficients of all minority-class samples; Step 3.6 Determination and Allocation of the Total Number of Synthetic Samples: According to the number of majority class samples M, the number of minority class samples m in the dataset, and the ratio coefficient ratio preset by the user, first calculate the total number of synthetic samples to be generated: ; Subsequently, combine the obtained total synthesis amount G with the normalized difficulty coefficient r of the previous step i : ; For each minority class sample allocate the number of synthetic samples it should generate; finally, generate specific synthetic samples based on the adaptive neighbor and weighted perturbation strategy and add them to the training set to effectively correct the global imbalance and obtain synthetic samples.

5. A computer-readable program medium for predicting the risk of gastric cancer surgery, characterized in that, The computer-readable storage medium stores a computer program, and the computer program is suitable for being loaded and executed by a processor to perform the method for constructing a gastric cancer surgery risk prediction model according to any one of claims 1-4.

6. A gastric cancer surgery risk prediction device, characterized in that, The device is equipped with the model, including a data acquisition and processing module, a data interpolation module, a risk assessment module, and an output module. The data acquisition and processing module is provided with a data input window. The output end of the data acquisition and processing module is connected to the input end of the data interpolation module. The output end of the data interpolation module is connected to the input end of the risk assessment module. The output end of the risk assessment module outputs the assessment result through the output module; The data acquisition and processing module runs Step 1 in the construction method described in claim 1; The data interpolation module runs Step 2 in the construction method described in claim 1; The risk assessment module runs the model after Step 3 in the construction method described in claim 1 is trained.