Volume 24, Issue 8 (August 2026)                   IJRM 2026, 24(8): 649-662 | Back to browse issues page

Ethics code: IR.SSU.REC.1401.087


XML Persian Abstract Print


Download citation:
BibTeX | RIS | EndNote | Medlars | ProCite | Reference Manager | RefWorks
Send citation to:

Zare Ebrahimabad M, Hashemzadeh M, Tabibnejad N. Prediction of chemical miscarriage in assisted reproductive technology pregnancies using machine learning: A developmental study. IJRM 2026; 24 (8) :649-662
URL: http://ijrm.ir/article-1-3795-en.html
1- Faculty of Information Technology and Computer Engineering, Azarbaijan Shahid Madani University, Tabriz, Iran.
2- Faculty of Information Technology and Computer Engineering, Azarbaijan Shahid Madani University, Tabriz, Iran. , hashemzadeh@azaruniv.ac.ir
3- Research and Clinical Center for Infertility, Yazd Reproductive Sciences Institute, Shahid Sadoughi University of Medical Sciences, Yazd, Iran.
Full-Text [PDF 1359 kb]   (277 Downloads)     |   Abstract (HTML)  (312 Views)
Full-Text:   (59 Views)
1. Introduction
Infertility, which affects millions worldwide, is defined as the inability to achieve pregnancy after 12 months of regular, unprotected intercourse (1). Approximately one in 7 couples encounter this issue (2). Assisted reproductive technology (ART) provides hope for many, but early miscarriage remains a significant concern, particularly in pregnancies achieved through ART. Miscarriage rates are estimated to be around 10-15% in natural pregnancies, with higher rates observed in ART pregnancies. So far, various factors that influence early miscarriage in both natural and ART cycles have been recognized in medical studies (3). However, accurately predicting treatment outcomes can help alleviate the anxiety faced by couples undergoing ART.
In recent years, machine learning (ML) has been widely used in medical diagnosis and prediction (4-11), often with very good results. Yet, few studies have specifically explored the use of ML to predict miscarriage risk in ART pregnancies. Existing research has not thoroughly examined all relevant features, highlighting the need for a predictive model encompassing a broad range of factors.
An ML model developed using 66,706 ART cycles identified fetal heart rate, maternal age, body mass index (BMI), gestational sac diameter, and hormone levels as key predictors, with Random Forest (RF) showing the best performance (12).
A study compared XGBoost and RF, using time-lapse embryo imaging data, with deep learning. The model achieved 68% accuracy, highlighting the importance of uterine and maternal factors in miscarriage prediction (13).
A machine-learning framework using hill-climbing feature selection was developed for in vitro fertilization outcome prediction. Multiple classifiers (RF, support vector machine [SVM], multilayer perceptron, classification and regression trees, C4.5 decision tree [DT] algorithm [C4.5]) were evaluated, and RF performed best. Key predictors included age, antral follicle count and fertilization-related factors (14). Ensemble models were applied to 1664 single vitrified-warmed blastocyst transfer cycles, achieving an area under the receiver operating characteristic (ROC) curve (AUC) of 0.836 for pregnancy outcome prediction. Blastocyst quality was identified as a key predictive feature (15).
A DT-based model using 1021 ART couples to predict miscarriage risk, achieved a mean accuracy of 0.84. Maternal age, embryo quality, and stimulation duration were identified as key predictors (16).
To the best of our knowledge, most ART miscarriage prediction studies rely on post-transfer or embryo-related variables, limiting their applicability to early infertility treatment.
In contrast, no prior studies have systematically developed predictive models using exclusively pre-treatment baseline clinical data, while simultaneously providing a publicly available benchmark dataset. This limits early-stage risk assessment and hinders reproducibility and comparative evaluation across studies.
This study develops a ML-based system using exclusively baseline clinical parameters recorded at the initial infertility evaluation to predict the risk of chemical pregnancy in infertile women. It introduces a benchmark dataset of 1234 real-world ART cases with 32 preprocessed features, publicly released as the first open-access resource in this domain for reproducibility and comparative analysis. Multiple ML algorithms are systematically evaluated on imbalanced data, balanced versions (synthetic minority oversampling technique [SMOTE] and adaptive synthetic sampling [ADASYN]), and reduced feature sets to identify optimal models and key abortion risk predictors.

2. Materials and Methods
In this developmental study, the comprehensive clinical data of 3000 infertile couples who were referred to the Yazd Reproductive Sciences Institute, Yazd, Iran from March 2020-September 2022 were extracted from their medical records.

2.1. Data collection
Data collection involved processes such as inner join and the creation of views to consolidate data from various tables in the dataset in the institute. In this study, clinical pregnancy was defined as the ultrasound visualization of an intrauterine gestational sac with fetal cardiac activity at 6-7 wk of gestation, whereas chemical (biochemical) pregnancy loss was defined as a pregnancy diagnosed only by a positive serum beta-human chorionic gonadotropin test at 14 days after embryo transfer that subsequently declined without ultrasound evidence of an intrauterine pregnancy, the inclusion criterion for the study is a positive result during the chemical pregnancy stage, indicated by a positive beta-human chorionic gonadotropin test 14 days after embryo transfer. Couples pursued treatment for different reasons, including male factors, female factors, and unknown reasons, and underwent either in vitro fertilization or intracytoplasmic sperm injection, as determined by clinical diagnosis.
In the original collected data, 1234 records were divided into 2 groups: women whose pregnancies ended in chemical miscarriage (positive class, n = 257) and those whose pregnancies progressed to the clinical stage (negative class, n = 977). Clinical pregnancy was defined as the detection of fetal heart rate via ultrasonography, while chemical miscarriage w:as char:acterized as the termination of pregnancy prior to the detection of fetal heart rate.

2.2. Data preprocessing
Since the collected dataset was a real-world dataset with various noise and inconsistencies, preprocessing operations were essential to enhance its quality for analytical purposes (17). This stage included operations such as feature selection, replacing or removing missing data, eliminating outliers, normalizing data, transforming continuous feature values, and discretizing continuous features. It also involved adjustments like removing duplicates and addressing missing values. Some key steps undertaken in this study are as follows:
  • Feature selection: identification of influential features
A variety of features can influence the occurrence of miscarriage, with certain factors deemed more critical by specialists. To ensure we selected an appropriate number of features from our dataset, we identified those that impact chemical miscarriage, drawing on the insights of experts in obstetrics, gynecology, and reproductive biology. The selected features are summarized in table I.
  • Handling the missing data
Missing data are defined as instances where no value was recorded for a variable in an observation, which can significantly affect data analysis. The reasons for missing data include noise in the recorded data, non-registration, and invalid values (18). In this study, several methods were used to address the missing data, including sample deletion, manual filling, utilizing feature averages, and applying the most probable value approach.
  • Handling outliers
Outliers are identified as values that significantly deviate from the rest of the dataset (19). These outliers were detected using the box plot tool, as illustrated in figure 1. To address the outliers, specific ranges for each variable were established in consultation with specialists, and data points falling outside these ranges were flagged as outliers. These outliers were subsequently replaced with mean or median values. Initially, outliers are particularly noticeable in the thyroid-stimulating hormone (TSH) variable (Figure 1); however, data points falling within the defined medical range were preserved. To enhance the model performance, outliers were re-evaluated using the DBSCAN (density-based spatial clustering of applications with noise) algorithm (20), a clustering method effective for outlier detection. The outliers identified through this process were then replaced with mean or median values (19, 21). As shown in figure 2, replacing the outliers yielded in a more symmetric and compressed distribution of the TSH values, effectively reducing the influence of extreme values in the model. This refinement is essential for improving the model's reliability and reducing potential biases caused by skewed data.
  • Data normalization
The choice of measurement units can have a significant effect on data analysis. To mitigate reliance on the specific choice of measurement units, it is essential to normalize or standardize the data. This process involves transforming the data into a smaller, common range, typically between (0, 1). The goal of normalization is to ensure that all features carry equal weight, which is especially beneficial for classification algorithms. In this study, min-max scaling was utilized as the normalization method (18).
  • Data transformation
Most ML algorithms necessitate numerical matrices for effective learning. However, non-numeric data are frequently encountered in real-world datasets. To convert categorical data into a numerical format, we employed the one-hot encoding method. This technique creates binary columns for each category, allowing the algorithms to process the data appropriately. In this study, the variables ART protocol plan and infertility diagnosis category, directly extracted from electronic records, were included in the models as categorical features using this encoding method. As clinician-entered text fields describing the planned ART procedure and the recorded infertility diagnoses, respectively.
  • Reducing data redundancy
To evaluate the correlations among features, we utilized covariance and correlation analysis. Correlation specifically measures the linear relationship between 2 features, though it does not imply causation (18). Figure 3 presents the pearson correlation heat map of numerical features, where the intensity of the color reflects the strength of the linear relationship. In this analysis, a threshold of 0.7 was selected to identify strongly correlated features. In clinical datasets, especially those related to reproductive medicine, moderate to strong correlations among features were common due to underlying biological associations.
Therefore, a relatively high threshold of 0.8 was adopted, following recommendations from applied modeling literature, which suggest that lower thresholds (e.g., 0.6 or 0.7) may lead to unnecessary exclusion of clinically important features (22). As shown in figure 3, none of the feature pairs exceeded this threshold, indicating an absence of severe correlation. Therefore, no features were removed based on the correlation analysis.
  • Data balancing
Imbalanced datasets are a frequent issue in medical data, presenting challenges as models may tend to overfit the majority class (23). In our dataset, the number of women without early miscarriage (n = 977, 79.17%) were significantly greater than that of women who experienced early miscarriage (n = 257, 20.83%). To tackle this imbalance, we employed oversampling methods to enhance the representation of the minority class. In this approach, new samples were generated by making minor adjustments to the values of the minority group. Essentially, the algorithm thus analyzes the feature space of data points within the minority class and considers their k nearest neighbors for sampling (24). There are various types of this method. In our study, we utilized the SMOTE and ADASYN algorithms to identify the most effective strategies for addressing the class imbalance (24-26).

2.3. Model generation and evaluation
In this stage, we focused on designing prediction models using various ML algorithms. The algorithms implemented and evaluated for the desired prediction model included DT, RF, SVM, and logistic regression (LR) (27, 28).
We evaluated the performance of the models using a range of metrics, including accuracy, recall, precision, F1-score, and AUC. The result of models for each sample was considered as true positive, or false positive, or true negative, or false negative cases based on their actual and predicted categories. Accordingly, the evaluation metrics were measured as follows:



AUC provides a single measure of the model's ability to distinguish between the classes. The larger the AUC value, the better the performance of the prediction algorithm, indicating a higher likelihood that the model will correctly classify positive and negative instances. An AUC of 1.0 signifies perfect classification, while an AUC of 0.5 suggests no discriminative ability, equivalent to random guessing.



2.4. Ethical Considerations
This study was approved by the ethics committee of Shahid Sadoughi University of Medical Sciences, Yazd, Iran (Code: IR.SSU.REC.1401.087). All procedures were conducted in accordance with relevant ethical guidelines and regulations. Due to the retrospective nature of the study and the use of de-identified clinical data, the requirement for informed consent was waived by the ethics committee. Patient confidentiality and privacy were strictly maintained, and all data were anonymized prior to analysis.

3. Results
We evaluated the performance of each ML algorithm, mentioned in section 2.3, on the test data and compared them with each other. Initially, the dataset was randomly divided into training (70%) and testing (30%) sets. The Stratified K-Fold algorithm with 5-folds was employed for training the models. The algorithms were implemented using Python programming language version 9.3.4.1. The evaluation of the models was carried out in 3 stages, utilizing different datasets: the original imbalanced data, data balanced using the SMOTE and ADASYN algorithms, and a dataset generated with the most influential features. Below, we outline the results from each evaluation stage.

3.1. Evaluation of the models on the imbalanced dataset
In this experiment, we evaluated the ML models on the original imbalanced data. Due to the imbalanced nature of the dataset, we expect to see lower accuracy, especially for the minority class. Table II summarizes results on the test dataset. As shown in this table, among the evaluated models, the RF algorithm achieved the highest AUC (70.90%) and accuracy at 82.20%, demonstrating robustness in handling imbalanced data. However, its recall for the minority class remained low (24.10%), indicating limited effectiveness in identifying chemical miscarriages. The DT model delivered moderate performance with 73.60% accuracy and a recall of 44.30%. Although it balances precision and recall more effectively than other models, its overall accuracy is lower compared to RF. SVM achieved 80.30% accuracy, but suffers from low recall (19.00%), indicating difficulty in detecting the minority class. LR performs the weakest, with only 75.70% accuracy and a recall of 10.10%, confirming its ineffectiveness in managing data imbalance. In the context of clinical risk stratification, RF demonstrated a robust ability to identify low-risk patients, characterized by its high specificity. This feature enables healthcare professionals to fine-tune decision thresholds in scenarios where heightened sensitivity is required, particularly for enhancing the detection of miscarriages. Conversely, DT exhibited a superior recall rate of 44.3%, making it particularly effective for screening high-risk individuals. The complementary strengths of RF and DT suggested that a combined approach could enhance overall diagnostic capabilities, allowing for more nuanced risk assessments and better-informed clinical decisions.

3.2. Evaluation of the models on the balanced dataset
In this stage, the dataset was balanced using the SMOTE and ADASYN algorithms. These techniques aim to address the class imbalance by generating synthetic samples for the minority class. Following the application of these algorithms, we evaluated the performance of the models on the newly balanced datasets. The results from this evaluation highlighted improvements in accuracy and other performance metrics compared to the original imbalanced dataset.
  • SMOTE balanced dataset: this dataset contains 1945 samples, with 977 samples each in the majority and minority classes.
  • ADASYN balanced dataset: this dataset includes 1943 samples, with 977 samples in the majority class and 966 in the minority class.
To avoid data leakage, all oversampling procedures (SMOTE and ADASYN) were strictly confined to the training data. Both balanced datasets were divided in the same manner, with 70% allocated for training and 30% for testing. The performance of the different models on these 2 balanced datasets (evaluated on test data) were compared in table III. The results indicated that, again, the RF algorithm outperformed all other models, achieving 81.10% accuracy with the SMOTE dataset and 80.01% with the ADASYN dataset.
DT showed lower accuracy compared to RF, achieving 71.70% with the SMOTE dataset and 70.90% with the ADASYN dataset. SVM obtained 69.80% accuracy with SMOTE and 68.50% with ADASYN, while LR recorded the lowest accuracies of 58.20% and 56.60%, respectively. Although RF maintained the highest overall accuracy, class balancing techniques significantly improved the models’ ability to detect the minority class. The SVM demonstrated improved recall (53.20% with SMOTE and 55.70% with ADASYN), indicating that class balancing techniques have significantly enhanced its ability to detect chemical abortion cases. The LR, while showing the lowest accuracy (58.20% with SMOTE and 56.60% with ADASYN), achieved the highest recall among all models (54.40% and 57.00%, respectively), showing its increased sensitivity to the minority class after balancing.
The results indicated that both SMOTE and ADASYN effectively enhanced the models' ability to predict the minority class (chemical abortion), as demonstrated by the increases in recall and F1 scores. These improvements highlighted the importance of using balancing techniques to address class imbalances, ultimately leading to more accurate and reliable predictions for the minority class.
Figure 4 shows the comparison of AUC values for different models evaluated on 3 datasets: the imbalanced dataset, the balanced dataset with SMOTE, and the balanced dataset with ADASYN. The results reveal important insights into how data balancing affects model performance, highlighting the improvements achieved by using balancing techniques to enhance the predictive capabilities of models. This comparison emphasizes the important role that dataset characteristics play in determining the effectiveness of ML algorithms:
a) Imbalanced dataset: here, the RF algorithm achieved the highest AUC of 70.790%, which shows its superior performance in handling data imbalance compared to other models. In contrast, both SVM and LR showed lower AUC values, indicating their reduced ability to discriminate between classes effectively. This decrease in performance is largely attributed to the absence of the minority class, which hinders the predictive capabilities of these models in this field.
b) SMOTE-balanced dataset: balancing the dataset with SMOTE leads to moderate improvements in all models. The RF algorithm achieves an AUC of 70.30% and presents itself as the top-performing model, while the SVM achieved an AUC of 66.90%. DT and LR models also show some improvements, reaching 62.00% and 57.40% AUC, respectively. This point highlights the partial effectiveness of SMOTE in improving model performance.
c) ADASYN balanced dataset: using ADASYN, slight improvements in AUC were observed, especially for the RF algorithm, which achieved an AUC of 70.80%. Meanwhile, SVM maintained a comparable AUC of 66.20%, similar to its performance with SMOTE. DT and LR models reached 58.00% and 58.70% AUC, respectively, showing modest gains over the imbalanced dataset.
The above-stated findings confirm that class balancing techniques primarily improve the models sensitivity rather than overall accuracy, which is particularly important in imbalanced clinical datasets such as those related to chemical pregnancy loss.

3.3. Most influential features
Feature selection is utilized to optimize the model dimensions and improve the accuracy and performance (29). In this study, 3 feature selection algorithms, KBest (select K best), RF, and XGBoost (eXtreme gradient boosting), were employed to identify the most relevant predictors of miscarriage. To enhance model stability and ensure clinical interpretability, only the features consistently selected by all 3 methods are retained for model development. The final set of 12 influential features included female age, BMI, number of previous abortions, TSH, sperm non-progressive motility, sperm immotility, sperm morphology, ART protocol plan, ART history, ovarian stimulation protocol, history of intrauterine insemination, and menstrual regularity.



4. Discussion
This study developed a ML-based framework for early prediction of chemical miscarriage in ART pregnancies using exclusively pre-treatment baseline clinical data. Unlike many previous studies that incorporate post-transfer or embryo-specific variables, this approach enables risk assessment at the initial stage of infertility evaluation, thereby supporting earlier and more actionable clinical decision-making.
Among the evaluated models, the RF algorithm consistently achieved the best overall performance across both imbalanced and balanced datasets. In particular, RF obtained AUC values of 70.9%, 70.3%, and 70.8% on the imbalanced, SMOTE-balanced, and ADASYN-balanced datasets, respectively, with corresponding accuracies of 82.2%, 81.1%, and 80.0% (Tables II and III). The superior performance of RF can be attributed to its ability to capture complex nonlinear relationships and interactions among clinical variables, which are common in multifactorial conditions such as early pregnancy loss. In contrast, linear models such as LR demonstrated limited performance, likely due to their inability to model such complex dependencies. Although DT models showed lower overall accuracy, their relatively higher recall for the minority class suggests potential utility in high-sensitivity screening scenarios.
An important observation in this study is that class balancing techniques (SMOTE and ADASYN) primarily improved model sensitivity rather than overall accuracy. This is consistent with the nature of imbalanced clinical datasets, where detecting the minority class (miscarriage cases) is inherently challenging. From a clinical perspective, improving recall is particularly important, as failure to identify high-risk patients may lead to missed opportunities for closer monitoring or early intervention.
Feature selection identified 12 influential predictors, including maternal age, BMI, number of previous abortions, TSH, sperm-related parameters, ART protocol characteristics, and menstrual regularity. These predictors are not only statistically significant but also biologically and clinically plausible. Maternal age is strongly associated with increased chromosomal abnormalities and reduced oocyte quality, which are major contributors to early pregnancy loss. BMI influences hormonal balance, insulin resistance, and endometrial receptivity, all of which play critical roles in implantation and early pregnancy maintenance. TSH is essential for early embryonic development, and thyroid dysfunction has been linked to increased miscarriage risk even within subclinical ranges. A history of previous abortions may indicate underlying reproductive or uterine conditions predisposing patients to recurrent pregnancy loss. In addition, sperm motility and morphology reflect sperm quality and genetic integrity, which directly influence embryo viability. Menstrual regularity is indicative of the stability of the hypothalamic-pituitary-ovarian axis and overall endocrine function. Finally, ART-related variables, such as ovarian stimulation protocols and treatment history, may indirectly capture patient-specific reproductive conditions. The alignment between model-identified predictors and established biological mechanisms supports the clinical validity and interpretability of the proposed approach.
Compared with previous studies, several important distinctions emerged. Many prior works rely on post-transfer variables, such as fetal heart rate, embryo quality, or time-lapse imaging data, which inherently provide stronger predictive signals due to their proximity to the outcome. In contrast, the present study focuses exclusively on pre-treatment clinical variables, making the prediction task more challenging but significantly more valuable for early-stage clinical use. Despite this, the performance achieved in this study (AUC ≈ 0.70) was comparable to or reasonably close to studies incorporating more informative post-treatment features. Furthermore, differences in dataset size, feature types, and prediction timing should be considered when comparing reported performance across studies. For instance, studies using imaging data or larger cohorts often report higher accuracy, whereas the present study demonstrates that meaningful prediction is achievable even with baseline clinical data alone.
From a clinical perspective, early prediction of miscarriage risk using baseline data has important implications. It can support personalized patient counseling, guide treatment planning, and enable risk stratification prior to initiating ART procedures. In addition, the identification of key predictors provides actionable insights for clinicians to better understand patient-specific risk profiles.
A key contribution of this work is the preparation and public release of a benchmark clinical dataset comprising 1234 real-world ART cases with 32 features. This dataset provides a valuable resource for reproducibility, comparative evaluation, and future research in predictive reproductive medicine. In addition, the study demonstrated a rigorous and transparent ML pipeline, including careful preprocessing, handling of missing data and outliers, and strict prevention of data leakage.
Despite these strengths, several limitations should be acknowledged. First, the analysis is based on a retrospective, single-center dataset, which may limit the generalizability of the findings. Although internal validation was performed using stratified train-test splitting and cross-validation, external validation on independent datasets was not conducted. Therefore, the proposed models should not be considered for routine clinical use. Future research should focus on validating the proposed approach using multi-center and temporally independent datasets to enhance generalizability and clinical applicability.

5. Conclusion
This study illustrates that ML models, particularly RF and DT, can serve as valuable tools for predicting early miscarriage in ART. More importantly, the release of a high-quality benchmark dataset represents an important step toward collaborative research and the development of clinically robust predictive models, ultimately supporting better outcomes for couples undergoing infertility treatment. It is noteworthy that although the proposed models showed promising performance, they are not yet intended for routine clinical use and require further external validation on independent cohorts.

Data Availability
Study data are publicly available to the research community and can be shared electronically through the corresponding author’s email.

Author Contributions
M. Zare Ebrahimabad and N. Tabibnejad designed the study, collected the data, analyzed data, implemented the models, and wrote the initial version of the manuscript. M. Hashemzadeh designed and monitored the study, analyzed the results, and critically reviewed the manuscript. All authors approved the final version of the manuscript and take responsibility for the integrity of the data.

Acknowledgments
We would like to convey our heartfelt thanks to the Yazd Reproductive Sciences Institute, Yazd, Iran for providing the essential data and support for this research. We also extend our gratitude to the medical professionals and experts whose insights and expertise were invaluable in shaping this study. Additionally, we appreciate our colleagues for their assistance during the data preprocessing and analysis phases, which greatly contributed to the success of this work. No artificial intelligence (AI) tools or automated systems were used at any stage of this study, including data analysis, manuscript writing, editing, revision, translation, or grammar checking. All aspects of the research and manuscript preparation were performed solely by the authors. This research did not receive any specific grant from funding agencies in the public, commercial, or not-for-profit sectors.

Conflict of Interest
The authors declare that there is no conflict of interest.

Send email to the article author


Rights and permissions
Creative Commons License This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.

Designed & Developed by : Yektaweb