ERCP postoperative common bile duct calculus recurrence prediction system based on machine learning
Through the machine learning-based ERCP postoperative common bile duct stone recurrence prediction system, the improved bidirectional gating recurrent unit network model and gray wolf optimization algorithm are used to solve the problem of insufficient data integration and modeling capabilities in the existing prediction methods, and more accurate recurrence risk prediction and personalized clinical decision-making are achieved.
Patent Information
- Application Number
- CN202510534076.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-27
- Publication Date
- 2025-05-30
- Estimated Expiration
- 2045-04-27
AI Technical Summary
The existing methods for predicting recurrence after common bile duct stones are difficult to systematically integrate multidimensional data, lack of modeling capabilities, and cannot accurately capture dynamic risk signals during intraoperative state changes and postoperative recovery. The lack of model parameter optimization mechanisms, resulting in insufficient prediction accuracy and individual adaptability.
A machine learning-based ERCP postoperative common bile duct stone recurrence prediction system is proposed. Through data acquisition, preprocessing and feature construction, an improved bidirectional gating recurrent unit network model is constructed, and hyperparameter tuning is used to achieve adaptive optimization of model parameters.
It improves the accuracy of predicting the risk of recurrence of common bile duct stones after surgery, can identify high-risk individuals early, provide personalized postoperative management strategies and follow-up plans, and improves clinical practicality.
Smart Images

Figure CN120072320A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of common bile duct stones, and particularly to a recurrence prediction system for common bile duct stones after ERCP based on machine learning. Background Art
[0002] With the development of minimally invasive techniques, endoscopic retrograde cholangiopancreatography has become an important means for treating common bile duct stones. However, the problem of postoperative recurrence still plagues clinical practice. Some patients develop stones again within several months to several years after the operation, bringing a heavy burden to the health of patients and the medical system. In recent years, in order to effectively predict the recurrence risk and optimize the follow-up strategy, clinical research has gradually introduced data-driven methods to attempt risk modeling and predictive analysis.
[0003] Currently, the prediction of recurrence after common bile duct stone surgery mainly relies on retrospective statistical analysis or risk assessment models based on expert experience, which use single or a small number of clinical features as risk factors, such as patient age, gender, postoperative biliary dilation, or liver function indicators. It is difficult to systematically integrate multi-dimensional data of patients before, during, and after the operation. On the other hand, some studies have tried to use traditional machine learning methods such as logistic regression and support vector machines for prediction, but their modeling ability is limited by insufficient feature expression ability and non-temporal data structures, and they cannot accurately capture the dynamic risk signals during the intraoperative state change and postoperative recovery process.
[0004] In addition, existing prediction methods generally lack an optimization mechanism for model parameters, often relying on manual experience for parameter setting, and it is difficult to achieve the optimal configuration of model performance. There is still a large room for improvement in terms of prediction accuracy, individual adaptability, and temporal modeling ability. Especially in postoperative risk stratification and individualized management, the existing technologies are difficult to meet the requirements of precision medicine. Therefore, there is an urgent need for a recurrence prediction method that can integrate multi-stage clinical data, has temporal modeling ability, and supports adaptive optimization of model parameters to improve prediction accuracy and clinical practicability. Summary of the Invention
[0005] An object of the present invention is to provide a recurrence prediction system for common bile duct stones after ERCP based on machine learning, which has significant clinical value for the early identification of high-risk individuals in actual deployment.
[0006] A recurrence prediction system for common bile duct stones after ERCP based on machine learning according to an embodiment of the present invention includes the following modules: A data acquisition module for collecting multi-dimensional clinical data of patients in the pre-ERCP, intra-ERCP, and post-ERCP stages to form an original clinical data set; A data preprocessing module for performing preprocessing operations on the original clinical data set to construct a standardized preprocessed clinical data set; A feature construction and hyperparameter search space definition module, which is used to construct preoperative, intraoperative, and postoperative phased feature vectors based on a standardized preprocessed clinical dataset, and define the hyperparameter search space of an improved bidirectional gated recurrent unit network model; An improved bidirectional gated recurrent unit network model construction module, which is used to construct an improved bidirectional gated recurrent unit network model integrating a temporal enhancement mechanism, a clinical stage-aware gating mechanism, and a risk-guided fusion strategy, and output a recurrence risk prediction value; A grey wolf optimization hyperparameter tuning module, which is used to initialize the hyperparameter search space based on key medical feature guidance, construct a medical-guided initial population, and perform multiple rounds of grey wolf optimization search based on a stage-stratified convergence strategy and a risk-sensitive fitness function to obtain the optimal hyperparameter configuration, and finally generate an optimized improved bidirectional gated recurrent unit network model; A model training and prediction module, which is used to perform forward prediction on standardized new patient clinical data using the optimized improved bidirectional gated recurrent unit network model, output a recurrence probability value, and construct a risk classification rule based on the predicted probability and postoperative key indicators; An individualized result output module, which is used to stratify and output the prediction results according to high-risk, medium-risk, and low-risk levels. The output results include: individual recurrence probability values, stratified risk levels, explanations of key driving medical indicators, and push the prediction results to the doctor-side clinical decision support system to assist in formulating personalized postoperative management strategies and follow-up plans.
[0007] A method for predicting the recurrence of common bile duct stones after ERCP based on machine learning, which is applied to a system for predicting the recurrence of common bile duct stones after ERCP based on machine learning, and includes the following steps: S1. Collect multi-dimensional clinical datasets of patients before, during, and after ERCP to form a clinical dataset for prediction; S2. Preprocess the clinical dataset to construct a standardized preprocessed clinical dataset; S3. Construct feature vectors based on the preprocessed clinical dataset to establish a feature dataset suitable for the input requirements of the bidirectional gated recurrent unit network; S4. Construct an improved bidirectional gated recurrent unit network model to perform prediction output of recurrence risk; S5. Initialize the hyperparameter search space guided by medical features according to the key indicators reflecting the recurrence characteristics of common bile duct stones after ERCP in the preprocessed clinical dataset to form an optimized initial population. Use the Grey Wolf Optimization Algorithm to globally search for the hyperparameters of the improved bidirectional gated recurrent unit network model, perform dynamic fitness evaluation, update the population position to obtain the optimal hyperparameters, and apply the optimal hyperparameter configuration to the improved bidirectional gated recurrent unit network model to obtain an optimized improved bidirectional gated recurrent unit network model; S6. Use the optimized improved bidirectional gated recurrent unit network model to predict the recurrence risk of the new preprocessed clinical dataset and output the individualized recurrence risk prediction results of common bile duct stones after ERCP.
[0008] Optionally, the S1 includes the following steps: S11. Set the clinical data collection window, collect the multi-dimensional clinical raw data of patients before, during, and after ERCP to form an initial clinical data set : ; where, represents the clinical data record of the -th patient, is the total number of patients, represents the surgical time point of the -th patient, represents the preoperative data vector, and the preoperative data vector includes patient demographic information and basic examination indicators, represents the intraoperative data vector, and the intraoperative data vector includes variables related to surgical records, represents the postoperative data vector, and the postoperative data vector includes biochemical indicators, imaging data, and follow-up record features; S12. Define a unified feature space mapping function for different types of clinical data in the initial clinical data set . The feature space mapping function includes unified data encoding, time alignment, and structured rearrangement operations. The feature space mapping function maps each type of data to a standardized feature space to form a preoperative feature set, an intraoperative feature set, and a postoperative feature set; S13. Integrate the preoperative feature set, intraoperative feature set, and postoperative feature set in chronological order to construct a clinical data set for modeling. Normalize the timestamp set in the clinical data set to form a standardized time axis for calibrating the time series alignment operation between patients. Use the integrated clinical data set and the time axis as the standardized input.
[0009] Optionally, the S2 includes the following steps: S21. Detect and process missing values in the clinical data set for the feature vectors in it. For the feature dimensions with missing values, adopt the mean filling strategy to complete the filling. When the th patient's th eigenvalue is missing, use the arithmetic mean of the th eigenvalues of all patients without missing this feature for replacement, forming the feature vector after missing value filling; S22. Based on the feature vector after missing value filling, perform outlier detection and processing operations. For each feature dimension, calculate the median of the eigenvalues of all patients for this feature and the absolute value of the deviation from the median, and use this to judge outliers. When the deviation between a certain eigenvalue and the median exceeds the preset tolerance multiple range, replace this eigenvalue with the median of the current feature dimension, forming the feature vector after outlier processing; S23. Perform a normalization operation on the feature vector after outlier processing, standardize all eigenvalues to the interval range. Take the minimum value of this feature dimension among all patients as the lower limit and the maximum value as the upper limit, and perform linear scaling on each eigenvalue to form the normalized feature vector; S24. Represent the normalized feature vectors of all patients as a standardized preprocessed clinical feature matrix: ; where represents the normalized value of the th patient's th feature, is the standardized preprocessed clinical feature matrix with dimension , is the number of patient samples, is the feature dimension; S25. Combine the standardized preprocessed clinical feature matrix with the standardized time axis to construct a temporally aligned standardized preprocessed clinical data set .
[0010] Optionally, the said S3 includes the following steps: S31. Based on the standardized preprocessed clinical data set , extract the clinical time series feature vector of each patient, combine the feature vectors of all patients in chronological order, and construct a two-dimensional input feature data set. The two-dimensional input feature data set has a structure of rows and columns, represents the number of patients, represents the standardized feature dimension of each patient; S32. Convert the two-dimensional input feature dataset into a sequence format divided by time steps, and set the time step length to , and divide the feature vectors of each patient into consecutive time step inputs, and each time step input contains a feature vector consistent with the standardized feature dimension ; S33. Establish the hyperparameter search space of the improved bidirectional gated recurrent unit network model , and the hyperparameter search space includes the number of network layers , the number of hidden units in each layer , the learning rate , the dropout rate , and the batch size , where: The number of network layers is a positive integer, which is used to define the depth of the GRU layer in the model; The number of hidden units in each layer is a positive integer, which is used to define the number of neurons in each GRU unit; The learning rate is a continuous real number between 0 and 1, which is used to control the step size of model parameter update; The dropout rate is a continuous real number between 0 and 1, which is used to control the random dropout ratio of nodes in the model; The batch size is a positive integer, which is used to set the number of samples used for each round of parameter update in model training; S34. Set the corresponding initial search range for each hyperparameter . The value range of the number of network layers is set from the minimum number of layers to the maximum number of layers. The value range of the number of hidden units in each layer is set from the minimum number of hidden units to the maximum number of hidden units. The value range of the learning rate is set from the minimum learning rate to the maximum learning rate. The value range of the dropout rate is set from the minimum dropout rate to the maximum dropout rate. The value range of the batch size is set from the minimum batch size to the maximum batch size.
[0011] Optionally, the S4 includes the following steps: S41. According to the preoperative data vector , the intraoperative data vector , and the postoperative data vector , set the clinical stage label for each time segment, where represents the corresponding stage; S42. For the feature vector of each stage, calculate the clinical feature change trend of this stage and the previous stage, and form a time series enhanced feature vector ; S43. Input the time series enhanced feature vector and the clinical stage label into the clinical stage aware gating mechanism to define the gating weights as: ; where is the Sigmoid function, , , are the weights, stage embedding matrix and biases learned during the model training process, is the gating weight for each feature dimension, representing the importance of this metric for recurrence risk modeling at this stage; S44. The input to the bidirectional gated recurrent unit network is the stage-regulated feature vector : ; where is the Hadamard element-wise product, indicating that in a specific stage after ERCP, only the feature dimensions highly correlated with the recurrence risk are retained; S45. Take the stage-regulated feature vector as the input and feed it into a network structure composed of layers of bidirectional gated recurrent units. Each layer is set with hidden units, and the forward state and the backward state are output. Combining the temporal significance of ERCP postoperative recurrence in the postoperative stage, a risk-guided bidirectional fusion mechanism is used to define the fusion representation as: ; where is the risk attention weight; S46. Perform weighted pooling on the fusion representations output at all time steps to obtain the patient-level global temporal feature expression vector ; S47. Input the global temporal feature expression vector into the fully connected layer to predict the output recurrence risk as: ; where , are the weights and bias terms, represents the recurrence risk probability of the th patient; S48. During the training process, hyperparameters are used for optimization control: Learning rate : Controls the speed of parameter update; Dropout rate : Used to randomly discard some neurons in the bidirectional gated recurrent unit layer and the fully connected layer; Batch size : Controls the number of samples selected in each round of parameter update; Number of network layers , Number of hidden units : Controls the structural depth and feature capacity of the bidirectional gated recurrent unit network.
[0012] Optionally, the S5 includes the following steps: S51. Extract a set of key medical features significantly related to the recurrence risk after choledocholithotomy from the standardized preprocessed clinical dataset , The set of key medical features includes the total number of intraoperative stone removals, the postoperative change rate of TBiL, the postoperative peak ALT, and the postoperative 7-day reexamination results, and construct a feature intensity vector ; S52. Based on the feature intensity vector , Introduce a medical feature-guided initialization mechanism to generate an optimized population initialization offset matrix , And inject the optimized population initialization offset matrix into the generation process of the initial population of the gray wolf algorithm: ; Among them, is the offset intensity weight, is the standard uniform initialization hyperparameter individual, and the optimized population initialization offset matrix is generated by mapping, so that the hyperparameters corresponding to high-risk medical features preferentially enter the search space, is the population size in the gray wolf optimization algorithm; S53. Partition the search space according to the clinical stage, construct a stage-stratified convergence strategy, and define the search status label of each gray wolf individual in the population , Dynamically control the update step factor according to the search status label , Set the postoperative high-risk stage to preferentially maintain the global search ability: ; Among them, is the maximum number of iterations, is the initial step control factor, and t represents the current iteration number index in the gray wolf optimization algorithm; S54. Based on the training set and the validation set, construct a risk-sensitive dynamic fitness function for each group of candidate hyperparameters :
[0013] Among them, represents the area under the ROC curve of the model on the validation set, represents the recurrence sensitivity of the model on the samples in the postoperative stage, is the balance coefficient; S55. According to the grey wolf optimization strategy, select the optimal individual, sub-optimal individual, and sub-sub-optimal individual from the current population, and let their positions be 、 、 , respectively. Then update the position of the -th individual as:
[0014] Among them, is the Euclidean distance combination quantity between the current individual and the three excellent individuals; S56. Repeat steps S53–S55, perform global search iteratively until the maximum number of iterations is reached or the convergence condition that the fitness change is less than the preset threshold is satisfied, and finally obtain the optimal hyperparameter configuration:
[0015] S57. Apply the optimal hyperparameter configuration to the bidirectional gated recurrent unit network structure, perform global optimization on the final training task, apply the optimal hyperparameter configuration to the improved bidirectional gated recurrent unit network model, and perform iterative training on the preprocessed clinical dataset until the training of the improved bidirectional gated recurrent unit network model reaches the preset stop criterion, and obtain the optimized improved bidirectional gated recurrent unit network model.
[0016] Optionally, the said S6 includes the following steps: S71. Input the preprocessed new clinical dataset into the optimized improved bidirectional gated recurrent unit network model, perform forward prediction, and obtain the output value of the stone recurrence probability of the -th new patient; S72. For the output value of the stone recurrence probability of the new patient, combine it with the postoperative high-risk index threshold, construct an individualized recurrence risk classification standard based on medical rules, and divide each patient into the corresponding risk level; S73. Correlate and statistically analyze the output value of the stone recurrence probability of each new patient and the key index data during and after the operation, and output them stratified by risk level to form an individualized prediction result of the recurrence risk of common bile duct stones after ERCP.
[0017] Optionally, the risk levels include: High-risk patients are those who meet any of the following conditions and are classified as high-risk: predicted probability , and the change rate of TBiL within 7 days after surgery , or the peak value of ALT after surgery , or the number of residual stones during surgery ; Medium-risk patients are those who meet any of the following conditions and are classified as medium-risk: predicted probability , and the change rate of TBiL within 7 days after surgery , or the number of residual stones during surgery , or the peak value of ALT after surgery ; Low-risk patients are those who meet any of the following conditions and are classified as low-risk: predicted probability , and the change rate of TBiL after surgery , and the peak value of ALT after surgery , and there are no residual stones during surgery, that is .
[0018] The beneficial effects of the present invention are as follows: (1) The present invention constructs data input channels for the pre-operative, intra-operative, and post-operative stages, and generates time-series enhanced features by combining the change trends of feature vectors in each stage; on this basis, a clinical stage-aware gating mechanism is proposed, which dynamically adjusts the expression intensity of each feature dimension in different time segments by introducing label embedding and feature gating weight learning in each stage, effectively emphasizes the contribution of post-operative biochemical indicators and imaging information to recurrence modeling, and can automatically adjust the feature flow according to the stage risk weights, effectively improving the model's attention ability to recurrence-sensitive regions.
[0019] (2) The present invention embeds key medical features into the construction of the initial population of the grey wolf optimization algorithm to form a medical feature-driven initialization offset matrix, and introduces a stage-stratified convergence control strategy, enabling the high-risk stage after surgery to maintain global search ability in the early stage and the pre-operative stage to converge quickly to stabilize the basic network.
[0020] (3) The present invention constructs a risk-guided bidirectional fusion mechanism based on GRU, introduces key stage weights at the network output stage to form a dynamically risk-aware time-series aggregation representation, and at the same time combines weighted pooling to enhance the model's ability to integrate long-term dependence information, which has significant clinical value for the early identification of high-risk individuals in actual deployment. Description of the Drawings
[0021] The drawings are used to provide a further understanding of the present invention, and constitute a part of the specification, and are used to explain the present invention together with the embodiments of the present invention, and do not constitute a limitation to the present invention. In the drawings: Figure 1 This is a flowchart of a recurrence prediction system for common bile duct stones after ERCP based on machine learning proposed by the present invention. Specific implementation manners
[0022] Now, the present invention will be further described in detail with reference to the accompanying drawings. These drawings are all simplified schematic diagrams, only illustrating the basic structure of the present invention in a schematic manner, so they only show the components related to the present invention.
[0023] Reference Figure 1 , a recurrence prediction system for common bile duct stones after ERCP based on machine learning, includes the following modules: A data acquisition module, which is used to collect multi-dimensional clinical data of patients in the pre-ERCP, intra-ERCP, and post-ERCP stages to form an original clinical data set; A data preprocessing module, which is used to perform preprocessing operations on the original clinical data set to construct a standardized preprocessed clinical data set; A feature construction and hyperparameter search space definition module, which is used to construct pre-operative, intra-operative, and post-operative stage feature vectors based on the standardized preprocessed clinical data set and define the hyperparameter search space of the improved bidirectional gated recurrent unit network model; An improved bidirectional gated recurrent unit network model construction module, which is used to construct an improved bidirectional gated recurrent unit network model integrating a time series enhancement mechanism, a clinical stage perception gating mechanism, and a risk-guided fusion strategy, and output a recurrence risk prediction value; A grey wolf optimization hyperparameter tuning module, which is used to initialize the hyperparameter search space based on key medical feature guidance, construct a medical-guided initial population, and perform multiple rounds of grey wolf optimization search based on a stage-stratified convergence strategy and a risk-sensitive fitness function to obtain the optimal hyperparameter configuration, and finally generate an optimized improved bidirectional gated recurrent unit network model; A model training and prediction module, which is used to perform forward prediction on the standardized new patient clinical data using the optimized improved bidirectional gated recurrent unit network model, output a recurrence probability value, and construct a risk classification rule based on the predicted probability and post-operative key indicators; An individualized result output module, which is used to stratify and output the prediction results according to high-risk, medium-risk, and low-risk levels. The output results include: individual recurrence probability value, stratified risk level, explanation of key driving medical indicators, and push the prediction results to the doctor-side clinical decision support system to assist in formulating personalized post-operative management strategies and follow-up plans.
[0024] A recurrence prediction method for common bile duct stones after ERCP based on machine learning, which is applied to a recurrence prediction system for common bile duct stones after ERCP based on machine learning, includes the following steps: S1. Collect the multi-dimensional clinical data sets of patients before, during, and after ERCP to form a clinical data set for prediction; S2. Preprocess the clinical data set to construct a standardized preprocessed clinical data set; S3. Construct feature vectors based on the preprocessed clinical data set to establish a feature data set that meets the input requirements of the bidirectional gated recurrent unit network; S4. Construct an improved bidirectional gated recurrent unit network model for predicting recurrence risk; S5. According to the key indicators reflecting the recurrence characteristics of common bile duct stones after ERCP in the preprocessed clinical data set, perform a medical feature-guided initialization setting on the hyperparameter search space to form an optimized initial population. Use the gray wolf optimization algorithm to globally search the hyperparameters of the improved bidirectional gated recurrent unit network model, perform dynamic fitness evaluation, update the population position to obtain the optimal hyperparameters, and apply the optimal hyperparameter configuration to the improved bidirectional gated recurrent unit network model to obtain an optimized improved bidirectional gated recurrent unit network model; S6. Use the optimized improved bidirectional gated recurrent unit network model to predict the recurrence risk of the new preprocessed clinical data set and output the individualized recurrence risk prediction results of common bile duct stones after ERCP.
[0025] In this embodiment, S1 includes the following steps: S11. Set the clinical data collection window, collect the multi-dimensional clinical raw data of patients before, during, and after ERCP to form an initial clinical data set : ; Among them, represents the clinical data record of the th patient, is the total number of patients, represents the surgical time point of the th patient, represents the preoperative data vector, and the preoperative data vector includes patient demographic information and basic examination indicators, represents the intraoperative data vector, and the intraoperative data vector includes variables related to the surgical record, represents the postoperative data vector, and the postoperative data vector includes biochemical indicators, imaging data, and follow-up record characteristics; S12. Define a unified feature space mapping function for different types of clinical data in the initial clinical data set . The feature space mapping function includes unified data encoding, time alignment, and structured rearrangement operations. The feature space mapping function maps each type of data to a standardized feature space to form a preoperative feature set, an intraoperative feature set, and a postoperative feature set; S13. Integrate the preoperative feature set, intraoperative feature set, and postoperative feature set in chronological order to construct a clinical dataset for modeling. Normalize the set of timestamps in the clinical dataset to form a standardized time axis for calibrating the time series alignment operation between patients. Use the integrated clinical dataset and the time axis as the standardized input.
[0026] In this embodiment, S2 includes the following steps: S21. Detect and process missing values in the feature vectors in the clinical dataset . For the feature dimensions with missing values, adopt the mean filling strategy to complete the filling. When the th patient's th feature value is missing, use the arithmetic mean of the th feature values of all patients without missing this feature for replacement to form the feature vector after missing value filling; S22. Based on the feature vector after missing value filling, perform outlier detection and processing operations. For each feature dimension, calculate the median of the feature values of all patients and the absolute value of the deviation from the median, and use this to judge outliers. When the deviation between a certain feature value and the median exceeds the preset tolerance multiple range, replace the feature value with the median of the current feature dimension to form the feature vector after outlier processing; S23. Perform a normalization operation on the feature vector after outlier processing, standardize all feature values to the interval . Use the minimum value of this feature dimension among all patients as the lower limit and the maximum value as the upper limit, and perform linear scaling on each feature value to form the normalized feature vector; S24. Represent the normalized feature vectors of all patients as a standardized preprocessed clinical feature matrix: ; where represents the normalized value of the th patient's th feature, is the standardized preprocessed clinical feature matrix with dimension , is the number of patient samples, is the feature dimension; S25. Combine the standardized preprocessed clinical feature matrix with the standardized time axis to construct a standardized preprocessed clinical dataset with time series alignment .
[0027] In this embodiment, S3 includes the following steps: S31. Based on the standardized preprocessed clinical data set , extract the clinical time series feature vectors of each patient , combine the feature vectors of all patients in chronological order to construct a two-dimensional input feature data set, and the two-dimensional input feature data set has rows, columns of structure, represents the number of patients, represents the standardized feature dimension of each patient; S32. Convert the two-dimensional input feature data set into a sequence format divided by time steps, set the time step length to , and divide the feature vectors of each patient into continuous time step inputs according to the time stamps, and each time step input contains a feature vector consistent with the standardized feature dimension ; S33. Establish the hyperparameter search space of the improved bidirectional gated recurrent unit network model , and the hyperparameter search space includes the number of network layers , the number of hidden units in each layer , the learning rate , the dropout rate and the batch size , where: The number of network layers is a positive integer and is used to define the depth of the GRU layer in the model; The number of hidden units in each layer is a positive integer and is used to define the number of neurons in each GRU unit; The learning rate is a continuous real number between 0 and 1 and is used to control the step size of model parameter updates; The dropout rate is a continuous real number between 0 and 1 and is used to control the random dropout ratio of nodes in the model; The batch size is a positive integer and is used to set the number of samples used for each round of parameter updates during model training; S34. Set the corresponding initial search range for each hyperparameter . The value range of the number of network layers is set from the minimum number of layers to the maximum number of layers, the value range of the number of hidden units in each layer is set from the minimum number of hidden units to the maximum number of hidden units, the value range of the learning rate is set from the minimum learning rate to the maximum learning rate, the value range of the dropout rate is set from the minimum dropout rate to the maximum dropout rate, and the value range of the batch size is set from the minimum batch size to the maximum batch size.
[0028] In this embodiment, S4 includes the following steps: S41. According to the preoperative data vector intraoperative data vector and postoperative data vector Set clinical stage labels for each time segment where represents the corresponding stage; S42. Feature vector for each stage Calculate the clinical feature change trend of this stage compared with the previous stage to form a temporal enhanced feature vector ; S43. Input the temporal enhanced feature vector and the clinical stage label into the clinical stage perception gating mechanism to define the gating weight as: ; where is the Sigmoid function, , , are the weights, stage embedding matrix, and bias learned during model training, is the gating weight for each feature dimension, representing the importance of this indicator for recurrence risk modeling at this stage; S44. The input to the bidirectional gated recurrent unit network is the stage-regulated feature vector : ; where is the Hadamard element-wise product, indicating that in a specific stage after ERCP, only the feature dimensions highly correlated with the recurrence risk are retained; S45. Use the stage-regulated feature vector as the input and feed it into a network structure composed of layers of bidirectional gated recurrent units. Each layer is set with hidden units, and the forward state and the backward state are output. Combining the temporal significance of ERCP postoperative recurrence at the postoperative stage, a risk-guided bidirectional fusion mechanism is used to define the fusion representation : ; where is the risk attention weight; S46. Perform weighted pooling on the fusion representations output at all time steps to obtain a patient-level global temporal feature expression vector ; S47. The global temporal feature expression vector Input to the fully connected layer to predict the recurrence risk of the output : ; Among them, 、 are the weight and bias terms, represents the recurrence risk probability of the th patient; S48. During the training process, hyperparameters are used for optimization control: Learning rate : Control the parameter update speed; Dropout rate : Used to randomly discard some neurons in the bidirectional gated recurrent unit layer and the fully connected layer; Batch size : Control the number of samples selected in each round of parameter update; Number of network layers 、Hidden unit number : Control the structural depth and feature capacity of the bidirectional gated recurrent unit network.
[0029] In this embodiment, S5 includes the following steps: S51. Extract the key medical feature set significantly related to the recurrence risk after choledocholithotomy from the standardized preprocessed clinical data set , the key medical feature set includes the total number of intraoperative stone removals, the postoperative change rate of TBiL, the postoperative peak ALT, and the postoperative 7-day reexamination results, and construct a feature intensity vector ; S52. Based on the feature intensity vector , introduce a medical feature-guided initialization mechanism to generate an optimized population initialization offset matrix , and inject the optimized population initialization offset matrix into the generation process of the initial population of the gray wolf algorithm: ; Among them, is the offset intensity weight, is the standard uniform initialization hyperparameter individual, and the optimized population initialization offset matrix is generated by the mapping of , so that the hyperparameters corresponding to high-risk medical features preferentially enter the search space, is the population size in the gray wolf optimization algorithm; Optimized population initialization offset matrix The system performs mapping in the following way: First, normalize each medical feature within its overall sample distribution so that its value falls between 0 and 1 to unify the dimension and avoid affecting the initialization offset weights due to differences in feature scales. Then, define a preset hyperparameter - feature - correlation matrix to clarify the sensitive mapping relationships between different medical features and each hyperparameter in the grey wolf optimization search space. For example: When the postoperative change rate of TBiL is large, it is necessary to increase the model learning rate and network depth to enhance the learning ability for pathological mutations; when the ALT peak value is abnormal, it is recommended to increase the number of hidden units and dropout rate to improve the model robustness and control overfitting; when the number of residual stones during the operation is large, appropriately increase the batch size so that the model can more stably perceive the "complex input" pattern.
[0030] Finally, the system performs matrix multiplication on the normalized medical feature values and the above mapping relationships to calculate the offset values of each hyperparameter in the initial population, and constructs an optimized population initialization offset matrix to guide the initial population to concentrate and distribute in the search space towards the direction of potentially better solutions.
[0031] S53. Partition the search space according to the clinical stage, construct a stage - stratified convergence strategy, and define the search status labels for each grey wolf individual in the population to dynamically control the update step - size factor according to the search status labels assuming that the high - risk postoperative stage preferentially maintains the global search ability: ; wherein, is the maximum number of iterations, is the initial step - size control factor, and t represents the current iteration number index in the grey wolf optimization algorithm; S54. Based on the training set and validation set, construct a risk - sensitive dynamic fitness function for each group of candidate hyperparameters :
[0032] wherein, represents the area under the ROC curve of the model on the validation set, represents the recurrence sensitivity of the model on the postoperative stage samples, is the balance coefficient; S55. According to the grey wolf optimization strategy, select the optimal individual, sub - optimal individual, and sub - sub - optimal individual from the current population, and assume their positions are 、 、 , then update the position of the th individual to:
[0033] Among them, is the Euclidean distance combination quantity between the current individual and the three excellent individuals; S56. Repeat steps S53–S55, iteratively perform global search until the maximum number of iteration rounds or the fitness change meets the convergence condition of being less than the preset threshold is satisfied, and finally obtain the optimal hyperparameter configuration:
[0034] S57. Apply the optimal hyperparameter configuration to the bidirectional gated recurrent unit network structure, globally optimize the final training task, apply the optimal hyperparameter configuration to the improved bidirectional gated recurrent unit network model, and iteratively train the preprocessed clinical data set until the training of the improved bidirectional gated recurrent unit network model reaches the preset stop criterion, and obtain the optimized improved bidirectional gated recurrent unit network model.
[0035] In this embodiment, S6 includes the following steps: S71. Input the preprocessed new clinical data set into the optimized improved bidirectional gated recurrent unit network model, perform forward prediction, and obtain the stone recurrence probability output value of the -th new patient ; S72. For the stone recurrence probability output value of the new patient, combine the postoperative high-risk index threshold, construct an individualized recurrence risk classification standard based on medical rules, and classify each patient into the corresponding risk level; S73. Statistically correlate the stone recurrence probability output value
[0036] of each new patient with the key index data during and after the operation, and output by stratifying according to the risk level to form an individualized ERCP postoperative common bile duct stone recurrence risk prediction result. In this embodiment, the risk levels include: High-risk patients are classified as high-risk if they meet any of the following conditions: predicted probability , and the change rate of TBiL within 7 days after the operation , or the peak value of ALT after the operation ; Medium-risk patients are classified as medium-risk if they meet any of the following conditions: predicted probability , and the change rate of TBiL within 7 days after the operation , or the number of residual stones during the operation , or the peak value of ALT after the operation ; Low-risk patients are classified as low-risk if they meet any of the following conditions: predicted probability , and the change rate of postoperative TBiL , and the peak value of postoperative ALT , and there are no residual stones during the operation, that is .
[0037] The present invention constructs data input channels for the pre-operative, intra-operative, and post-operative stages, and generates time-series enhanced features by combining the changing trends of feature vectors at each stage. On this basis, a clinical stage-aware gating mechanism is proposed. By introducing label embedding and feature gating weight learning at each stage, the expression intensity of each feature dimension in different time segments is dynamically adjusted, effectively emphasizing the contribution of postoperative biochemical indicators and imaging information to recurrence modeling, and the feature flow can be automatically adjusted according to the stage-based risk weights, effectively improving the model's attention ability to recurrence-sensitive regions.
[0038] The present invention embeds key medical features into the construction of the initial population of the grey wolf optimization algorithm to form a medical feature-driven initialization offset matrix, and introduces a stage-stratified convergence control strategy to enable the high-risk postoperative stage to maintain global search ability in the early stage and the preoperative stage to converge quickly to stabilize the basic network.
[0039] The present invention constructs a risk-guided bidirectional fusion mechanism based on GRU, introduces key stage weights at the network output stage to form a time-series aggregation representation with dynamic risk perception, and at the same time combines weighted pooling to enhance the model's ability to integrate long-term dependence information, which has significant clinical value for the early identification of high-risk individuals in actual deployment.
[0040] The above is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present invention, according to the technical solution and inventive concept of the present invention, makes equivalent substitutions or changes, and should be covered by the protection scope of the present invention.
Claims
1. A machine learning-based prediction system for common bile duct stones recurrence after ERCP, characterized in that: Includes the following modules: The data collection module is used to collect multi-dimensional clinical data of patients before, during and after ERCP to form an original clinical data set; A data preprocessing module is used to perform preprocessing operations on the original clinical data set and construct a standardized preprocessed clinical data set; Feature construction and hyperparameter search space definition module, which is used to construct preoperative, intraoperative and postoperative staged feature vectors based on standardized preprocessed clinical data sets, and define the hyperparameter search space of the improved bidirectional gated recurrent unit network model; An improved bidirectional gated recurrent unit network model construction module is used to construct an improved bidirectional gated recurrent unit network model and output a recurrence risk prediction value; The Gray Wolf Optimization hyperparameter tuning module builds a medically guided initialization population and performs multiple rounds of Gray Wolf optimization searches to obtain the optimal hyperparameter configuration, ultimately generating an optimized improved bidirectional gated recurrent unit network model; The model training and prediction module is used to use the optimized improved bidirectional gated recurrent unit network model to perform forward prediction on the standardized new patient clinical data, output the recurrence probability value, and construct risk classification rules based on the predicted probability and postoperative key indicators; The individualized result output module is used to output the prediction results in layers according to high-risk, medium-risk and low-risk levels, and push the prediction results to the doctor side.
2. A method for predicting the recurrence of common bile duct stones after ERCP based on machine learning, applied to a system for predicting the recurrence of common bile duct stones after ERCP based on machine learning as claimed in claim 1, characterized in that: The following steps are involved: S1. Collect multidimensional clinical data sets of patients before, during and after ERCP to form clinical data sets for prediction; S2. Preprocess the clinical data set and construct a standardized preprocessed clinical data set; S3. Construct feature vectors based on the preprocessed clinical dataset and establish a feature dataset suitable for the input requirements of the bidirectional gated recurrent unit network; S4. Construct an improved bidirectional gated recurrent unit network model to predict the recurrence risk; S5. Based on the key indicators reflecting the recurrence characteristics of common bile duct stones after ERCP in the preprocessed clinical data set, the hyperparameter search space is initialized with medical feature guidance to form an optimized initial population. The gray wolf optimization algorithm is used to perform a global search for the hyperparameters of the improved bidirectional gated recurrent unit network model, and a dynamic fitness evaluation is performed. The population position is updated to obtain the optimal hyperparameters. The optimal hyperparameter configuration is applied to the improved bidirectional gated recurrent unit network model to obtain the optimized improved bidirectional gated recurrent unit network model. S6. The optimized improved bidirectional gated recurrent unit network model was used to predict the recurrence risk of the new preprocessed clinical data set, and the individualized recurrence risk prediction results of common bile duct stones after ERCP were output.
3. The method for predicting recurrence of common bile duct stones after ERCP based on machine learning according to claim 2, characterized in that: The S1 comprises the following steps: S11. Set the clinical data collection window to collect the multi-dimensional clinical raw data of patients before, during and after ERCP to form an initial clinical data set : ; in, Indicates Clinical data records of patients, is the total number of patients, Indicates The surgery time of each patient was represents the preoperative data vector, which includes patient demographic information and basic examination indicators. represents the intraoperative data vector, which includes variables related to surgical records. represents the postoperative data vector, which includes biochemical indicators, imaging data and follow-up record characteristics; S12. For initial clinical data collection A unified feature space mapping function is defined for different types of clinical data. The feature space mapping function includes unified data encoding, time alignment, and structured rearrangement operations. The feature space mapping function maps each type of data to a standardized feature space to form a preoperative feature set, an intraoperative feature set, and a postoperative feature set. S13. Integrate the preoperative feature set, intraoperative feature set, and postoperative feature set in chronological order to construct a clinical data set for modeling. Normalize the timestamp set in the clinical data set to form a standardized time axis for calibrating the time series alignment operation between patients. and timeline as standardized input.
4. The method for predicting recurrence of common bile duct stones after ERCP based on machine learning according to claim 2, characterized in that: The S2 comprises the following steps: S21. Clinical Datasets The eigenvectors in Detect and process missing values. For feature dimensions with missing values, use the mean filling strategy to complete them. The patient's When a feature value is missing, use the The arithmetic mean of the eigenvalues is replaced to form the eigenvector after the missing values are filled; S22. Based on the feature vector after missing value filling, perform outlier detection and processing operations. For each feature dimension, calculate the median of the feature value of all patients and the absolute value of the deviation from the median, and use this to determine the outlier. When the deviation between a feature value and the median exceeds the preset tolerance multiple range, replace the feature value with the median of the current feature dimension to form a feature vector after outlier processing; S23. Perform normalization on the feature vector after outlier processing, and standardize all feature values to the interval Within the range, the minimum value of the feature dimension in all patients is taken as the lower limit and the maximum value is taken as the upper limit, and each feature value is linearly scaled to form a normalized feature vector; S24. Represent all normalized patient feature vectors as the standardized preprocessed clinical feature matrix ; S25. Combine the standardized preprocessed clinical feature matrix with the standardized timeline to construct a time-aligned standardized preprocessed clinical dataset .
5. The method for predicting recurrence of common bile duct stones after ERCP based on machine learning according to claim 4, characterized in that: The S3 comprises the following steps: S31. Based on standardized preprocessed clinical data sets , extract the clinical time series feature vector of each patient , combine the feature vectors of all patients in chronological order to construct a two-dimensional input feature dataset. The two-dimensional input feature dataset has OK, The structure of the columns, represents the number of patients, represents the standardized characteristic dimensions of each patient; S32. Convert the two-dimensional input feature data set into a sequence format divided by time steps, and set the time step length to , divide the feature vector of each patient into continuous time step input, each time step input contains a normalized feature dimension consistent eigenvectors; S33. Establishing a hyperparameter search space for an improved bidirectional gated recurrent unit network model , the hyperparameter search space includes the number of network layers , the number of hidden units in each layer , learning rate , dropout rate and batch processing size ; S34. For each hyperparameter Set the corresponding initial search range.
6. The method for predicting recurrence of common bile duct stones after ERCP based on machine learning according to claim 5, characterized in that: The S4 comprises the following steps: S41. Based on preoperative data vector , intraoperative data vector and postoperative data vector , set clinical stage labels for each time segment ,in Indicates the corresponding stage; S42. Feature vector for each stage , calculate the changing trend of clinical characteristics between this stage and the previous stage, and form a time series enhanced feature vector ; S43. Time series enhanced feature vector With clinical stage label Input to clinical stage perceived gating mechanism to define gating weights for: ; in, is the Sigmoid function, , , are the weights, stage embedding matrices and biases learned during model training, is the gating weight for each feature dimension, representing the importance of this indicator to recurrence risk modeling at this stage; S44. Construct a bidirectional gated recurrent unit network with the input as the feature vector after stage regulation : ; in, It is the Hadamard element-by-element product, which means that only the feature dimensions that are highly correlated with the risk of recurrence are retained in a specific stage after ERCP. S45. The feature vector after stage adjustment As input, the In the network structure composed of layers of bidirectional gated recurrent units, each layer is set hidden units, outputting the forward state and backward state Combined with the temporal significance of post-ERCP recurrence in the postoperative period, a risk-guided bidirectional fusion mechanism was used to define the fusion representation ; S46. Fusion representation of all time step outputs Perform weighted pooling to obtain the patient-level global temporal feature expression vector ; S47. Express the global temporal feature vector Input to the fully connected layer and predict the output recurrence risk .
7. The method for predicting recurrence of common bile duct stones after ERCP based on machine learning according to claim 6, characterized in that: The S5 comprises the following steps: S51. Extraction of key medical features significantly associated with the risk of postoperative recurrence of common bile duct stones based on standardized preprocessed clinical data sets The key medical feature set includes the total number of stones removed during surgery, the change rate of TBiL after surgery, the peak value of ALT after surgery, and the results of the 7-day follow-up after surgery. The feature strength vector is constructed ; S52. Based on feature intensity vector , introduce the medical feature-guided initialization mechanism to generate the optimized population initialization offset matrix , and inject the optimized population initialization offset matrix into the generation process of the initial population of the gray wolf algorithm: ; in, is the bias intensity weight, Initialize the hyperparameter individuals uniformly for the standard and optimize the population initialization offset matrix Depend on Mapping generation allows the hyperparameters corresponding to high-risk medical features to enter the search space first. Optimizing the population size in the algorithm for gray wolves; S53. Partition the search space by clinical stage, construct a stage-by-stage convergence strategy, and define the search state label for each individual gray wolf in the population , dynamically control the update step factor according to the search status label , assuming that the global search capability is maintained first during the postoperative high-risk phase: ; in, is the maximum number of iterations, is the initial step size control factor, t represents the current iteration index in the gray wolf optimization algorithm; S54. Based on the training set and the validation set, for each set of candidate hyperparameters Constructing a risk-sensitive dynamic fitness function: ; in, Represents the area under the ROC curve of the model on the validation set. represents the recurrence sensitivity of the model on the postoperative stage samples, is the balance coefficient; S55. According to the gray wolf optimization strategy, select the best individual, the second best individual, and the second best individual from the current population, and set their positions respectively , , , then update the The position of each individual is: ; in, is the combined Euclidean distance between the current individual and the three best individuals; S56. Repeat steps S53-S55, iteratively perform global search until the maximum number of iterations is reached Or the fitness change is less than the preset threshold The convergence condition of ; S57. Configure the optimal hyperparameters Applied to the bidirectional gated recurrent unit network structure, the final training task is globally optimized, the optimal hyperparameter configuration is applied to the improved bidirectional gated recurrent unit network model, and the preprocessed clinical dataset is iteratively trained until the improved bidirectional gated recurrent unit network model training reaches the preset stopping criterion to obtain the optimized improved bidirectional gated recurrent unit network model.
8. The method for predicting recurrence of common bile duct stones after ERCP based on machine learning according to claim 7, characterized in that: The S6 comprises the following steps: S71. Input the preprocessed new clinical data set into the optimized improved bidirectional gated recurrent unit network model, perform forward prediction, and obtain the first Output value of stone recurrence probability for new patients ; S72. Output value of stone recurrence probability for new patients , combined with the postoperative high-risk indicator threshold, to construct an individualized recurrence risk classification standard based on medical rules, and divide each patient into the corresponding risk level; S73. Output the probability of stone recurrence for each new patient The data of key indicators during and after the operation are correlated and statistically analyzed, and the data are stratified by risk level to form an individualized prediction result of the risk of recurrence of common bile duct stones after ERCP.
9. The method for predicting recurrence of common bile duct stones after ERCP based on machine learning according to claim 8, characterized in that: The risk levels include: High-risk patients are classified as high risk if they meet any of the following conditions: Predicted probability , and the TBiL change rate within 7 days after surgery , or postoperative ALT peak , or the number of stones remaining during surgery ; Patients at medium risk were classified as those who met any of the following conditions: Predicted probability , and the TBiL change rate within 7 days after surgery , or the number of stones remaining during surgery , or postoperative ALT peak ; Low-risk patients were classified as low-risk if they met any of the following criteria: Predicted probability , and the postoperative TBiL change rate , and the peak ALT level after surgery , and there are no residual stones during the operation, that is .
Citation Information
Patent Citations
Intelligent early warning system for risk after ERCP operation
CN115762769A
ERCP intelligent auxiliary diagnosis model training method and system
CN116646071A
Comprehensive energy system short-term multi-element load prediction method fusing deep learning combination model
CN119476713A
Cited By
Chronic patient screening and personalized processing method and system based on large model
CN121237407A
