Development and validation of machine learning based prediction model for postoperative pain risk after extraction of impacted mandibular third molars Authors: Dongsheng Yu, Zifeng Liu, Weijie Zhuang, Kechen Li, Yaxin Lu Published: 2023 ABSTRACT AbstractBackgroundPredicting postoperative pain risk in patients with impacted mandibular third molar extractions is helpful in guiding clinical decision-making, enhancing perioperative pain management, and improving the patients’ medical experience. This study aims to develop a prediction model based on machine learning algorithms to identify patients at high risk of postoperative pain after tooth extraction.MethodsWe conducted a prospective cohort study. Outpatients with impacted mandibular third molars were recruited and the outcome was defined as the NRS (Numerical Rating Scale) score of peak postoperative pain within 24 h after the operation ≥7, which is considered a high risk of postoperative pain. We compared the models built using nine different machine learning algorithms and conducted internal and time-series external validations to evaluate the model's predictive performances in terms of the area under the curve (AUC), accuracy, sensitivity, specificity, and F1-value.ResultsA total of 185 patients and 202 cases of impacted mandibular third molar data were included in this study. Five modeling variables were screened out using least absolute selection and shrinkage operator regression, including physician qualification, patient self-reported maximum pain sensitivity, OHI–S–CI, BMI, and systolic blood pressure. The overall performance of the random forest model was evaluated. The AUC, sensitivity, and specificity of the prediction model built using the random forest method were 0.879 (0.861–0.891), 0.857, and 0.846, respectively, for the training set and 0.724 (0.673–0.732), 0.667, and 0.600, respectively, for the time series validation set.ConclusionsThis study developed a machine learning-based postoperative pain risk prediction model for impacted mandibular third molar extraction, which is promising for providing a theoretical basis for better pain management to reduce postoperative pain after third molar extraction.Keywords: Impacted mandibular third molars (IMTMs), Risk stratification, Prediction model, Postoperative pain, Machine learning Introduction The third molar (wisdom tooth), which is located at the end of the dental arch and develops last [1], tends to not emerge naturally because of a lack of jaw space and resistance from other teeth, bones, or soft tissue. The prevalence of impacted third molar is as high as 24.4 % worldwide [2]. Clinically, tooth extraction is typically the first option for treating impacted third molars, because it is the most cost-effective method. However, invasiveness during surgery often leads to postoperative complications, including pain, facial swelling, abnormal sensation, trismus, and infection [3], among which acute postoperative pain is the most common. An increase in the duration and severity of postoperative pain significantly impacts a patient's psychological state, increasing the risk of anxiety and depression [4]. Following tooth removal, some patients may endure severe pain, which negatively impacts daily activities, lowers their quality of life, and increases the possibility of developing dental anxiety. Patient anxiety and fear may affect their willingness to seek medical help, thereby delaying treatment [5,6]. The effects of conventional postoperative analgesics vary by person and require time to become effective. Therefore, predicting the risk of pain in patients undergoing tooth extraction before the operation is important. This can effectively guide clinicians in medication and considering preoperative analgesic interventions and early expert consultations as well as in facilitating the rational allocation of medical resources, thereby enhancing perioperative pain management [7], improving patient satisfaction, and reducing postoperative adverse reactions. Machine learning is a promising data analysis strategy that can automatically detect data correlations and establish analysis models [8]. Recently, machine learning algorithms have been applied to pain in numerous studies. Its functions include predicting pain phenotypes based on complex case data, the analysis of complex pain-related data, and exploring pain-related data [9]. Given a dataset, these algorithms can learn complex features and predict pain phenotypes by building relevant models [10,11]. Traditional statistical analysis methods focus on using mathematical equations to analyze the probability of observations, given the known distribution of the basic data [9]. Emerging machine learning-based analysis strategies can combine a large number of variables and select the most appropriate algorithm to establish a predictive model and analyze complex patterns in the dataset [12,13]. Individuals with impacted mandibular third molars extracted from outpatient clinics were included in a prospective cohort. Data on demographics, oral hygiene, vital signs, radiographic factors, psychological factors, operative factors, and medications were collected for analysis. Using nine different machine learning algorithms, we developed and validated a 24 h peak postoperative pain prediction model following the impacted wisdom tooth extraction to improve the surgeon's ability to identify patients with a high postoperative pain risk before surgery. This study aims to influence clinical applications and provide a theoretical basis for reducing peak pain after third molar extractions. Methods Study design and patient enrollment This was a prospective cohort study with a follow-up period of one week in accordance with the STROBE and TRIPOD statements. This study was conducted in accordance with the principles of ICH-GCP and Declaration of Helsinki. A total of 185 patients were admitted to the Maxillofacial Surgery Department of the Hospital of Stomatology, from July 2022 to March 2023, with a total of 202 cases of mandibular impacted wisdom teeth data. All patients extracted unilateral impacted mandibular third molars at a single visit in this study. Of all the 185 patients, 17 had their impacted mandibular third molars on the opposite side removed at the second visit. The inclusion criteria of the study were as follows: (1) the patient was diagnosed with at least one impacted mandibular third molar (ICD-10 disease code: K01.101) and meets the indications for impacted mandibular third molar extraction; (2) the patient was at least 18 years old. The exclusion criteria of the study were as follows: (1) the patient meets the contraindications for impacted mandibular third molar extraction; (2) the patient has a history of opioid or systemic steroid use within one week before surgery; and (3) patients has a mental illness and is unable to correctly understand the questionnaire information (Refer to Supplementary Table S1 for indications and contraindications for impacted third molar extractions). The procedure of the study was as follows. The patient underwent digital panoramic radiography (PLANMECA, ProMax 3D Mid, Finland) in the radiology department before the operation. All panoramic radiographs were collected by two qualified radiologists using the same computer, and the relevant radiographic factors were evaluated based on Winter's classification, Pell and Gregory's vertical and horizontal classification, and the root number of impacted mandibular third molars. For disagreements, a third radiologist made the final decision. After radiography, Patients were guided by staff who received standardized training on completing a preoperative questionnaire (concerning their age, Body Mass Index (BMI), sex, toothbrushing frequency and time, psychological evaluation scale, and preoperative NRS pain score). Nurses measured the patients' blood pressures and heart rates. Surgeons evaluated the patients’ oral hygiene by the simplified oral hygiene index (OHI–S), including the debris index (DI) and calculus index (CI), and formulated a treatment plan. The impacted third molar was extracted using local anesthesia (articaine and epinephrine). Surgical information, including flapping, bone removal, use of a dental elevator, irrigation, and hemostasis, was recorded immediately after the operation. Follow-up The staff followed up with the patients via text messages and telephone calls at 6 h, 12 h, 24 h, three days, and seven days after the operation. The inquiry was conducted using a standardized questionnaire that included the following three parts: (1) the postoperative pain level was evaluated using the NRS pain scale from 0 to 10, 0 as no pain, 1–3 as mild pain, 4–6 as moderate pain, and 7–10 as severe pain; (2) patients’ postoperative medication including drug name, frequency, and single dose; (3) occurrence of other postoperative complications including swelling, bleeding, and dry sockets. All follow-up data were confirmed one week later when the patients returned to remove their stitches. Candidate predictors The collected variables were divided into seven different categories, including demographics (age, sex, BMI), oral hygiene (OHI–S [14], toothbrushing frequency and time), vital signs (blood pressure, heart rates), radiographic factors [15] (mandibular impacted wisdom teeth classification, root number), psychological factors [16] (the USOS scale for evaluating pain sensitivity, stress, and fear), operative factors [17] (operation duration, extraction number, surgeon qualification, flap design, bone removal, dental elevator, irrigation, hemostasis), and medication (nonsteroidal anti-inflammatory drugs (NSAIDs), antibiotics, dexamethasone). The study included 32 variables as candidate predictors (see Supplementary Table S2 for definitions and details). Outcome definition Pain after the extraction of the impacted third molars was assessed using the NRS Scale [18]. As this study aimed to predict the risk of acute postoperative pain, provide theoretical guidance for perioperative pain management, and reduce the peak value of pain, we focused on identifying patients with severe postoperative pain within 24 h. According to the NRS score, the postoperative pain level can be divided into two categories: NRS scores ≤6 (less than moderate pain) and ≥7 (severe pain) [19]. The outcome of the study is defined as the NRS pain score of the peak postoperative pain ≥7 within three follow-ups in 24 h. Statistical analysis Continuous data were described using the median (interquartile range [IQR]), and categorical data were described as counts (percentages). The model prediction performance was evaluated using the area under the curve (AUC), sensitivity, specificity, accuracy, and F1-score. All data analyses were performed using Python version 3.8.13 and R [20] version 3.6.2. Fig. 1 illustrates the study process. The process of study and statistical analysis. Data preprocessing The mean and mode substitution methods were used for the missing data of continuous and categorical variables, and all continuous variables were subjected to the Yeo-Johnson normal transformation, centering, and normalization. Predictor selection The least absolute selection and shrinkage operator (LASSO) regression algorithm was used to screen all candidate predictor variables, the regression loss function was set as the mean square error, and the optimal regularization parameter λ was selected based on 10-fold cross-validation. Model building and validation The data of the 164 cases followed up in 2022 were used as the training set, which was divided into a development set and an internal validation set via random stratified sampling at a ratio of 8:2. Nine machine learning algorithms were used to construct prediction models using the development set: random forest (RF), linear discriminant analysis (LDA), extreme gradient boosting (XGBoost), support vector machines (SVM), gaussian naive bayes (Gaussian NB), logistic regression (LR), decision tree (DT), adaptive boosting (AdaBoost), K-nearest neighbors (KNN). In the given range of hyper-variables, the optimal hyper-variables for each algorithm were determined using 10-fold cross-validation based on a grid search. Supplementary Table S3 presents the hypervariables used in the algorithms. Based on the optimal hyper-variables, each model was internally validated. A time-series validation method was adopted, and external validation was conducted using the data of the 38 cases followed up until 2023 as the external validation set. Results Candidate predictors This study included 185 outpatients who underwent impacted third molar extractions. The unilateral mandibular impacted third molars were considered a single study sample, and the number of baseline data cases was 202. All patients were followed up for one week after the operation. The incidence rate of these outcomes was 18.8 %, according to the definition of the outcome. 18.8 % of patients were classified as the high pain group with an NRS score of peak postoperative pain ≥7 within 24 h, and 81.2 % of patients were classified as the low pain group with an NRS score of peak postoperative pain ≤6 within 24 h. No data was missed of the 32 candidate predictors in this study. Table 1 presents the baseline data for all candidate predictors. Table 1Baseline data of all candidate predictors.Table 1Candidate predictorGroupTotal (n = 202)Training set(2022)(n = 164)Validation set(2023)(n = 38)Low pain level (n = 129)High pain level (n = 35)Low pain level (n = 35)High pain level (n = 3)DemographicsAge26.6 [22.4; 32.0]27.3 [22.8; 33.0]26.5 [23.1; 29.8]24.8 [21.2; 30.6]29.0 [25.6; 32.4]BMI20.7 [19.0; 22.9]20.8 [19.2; 23.1]20.3 [18.4; 20.9]21.6 [18.9; 23.6]21.2 [20.6; 22.4]SexMale70 (34.7 %)45 (34.9 %)8 (22.9 %)16 (45.7 %)1 (33.3 %)Female132 (65.3 %)84 (65.1 %)27 (77.1 %)19 (54.3 %)2 (66.7 %)Oral hygieneToothbrushing frequencyOnce per day or less23 (11.5 %)12 (9.3 %)3 (8.6 %)8 (24.2 %)0 (0.0 %)Twice per day or more177 (88.5 %)117 (90.7 %)32 (91.4 %)25 (75.8 %)3 (100 %)Toothbrushing timeLess than 2 min a time29 (14.6 %)16 (12.5 %)7 (20.0 %)6 (18.2 %)0 (0.0 %)2–3 min at a time128 (64.3 %)81 (63.3 %)22 (62.9 %)23 (69.7 %)2 (66.7 %)More than 3 min at a time42 (21.1 %)31 (24.2 %)6 (17.1 %)4 (12.1 %)1 (33.3 %)Oral hygiene index(OHI-DI)068 (33.8 %)47 (36.7 %)12 (34.3 %)6 (17.1 %)3 (100 %)1–3133 (66.2 %)81 (63.3 %)23 (65.7 %)29 (82.9 %)0 (0.0 %)Oral hygiene index(OHI–S–CI)0117 (58.5 %)82 (64.6 %)17 (48.6 %)15 (42.9 %)3 (100 %)1–383 (41.5 %)45 (35.4 %)18 (51.4 %)20 (57.1 %)0 (0.0 %)Vital signsBlood pressure(systolic pressure)119.0 [109.0; 129.0]122.0 [109.0; 130.0]114.0 [104.0; 124.0]119.0 [110.0; 122.0]109.0 [101.0; 118.0]Blood pressure(diastolic pressure)77.0 [72.2; 85.8]78.0 [71.0; 86.5]77.0 [73.0; 79.0]79.0 [75.0; 86.0]77.0 [76.5; 79.0]Heart rates84.0 [76.0; 92.0]82.0 [75.0; 92.0]87.0 [81.5; 95.0]84.0 [76.0; 89.0]86.0 [81.0; 87.5]Radiographic factorsMandibular impaction direction (Winter classification)Mesioangular56 (27.7 %)41 (31.8 %)6 (17.1 %)8 (22.9 %)1 (33.3 %)Vertical59 (29.2 %)33 (25.6 %)12 (34.3 %)13 (37.1 %)1 (33.3 %)Horizontal76 (37.6 %)48 (37.2 %)16 (45.7 %)11 (31.4 %)1 (33.3 %)Distoangular11 (5.5 %)7 (5.4 %)1 (2.9 %)3 (8.6 %)0 (0.0 %)Mandibular impaction direction (Pell&Gregory vertical classification)A77 (38.1 %)51 (39.5 %)12 (34.2 %)13 (37.2 %)1 (33.3 %)B67 (33.2 %)47 (36.5 %)8 (22.9 %)11 (31.4 %)1 (33.3 %)C58 (28.7 %)31 (24.0 %)15 (42.9 %)11 (31.4 %)1 (33.3 %)Mandibular impaction direction (Pell&Gregory horizontal classification)Ⅰ56 (27.7 %)32 (24.8 %)13 (37.1 %)10 (28.6 %)1 (33.3 %)Ⅱ61 (30.2 %)40 (31.0 %)6 (17.1 %)14 (40.0 %)1 (33.3 %)Ⅲ85 (42.1 %)57 (44.2 %)16 (45.7 %)11 (31.4 %)1 (33.3 %)Root numberSingle root78 (38.6 %)44 (34.1 %)15 (42.9 %)17 (48.6 %)2 (66.7 %)Multi-root124 (61.4 %)85 (65.9 %)20 (57.1 %)18 (51.4 %)1 (33.3 %)Psychological factorsPain sensitivity (self-reported)Low38 (18.8 %)31 (24.0 %)1 (2.9 %)6 (17.1 %)0 (0.0 %)Middle97 (48.0 %)60 (46.5 %)18 (51.4 %)19 (54.3 %)0 (0.0 %)High67 (33.2 %)38 (29.5 %)16 (45.7 %)10 (28.6 %)3 (100 %)Stress (self-reported)Low67 (33.2 %)47 (36.4 %)6 (17.1 %)14 (40.0 %)0 (0.0 %)Middle77 (38.1 %)46 (35.7 %)17 (48.6 %)12 (34.3 %)2 (66.7 %)High58 (28.7 %)36 (27.9 %)12 (34.3 %)9 (25.7 %)1 (33.3 %)Fear (self-reported)Low97 (48.0 %)63 (48.8 %)20 (57.1 %)13 (37.2 %)1 (33.3 %)Middle80 (39.6 %)54 (41.9 %)13 (37.1 %)11 (31.4 %)2 (66.7 %)High25 (12.4 %)12 (9.3 %)2 (5.8 %)11 (31.4 %)0 (0.0 %)Preoperative pain level(NRS score)0113 (56.0 %)71 (55.0 %)20 (57.1 %)22 (62.9 %)0 (0.0 %)1–357 (28.2 %)36 (27.9 %)11 (31.4 %)9 (25.7 %)1 (33.3 %)4–1032 (15.8 %)22 (17.1 %)4 (11.4 %)4 (11.4 %)2 (66.7 %)Pain sensitivity (Surgeon-reported)Low125 (61.9 %)83 (64.3 %)25 (71.4 %)17 (48.6 %)0 (0.0 %)Middle67 (33.2 %)41 (31.8 %)9 (25.7 %)16 (45.7 %)1 (33.3 %)High10 (4.9 %)5 (3.9 %)1 (2.9 %)2 (5.7 %)2 (66.7 %)Stress (Surgeon-reported)Low112 (55.4 %)72 (55.8 %)23 (65.7 %)17 (48.6 %)0 (0.0 %)Middle63 (31.2 %)38 (29.5 %)10 (28.6 %)14 (40.0 %)1 (33.3 %)High27 (13.4 %)19 (14.7 %)2 (5.71 %)4 (11.4 %)2 (66.7 %)Fear (Surgeon-reported)Low172 (85.1 %)108 (83.7 %)33 (94.3 %)29 (82.9 %)2 (66.7 %)Middle28 (13.9 %)19 (14.7 %)2 (5.7 %)6 (17.1 %)1 (33.3 %)High2 (1.0 %)2 (1.6 %)0 (0.0 %)0 (0.0 %)0 (0.0 %)Operative factorsOperation duration(min)14.0 [8.0; 20.0]14.0 [9.0; 20.5]11.0 [8.0; 17.8]16.0 [8.0; 22.5]16.0 [12.0; 19.5]Extraction number(unilateral)1101 (50.0 %)67 (51.9 %)17 (48.6 %)16 (45.7 %)1 (33.3 %)2101 (50.0 %)62 (48.1 %)18 (51.4 %)19 (54.3 %)2 (66.7 %)Surgeon qualificationPrimary22 (10.9 %)19 (14.7 %)2 (5.7 %)1 (2.9 %)0 (0.0 %)Intermediate85 (42.1 %)64 (49.6 %)10 (28.6 %)11 (31.4 %)0 (0.0 %)Senior95 (47.0 %)46 (35.7 %)23 (65.7 %)23 (65.7 %)3 (100 %)Flap designNo flap10 (5.0 %)8 (6.2 %)2 (5.7 %)0 (0.0 %)0 (0.0 %)Envelope flap16 (7.9 %)7 (5.4 %)1 (2.9 %)7 (20.0 %)1 (33.3 %)Triangular flap176 (87.1 %)114 (88.4 %)32 (91.4 %)28 (80.0 %)2 (66.7 %)Bone removalNo bone removal56 (27.7 %)39 (30.2 %)9 (25.7 %)8 (22.9 %)0 (0.0 %)Bone removal146 (72.3 %)90 (69.8 %)26 (74.3 %)27 (77.1 %)3 (100 %)Dental elevatorRegular elevator178 (88.1 %)113 (87.6 %)34 (97.1 %)28 (80.0 %)3 (100 %)Apex/Minimally invasive elevator24 (11.9 %)16 (12.4 %)1 (2.9 %)7 (20.0 %)0 (0.0 %)IrrigationNo irrigation80 (39.6 %)56 (43.4 %)16 (45.7 %)8 (22.9 %)0 (0.0 %)Normal saline122 (60.4 %)73 (56.6 %)19 (54.3 %)27 (77.1 %)3 (100 %)HemostasisNo collagen178 (88.1 %)117 (90.7 %)31 (88.6 %)28 (80.0 %)2 (66.7 %)Collagen24 (11.9 %)12 (9.3 %)4 (11.4 %)7 (20.0 %)1 (33.3 %)MedicationNSAIDNo NSAID14 (6.9 %)12 (9.3 %)0 (0.0 %)2 (5.8 %)0 (0.0 %)Ibuprofen124 (61.4 %)86 (66.7 %)32 (91.4 %)6 (17.1 %)0 (0.0 %)Loxoprofen sodium64 (31.7 %)31 (24.0 %)3 (8.6 %)27 (77.1 %)3 (100 %)AntibioticsNo69 (34.2 %)43 (33.3 %)12 (34.3 %)14 (40.0 %)0 (0.0 %)Yes133 (65.8 %)86 (66.7 %)23 (65.7 %)21 (60.0 %)3 (100 %)DexamethasoneNo93 (46.0 %)63 (48.8 %)14 (40.0 %)16 (45.7 %)0 (0.0 %)Yes109 (54.0 %)66 (51.2 %)21 (60.0 %)19 (54.3 %)3 (100 %) Baseline data of all candidate predictors. Feature screening for modeling LASSO regression was used for variable screening, and five variables were selected as modeling predictors: surgeon qualification, patient self-reported pain sensitivity, OHI–S–CI, BMI, and systolic blood pressure. The Lasso regression coefficients of the five variables were 0.192, 0.114, 0.020,-0.047, and −0.053, respectively. Fig. 2 (A, B) shows the results of the LASSO regression and illustrates the screening process for the variables. LassoRegression. Development of prediction model and validation Based on the five modeling predictors screened by the LASSO regression, a prediction model was developed based on nine different machine learning algorithms and validated internally with the training set. Table 2 lists the internal validation results of the nine machine learning prediction models assessed by the evaluation metrics: AUC, sensitivity, specificity, accuracy, and F1-score. The overall performance of the model established using the random forest algorithm performed best. The AUC, sensitivity, specificity, and accuracy of the prediction model built using random forest were 0.879 (0.861–0.891), 0.857, 0.846, and 0.848, respectively, for the internal validation set and 0.724 (0.673–0.732), 0.667, 0.600, and 0.605, respectively, for the external validation set. Table 3 presents the results of the study. Supplementary Figs. S1 and S2 show the receiver operating characteristic (ROC) curves for the internal and external validations. Table 2Evaluation metrics of each model for internal validation.Table 2ModelAUCCutoffaSensitivitySpecificityAccuracyF1RF0.879 (0.861–0.891)0.3230.8570.8460.8480.706KNN0.830 (0.802–0.842)0.2400.8570.8460.8480.706XGBoost0.830 (0.805–0.838)0.3880.8570.8080.8180.667Ada Boost0.854 (0.839–0.864)0.3750.8570.7690.7880.632Gaussian NB0.857 (0.839–0.866)0.3670.7140.7690.7580.556SVM0.852 (0.833–0.861)0.2590.7140.7690.7580.556LDA0.890 (0.878–0.901)0.2890.7140.7310.7270.526LR0.846 (0.826–0.855)0.2610.7140.7310.7270.526DT0.736 (0.712–0.746)0.3850.8570.6150.6670.522abalance threshold with sensitivity equal to specificity is chosen. Evaluation metrics of each model for internal validation. balance threshold with sensitivity equal to specificity is chosen. Table 3Prediction performance of random forest algorithm model.Table 3MetricsTraining setExternal validation setAUC0.879 (0.861–0.891)0.724 (0.673–0.732)Cutoff0.3230.323Sensitivity0.8570.667Specificity0.8460.600Accuracy0.8480.605 Prediction performance of random forest algorithm model. Application of the prediction model Based on the study results, a web‐based tool can be developed to enable clinicians to use the proposed model. Pain risk after the extraction of impacted mandibular third molars can be assessed preoperatively by inputting the surgeon qualifications, patient pain sensitivity, blood pressure, BMI, and OHI–S–CI into the model. Fig. 3 shows the interface of the web‐based tool of the prediction model for postoperative pain risk after extraction of impacted mandibular third molars. Relevant content was released at http://8.134.96.171:8507/ The web-based tool of prediction model. Discussion Using the machine learning algorithm, we developed a postoperative pain risk prediction model for impacted mandibular third molar extraction, which exhibited good predictive performances in both internal and external validations. This model was based on five predictors, surgeon qualification was the most important, followed by patient self-reported pain sensitivity, systolic blood pressure, BMI, and OHI–S-DI. Surgeon qualification This study determined that the risk of severe postoperative pain increased with higher surgeon qualifications. This may be related to difficulties experienced by doctors with different qualifications [21]. This is in line with clinical practice expectations that patients with complex medical situations are likelier to seek help from senior surgeons and experience greater difficulty with the operation. Moreover, studies have shown that doctors' experience may affect their perception of patients' pain during surgery [22] and experienced doctors may underestimate patients' pain, which may impact patients’ postoperative pain levels. Pain sensitivity Considering the trauma of impacted third molar extraction and lack of specificity of the regular psychological scale of dental fear and anxiety, we adopted the New Universal Scale in Oral Surgery (USOS) for patient psycho-emotional status rating proposed by Astramskaite and Juodbalys [16]. It involves a self-reported component and a surgeon-reported component, and three dimensions including the assessment of pain sensitivity, stress, and fear. We observed a significant correlation between patients' self-reported pain sensitivity and postoperative pain. Pain sensitivity was evaluated in two aspects: the patient's past pain experience and their expectation of upcoming pain. Previous research has demonstrated that a patient's unpleasant experience with pain may cause them to become more sensitive to pain [16] and that the painful recollection of patients undergoing tooth extraction is a major factor in postoperative pain [23]. Simultaneously, patients' expectations of pain can affect their perception of pain. Helping individuals reduce their pain expectations may benefit pain management [24]. Combined with the aforementioned relationship between surgeon qualifications and postoperative pain, surgeons should pay more attention to patient emotions and the concept of minimally invasive and painless treatment. Although the effects of anxiety and fear on postoperative pain were unclear in this study, previous studies have shown that anxiety significantly influences pain during treatment. Patients with dental anxiety often have a greater perception of pain [5] and higher prevalence of toothache, resulting in a lower quality of life [25]. In addition, statistics show that the prevalence of dental anxiety in adults in the population is as high as 15.3 %. Fear of oral treatment prompts patients to avoid oral examinations, which may worsen their condition and cause pain, resulting in more invasive treatment [6]. High blood pressure Studies have suggested that postoperative oral pain in patients with a high resting blood pressure is lower than that in patients with a low resting blood pressure [26], which is consistent with the results of our study. A high blood pressure may lead to a higher pain threshold, which is known as “blood pressure-related hypoalgesia” [27,28]. The mechanism underlying the negative correlation between blood pressure and postoperative pain has not been determined; however, studies have indicated that carotid pressure sensors may play an important role [28]. Blood pressure-related hypoalgesia can be significantly reduced or eliminated by reducing or interrupting the sinoaortic afferent input [26]. According to previous studies, certain brain areas can regulate both pain and blood pressure, and stimulating baroreceptor afferents can produce anti-nociceptive sensations. Blood pressure-related hypoalgesia may be caused by a descending inhibition of brainstem sites, which weakens the transmission of harmful stimuli to the spinal cord. Animal studies have suggested that endogenous opioid peptides and α-2-epinephrine-mediated pain inhibition pathways play important roles in blood pressure-related pain reduction [26,27]. BMI The effect of a high BMI, or obesity, on pain threshold remains inconclusive [29,30]. Some studies have suggested that obese patients are less sensitive to pain and have a higher pain threshold [31,32]. This may be related to the increased secretion of brain-derived neurotrophic factoroxytocin, and other related hormones in the plasma of obese patients. However, certain scholars have reported a positive correlation between the BMI and pain [33], which may be relevant to the different sources of pain investigated, as we suspect. Studies focused on chronic musculoskeletal pain, which is significantly affected by body weight bearing, may draw different conclusions compared with studies focused on noxious stimulation or postoperative pain. Recent research suggests that the BMI has different effects on pain in different parts of the body. In obese patients with osteoarthritis, the mediating effect of the increase of leptin levels on the hands was greater than that on the lower limbs [34]. In this study, patients with a high BMI demonstrated a lower probability of severe postoperative pain, which is consistent with the results of Price [32] and Dodet [31]. Oral hygiene This study used a questionnaire regarding oral hygiene habits and oral hygiene index to comprehensively evaluate the effect of oral health on postoperative pain. The results indicate that patients with a high OHI–S–CI score with more dental calculus were at greater risk of severe postoperative pain. Previous studies have demonstrated that patients with a lower frequency of brushing before third molar extraction have higher postoperative pain levels [35]; however, this study determined no correlation. Considering the subjectivity of the questionnaire and non-standard toothbrushing habits of many patients, we believe that the clinical examination results are more convincing than the frequency and duration of toothbrushing. Other factors In contrast to earlier research [15], this study observed no association between the imaging classification of impacted third molars and postoperative pain. Recently, some scholars have questioned the traditional classification of impacted third molars and Pederson difficulty index regarding their lack of accuracy and guidance in predicting the difficulty of tooth extraction in clinical practice [36]. This may be because the traditional classification of impacted third molars considers only the orientation of the impacted teeth while neglecting the influence of bone density and root morphology on the difficulty of tooth extraction. Therefore, the risk of postoperative pain cannot be accurately assessed using radiological classification. The tooth extraction methods used in this study were all conventional operations and no significant group differences were observed. The plan for a tooth extraction procedure depends primarily on the clinician's consideration. Current studies cannot confirm the effects of flapping, bone removal, irrigation, and other surgeries on postoperative pain [17]. Several studies have discussed conducting interventions to reduce complications after the extraction of impacted mandibular third molars. Paracetamol, NSAIDs, and opioids are widely used as analgesics after the extractions of mandibular third molars [37]. Postoperative administration of 1000 mg paracetamol [38] or 400 mg ibuprofen alone [39] has been proven effective in relieving pain. A combination of paracetamol and ibuprofen can decrease adverse reactions and may have a better analgesic effect [40,41]. In addition, the meta-analysis by Isiordia-Espinoza et al. [42] shows that the selective COX-2 inhibitor, tramadol, may be a better choice for postoperative analgesia because it is as effective as ibuprofen in terms of analgesic effectiveness, with a lower frequency of nausea and vomiting. Low-dose opioids (such as 60 mg of codeine) have been reported to be as effective in analgesic efficacy as ibuprofen and paracetamol for shorter durations [43,44]. Considering the current status of opioid abuse, the clinical application of opioids remains controversial [37]. The preoperative administration of analgesics may help to improve the experience of patients after extraction of impacted third molars. Several studies have evaluated the preemptive effects of analgesics on pain [45]. The preoperative administration of 120 mg of Etoricoxib or 400 mg of ibuprofen can significantly reduce pain after a third molar extraction [46]. Simultaneously, the concentration of proinflammatory cytokines TNF- α and IL-1 β in patients’ gingival tissue has been shown to decrease, which reduces the degree of tissue edema. Moreover, other studies have shown that the preoperative oral administration of 120 mg of etoricoxib [47] or 200 mg of celecoxib [48] and a preoperative intravenous injection of 30 mg ketorolac [49] or 800 mg of ibuprofen [50] can effectively reduce postoperative pain and the need for rescue analgesia. This study constructed a model for predicting pain after the extraction of impacted third molars based on nine machine learning algorithms. This model can accurately stratify patients with different pain risks after the tooth extraction and guide clinicians in selecting postoperative medication and surgical procedures. The prediction model provides support for interventions (such as more powerful painkillers or preoperative analgesics) to reduce the peak degree of pain after tooth extractions and ensures a painless and comfortable environment for patients throughout the treatment process. As a computer algorithm, the machine learning method provides a new statistical analysis strategy for the development of clinical prediction models. To the best of our knowledge, this is the first prospective study to apply machine learning algorithms to pain risk prediction in wisdom tooth extraction, combined with multi-domain clinical data. This study is expected to contribute to the research progress in this field and provide guidance for clinicians. All in all, this study developed a machine learning-based postoperative pain risk prediction model for impacted mandibular third molar extraction. Both internal and external validations showed that the model has a good predictive performance and can accurately identify patients at high risk of postoperative pain. Based on this model, we developed a web‐based tool to promote its application, with the hope that it can guide clinical pain management. Limitations of the study The main limitation of this study is that the clinical sample size is relatively small, and the study population lacks ethnic diversity. We hope to expand the sample size and enhance the diversity of the subjects in the future. Institutional URL Hospital of Stomatology, Sun Yat-sen University: https://www.zdkqyy.com/ Data availability statement Data will be made available on request. Additional information No additional information is available for this paper. Ethical approval Ethical approval was received from the medical ethics committee on 26–07-2022 (Ethics Number: KQEC-2022-85-01). All participants provided written informed consent. Funding This study was funded by the National Natural Science Foundation of China (No. 82073378) and the Natural Science Foundation of Guangdong Province (No. 2021A1515012399). The funders had no role in method design, data selection, analysis, the decision to publish, or the preparation of the manuscript. CRediT authorship contribution statement Dongsheng Yu: Writing – review & editing, Validation, Supervision, Resources, Project administration, Methodology, Investigation, Funding acquisition, Conceptualization. Zifeng Liu: Visualization, Validation, Supervision, Software, Resources, Project administration, Methodology, Formal analysis. Weijie Zhuang: Writing – review & editing, Writing – original draft, Investigation, Formal analysis, Data curation, Conceptualization. Kechen Li: Writing – review & editing, Investigation, Formal analysis, Data curation, Conceptualization. Yaxin Lu: Visualization, Validation, Software, Resources, Project administration, Methodology, Investigation, Formal analysis. Declaration of competing interest The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper. Acknowledgements The authors thank the surgeons in the oral and maxillofacial surgery department and radiologists at Hospital of Stomatology of Sun Yat-sen University for data contributions. Footnotes Supplementary data to this article can be found online at https://doi.org/10.1016/j.heliyon.2023.e23052. Contributor Information Dongsheng Yu, Email: yudsh@mail.sysu.edu.cn. Zifeng Liu, Email: liuzf@mail.sysu.edu.cn. Weijie Zhuang, Email: zhuangwj6@mail2.sysu.edu.cn. Kechen Li, Email: likch5@mail2.sysu.edu.cn. Yaxin Lu, Email: luyx68@mail.sysu.edu.cn. Supplementary data The following are the Supplementary data to this article: Multimedia component 1 Multimedia component 2 References Associated Data Supplementary Materials Multimedia component 1 Multimedia component 2 Data Availability Statement Data will be made available on request.