Prediction of ectopic pregnancy using interpretable machine learning algorithms.

OA: gold CC-BY-NC-ND-4.0

Abstract

BackgroundEctopic Pregnancy (EP) is a type of pregnancy where the developing blastocyst implants in a location other than the endometrial cavity. The aim of study was developing predictive models that could improve the accuracy of identifying individuals at risk and uncover relationships between known risk factors and ectopic pregnancy occurrence.MethodsFive-fold cross-validation were employed to prevent overfitting and the Grid Search method was utilized to determine the optimal hyper-parameters for the models. The performance of the models was evaluated using metrics such as accuracy, Area Under the Curve (AUC), and Negative Predictive Value (NPV). The SHapley Additive exPlanations (SHAP) method was used to interpret the model's decision-making process and identify the most significant features.ResultsRF demonstrated the best performance (87.13% accuracy, 90.65% AUC). Key predictors identified via logistic regression (LR) and SHAP analysis included mid-cycle pain, genital surgery history and dysmenorrhea.ConclusionThis investigation illustrates the potential for machine learning models to improve clinical decision-making and optimize patient outcomes in cases of ectopic pregnancy. Further validation in diverse populations is required due to the constraints of single-center data and the absence of critical risk factors, such as the use of PIDs and IUDs.
Full text 38,991 characters · extracted from pmc-nxml · 5 sections · click to expand

Results

Table  1 illustrates the frequency distribution and percentage of demographic and clinical factors among two cohorts of women: those with EP and the control group (women without EP). The findings demonstrate a statistically significant disparity in the distribution of several variables between the two groups ( p  < 0.05). In the EP group, the proportion of women with a history of EP (10.19%) is markedly greater than that in the control group (6.70%). Likewise, the proportion of women having a history of genital surgery, psychiatric disorders, and vaginal hemorrhage was elevated in the EP group compared to the control group. These data indicate that these factors may contribute to the development of EP. In contrast, the distribution of additional characteristics, including age did not exhibit significant differences between the two groups. our implies that these factors alone may not qualify as risk factors for EP and that additional, unexamined factors may be implicated in our study. A LR model was employed to further examine the relationship between each of these variables and EP, with the results displayed in Table  2 . The LR analysis results (Table  2 ) indicated a statistically significant correlation between a history of EP, genital surgery, psychiatric problems, and vaginal hemorrhage and the outcome of EP ( p  < 0.05). Women having a history of EP were 2.432 times more likely to experience EP compared to those without such a history (OR = 2.432, 95% CI: 1.168–4.902). Women who underwent genital surgery exhibited a 2.392-fold increased likelihood of developing EP compared to other infertile women (OR = 2.392, 95% CI: 1.239–3.074). A history of psychiatric disorders was correlated with a heightened probability of EP, with women possessing such a history being 1.952 times more likely to experience EP compared to other infertile women (OR = 1.952, 95% CI: 1.154–4.080). Vaginal hemorrhage was discovered as a risk factor for EP, with the probability of EP in women experiencing vaginal bleeding being 2.170 times higher than in other infertile women (OR = 2.170, 95% CI: 1.154–4.080). Conversely, other characteristics analyzed in this study did not exhibit a significant correlation with EP. The Pearson correlation coefficient was employed to analyze the correlations between features in the primary dataset. Figures  1 and 2 display the correlation coefficients for the features in the primary dataset and the external validation dataset, respectively. For model development, Table  3 lists the Optimized hyperparameters for each classifier. Model performance was evaluated using accuracy, sensitivity, PPV, F1-score, NPV, and AUC. Table 4  reports the average 5-fold cross-validation performance on the primary dataset, with the RF achieving the best overall results across metrics. Table 2 Logistic regression analysis results for predicting EP B S.E. Wald df Sig. Exp(B) 95% C.I.for EXP(B) Lower Upper age 0.008 0.007 1.210 1 0.271 1.008 0.994 1.023 ectopic_past 2.520 0.352 51.270 1 0.000 2.432 4.783 6.237 Genital surgery in the past 0.872 0.366 5.681 1 0.017 2.392 1.168 4.902 psychiatric disorders 0.669 0.232 8.321 1 0.004 1.952 1.239 3.074 Vulvitis 0.088 0.240 0.134 1 0.715 1.092 0.682 1.747 Endometriosis 0.527 0.567 0.864 1 0.353 1.694 0.558 5.144 Erosion and ectropion of cervix uteri 0.222 0.246 0.813 1 0.367 1.248 0.771 2.022 Non-inflammatory disorders of vagina, unspecified 0.160 0.156 1.051 1 0.305 1.173 0.864 1.593 Absent, scanty, and rare menstruation 0.127 0.199 0.407 1 0.524 1.135 0.769 1.677 irregular menstruation 0.129 0.177 0.529 1 0.467 1.138 0.804 1.611 vaginal bleeding 0.775 0.322 5.788 1 0.016 2.170 1.154 4.080 Mid-cycle pain 1.759 1.092 2.591 1 0.107 5.805 0.682 49.400 Dysmenorrhea 0.107 0.228 0.222 1 0.638 1.113 0.712 1.740 Constant − 0.478 0.237 4.053 1 0.044 0.620 a. Variable(s) entered on step 1: age, ectopic_past, Genital, psychiatric disease, vulvits, endometric, erosion, Non-inflammatory, absent, irregular, vaginal, mid, Dysmenorrhea Fig. 1 Pearson correlation coefficient map of the primary dataset Fig. 2 Pearson correlation coefficient map of the external validation dataset Table 3 Optimized hyperparameters for the models (5-fold CV, grid search) Model Hyperparameters LR C: 1 DT Max_depth: 7, splitter: best SVM C: 0.1, gamma: 1, kernel: rbf RF Max_depth: 7, n_estimators: 100 Table 4 Average performance across the five folds of the proposed models Model Accuracy (%) Recall (%) Precision or PPV (%) F1-Score NPV (%) AUC (%) LR 84.17 80.06 86.12 82.98 82.57 90.65 DT 85.14 77.96 89.91 83.50 81.72 91.34 SVM 83.59 78.99 85.88 82.28 81.75 90.21 RF 87.13 81.71 90.73 85.97 84.37 95.12 Logistic regression analysis results for predicting EP a. Variable(s) entered on step 1: age, ectopic_past, Genital, psychiatric disease, vulvits, endometric, erosion, Non-inflammatory, absent, irregular, vaginal, mid, Dysmenorrhea Pearson correlation coefficient map of the primary dataset Pearson correlation coefficient map of the external validation dataset Optimized hyperparameters for the models (5-fold CV, grid search) Average performance across the five folds of the proposed models Consistent with other studies, accuracy and AUC were considered the most critical metrics for model evaluation [ 32 ]. Detailed values for the five folds of the RF model are provided in Table 5 . Table 5 Performance of the RF model across all folds of the primary dataset Fold Accuracy (%) Recall (%) Precision or PPV (%) F1-Score NPV (%) AUC (%) Fold 1 86.89 81.15 91.80 86.15 82.96 95.61 Fold 2 87.62 82.47 90.39 86.25 85.53 95.14 Fold 3 88.59 84.45 90.55 87.39 87.06 95.33 Fold 4 85.19 79.89 88.33 83.90 82.75 94.49 Fold 5 87.37 80.59 92.57 86.17 83.54 95.05 Average 87.13 81.71 90.73 85.97 84.37 95.12 Performance of the RF model across all folds of the primary dataset Furthermore, as the top-performing model, the RF model’s confusion matrices and AUC diagrams for all folds are depicted in Fig.  3 A to E and Fig.  4 A to E, respectively. The most significant features of the primary dataset identified by the RF model are shown in Fig.  5 A, while the corresponding features of the external validation dataset are presented in Fig.  5 B. Figure  6 A illustrates the contribution of features from the primary dataset to the RF model’s decision-making using SHAP values, and Fig.  6 B presents the SHAP-based interpretation of the external validation dataset. Table 6  presents the efficacy of the RF model on the external validation dataset. Additionally, Fig.  7 A and B present the confusion matrix and AUC diagram for this dataset, respectively. Finally, the decision curve analysis of the developed models for predicting ectopic pregnancy is illustrated in Fig.  8 , highlighting their potential clinical utility.Clinical Application Evaluation. Fig. 3 RF model in the primary dataset confusion matrices across five cross-validation folds. Panels ( A ) to ( E ) show the matrices for folds 1 through 5 Fig. 4 AUC diagram for the RF model in the primary dataset with 5-fold cross-validation. Panels ( A ) to ( E ) illustrate the AUC for each distinct fold Fig. 5 Most important features of the primary dataset ( A ) and the external validation dataset ( B ) RF model in the primary dataset confusion matrices across five cross-validation folds. Panels ( A ) to ( E ) show the matrices for folds 1 through 5 AUC diagram for the RF model in the primary dataset with 5-fold cross-validation. Panels ( A ) to ( E ) illustrate the AUC for each distinct fold Most important features of the primary dataset ( A ) and the external validation dataset ( B ) Fig. 6 Impact of the features of the primary dataset ( A ) and the external validation dataset ( B ) on the model’s decision-making Impact of the features of the primary dataset ( A ) and the external validation dataset ( B ) on the model’s decision-making Table 6 Performance of the RF model on external validation dataset Accuracy (%) Recall (%) Precision or PPV (%) F1-Score NPV (%) AUC (%) 85.00 84.37 87.09 85.71 82.75 97.02 Performance of the RF model on external validation dataset Fig. 7 A : Confusion matrix of the RF model in the external validation dataset, B ; AUC diagram of the RF model in the external validation dataset A : Confusion matrix of the RF model in the external validation dataset, B ; AUC diagram of the RF model in the external validation dataset Fig. 8 Decision Curve Analysis of the Developed Models for Predicting Ectopic Pregnancy Decision Curve Analysis of the Developed Models for Predicting Ectopic Pregnancy Decision curve analysis shows that machine learning models showed higher net benefits than default all-or-none treatment strategies over a wide range of threshold probabilities (10 to 80%). The RF model achieved the highest clinical net benefit, especially between 30 and 60% thresholds, indicating its superior predictive performance. It provided higher net benefits than the default “treat all” and “treat none” strategies over a wide range of threshold probabilities (from 0 to approximately 80%). The model’s net benefit curve lies above both reference lines, indicating its clinical utility in identifying true positives while reducing unnecessary interventions. In the 10 to 40% threshold range, the RF model consistently outperformed the other models. In comparison, at higher thresholds (> 80%), its benefit decreases due to the decrease in the number of positive cases (Fig.  8 ).

Background

Ectopic Pregnancy (EP) is a type of pregnancy where the developing blastocyst implants in a location other than the uterine cavity. The most common site for implantation is the Fallopian tubes, accounting for approximately 96% of all EP [ 1 ]. EP frequently causes in unilateral lower abdomen pain accompanied by vaginal hemorrhage. Symptoms such as dizziness, syncope, shoulder discomfort, or intense pelvic pain may signify a ruptured EP. Nonetheless, these symptoms may resemble other illnesses, such as early normal intrauterine pregnancy, miscarriage, ovarian cyst rupture, or appendicitis [ 2 ]. Consequently, distinguishing EP from illnesses with similar clinical characteristics can be challenging, Rendering timely medical assessment essential for precise diagnosis and intervention.EP can lead to rupture, bleeding, and potentially life-threatening consequences for the mother. The mortality rates associated with EP range from approximately 9–14% [ 3 ]. It is widely recognized as the leading cause of maternal mortality during the first trimester of pregnancy, particularly in developing countries [ 4 ]. The long-term negative consequences of EP, especially concerning fertility, underscore the necessity for effective treatment to reduce risks [ 5 ]. EP, a significant concern in reproductive health, is markedly elevated in individuals with a prior history of EP [ 6 ], infertility, invasive assisted reproductive interventions, and failed sterilizations [ 7 ]. Inflammation and infection of the female genitalia, particularly pelvic inflammatory disease (PID), contribute to fallopian tube damage and increased EP risk [ 8 ]. Endometriosis is also identified as a risk factor, with an odds ratio of 2.6 [ 9 ]. Menstrual and ovulatory disorders, psychiatric conditions, advanced maternal age, prior reproductive tract pathology, smoking, and previous use of an IUD are among the significant risk factors for EP [ 10 – 14 ]. Given the rising incidence, prioritizing screening of high-risk cases and early intervention is crucial for improving maternal survival and preserving reproductive capacity [ 15 ]. While advancements in ultrasound, hormone assays, Early Pregnancy Units, and knowledge of risk factors have improved diagnosis, approximately 50% of EPs are not identified at initial presentation [ 16 , 17 ]. Despite diagnostic progress, prompt and precise prediction remains a therapeutic challenge, as reliance on clinical manifestations and transvaginal ultrasound often lacks sufficient sensitivity and specificity for early detection, leading to delayed diagnoses and potential complications [ 16 ]. There is a need for enhanced predictive models utilizing accessible clinical data to more effectively identify women at elevated EP risk. Diagnosis is complicated by clinical mimics and non-specific symptoms [ 17 ]. Current methods, such as relying on clinical symptoms and transvaginal ultrasound, often lack the sensitivity and specificity needed for early detection, leading to delayed diagnosis and potentially adverse outcomes. This diagnostic uncertainty highlights the critical need for improved prediction models. Machine learning (ML) offers a promising avenue for addressing this challenge. By leveraging readily available clinical data and identifying complex patterns indicative of EP risk, ML models have the potential to identify at-risk women earlier and more effectively than current methods [ 18 ]. In recent years, the integration of machine learning (ML) and artificial intelligence (AI) algorithms in the field of medicine has ushered in a new era of prediction, diagnosis, treatment, and healthcare management. One crucial application of these algorithms is disease detection. Given the significant importance of EP, its prevalence, and the preventability of many known risk factors, coupled with the increasing advancements in the use of AIfor disease prediction, In light of the identified need to address this issue and the lack of previous investigations in this area, a study was designed and conducted in collaboration with Kowsar Urmia Hospital.This hospital serves as a level 3 referral center in West Azerbaijan province, receiving the majority of EP cases. Our aim was to develop advanced and technology-based predictive models that not only improve the accuracy of identifying individuals at risk but also uncover latent and multidimensional relationships between known risk factors and their impact on EP risk. By doing so, we hoped to gain new insights into the mechanisms and patterns associated with EP occurrence, bridging existing gaps in prediction methods that encompass both traditional and innovative approaches. This study aims to develop and evaluate interpretable machine learning algorithms specifically designed for predicting EP. This mission will be accomplished by utilizing accessible clinical data and uncovering intricate patterns linked to the risk of EP. These models are expected to improve the accuracy and speed of finding women at risk compared to current diagnostic methods, allowing for earlier diagnosis, quicker treatment, fewer complications, and better results for patients. Additionally, these models will help us better understand the risk factors and how they interact with EP, which could lead to better ways to prevent and manage the condition.

Conclusion

This study demonstrates how EP can be predicted using clinical and laboratory indicators using interpretable machine learning models, particularly RF and LR. The models found that mid-cycle discomfort, genital surgery history, and dysmenorrhea were the most significant predictors. Although external validation highlighted the importance of dataset diversity, the RF model showed the highest accuracy and AUC. The findings imply that machine learning holds promise for significantly assisting doctors. To assess the models across a range of populations, add more clinical risk factors, and deal with issues like overfitting and limite generalizability, more study is required [ 40 ].

Discussion

This study investigated the efficacy of machine learning (ML) in forecasting EP through clinical and laboratory indicators. To identify major factors and evaluate predictive performance for EP, four models LR, DT, SVM, and RF were applied. The results demonstrate that readily obtainable clinical and laboratory data can be effectively employed for forecasting EP. The RF and LR models both exhibited the potential to predict EP. The RF model demonstrated exceptional performance in various evaluation metrics. The LR model provided significant interpretability via its coefficients, elucidating the relative importance of various factors in predicting EP. This interpretability is essential for clinical adoption, since it enables physicians to comprehend the reasoning behind the model’s predictions. A comparison of the top three influential features across both datasets reveals a consistent emphasis on mid-cycle pain, genital surgery history, and dysmenorrhea, underscoring their robust association with EP. This finding is in concert with clinical studies, which identify such factors as possible markers of a possible underlying gynecological disorder that may raise the risk for an EP, such as endometriosis, prior history of infertility, and the use of assisted reproductive technology. Clinically, this profile justifies the necessity for an appropriate menstrual history in the diagnostic workup in a case of suspected EP. Thus, the presence of dysmenorrhea calls for an increased index of suspicion, perhaps earlier investigations, and timely diagnosis when associated with other risk factors. Similarly, new or worsening irregular menstruation or mid-cycle pain should trigger further evaluation, potentially necessitating additional imaging or hormonal assessments. These findings are in concordance with established knowledge in medical science and can thus be used within clinical decision-making to early identify and treat EP. This will also help the clinicians decide whether ultrasound or laparoscopy should be used for definitive diagnosis. SHAP analysis presents an explanation of the various factors contributing to a model’s prediction of the medical condition under investigation. Our research identified mid-cycle pain, prior genital surgery, and dysmenorrhea as the three most significant factors in predicting EP. The positive SHAP ratings for these variables signify that their inclusion elevates the projected risk. Mid-cycle pain exhibited the most significant correlation, underscoring its potential clinical use as a prognostic indicator. The significance of a history of genital surgery and dysmenorrhea aligns with the clinical comprehension of risk factors associated with EP. These findings emphasize the necessity of meticulously assessing these parameters in women with suspected EP. Menstrual irregularities, vaginal hemorrhage, and intermenstrual discomfort were supplementary risk factors for EP. In 2016, Ayim and colleagues identified in a cohort of 1,320 women in the UK that pelvic pain (OR = 2.4) and diarrhea (OR = 2.2) occurring within 24 h previous to their presentation at the early pregnancy assessment center elevated the probability of EP [ 33 ]. likely to experience EP compared to controls, however it remained uncertain whether the heightened risk was attributable to genital surgery or the underlying condition [ 34 ]. Tubal surgery is a probable risk factor for EP, however the influence of nontubal surgery is ambiguous. An initial study looking at this question found no significant correlation for abdominal or pelvic surgery and EP [ 35 ]. Conversely, several studies had established that this operation raised the risk of having this pregnancy-related complication [ 20 , 21 ]. Barnhart et al. in 2006 analyzed women in Pennsylvania and concluded that previous nontubal pelvic surgery was not associated with EP. Because in this retrospective study our inability to differentiate between tubal and nontubal procedures did not permit an analysis of their separate effects, the two conditions cannot be commented upon separately. Moreover, cervical erosion and ectropion were found to be adjunctive risk factors for EP. This discovery may also indirectly indicate the association of local treatment (surgical or conservative) to potentially occult ascending infection that destroys the function of the tubes [ 31 , 36 ]. Our research highlights the significance of risk factor-based prediction of EP utilizing Random Forests (AUC = 90.6%) and complements the Jurman study, which employed a Decision Tree to predict expectant management outcomes (precision = 92%, recall = 95%). These methods together show how interpretable machine learning could help with early risk classification and individualized treatment decisions in EP [ 37 ]. Jacob et al. found that dysmenorrhea, which is commonly linked with endometriosis, is associated with a 1.35-fold increased risk of EP. This discovery indicates that dysmenorrhea constitutes an independent risk factor for the onset of an EP. However, dysmenorrhea, prevalent in various circumstances, may only indicate the substantial influence of factors not incorporated in the current LR study on the likelihood of being diagnosed with an EP [ 10 ].Likewise, irregular menstruation and mid-cycle discomfort greatly influenced the model’s predictions, further indicating the involvement of menstrual abnormalities in the condition’s pathophysiology. These findings highlight the significance of comprehensive menstrual history evaluation in clinical assessment. Although age, vulvitis, and psychiatric disorders exhibited a less significant impact, their high SHAP values indicate a possible correlation with the illness. This necessitates additional inquiry to clarify the fundamental mechanisms and any connections with other risk variables. However, it is noteworthy that both non-inflammatory vaginal diseases and a prior history of EP are minimal contributions. This may indicate that the role of engagement in forecasting the disease is not as significant as previously assumed. It must also be acknowledged that there is a limit to the extent the model can encapsulate the complexity of the condition’s etiology using only a limited number of features. The “sum of four additional features” remains opaque in this analysis, obstructing a thorough understanding of their contributions. Future research should strive to deliver a clearer delineation of these features to improve the model’s interpretability and clinical significance. This SHAP analysis offers significant insights into the relative significance of several elements in forecasting the medical state. It is crucial to underscore that this interpretation is model-based, and clinical judgment must always accompany these findings. Additional study is required to confirm these results across varied populations and to investigate the possible therapeutic ramifications of these findings for individualized risk evaluation and customized therapies. RF models typically provide robust predictive accuracy owing to its capacity to capture intricate non-linear relationships, handle high-dimensional data, and account for correlations and interactions among features [ 38 ]. During the external validation phase of Rueangket et al., Neural Networks (NNs) surpassed RF, underscoring the significance of context and data attributes in identifying the most suitable model. This is a vital factor in medical applications, where comprehending the rationale behind a model’s forecast is frequently as significant as the prediction itself. Moreover, the efficacy of RF, akin to other intricate models, might be affected by the dimensions and quality of the training dataset. This poses a major obstacle in medical research, as acquiring extensive, high-quality datasets may prove challenging. Our results contrast with those of Rueangket et al. during the external validation phase, in which they determined that NNswere superior. This mismatch may be due to differences in the validation datasets or the particular neural network architecture employed. It underscores the significance of stringent external validation and the possibility for various models to excel in distinct circumstances [ 39 ]. Deep learning and hybrid methodologies can improve the prediction of EP risk with tabular data by identifying intricate, nonlinear correlations among variables. Deep neural networks (DNNs) can discern complex patterns from structured data, whereas hybrid methods can integrate DNNs with algorithms like gradient boosting to capitalize on the advantages of both approaches. These techniques enhance prediction precision and provide superior feature interaction modeling, providing more dependable risk classification for early diagnosis and therapy. This research possesses multiple limitations. The single-institution data source may restrict generalizability due to potential selection bias, as the patient population at this institution may not reflect the demographics of all women experiencing EP. Secondly, although several clinical and laboratory characteristics were incorporated, additional pertinent factors (e.g., lifestyle, healthcare accessibility, specific comorbidities) that may affect predictions were not included, potentially resulting in omitted variable bias. Third, although the goal is variety, certain patient features (e.g., age range, parity) may further restrict generalizability, as model performance could differ beyond the demographics of the research sample. The retrospective design may add possible information or recall bias. Ultimately, although missing data were addressed statistically, their existence could still affect model performance. Future research must rectify these limitations by employing multi-institutional data collection to enhance generalizability and mitigate selection bias, integrating a broader array of predictors to diminish omitted variable bias, ensuring representative study populations, utilizing prospective studies with standardized data collection to alleviate information and recall bias, and investigating sophisticated methods for managing missing data. Notwithstanding the commendable performance of our models, this study possesses limitations. Initially, our data were sourced from a singular institution and may not comprehensively reflect the diversity of the patient community. Secondly, some notable risk factors, including a history of PID and the utilization of intrauterine devices (IUDs), were omitted from our model. Subsequent research that integrates these variables and employs multicenter data may improve the predicted accuracy of the models. Moreover, the integration of interpretable models with deep learning methodologies may result in the creation of more resilient and comprehensible prediction models. Furthermore, utilizing model explainability strategies helps improve comprehension of model judgments and cultivate clinicians’ trust. These problems must be resolved to guarantee the effective incorporation of ML models into clinical practice.

Methodology

This was a retrospective cohort research, shown in Table  1 , conducted using medical records of 60 pregnant women exhibiting first-trimester complications such as abdominal pain and/or abnormal vaginal bleeding at Kowsar Hospital from May 2023 to May 2024. The inclusion criteria comprised people suspected of having PUL, substantiated by a medical report detailing clinical history, physical examination, and ultrasound evaluation. Women were enrolled regardless of serum HCG tests, depending on medical judgment at that time, including those displaying suspected signs of intrauterine or ectopic pregnancy as identified by ultrasonography on the initial visit. Patients demonstrating clinically significant ruptured EP (clinical instability or signs of intra-abdominal hemorrhage) or showing any indication of intrauterine gestational material or EP (adnexal mass with fetal pole or fetal cardiac activity) via ultrasound during the initial consultation were excluded. Patients with EP were diagnosed through pathological findings in surgical instances and anomalous serial serum HCG levels in non-surgical circumstances. The patient’s identity was anonymized before analysis and discussion. This study utilized segments of comparable medical data from patients at Kowsar Hospital for model validation, employing diverse research queries and methodologies [ 19 ]. The method of a retrospective study inherently leads to the unavoidable absence of input data. Analysis of the patients revealed that approximately 10–20% exhibited absent values across all features, occurring randomly and primarily linked to minimal adverse outcomes or presumed irrelevant histories during their hospitalizations [ 20 ]. The objective was to understand the data for training purposes, rather than omitting any, as this could introduce bias into the classifier’s performance [ 21 ]. Data were obtained from the electronic medical records of the Obstetrics and Gynecology Department at a tertiary care institution. We gathered data on demographics, medical history, gynecological and obstetrical history, gestational age, clinical parameters, sonographic results, and HCG levels. In this study, the EP dataset collected by Jacob et al. [ 22 ] was used as the primary dataset to train and test ML algorithms. Additionally, an external validation dataset was collected by the researchers of this study from Kowsar Hospital in Urmia, Iran. In both datasets, all characteristics (age, History of EP, genital surgery in the past, psychiatric disease, vulvitis, endometriosis, erosion and ectropion of the cervix uteri, non-inflammatory disorders of the vagina, unspecified, absent, scanty, and rare menstruation, irregular menstruation, vaginal bleeding, mid-cycle pain, dysmenorrhea) have binary values except for age. In the primary dataset, the age of the youngest patient was 16 years and the oldest patient was 45 years, whereas in the external validation dataset, the age of the youngest patient was 16 years and the oldest patient was 44 years. The primary dataset contains records of 2,060 patients, and the external validation dataset contains records of 60 patients. Both datasets are balanced, with half of the patients having EP and the other half not having EP. Before using the model, we performed thorough data cleaning. This entailed eliminating non-informative and irrelevant characteristics, addressing missing values, standardizing value scaling, and incorporating important columns to improve predictive performance. We affirm that we utilized portions of similar electronic medical data from patients attending Kowsar Hospital for model validation in this research, employing various research queries and methodologies. To prevent conflating correlation with causality, characteristics exhibiting a large absolute correlation exceeding 0.95 were eliminated [ 23 ]. Table 1 Descriptive characteristics of study participants Variables ( N %) Control ( N %) p -value Previous ectopic pregnancy  Yes 10.19 0.87 ≤0.001  No 89.81 99.13 history of genital surgery  Yes 2.91 1.07 0.003  No 97.09 98.93 psychiatric disorders  Yes 6.70 3.01  ≤0.001  No 93.30 96.99 Vulvitis  Yes 4.47 3.50 0.260  No 95.5 96.50 Endometriosis  Yes 1.26 0.49 0.058  No 98.74 99.51 Cervical erosion/ectropion  Yes 5.15 3.30 0.037  No 94.85 96.70 Non-inflammatory disorders of vagina, unspecified  Yes 13.79 9.71 0.004  No 86.21 90.29 Absent, scanty, and rare menstruation  Yes 6.80 5.15 0.114  No 93.20 94.85 irregular menstruation  Yes 9.51 6.70 0.019  No 90.49 93.30 vaginal bleeding  Yes 3.40 1.46 0.004  No 96.60 98.54 Mid-cycle pain  Yes 0.68 0.10 0.034  No 99.32 99.90 Dysmenorrhea  Yes 5.05 3.88 0.201  No 94.95 96.12 Descriptive characteristics of study participants In this study, the Min-Max normalization technique from Python’s Sklearn library was utilized. Consequently, the age attribute was scaled to the interval (0,1) in accordance with Eq. ( 1 ), where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\:{X}_{min}$$\end{document} represents the minimum value, and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\:{X}_{max}$$\end{document} denotes the maximum value of this feature. 1 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\:{X}_{normalize}=\frac{X-{X}_{min}}{{X}_{max}-{X}_{min}}$$\end{document} The Pearson correlation coefficient was employed to analyze the relationships among all features in the dataset. This coefficient measures the extent and nature of pairwise associations between features [ 24 ], with values ranging from − 1 to 1, where 1 signifies the strongest correlation. Evaluating the importance of dataset features is valuable for supporting medical decision making [ 25 ]. Consequently, the SHAPmethod was utilized to interpret the model applied to our dataset. This approach provides insights into each feature’s importance and its role in the model’s decision-making process [ 26 ]. The LR is a ML algorithm utilized to estimate the probability of a binary target variable, meaning it can only have two possible classes. This model is utilized to classify various types of problems. The Decision Tree (DT) algorithm is a widely utilized supervised ML method suitable for both classification and regression. It employs the Gini criterion to determine the most likely successful strategy. This algorithm comprises leaves, roots, and branches. The Support Vector Machine (SVM) algorithm, a supervised and instance-based ML technique, uses hyperplanes to separate data samples. It aims to maximize the margin between classes, categorizing samples on one side of the hyperplane as similar. The Random Forest (RF) algorithm is a highly popular supervised ML technique used for classification and regression. To achieve more robust performance, it aggregates predictions from multiple trees instead of relying on a single DT, making decisions based on majority votes. Increasing the number of trees typically enhances performance and mitigates over-fitting. RF is among the most effective ML algorithms for various applications [ 19 ]. Five-fold cross-validation was utilized to prevent overfitting and assess the performance of the implemented models [ 27 ]. In each iteration, 80% of the primary dataset was allocated for training, while the remaining 20% was used for testing. Finally, after the training and testing phases, the best-performing model was evaluated using an external validation dataset. In this study, the Grid Search method was employed to determine the optimal hyperparameters for all models. A confusion matrix is a classification evaluation tool, represented as a square matrix with dimensions equal to the number of classes in the classification [ 28 ]. Following the training and testing of models, several ML evaluation metrics for determine performance of classification were used [ 28 – 30 ]. Accuracy, defined in Eq. ( 2 ), measures the ratio of correct predictions to the total number of predictions, serving as a key metric for evaluating ML classification models [ 29 , 30 ]. 2 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\:Accuracy=\frac{TP+TN}{TP+FP+FN+TN}$$\end{document} Sensitivity, or Recall, shown in Eq. ( 3 ), is the ratio of true positives to the sum of false negatives and true positives. It evaluates an ML model’s ability to identify positive samples. 3 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\:Sensitivity\:or\:Recall=\frac{TP}{FN+TP}$$\end{document} Precision, or Positive Predictive Value (PPV), is outlined in Eq. ( 4 ). It is the ratio of true positives to the sum of false positives and true positives, indicating the accuracy of a model’s positive predictions [ 29 ]. 4 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\:Precision\:or\:Positive\:Predictive\:Value\:\left(PPV\right)=\frac{TP}{FP+TP}$$\end{document} The F1-Score, calculated as the harmonic mean of recall and precision, is presented in Eq. ( 5 ). It provides a single metric to compare models, with a high F1-Score indicating low false positives and negatives [ 28 , 29 ]. 5 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\:F1-Score=\frac{2\times\:Precision\times\:Recall}{Precision+Recall}$$\end{document} NPV, detailed in Eq. ( 6 ), is the ratio of true negatives to the sum of false negatives and true negatives. This metric shows the likelihood that a person testing negative for a disease is indeed healthy [ 29 ]. 6 \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\:Negative\:Predictive\:Value\:\left(NPV\right)=\frac{TN}{FN+TN}$$\end{document} In above-mentioned Eqs. ( 2 , 3 , 4 , 5 ,  6 ), TP denotes true positive, TN denotes true negative, FP denotes false positive, and FN denotes false negative. The AUCrepresents the area under the Receiver Operating Characteristic curve, serving as an indicator of the overall accuracy of the models. AUC values range from 0 to 1, with lower values indicating poor model performance and higher values indicating better accuracy [ 30 ]. The decision curve analysis (DCA) was used to support the clinical decisions of the prepared prediction models [ 31 ]. This study utilized numerous statistical methods for data analysis. Descriptive statistics, including frequency and percentage for categorical variables and mean and standard deviation for continuous variables, were employed to characterize the research population. A LR model was employed to examine the relationship between risk factors and EP. The RF model was ultimately employed to predict the likelihood of EP, with its performance assessed by the AUC metric. The SHAP technique was utilized to determine the most significant risk factors in forecasting EP.

Text is read by the "Ask this paper" AI Q&A widget below. Extraction quality varies by source — PMC NXML preserves structure cleanly, OA-HTML may include some navigation residue, and OA-PDF can have broken hyphenation. The publisher copy (via DOI) is the canonical version.

My notes (saved in your browser only)

Ask this paper AI returns verbatim quotes from the full text · source: pmc-nxml

Answers must be backed by verbatim quotes from this paper's full text. Hallucinated quotes are dropped automatically; if no verbatim passage answers the question, we say so. How this works

Citation neighborhood (no data yet)

We don't have any in-corpus citations linked to this paper yet. This is a recent paper (2025) — citers typically take a year or two to land, and the OpenAlex reference graph may still be filling in.

Source provenance

europepmc
last seen: 2026-08-13T06:15:24.848197+00:00
unpaywall
last seen: 2026-05-21T05:10:58.409756+00:00
License: CC-BY-NC-ND-4.0