Machine Learning-Based Methods for Predicting Postpartum Pain and Extracting High-Risk Factors After Cesarean Section

By constructing a dual-branch hybrid architecture model, combining static and dynamic variables for time-series modeling, and using the SHAP algorithm to interpret the model output, the accuracy and interpretability issues of postoperative pain assessment after cesarean section in existing technologies are solved. This enables dynamic prediction of postoperative pain risk and identification of high-risk factors, thereby enhancing the value of clinical decision support.

CN122369768APending Publication Date: 2026-07-10TONGJI HOSPITAL ATTACHED TO TONGJI MEDICAL COLLEGE HUAZHONG SCI TECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
TONGJI HOSPITAL ATTACHED TO TONGJI MEDICAL COLLEGE HUAZHONG SCI TECH
Filing Date
2026-06-10
Publication Date
2026-07-10

AI Technical Summary

Technical Problem

Current technologies lack a systematic model of the entire postoperative recovery process in assessing pain after cesarean section, making it impossible to accurately predict the risk of chronic pain. Furthermore, machine learning models cannot explain the impact of various clinical variables on the occurrence of pain, thus limiting the application value of predictive models in clinical decision support.

Method used

A machine learning-based dual-branch hybrid architecture model is constructed, combining static and dynamic variables. Temporal modeling is performed using recurrent neural networks, and the SHAP attribution algorithm is used to interpret the model output and identify high-risk factors.

Benefits of technology

It enables dynamic prediction of postoperative pain risk and identification of high-risk factors after cesarean section, improving the accuracy and interpretability of prediction and providing reliable risk factor evidence for clinical intervention.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122369768A_ABST
    Figure CN122369768A_ABST
Patent Text Reader

Abstract

This invention discloses a machine learning-based method for predicting postoperative pain and extracting high-risk factors after cesarean section, belonging to the field of postoperative pain detection technology. It involves a unified modeling of static variables such as preoperative and intraoperative demographic characteristics, medical history, and surgical parameters, along with dynamic variables such as physiological monitoring indicators and analgesia intervention data obtained at different postoperative recovery stages. A two-branch prediction model with a static coding branch and a dynamic evolution branch is constructed. After model training, the SHAP attribution algorithm is introduced to interpret and analyze the prediction model, decomposing the model output into the contribution of each input variable to the prediction result, thereby quantifying the influence of each factor on pain risk. This invention utilizes a recurrent neural network to model the dynamic feature sequence that changes over time, enabling the model to learn the evolutionary pattern of postoperative pain as it changes with the recovery stage, improving the accuracy and stability of chronic pain risk prediction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of postoperative pain detection technology, specifically a method for predicting postoperative pain and extracting high-risk factors after cesarean section based on machine learning. Background Technology

[0002] Chronic Post-Surgical Pain after Cesarean Delivery (CPSP-CD) is influenced by a variety of factors, including the patient's preoperative individual characteristics, surgical and anesthetic factors during the operation, and physiological changes and analgesic interventions during the postoperative recovery phase.

[0003] However, current clinical research commonly uses postoperative pain assessment methods based on pain scores at a fixed postoperative time point or a few static indicators for risk assessment, such as VAS pain score analysis at 24 or 48 hours postoperatively. These methods typically utilize only single-observation data for statistical analysis, lacking a systematic modeling of pain changes throughout the patient's postoperative recovery process. They cannot capture the dynamic evolution trend of patients from acute postoperative pain to subacute and chronic pain, thus exhibiting significant limitations in accuracy and prospectivity in the early prediction of postoperative chronic pain risk.

[0004] While some existing studies employ machine learning or deep learning methods to construct postoperative pain risk prediction models, these models are mostly single-branch static feature models that cannot integrate postoperative time-series dynamic data and generally exhibit "black box" characteristics. The prediction results cannot directly explain the specific impact of each clinical variable on the risk of pain occurrence. Consequently, clinicians struggle to clearly identify the main high-risk factors leading to pain based on model results, and also find it difficult to develop targeted interventions. This, to some extent, limits the application value of these prediction models in clinical decision support. Summary of the Invention

[0005] (a) Technical problems to be solved This invention provides a machine learning-based method for predicting postoperative pain and extracting high-risk factors after cesarean section, realizing an integrated analysis process for dynamic prediction, stage assessment and identification of high-risk factors of postoperative pain risk after cesarean section.

[0006] (II) Technical Solution To achieve the above objectives, the present invention provides the following technical solution: a method for predicting postoperative pain and extracting high-risk factors after cesarean section based on machine learning, comprising the following execution steps: Static variables were obtained for each patient before and during surgery, as well as dynamic variables at each postoperative stage. The static variables included basic physiological characteristics, pain threshold indicators, and intraoperative stress and medication patterns. The dynamic variables included physiological monitoring indicators and analgesia intervention indicators for patients at each postoperative stage. Missing values ​​were imputed and standardized for all types of original variables. Static variables for each patient were encoded into fixed-length two-dimensional feature tensors, and dynamic variables were encoded into three-dimensional feature tensors according to time stages. A dual-branch hybrid architecture prediction model is constructed, wherein the static encoding branch of the prediction model maps the two-dimensional feature tensor to the patient's basic feature vector and serves as the initial hidden state input for the dynamic evolution branch. The dynamic evolution branch adopts a recurrent neural network structure, which recursively models the three-dimensional feature tensor of each stage in time sequence. The three-dimensional feature tensor of the current stage and the patient's real pain label of the previous stage constitute the input of the current stage. Together with the hidden state calculated by the dynamic evolution branch of the previous stage, it is input into the recurrent neural network structure to learn the evolution law of the patient's pain over time. In each stage, the probability of pain occurrence and the corresponding pain level prediction output are set. A joint loss function is constructed based on a multi-task learning strategy, and the prediction model parameters are jointly optimized through backpropagation. For the trained prediction model, based on the SHAP attribution algorithm, the contribution of each type of input variable to the prediction output at the corresponding stage is calculated, and variables with high contribution are defined as high-risk factors affecting the evolution of postoperative pain. The synergistic relationship between high-contribution variables is analyzed to extract the combination pattern of high-risk factors.

[0007] In some feasible embodiments, preoperative information such as age, BMI, basal metabolic rate, history of chronic pain and pain threshold monitoring indicators of each patient is first obtained, as well as the duration of surgery, anesthesia method and analgesic drug use pattern during the operation are recorded to form a set of static variables for the patient. During the postoperative recovery period of each patient, the postoperative monitoring timeline of the patient is divided into multiple consecutive stages. Physiological monitoring indicators and analgesia intervention data of the patient are acquired in each of the divided stages. By extracting the physiological and analgesia indicator characteristics of each stage, a set of dynamic variables for the corresponding stage is formed.

[0008] In some feasible embodiments, the collected static variables and dynamic variables at various stages of the patients are cleaned, including outlier removal and missing value imputation, and then differential coding is performed according to the type of the variable; wherein, binary type variables are binarized and encoded; low cardinality categorical variables are one-hot encoded; and for ordered variables with numerical magnitude and continuous variables, their numerical form is preserved during encoding. After encoding is completed, standardization is performed on all continuous and ordered variables; the processed static variables are constructed into two-dimensional feature tensors; and the dynamic variables of each stage are arranged in chronological order into three-dimensional feature tensors.

[0009] In some feasible embodiments, for different patients with different number of stages in the dataset, insufficient stages are filled by setting a uniform maximum stage length, and a stage mask matrix is ​​constructed to identify the actual observed stage and the filled stage after surgery.

[0010] In some feasible embodiments, the static coding branch of the prediction model receives the patient's two-dimensional feature tensor, performs nonlinear feature mapping through a multi-layer fully connected network to the patient's basic state vector, which represents the patient's individual physiological characteristics and pain sensitivity, and maps the basic state vector to the initial hidden state of the dynamic evolution branch through a linear transformation. In the recursive evolution stage of the dynamic evolution branch, the three-dimensional feature tensor is processed stage by stage in chronological order. In each stage, the three-dimensional feature tensor of the current stage is concatenated with the patient's pain occurrence state and pain score obtained in the previous stage as the input of the current stage. This input, along with the hidden state of the previous stage, is fed into the recurrent neural network of the dynamic evolution branch to perform the pain state update calculation for the current stage, thereby obtaining the hidden state of the current stage. In some feasible embodiments, during the output phase of the prediction model, two independent output channels are established; based on the hidden state generated by the dynamic evolution branch in the current phase, each output channel is mapped to generate the probability of pain occurrence and the pain level; wherein, the probability of pain occurrence is obtained by linear transformation combined with the Sigmoid function; the other output channel obtains the pain level by linear transformation combined with the Softmax function.

[0011] In some feasible embodiments, during the training phase of the prediction model, the prediction result of the probability of pain occurrence and the prediction result of the pain level are output at each stage, and the prediction loss of each stage is calculated by combining the pain label corresponding to each stage of the patient; wherein, the prediction of the probability of pain occurrence uses the Sigmoid function to activate the linear mapping result, and the error between the prediction result of the probability of pain occurrence and the occurrence state in the pain label is calculated by the binary cross-entropy function. The pain level prediction uses the Softmax function to normalize the linear mapping results and the cross-entropy function to calculate the error between the predicted pain level and the pain level score in the pain label.

[0012] In some feasible embodiments, during the training of the prediction model, the stage mask matrix is ​​used to calculate the error loss only for the real observation stage and participate in the update of the prediction model parameters, while the error loss for the filling stage is masked. The weighted error losses of all stages are accumulated, and a joint loss function is constructed by combining the weight coefficients set for each stage. The static coding branch parameters, dynamic evolution branch parameters, and mapping parameters of each output channel are jointly optimized by backpropagation.

[0013] In some feasible embodiments of high-risk factor extraction, after the prediction model is trained, the SHAP attribution algorithm is introduced, and SHAP interpreters are constructed for each stage. The predicted probability of pain occurrence and the predicted pain level at each stage are used as the explanatory targets. The contribution of various input variables to the output of the prediction model is quantified by the SHAP value. The SHAP value of the static variable is used to reflect the influence of the patient's basic physiological factors on the evolution of postoperative pain throughout the entire postoperative pain time process. The SHAP values ​​of the dynamic variables at each stage are used to reflect the immediate impact of physiological indicators and analgesic interventions at each stage on various prediction results at the current stage.

[0014] In some feasible embodiments of high-risk factor extraction, during the SHAP attribution calculation process, the SHAP value distribution of various variables is calculated at each stage, and the average SHAP value of different variables at different stages is statistically analyzed. Based on the average SHAP values ​​of various input variables at each stage, the input variables are sorted and the variables that consistently rank high in each stage are selected as high-risk factors affecting the occurrence and evolution of postoperative pain.

[0015] (III) Beneficial Effects: Compared with the prior art, this invention has the following beneficial effects: This invention unifies the modeling of static variables such as preoperative and intraoperative demographic characteristics, medical history, surgical parameters, and pain threshold detection with dynamic variables such as physiological monitoring indicators and analgesia intervention data obtained at different postoperative recovery stages. By constructing a bi-branch prediction model with static coding branches and dynamic evolution branches, it achieves a comprehensive representation of the patient's individual basic pain risk and changes in the postoperative recovery process.

[0016] By introducing the SHAP attribution algorithm to interpret and analyze the predictive model, the model output is decomposed into the contribution of each input variable to the prediction result, thereby quantifying the influence of preoperative factors, intraoperative factors, and physiological indicators at different postoperative stages on pain risk. Statistical summarization of SHAP values ​​from all patient samples and contribution analysis by time stage can identify key factors affecting pain occurrence at different recovery stages, providing reliable risk factor evidence for clinical research. Attached Figure Description

[0017] Figure 1 This is a flowchart illustrating the machine learning-based method for predicting postoperative pain and extracting high-risk factors after cesarean section, as provided in an embodiment of the present invention. Figure 2 The following is a schematic diagram of the sequential process from acquiring individual data of each patient to constructing and training the prediction model in the machine learning-based method for predicting postoperative pain and extracting high-risk factors after cesarean section provided in the embodiments of the present invention. Figure 3 This is a schematic diagram of various feature tensors corresponding to each branch of the prediction model in the machine learning-based method for predicting postoperative pain and extracting high-risk factors after cesarean section provided in an embodiment of the present invention. Figure 4 This is a schematic diagram of the framework of the dual-branch prediction model constructed in the machine learning-based method for predicting postoperative pain and extracting high-risk factors after cesarean section provided in this embodiment of the invention. Figure 5 This is a schematic diagram illustrating the principle of updating the state at each stage in the dynamic evolution branch of the prediction model in the machine learning-based method for predicting postoperative pain and extracting high-risk factors after cesarean section provided in this embodiment of the invention. Detailed Implementation

[0018] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.

[0019] It should be noted that, where there is no conflict, the features in the embodiments of the present invention can be combined with each other.

[0020] In studies of chronic post-cesarean section pain (CPSP), the occurrence of pain is generally considered to be a multifactorial process that evolves over time. These influencing factors can be categorized into two types based on the time dimension.

[0021] One type of factor is determined before or during surgery and remains largely unchanged post-surgery. These factors primarily determine a patient's baseline pain sensitivity. For example, a patient's age and BMI influence inflammatory responses and nerve recovery capabilities, while their pain threshold reflects their individual pain sensitivity. During surgery, the pattern of opioid (analgesic) use affects postoperative pain modulation.

[0022] Another aspect is that during the postoperative recovery process, the patient's physiological state and analgesia interventions will continue to change. For example, the patient may experience stress responses such as heart rate and blood pressure, as well as the use of analgesia pumps and the number of times analgesics are added at different stages after surgery.

[0023] Combination Figures 1 to 5 The machine learning-based method for predicting postoperative pain and extracting high-risk factors after cesarean section, as shown in the embodiments of the present invention, takes into account the various influencing factors mentioned above, and uses preoperative and intraoperative factors as static variables, which determine the individual's basic risk, and uses postoperative factors obtained at each stage of the patient's life as dynamic variables, which mainly reflect the pain development process.

[0024] Specifically, at the beginning of the study, it is necessary to establish patient-level baseline data records for each patient undergoing a cesarean section. First, during the preoperative assessment phase, basic physiological information of the patients should be obtained, such as age, height and weight, BMI, history of dysmenorrhea, and basal metabolic rate. These indicators mainly reflect the patient's basal metabolic level and tissue recovery capacity.

[0025] Secondly, it is necessary to record the patient's pain sensitivity indices. This is because quantitative sensory testing (QST) is commonly used in clinical studies to detect pain thresholds, such as pressure threshold, thermal threshold, and cold threshold. These indices are obtained by gradually increasing the stimulus intensity and recording the stimulus intensity value at which the patient first feels pain. It is important to note that the lower the pain threshold, the more sensitive the patient is to painful stimuli.

[0026] Subsequently, surgical variables were recorded during the operation, such as the duration of the operation, the method of anesthesia, and the cumulative dosage / pattern of opioids mentioned above. It is important to note that opioid dosages typically need to be converted to equivalent doses, for example, different opioids need to be converted to morphine equivalent doses.

[0027] Through the above steps, a set of static variables can be formed for each patient to describe the patient's basic pain risk characteristics.

[0028] After a cesarean section, continuous monitoring of the postoperative recovery period is necessary. Considering that postoperative pain after a cesarean section typically goes through several main mechanistic stages, including the acute pain stage, the subacute recovery period, and the chronic pain formation period, please refer to Table 1 below.

[0029] Table 1. Criteria for classifying pain stages and reference indicators

[0030] By combining the above steps and setting up multiple stages according to the postoperative timeline, and collecting dynamic indicators and pain tags related to the corresponding pathological mechanisms at each stage, the following data structure can be formed: Static variables: preoperative and intraoperative factors; Dynamic variables: stage-specific indicators; Tag data: Pain status corresponding to each stage (e.g., whether there is pain / pain type / VAS score); This data structure can express the individual differences of patients and the development of pain at different time stages, thus providing a time series data foundation that reflects the evolution of pain for subsequent deep learning model training.

[0031] During clinical data collection, it is important to consider that some indicators may be missing for different patients. For example, some patients may not have completed pain threshold testing, or some indicators may not have been recorded completely during certain follow-up stages. If missing data is not processed, it will lead to abnormalities or biases in the model training process. Therefore, it is necessary to uniformly impute missing values.

[0032] First, it's necessary to detect missing values ​​for each variable in the dataset. For example, for continuous variables such as patient age, BMI, and pain threshold, the missing value can be determined by calculating the proportion of missing values. When a variable has missing values ​​in the dataset, population statistics can be used to impute them. For example, for continuous variables, the sample mean or median can be used as substitutes.

[0033] For binary or categorical variables, such as "history of chronic pain" or "anesthesia method," mode imputation can be used, which means using the category with the highest frequency of occurrence of the variable to replace missing values. For example, if most patients use spinal anesthesia, then missing records can be imputed with "spinal anesthesia."

[0034] For dynamic variables obtained at different stages, such as the number of analgesia pump presses 48 hours post-surgery or the incision tenderness score at 3 months, if individual monitoring values ​​are missing at a certain stage, they can be supplemented by the average value within the stage or by interpolation of the time points before and after.

[0035] Through the above processing, it can be understood that it ensures that all variables have complete values, thereby avoiding model calculation errors caused by missing data during training.

[0036] After handling missing values, it's necessary to convert categorical variables in the original data into numerical form, as neural network models can only process numerical inputs. Common categorical variables in post-cesarean section pain studies include:

[0037] Anesthesia method (general anesthesia, spinal anesthesia, combined anesthesia); Nature of pain (stabbing, dull, burning). Does the individual have a history of chronic pain? For variables that include multiple categories, one-hot coding is typically used, as shown in Table 2 below.

[0038] Table 2. Encoding vectors corresponding to anesthesia methods

[0039] Referring to Table 2 above, the original single-category variable is transformed into multiple binary features, enabling the model to identify differences between different categories. After encoding, all variables are converted into a unified numerical form, allowing them to directly participate in model calculations.

[0040] In summary, it's important to understand that the coding format in Table 2 is a unique heat coding method. However, this method is not suitable for all types of variables; it's only applicable for determining whether there is a history of chronic illness (binary classification) or low-cardinality classification (such as the anesthesia method mentioned above, which has two or more categories). For other ordered or continuous numerical variables such as VAS scores and pain levels, differentiated coding is still required.

[0041] For example, BMI is typically between 18 and 35, analgesic dosages may reach hundreds of milligrams, and heart rate is typically between 60 and 120. If these large-scale variables are directly input into the model, they will dominate during gradient updates. Therefore, standardization is necessary to ensure that all variables are within similar numerical ranges. Standardization can also be performed on pain levels and VAS scores.

[0042] As for the dynamic variables observed at each stage, such as physiological indicators, medication dosage, pain type and corresponding scores, these are essentially ordered variables and can therefore be standardized.

[0043] After completing the above preprocessing steps, each patient's static variables can be represented as a fixed-length numerical vector. For example, a patient's static variables (range of indicators) might include: age, BMI (mildly overweight), pain threshold (sensitive), history of chronic pain (yes, coded as 1; no, coded as 0), duration of surgery (within normal range), and opioid dosage (high remifentanil dosage). Assume there are a total of... Given N static variables, when there are N patients in the dataset, stacking the static features of all patients row-wise can form a two-dimensional feature tensor: ; This two-dimensional tensor serves as the input data for the static coding branch of the model.

[0044] Similarly, for dynamic variables, both the patient dimension and the time stage dimension need to be considered simultaneously.

[0045] Referring to the various stages defined in the table above, the corresponding values ​​and clinical meanings of the dynamic variables obtained for each stage of the patients are as follows (see section 3).

[0046] Table 3. Dynamic variables collected for each stage of pain and their clinical meaning.

[0047] The multiple indicators collected at each stage, such as analgesic bolus dose, incision tenderness score, sensory abnormality score, and functional impairment score, correspond to the following three-dimensional feature tensor: ; Among them, the first dimension Indicates the patient, second dimension Indicates a time period, the third dimension Indicates dynamic characteristics.

[0048] In other embodiments of the present invention, considering that different patients may not complete all follow-up stages during actual follow-up, for example, a patient may only complete the 48-hour and 3-month follow-ups, but not the 6-month and 12-month follow-ups. Directly constructing a time series tensor would result in inconsistent sequence lengths. Therefore, a time mask matrix is ​​constructed simultaneously to identify the actual stages and the filled stages. For example, the mask vector for a patient is: ; In this model, 1 indicates that there is actual observed data in that stage, while 0 indicates that the stage contains padding data. During subsequent model training, the loss function is only calculated for stages with Mask=1, thus avoiding interference from padding data in the model training process.

[0049] After completing data preprocessing and forming a unified tensor structure, the next stage is the construction of the prediction model. This stage references... Figure 3 and Figure 4 The main goal is to establish a deep learning model structure that can simultaneously integrate the patient's basic individual differences with the evolution of postoperative pain over time.

[0050] In embodiments of the present invention, a dual-branch hybrid architecture model is employed, including a static coding branch for processing patient static information and a dynamic evolution branch for modeling the process of postoperative pain changes over time.

[0051] First, the model needs to encode the patient's preoperative and intraoperative static variables to extract latent representations that can represent the patient's individual basic characteristics. During the data preprocessing stage, the static variables for each patient have been integrated into a two-dimensional feature tensor: ; Because of the complex nonlinear relationships among these variables, feature mapping is required through multi-layer neural networks. Therefore, the static coding branch typically uses a multi-layer perceptron (MLP) for feature extraction.

[0052] The first input is a static feature vector. The static coding branch (MLP) transforms these physical units (kPa, μg) into dimensionless neuron activation values ​​through the first-layer weight matrix: ; in, This is the corresponding weight matrix. For bias terms, It is a non-linear activation function.

[0053] The next step is the second layer of feature compression: ; After the above multi-layer nonlinear mapping, a fixed-length latent representation vector is finally obtained. This vector is used to describe a patient's individual pain sensitivity and surgical trauma background. Note this vector. It does not represent the intensity of pain, but rather the patient's endophenotypic pain sensitivity.

[0054] After encoding the static variables, the model needs to perform time-series modeling of the dynamic variables at different stages after surgery to capture the pattern of pain state changes over time. The initial state of the dynamic evolution branch is not randomly generated, but is directly equal to the high-dimensional vector output by the static encoding branch.

[0055] Based on the table above, the vector output by the static encoding branch is used as the initial hidden state of the dynamic evolution branch of the model. This is to ensure that before the model performs dynamic variable evolution analysis at each postoperative stage, the memory unit of the dynamic evolution branch stores the background information of the mother's low pain threshold and extremely high medication dosage.

[0056] During the data preprocessing stage, the dynamic variables at each stage have been organized into three-dimensional feature tensors: ; ; To model these time-series data, some embodiments of the present invention employ recurrent neural networks (RNNs) or LSTMs for processing. Considering that the embodiments of the present invention involve a wide variety of variable types and a large amount of data, a simplified variant of RNN, GRU (Gated Recurrent Unit), is used as an example below. One characteristic of the GRU algorithm is that it can determine how much history (variables from preceding stages that affect subsequent stages of pain) should be retained.

[0057] First, combine the vector output by the aforementioned static coding branch. As the initial hidden state of the RNN, it needs to undergo a mapping process first, namely: ; in, For the mapping matrix, This represents the initial hidden state in the dynamic evolution branch.

[0058] After obtaining the initial hidden state, recursive modeling begins, progressing through each time stage. First, the input for each stage needs to be constructed; in some embodiments of this invention, the variables of the current stage... The patient's pain status in the previous stage The combination is: ; This is the current input for the dynamic evolution branch; note the patient's pain status here. Generally, VAS scores observed during actual follow-up visits are used, and these scores need to be standardized before vector concatenation. Subsequent pain level prediction is also typically based on VAS score grading. Therefore, during model training, the patient's actual observed pain state is used as input for the previous stage, and the model's prediction results are recursively used as input for subsequent prediction stages.

[0059] In GRU, see reference here. Figure 5 The hidden state at each stage is updated through the following recursive relationship: ; in, This is the hidden state from the previous stage. This is the hidden state from the previous stage; For the input weight matrix, The state weight matrix is... For bias terms, This is the Sigmoid function (outputting 0-1). It's important to note that this Sigmoid function is different from the function used for subsequent probability predictions; they only share the same function type. These matrix parameters will be updated in subsequent model iterations.

[0060] Regarding the hidden status of the current update phase The closer the value is to 1, the less influence the variables from the patient's past (previous stage) have on this stage, and the greater the influence of the input variables in the current stage; the closer the value is to 0, the more the pain in the current stage is mainly affected by the variables from the patient's past (previous stage).

[0061] Calculation of reset information: ; The calculation of the hidden state for the update is similar to that described above. For the corresponding input weight matrix, This is the corresponding state weight matrix. For bias terms, This is also a Sigmoid function, distinct from other calculations, only sharing the same type. When When approximately equal to 0, it indicates that variables from the past (previous stage) should be ignored; when... When the value is approximately 1, it indicates that variables from the previous stage should be retained.

[0062] Regarding the candidate hidden states at each stage: ; in, The new candidate is in a hidden state. This indicates multiplication along one dimension. For the activation function, in embodiments of the present invention, the range is from -1 to 1. It should be understood that the terms in the above equation... , which represents the variable information from the previous stage after filtering.

[0063] Finally, we reached the step of updating the status to the latest version: ; The terms of the above formula This indicates the retention of variable information from the previous state; the item... This represents the introduced new variable information. It can be understood as a new state, which is part of the old state and the new variable information. Applying this to the postoperative pain prediction of patients in this embodiment of the invention, and combining it with the example in the table above, it can be understood as first combining... (Patient's physiological background) and (Acute pain phase) Calculate new hidden states ;exist When calculating the (subacute phase), input the data for the corresponding month in the table above (such as hyperalgesia), and combine it with... (Previous memories of insufficient analgesia) and (The current healing status) has evolved into The calculations for subsequent stages are similar. What is determined is the rate of memory update (the influence of variables from the previous stage).

[0064] This allows time series models to include individual patient characteristics before processing dynamic data. For example, for a patient with a low pain threshold and a high intraoperative opioid dose, their baseline feature vector may correspond to a higher initial pain risk, thus affecting predictions in subsequent stages.

[0065] Through the construction of the above dual-branch structure, it can be understood that the prediction model can process two types of key information simultaneously.

[0066] On the one hand, the static coding branch extracts features from preoperative and intraoperative variables to form a representation of the patient's baseline state, which is used to reflect individual pain sensitivity and surgery-related risk factors.

[0067] On the other hand, the dynamic evolution branch uses a recurrent neural network to model the dynamic variables of different postoperative stages in time series, and recursively updates the patient's pain state by combining the hidden state of the previous stage, thereby learning the changing pattern of postoperative pain from the acute phase to the chronic phase.

[0068] By coupling static basic features with dynamic time series states in the model, the model can simultaneously capture individual differences and time evolution factors, thereby improving the predictive ability of postoperative pain risk after cesarean section and providing a model basis for subsequent multi-stage pain prediction and high-risk factor analysis.

[0069] When the hidden state of each stage is obtained Then, the corresponding output prediction needs to be performed through the prediction output layer. In the embodiments of the present invention, there are two independent channels from the hidden state to the prediction output: channel 1 outputs the probability of pain occurrence, and channel 2 outputs the pain level.

[0070] Specifically, regarding channel 1, the prediction is... The probability of a painful event occurring at the corresponding stage.

[0071] First, set the weight matrix of the output layer as follows: ; The bias term is: ; After performing a linear mapping: ; The probability is initially unnormalized, then mapped to a scalar using the sigmoid function. ; in, This represents the predicted probability of pain occurring in the patient at time t, and this output is also used for subsequent loss calculations.

[0072] Channel 2 outputs the pain level; similarly, a weight matrix is ​​first set. and bias terms Then perform a linear mapping: ; get: ; Note that the four items mentioned above correspond to the four stages in Table 1. Then, the pain level score prediction for each stage is performed using the Softmax function: ; In the formula This indicates the corresponding level score when pain occurs.

[0073] Since the above-mentioned bibranch model is designed for this type of clinical prediction task, the model should not be too deep (to prevent overfitting), and the parameter settings should follow the principles in Table 4 below.

[0074] Table 4. Parameter configuration of each layer of the model

[0075] During the model's training and prediction phase, to ensure the predicted probabilities closely approximate the true labels, a probability loss is first applied. Since this is a binary classification problem, in this embodiment of the invention, binary cross-entropy is employed: ; in, This represents the true label, which is the observation of the patient at the corresponding stage. The specific calculation of the binary cross-entropy will not be detailed here.

[0076] For pain level loss, which is a multi-class classification problem, cross-entropy is used for calculation:

[0077] in, Similarly, the model output is converted into a mutually exclusive probability distribution using the Softmax function, and then the cross-entropy loss is calculated. This will not be described in detail here.

[0078] Finally, the above multi-loss calculation task is fused, generally using a weighted approach. Furthermore, since the core objective of CPSP-CD is to predict long-term chronicity, the weights of the loss function (Loss) typically increase over time. Assuming there are T time periods (as shown in Table 1 above, the four periods), the overall loss function is: ; in, The weighting coefficients for each stage are as follows: for example, the acute phase is used as an auxiliary reference and has a value of 0.1; the subacute phase is used as an important transition and has a value of 0.3; and the chronic phase is used as the ultimate goal, with the sum of the weights of the two chronic phases being 0.6. For CE losses at each stage, This represents the BCE loss at each stage.

[0079] After training the predictive model, the decision-making mechanism needs to be interpreted and analyzed to identify key high-risk factors influencing postoperative pain after cesarean section. In this step, the SHAP attribution algorithm is introduced to decompose the model output into contribution factors, thereby quantifying the strength of different variables in pain risk prediction.

[0080] The first thing to understand is that the SHAP algorithm calculates the average contribution of each input variable at each stage to the model's prediction results. After completing the SHAP calculation for a single sample, it is necessary to statistically summarize all patient samples to obtain stable and reliable high-risk factor assessment results.

[0081] For the The total contribution of each variable can be calculated as follows: ; in, Let be the SHAP value of variable i in the k-th sample.

[0082] In addition, to analyze the impact of different recovery stages, it is also necessary to calculate the average contribution for each time stage: ; After obtaining the contribution indicators of each variable, the variables need to be ranked according to their contribution to identify the key factors that have the greatest impact on postoperative pain prediction. The ranking method can be referenced using the following formula: .

[0083] in, The rank is determined by numerical value; that is, by sorting from highest to lowest average SHAP contribution, and then selecting the top K variables by contribution as the main high-risk factors: ; in The variables are defined as follows: By ranking and screening the contribution of high-risk factors using the above method, a set of major risk factors affecting postoperative pain after cesarean section can be obtained.

[0084] Clinical staff can then develop targeted analgesic interventions based on the risk characteristics of different patients, such as optimizing analgesic drug use strategies, strengthening early postoperative analgesia management, or conducting long-term follow-up on patients at high risk of chronic pain, thereby improving pain management effectiveness and reducing the incidence of chronic postoperative pain.

[0085] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. The scope of protection of the present invention is defined by the claims. Similarly, any equivalent structural changes made based on the description and drawings of the present invention should also be included within the scope of protection of the present invention.

Claims

1. A method for predicting postoperative pain and extracting high-risk factors after cesarean section based on machine learning, characterized in that, Includes the following steps: Static variables were obtained for each patient before and during surgery, as well as dynamic variables at each postoperative stage. The static variables included basic physiological characteristics, pain threshold indicators, and intraoperative stress and medication patterns. The dynamic variables included physiological monitoring indicators and analgesia intervention indicators for patients at each postoperative stage. Missing values ​​were imputed and standardized for all types of original variables. Static variables for each patient were encoded into fixed-length two-dimensional feature tensors, and dynamic variables were encoded into three-dimensional feature tensors according to time stages. A dual-branch hybrid architecture prediction model is constructed, wherein the static encoding branch of the prediction model maps the two-dimensional feature tensor to the patient's basic feature vector and serves as the initial hidden state input for the dynamic evolution branch. The dynamic evolution branch adopts a recurrent neural network structure, which recursively models the three-dimensional feature tensor of each stage in time sequence. The three-dimensional feature tensor of the current stage and the patient's real pain label of the previous stage constitute the input of the current stage. Together with the hidden state calculated by the dynamic evolution branch of the previous stage, it is input into the recurrent neural network structure to learn the evolution law of the patient's pain over time. In each stage, the probability of pain occurrence and the corresponding pain level prediction output are set. A joint loss function is constructed based on a multi-task learning strategy, and the prediction model parameters are jointly optimized through backpropagation. For the trained prediction model, based on the SHAP attribution algorithm, the contribution of each type of input variable to the prediction output at the corresponding stage is calculated, and variables with high contribution are defined as high-risk factors affecting the evolution of postoperative pain. The synergistic relationship between high-contribution variables is analyzed to extract the combination pattern of high-risk factors.

2. The method for predicting postoperative pain and extracting high-risk factors after cesarean section based on machine learning according to claim 1, characterized in that, Preoperative information such as age, BMI, basal metabolic rate, history of chronic pain, and pain threshold monitoring indicators for each patient was obtained, as well as the duration of surgery, anesthesia method, and analgesic drug usage pattern during the operation were recorded to form the patient's static variables. During the postoperative recovery period of each patient, the postoperative monitoring timeline of the patient was divided into multiple consecutive stages. Physiological monitoring indicators and analgesia intervention data of the patient were acquired in each of the divided stages. By extracting the physiological and analgesia indicator characteristics of each stage, dynamic variables of the corresponding stage were formed.

3. The method for predicting postoperative pain and extracting high-risk factors after cesarean section based on machine learning according to claim 1, characterized in that, Data cleaning was performed on the static variables and dynamic variables at each stage of the patients collected, including outlier removal and missing value imputation. Then, differential coding was performed according to the type of the variable. Specifically, binary variables were binarized and coded; low cardinality categorical variables were coded one-hot; and ordered variables and continuous variables with numerical values ​​were encoded while preserving their numerical form. After encoding is completed, standardization is performed on all continuous and ordered variables; the processed static variables are constructed into two-dimensional feature tensors; and the dynamic variables of each stage are arranged in chronological order into three-dimensional feature tensors.

4. The method for predicting postoperative pain and extracting high-risk factors after cesarean section based on machine learning according to claim 3, characterized in that, For different patients in the dataset with different numbers of stages, the insufficient stages are filled by setting a uniform maximum stage length, and a stage mask matrix is ​​constructed to identify the actual observed stage and the filled stage after surgery.

5. The method for predicting postoperative pain and extracting high-risk factors after cesarean section based on machine learning according to claim 1, characterized in that, The static coding branch of the prediction model receives the patient's two-dimensional feature tensor, performs nonlinear feature mapping through a multi-layer fully connected network to the patient's basic state vector, which represents the patient's individual physiological characteristics and pain sensitivity, and maps the basic state vector to the initial hidden state of the dynamic evolution branch through a linear transformation. In the recursive evolution stage of the dynamic evolution branch, the three-dimensional feature tensor is processed stage by stage in chronological order; In each stage, the three-dimensional feature tensor of the current stage is concatenated with the patient's pain occurrence state and pain score obtained in the previous stage as the input of the current stage. This input, along with the hidden state of the previous stage, is fed into the recurrent neural network of the dynamic evolution branch to perform the pain state update calculation for the current stage, thus obtaining the hidden state of the current stage.

6. The method for predicting postoperative pain and extracting high-risk factors after cesarean section based on machine learning according to claim 5, characterized in that, In the output stage of the prediction model, two independent output channels are set up. Based on the hidden state generated by the dynamic evolution branch in the current stage, each output channel is mapped to generate the probability of pain occurrence and the pain level. The probability of pain occurrence is obtained by linear transformation combined with the Sigmoid function. The other output channel maps and outputs the pain level by linear transformation combined with the Softmax function.

7. The method for predicting postoperative pain and extracting high-risk factors after cesarean section based on machine learning according to claim 1, characterized in that, During the training phase of the prediction model, the predicted probability of pain occurrence and the predicted level of pain are output at each stage. The prediction loss for each stage is calculated by combining the patient's pain labels corresponding to each stage. The probability prediction of pain occurrence is achieved by activating the linear mapping result with the Sigmoid function and calculating the error between the probability prediction result of pain occurrence and the occurrence status in the pain label using the binary cross-entropy function. The pain level prediction uses the Softmax function to normalize the linear mapping results and the cross-entropy function to calculate the error between the predicted pain level and the pain level score in the pain label.

8. The method for predicting postoperative pain and extracting high-risk factors after cesarean section based on machine learning according to claim 6, characterized in that, During the training of the prediction model, the stage mask matrix is ​​used to calculate the error loss only for the real observation stage and participate in the update of the prediction model parameters, while the error loss for the filling stage is masked. The weighted error losses of all stages are accumulated, and a joint loss function is constructed by combining the weight coefficients set for each stage. The static coding branch parameters, dynamic evolution branch parameters, and mapping parameters of each output channel are jointly optimized by backpropagation.

9. The method for predicting postoperative pain and extracting high-risk factors after cesarean section based on machine learning according to claim 1, characterized in that, After training the prediction model, the SHAP attribution algorithm is introduced. SHAP interpreters are constructed for each stage, and the predicted pain probability and pain level at each stage are used as the explanatory targets. The contribution of various input variables to the output of the prediction model is quantified using SHAP values. The SHAP value of the static variable is used to reflect the degree of influence of the patient's basic physiological factors on the evolution of postoperative pain throughout the entire postoperative pain time. The SHAP values ​​of the dynamic variables at each stage are used to reflect the immediate impact of physiological indicators and analgesic interventions at each stage on various prediction results at the current stage.

10. The method for predicting postoperative pain and extracting high-risk factors after cesarean section based on machine learning according to claim 9, characterized in that, In the process of SHAP attribution calculation, the distribution of SHAP values ​​of various variables is calculated at each stage, and the average SHAP value of different variables at different stages is statistically analyzed. Based on the average SHAP values ​​of various input variables at each stage, the input variables are sorted and the variables that consistently rank high in each stage are selected as high-risk factors affecting the occurrence and evolution of postoperative pain.