AI-algorithm training and validation for endometrial CD138+ cells in infertility-associated conditions; polycystic ovary syndrome (PCOS) and recurrent implantation failure (RIF) ================================================================================================================================================================================= * Seungbaek Lee * Riikka K. Arffman * Elina K. Komsi * Outi Lindgren * Janette A. Kemppainen * Hanna Metsola * Anne Ahtikoski * Keiu Kask * Merli Saare * Andres Salumets * Terhi T. Piltonen ## Abstract Immunohistochemical analysis of CD138+ plasma cells has been applied for detecting endometrial inflammation, especially chronic endometritis (CE). In this study, we developed for the first time an artificial intelligence (AI) algorithm, AITAH, to identify CD138+ plasma cells within endometrial tissue, focusing on two infertility-related conditions: polycystic ovary syndrome (PCOS) and recurrent implantation failure (RIF). We obtained 193 endometrial tissues from healthy controls (n=73), women with PCOS (n=91), and RIF patients (n=29) and compared CD138+ cell percentages across cycle phases, ovulation status, and endometrial receptivity. We trained AITAH with CD138 stained tissue images, and experienced pathologists validated the training and performance of AITAH. AITAH, with high accuracy in detecting CD138+ cells (88.57%), revealed higher CD138+ cell percentages in the proliferative phase than in the secretory phase or in the anovulatory PCOS endometrium, irrespective of PCOS diagnosis. Interestingly, CD138+ percentages differed according to PCOS phenotype in the proliferative phase (p=0.01). Different receptivity statuses had no impact on the cell percentages in RIF samples. In summary, the AI-enabled analysis is a rapid and accurate tool to examine endometrial tissues, potentially aiding clinical decision-making. Here, the AI analysis demonstrated cycle-phase differences in CD138+ aggregations pattern, but no major alterations in PCOS or RIF samples. ## Introduction Menstrual cycle-related fluctuations in sex hormones not only contribute to the growth and degeneration of the endometrial lining but also modulate the local immune environment by regulating innate/adaptive immune responses and endometrial immune cell populations: B and T lymphocytes, uterine natural killer (uNK) cells, plasma cells, macrophages, and dendritic cells1–3. As a sum effect, cellular immunity in the endometrium is high in the proliferative phase but declines toward the mid-secretory phase, facilitating successful implantation of the semi-allogenic embryo2. Endometrial plasma cells can either be recruited from the circulation or developed locally from antigen-committed B cells4. CD138, a heparan sulfate proteoglycan (HSG) on the surface of plasma cells, serves as a receptor for growth factors and immune mediators, attracting plasma cells to the endometrium5. Endometrial CD138+ plasma cells have been used as a diagnostic biomarker for endometrial inflammation, including chronic endometritis (CE)6–8, and the number of CD138+ plasma cells is correlated with the severity of endometrial inflammation in women with reproductive failure7–9. Identifying isolated CD138+ plasma cell aggregates without other histological features of CE, such as stromal edema and increased stromal cell density, may also detect cases with potentially milder inflammation and related endometrial dysfunction10. However, current quantification methods of CD138+ cells are typically based on laborious and time-consuming microscopic assessments of only a few random areas from a sample10. These methods have limitations in accurately representing the entire slide and are susceptible to significant biases arising from both intra- and inter-observer variations10–12. Convolutional neural networks (CNNs) are widely used to analyze histological patterns13. In particular, the artificial intelligence (AI) embodied by CNNs enables rapid analysis of whole tissue slides with high resolution, addressing the current limitations of manual histopathological performance13. To date, this promising and potent AI technique has been increasingly applied in various clinical research fields to predict the onset and progression of specific diseases14–18. Given that an imbalanced inflammatory milieu has been linked to infertility-associated conditions, such as polycystic ovary syndrome (PCOS)19 and recurrent implantation failure (RIF)9,10, this study utilized an AI algorithm to assess endometrial CD138+ cells in these two conditions. PCOS is a common endocrine disorder characterized by hyperandrogenism (HA), systemic low-grade inflammation, insulin resistance, and anovulation20. The PCOS endometrium exhibits dysregulated immune profiles19 and altered receptivity-related proteomic profiles19,21, which could lead to poor reproductive outcomes19,21. However, many studies lack sufficient endometrial sample dating, often overlooking secretory phase samples despite occasional spontaneous ovulations and pregnancies in PCOS women. Moreover, although the presence of CD138+ cells varies depending on the menstrual cycle phase8,12, CD138+-based evaluation in PCOS endometrium across different cycle phases is lacking. RIF, often defined as three or more failed *in vitro* fertilization (IVF) attempts with good-quality embryos transferred, significantly impacts IVF success rates22. Factors from the maternal side, including age, body mass index (BMI), and immunological factors22, as well as unprepared endometrium for embryo implantation (e.g., shifted window of implantation, impaired decidualization in stroma)23,24, have an impact on the implantation rate and reproductive outcomes22,25. Moreover, CE is prevalent in RIF patients, affecting up to 14% of this population9. Given the multifaceted underlying mechanisms of RIF, it is important to understand the association between endometrial receptivity and inflammatory processes, particularly CD138+ cell clustering in fully receptive samples without prominent CE. In this study, we developed an AI algorithm, “Artificial Intelligence for Targeted Analysis of Histology” (AITAH), to detect stromal CD138+ cells, an indicator of the endometrial immune milieu. As a novel setup, we investigated the CD138+ cell occurrence to identify factors influencing the aggregation of CD138+ cells in relation to menstrual cycle phases and ovulatory status under PCOS conditions, as well as endometrial receptivity under RIF conditions. ## Materials and methods ### Tissue collection #### PCOS and control samples A total of 164 endometrial biopsy samples from 44 healthy controls and 61 women with PCOS were collected at the Oulu University Hospital (Oulu, Finland) from January 2017 to March 2020 (**Fig 1**, **Table 1**). The study was approved by The Regional Ethics Committee of the Northern Ostrobothnia Hospital District, Finland (65/2017), and informed consent was signed by all study subjects. All methods were carried out in accordance with relevant guidelines/regulations in line with the Declaration of Helsinki. All women were non-smokers and had not used any hormonal medication for at least three months prior to tissue collection. Some women gave samples in multiple phases in different cycles (only one biopsy per cycle), with a maximum of three samples per individual (depicted by multiple sample providers in **Fig 1**). Control women were healthy, had regular cycles, and were without PCOS symptoms. As per the international Guideline, PCOS was diagnosed according to the Rotterdam consensus, requiring the presence of at least two of the following clinical features: oligo-anovulation (OA), HA, and polycystic ovarian morphology (PCOM) 26. Some women with PCOS had occasional ovulations that were traced for secretory phase sampling and analysis. As for PCOS phenotype sub-analysis, PCOS women were divided based on their phenotype; 35 women with phenotype A (PCOM+OA+HA, most severe PCOS phenotype, metabolic) and 19 with phenotype D (PCOM+OA, mildest phenotype, reproductive), were identified (**Supplemental Table S1**)26. Endometrial biopsies were obtained by a suction curette (Pipelle), fixed in 10% formaldehyde for hematoxylin and eosin (H&E) staining and immunohistochemistry (IHC)27. The samples for ovulatory cycles were obtained in either the proliferative phase (PE) (cycle days 6–8) or the secretory phase (SE) on specific days after the luteinizing hormone (LH) surge, at +2–4 days (early secretory phase (ESE)), +7–8 days (mid-secretory phase (MSE)), or +11–12 days (late secretory phase (LSE)) (PE; 12 control, 24 PCOS, ESE; 15 control, 15 PCOS, MSE; 26 control, 21 PCOS, LSE; 20 control, 18 PCOS). The LH surge was detected using a Clearblue digital urine test in the morning, and the presence of the corpus luteum was confirmed by transvaginal ultrasonography (TVUS) via Voluson E8 (GE Healthcare Technologies, United States). The cycle phases were histologically determined from the H&E-stained slides by an experienced gyneco-pathologist. In the case of anovulation confirmed by clinical evaluation and histological analysis, 13 biopsies were obtained on any day convenient for the PCOS subjects. ![Figure 1.](http://medrxiv.org/https://www.medrxiv.org/content/medrxiv/early/2023/12/05/2023.12.05.23299423/F1.medium.gif) [Figure 1.](http://medrxiv.org/content/early/2023/12/05/2023.12.05.23299423/F1) Figure 1. **The study subjects in the control and PCOS population** A total of 164 endometrial biopsy samples were collected from 44 healthy controls and 61 women with PCOS. The subjects were categorized based on whether they provided a single or multiple samples. In the case of women with PCOS, the subjects were further classified depending on their ovulatory status. A total of 29 samples were collected from 29 RIF patients who underwent IVF treatment. HRT (hormone replacement treatment), P4 (progesterone) View this table: [Table 1.](http://medrxiv.org/content/early/2023/12/05/2023.12.05.23299423/T1) Table 1. Subject and sample information of age and BMI in different cycle phases and receptivity status Endometrial thickness was measured by TVUS. Serum levels of anti-Müllerian hormone (AMH), LH, follicle-stimulating hormone (FSH), and sex hormone-binding globulin (SHBG) were measured with Elecsys assays (Roche) using a cobas e411 analyzer. Serum testosterone and progesterone (P4) levels were measured at the University of Eastern Finland using an Agilent 1290 Rapid Resolution LC System (Agilent, San Jose, CA, United States)28. Free androgen index (FAI) was calculated using the formula: testosterone (nmol/L) / SHBG (nmol/L) *100. #### RIF samples A total of 29 RIF samples were obtained from the beREADY endometrial receptivity testing laboratory (CCHT, Tartu, Estonia) from women who had undergone an average of 3.9 unsuccessful IVF cycles despite having good-quality embryos transferred (**Fig 1**). The study was approved by the Research Ethics Committee of the University of Tartu, Estonia (340T-12). The requirement for informed consent for obtaining RIF samples was waived by the same Research Ethics Committee as data was anonymized. All experiments were performed in accordance with relevant guidelines/regulations in line with the Declaration of Helsinki. Their anonymized data and endometrial biopsies were obtained prior to the subsequent IVF treatment23 using a Pipelle during a hormone replacement treatment (HRT) cycle on day 5 after initiation of P4 administration (HRT: P+5). The first day of P4 administration was considered day zero (HRT: P+0). All biopsies were placed into RNAlater (Ambion, United States), and then stored at -80℃ before use ### Endometrial receptivity testing Gene expression profiling was conducted using the beREADY test at CCHT, involving 57 known endometrial receptivity genes along with four housekeeping genes (*SDHA*, *CYC1*, *TBP*, and *HMBS*)23,24. Endometrial RNA from RIF patients (n=29) was extracted using the Qiagen miRNeasy Mini kit, and according to the test results, the RIF samples were divided into pre-receptive (*n*=9), receptive (*n*=10), and post-receptive (*n*=10) (**Table 1**). ### Immunohistochemistry The endometrial biopsies were processed accordingly: 5-µm paraffin-embedded tissue sections of controls (n=73) and women with PCOS (n=91) and 2.5-µm paraffin sections of RIF patients (n=29) were de-paraffinized in xylene and rehydrated in different grades of alcohol. Next, antigen retrieval with Tris-EDTA (pH 9) was performed in a microwave oven (800W) for 2 min. Dako peroxidase blocking solution (Dako S2023) was used to neutralize endogenous peroxidase for 5 min. The sections were incubated with 40x diluted mouse anti-human monoclonal antibody CD138 (MS-1793-S; Thermo Fisher Scientific) for 30 min at room temperature and then for 30 min with Dako EnVision polymer (Dako K5007), followed by a DAB working solution for 3 min. H&E staining was performed for 15 sec. The IHC staining for both controls and PCOS samples was performed at the University of Oulu (Oulu, Finland), and the staining for the RIF samples was processed at the Tartu University Hospital Pathology Department and the University of Tartu (Tartu, Estonia). Positive and negative controls from four different human tissues (i.e., tonsils, liver, pancreas, and appendix) were used for the CD138 antibody. All IHC slides were scanned using a Leica SCN 400 Slide Scanner (Leica, Biosystems, United States), and the digitalized whole slide images (WSIs) were uploaded to Aiforia cloud (Aiforia Technologies Oy, Helsinki, Finland). Eleven slides with inadequate quality were excluded. ### AITAH algorithm training Our previous AI algorithm, AINO, was modified and trained to detect CD138+ plasma cells in the endometrial stroma16. Our current AI algorithm, AITAH, was trained using morphological features derived from 150 WSIs across two layers: the regional layer and the object layer. All training was performed on regions of interest (ROI) drawn to remove noise and background interference that could affect the analysis. The regional layers were trained to segment the epithelium and stroma, followed by training the object layers to differentiate CD138- and CD138+ cells within the stroma. The training set consisted of a 28,363 mm2 region and 7,345 object layers (6,942 CD138-cells and 403 CD138+ cells). The algorithmic structure of AITAH and the training process are shown in **Fig 2a-d**. ![Figure 2.](http://medrxiv.org/https://www.medrxiv.org/content/medrxiv/early/2023/12/05/2023.12.05.23299423/F2.medium.gif) [Figure 2.](http://medrxiv.org/content/early/2023/12/05/2023.12.05.23299423/F2) Figure 2. **Schematic overview of the AITAH algorithm and examples of training and validation.** (a) Structure of the convolutional neural networks (CNNs) model. CNN1 for the regional layer and CNN2 for the object layer. (b)–(d) Examples of the AITAH algorithm training. The training was done by manual annotation. Only the areas within the regions of interest (ROIs) shown as solid black lines were considered in the training. (b) original image, (c) manually annotated cells, (d) The AITAH algorithm training result. CD138-cells were marked cyan, and CD138+ cells were marked dark blue. (e)–(g) The training validation of the AITAH algorithm. The validation regions were marked as black dotted lines. (e) Analyzed images by the AITAH algorithm (CD138-cells marked cyan, CD138+ cells marked dark blue), (f) the validation from validator 1 (CD138-cells marked green, CD138+ cells marked yellow), (g) the validation from validator 2 (CD138-cells marked pink, CD138+ cells marked purple). ### AITAH algorithm validation and analysis The accuracy and reliability of the AITAH algorithm were assessed through a two-step validation by the three external validators (O.L., J.K., and H.M.) who did not take part in the AITAH algorithm training to avoid biased decisions. The training validation was performed in 18 WSIs not used for the model training. A total of 76 ROIs (36 regional and 40 object layers) were selected in each cycle phase and study group. The validators (O.L. and J.K.) annotated all the compartments, and the annotation was compared to the AITAH algorithm (**Fig 2e-g**). The error indices were automatically calculated in the AI platform17. Briefly, the total error indicates a sum of false negative (FN) and false positive (FP) predictions, precision is measured by dividing the true positive (TP) by all positives, sensitivity is measured by dividing the TP by the sum of the TP and the FN, and the F1 score is measured by the harmonic mean of precision and sensitivity. Furthermore, specificity is determined by dividing the true negative (TN) by the sum of TN and FP, while accuracy is computed by dividing the sum of TP and TN by the sum of TP, FP, FN, and TN. In the performance validation, the validators (O.L., J.K., and H.M.) manually counted the number of stromal CD138+ cells in ten randomly selected high-power fields (HPFs) on each slide for a total of 10 slides. Since a 1-mm2 unit area is equal to four HPFs29, the cell counts from AITAH analysis were divided by 4 to convert to cells/HPF format. These converted data were compared to the median number of CD138+ cells determined by the validators. After the validation, the analysis for 182 WSI (i.e., 71 control, 82 PCOS, and 29 RIF samples) was performed. CD138+ cell percentages were calculated manually by dividing the total number of CD138+ cells by the sum of CD138- and CD138+ cells in all ROIs within a WSI, and then multiplying by 100. ### Statistical analysis Statistical analyses were conducted using IBM SPSS Statistics v28 (IBM Corp., Armonk, NY, United States), and visualization was created using GraphPad Prism (version 9.3.0) and RStudio (version 2022.12.0.353 with R version 4.2.2). For the women who had provided more than one sample, the CD138+ cell percentages and clinical features were counted as individual samples in each cycle phase. The cell percentages based on PCOS diagnosis and cycle phases were analyzed by the mixed- model analysis of variance (ANOVA), in which the total variance is divided into the within-group variance and the between-group variance. The continuous variables were tested by a Mann-Whitney U test for paired tests and a Kruskal-Wallis test for multiple comparisons depending on the data distribution. Statistical significance was defined as *p*<0.05. An intra-class correlation (ICC) estimate was calculated using a two-way mixed effects model with an absolute agreement model, with ICC values interpreted as poor (<0.5), moderate (0.5–0.75), good (0.75–0.9), and excellent (>0.9) reliability30. Correlations between the CD138+ plasma cell percentages and clinical characteristics were calculated using Spearman correlations, considering data availability and distribution. ## Results ### Training and validating the AI-algorithm AITAH The final training error for the regional layers (i.e., epithelium and stroma) and the object layers (i.e., CD138-/+ stromal cell) was 2.28% and 6.15% (CD138+ cells 3.23%, CD138-cells 6.32%), respectively (**Supplemental Table S2**). In the training validation, median values of precision, sensitivity, F1 score, and specificity were calculated from 18 WSIs between pathologists (**Supplemental Figure S1a**). All verification statistics for CD138+ cells were 100%, indicating that the decisions made by the pathologists and the AITAH algorithm were in complete agreement. For the performance validation, we compared the number of CD138+ cells quantified by the pathologists and the AITAH analysis in 10 slides (**Supplemental Figure S1b**). The two evaluation methods showed excellent accuracy (ICC; 0.76, 95% CI; 0.36 to 0.93, *p*=0.002) and a positive correlation (Spearman’s rank correlation coefficient: 0.79, *p*<0.01). The interobserver variability between pathologists indicated good to excellent reliability for training validation and good reliability for performance validation (**Supplemental Table S3**). Therefore, the AITAH algorithm demonstrated sufficient functionality in identifying the target plasma cells. ### Endometrial stromal CD138+ plasma cell percentages by cycle phase and PCOS status The AITAH analyzed 71 controls and 82 PCOS slide images, grouped by PCOS diagnosis/phenotypes and menstrual cycle phases. CD138+ cell percentages showed a significant decrease from proliferative (PE) to secretory phases, regardless of PCOS diagnosis (*p*<0.001) (**Fig 3a**). Moreover, we did not find any differences in the CD138+ cell proportion between control and PCOS cases at the same cycle phase (*p*PE=0.83, *p*ESE=0.22, *p*MSE=0.92, *p*LSE=0.98). Interestingly, anovulatory PCOS cases exhibited similar CD138+ cell percentages than the PCOS SE samples (*p*>0.58) but markedly lower than PCOS PE samples (*p*<0.001). In the phenotype comparisons, we pooled the three secretory phases into one phase (SE) to simplify the comparisons between the cycle phases and increase the power of statistical analysis. Phenotype A cases showed significantly higher CD138+ cell percentages compared to phenotype D cases in the PE (*p*<0.001) (**Fig 3b**). ![Figure 3.](http://medrxiv.org/https://www.medrxiv.org/content/medrxiv/early/2023/12/05/2023.12.05.23299423/F3.medium.gif) [Figure 3.](http://medrxiv.org/content/early/2023/12/05/2023.12.05.23299423/F3) Figure 3. **Stromal CD138+ plasma cell percentages across PCOS status and cycle phases.** Stromal CD138+ cell percentages for (a) controls (12 PE, 15 ESE, 25 MSE, 19 LSE) and PCOS cases (21 PE, 14 ESE, 21 MSE, 16 LSE, 11 Anovulatory) and (b) different PCOS phenotypes (PhenotypeA; 12 PE, 26 SE, 8 Anovulatory, Phenotype D; 9 PE, 16 SE, 2 Anovulatory). Phenotype C was excluded due to the small sample size. The box indicates the inter-quartile range, the middle line represents the median, and the whiskers show the min-max range. \***|*p*<0.001 when compared to the PE. The statistical differences were calculated by the mixed model ANOVA. PE (proliferative phase), ESE (early secretory phase), MSE (mid-secretory phase), LSE (late secretory phase), SE (secretory phase) ### Correlations between endometrial stromal CD138+ plasma cell percentages and clinical characteristics in women with PCOS and non-PCOS controls To validate the correspondence between the AITAH analysis and menstrual cycle-related traits and elucidate factors contributing to increased CD138+ cell percentages in the PE, we analyzed correlations between the plasma cell percentages and physiological features (**Table 2**). Control SE samples showed negative correlations with P4 (r2=-0.43, *p*=0.02) and positive correlations with FAI and LH (FAI; r2=0.45, *p*<0.001, LH; r2=0.41, *p*=0.02). In contrast, PCOS SE cases exhibited positive correlations with testosterone (r2=0.32, *p*=0.02) and AMH (r2=0.30, *p*=0.03). Meanwhile, we did not observe any significant correlations in the PCOS anovulatory group. View this table: [Table 2.](http://medrxiv.org/content/early/2023/12/05/2023.12.05.23299423/T2) Table 2. Correlations between the CD138+ cell percentages and endometrium thickness and hormonal values ### Endometrial stromal CD138+ plasma cell percentages by receptivity in RIF samples Next, we investigated potential variations in CD138+ cell percentages across distinct endometrial receptivity statuses, defined by the gene expression. We utilized the endometrial samples that were timed after progesterone administration at P4+5 days, which is considered the window of implantation and common time for embryo transfer in assisted reproductive technology. We did not observe any differences in CD138+ cell percentages between different receptivity statuses among RIF samples (*p*=0.81) (**Fig 4**). ![Figure 4.](http://medrxiv.org/https://www.medrxiv.org/content/medrxiv/early/2023/12/05/2023.12.05.23299423/F4.medium.gif) [Figure 4.](http://medrxiv.org/content/early/2023/12/05/2023.12.05.23299423/F4) Figure 4. **Stromal CD138+ plasma cell percentages stratified by endometrial receptivity.** The CD138+ cell percentage comparisons of RIF patient samples (9 RIF pre-receptive, 10 RIF receptive, 10 RIF post-receptive). The box indicates the inter-quartile range, the middle line represents the median, and the whiskers show the min-max range. The statistical differences were calculated by the Kruskal-Wallis test. ## Discussion In this study, we developed an AI algorithm, AITAH, for the first time, to quantify CD138+ plasma cells and investigate the factors influencing the CD138+ cell aggregation in the human endometrium without any other signs of CE. We verified that the AITAH algorithm demonstrated excellent precision and specificity compared to human analysis. Our findings align with the previous research showing a higher CD138+ plasma cell presence in the proliferative phase endometrium compared to the secretory phase endometrium8,31. As a novel finding, anovulatory PCOS samples showed significantly lower CD138+ cell percentages compared to the PE PCOS samples, and phenotype A PCOS samples showed higher CD138+ cell percentages in the proliferative phase than phenotype D ones. On the other hand, the cell percentages did not show variations based on endometrial receptivity in RIF samples. In recent years, the advancement of deep CNN technology has revolutionized the rapid analysis of a massive number of WSIs. However, the application of CNN algorithms in uterine studies has predominantly focused on cancer research18,32. To our knowledge, our study was the first to target endometrial CD138+ plasma cells in a whole view of slides using a cloud-based CNN platform with high precision and specificity. As supported by previous publications, the implementation of the CNN platform enhances analysis capabilities by reducing intra- and inter-observer variations, minimizing hands-on time, and improving the speed and reproducibility of analysis15,17,25. Indeed, we analyzed 182 WSIs within an hour, surpassing what could be achieved by a pathologist alone. Still, certain endometrial features posed challenges in AITAH algorithm training and analysis, particularly pre- decidual structures in the stroma. AITAH occasionally misidentified these structures as epithelium, thus ignoring the stromal cells in those areas. Nevertheless, based on previous studies using the same AI platform, we evaluated the overall performance to be excellent 14,15,17. Higher CD138+ cell percentages in the proliferative phase compared to the secretory phase may be due to the estradiol-mediated recruitment of plasma cell progenitors from the systemic circulation into the endometrial mucosa, supported by a mouse study33. Furthermore, as the endometrium thickens towards the secretory phase, biopsies may predominantly contain superficial layers, resulting in lower CD138+ cell percentages relative to unstained stromal cells31. These hypotheses do not, however, explain our results that there were fewer CD138+ cells in anovulatory and amenorrhoeic PCOS samples compared to proliferative PCOS samples, despite the similar endometrial thickness. Considering that anovulatory endometrium exhibits an increased expression of estrogen receptors, heightened estrogen sensitivity, and greater estrogen exposure19,34, further research with a larger sample size is necessary to explore the presence of CD138+ cells in the anovulatory PCOS endometrium. In addition, higher CD138+ percentages in PCOS phenotype A compared to D at the beginning of a menstrual cycle (cycle days 6-8) suggest that hyperandrogenism also affects CD138+ recruitment. Our result indicated that receptivity status at P4+5 had no effect on CD138+ cell accumulation. However, further investigation is warranted to validate previous findings suggesting an increased prevalence of endometrial inflammation (or even CE) in infertile women as assessed by CD138+ plasma cell aggregation7,8 and the potential detrimental impact of HRT on immune cell profiles35. Future studies should consider larger sample sizes and incorporate prospective study designs, including women undergoing IVF treatment with natural menstrual cycles or stimulated cycles versus HRT cycles. The main strength of our study is the reliability of our AI algorithm in identifying stromal CD138+ plasma cells within a WSI in only a few seconds. Furthermore, with the rare and well-characterized human tissue sample set, we were able to encompass diverse endometrial conditions: i) different menstrual cycle phases; ii) individuals with PCOS or RIF diagnoses; iii) both ovulatory and anovulatory cases; and iv) varying endometrial receptivity statuses. As for limitations, we lacked confirmed CE cases as positive controls, although we did not look for overt endometritis. Additionally, the limited number of anovulatory PCOS samples may explain the absence of correlations between CD138+ plasma cell percentages and clinical characteristics, despite the exceptionally large total PCOS sample set. We lacked detailed clinical information on the RIF patients such as serum sample analysis. Lastly, in both control and PCOS populations, serum estrogen levels fell below the detection limit by LC-MS, as all steroids were analyzed in a single run and unavailable for separate analysis. Despite these limitations, our study showed the promising potential of AI technology to address current clinical and practical challenges in detecting endometrial immune cells. ## Conclusion Our findings emphasize the accuracy and potential of AITAH algorithm in detecting endometrial CD138+ plasma cells, offering distinct advantages such as rapid inspection of whole slide images, independence from trained pathologists, and consistent productivity. This supports the utilization of AI technology to help clinical decision-making for example in endometrial cycle phase-related dynamics, as well as in different reproductive disorders. ## Supplemental Data **Supplemental Figure S1. The AITAH algorithm validation result.** Validation for the AITAH algorithm was carried out in two stages: (A) training validation and (B) performance validation. (A) The heatmap calculated by the median between the two validators presents the agreements between the AITAH algorithm and the validators. (B) The number of CD138+ cells per high power field (HPF) from manual counting was compared to the AITAH analysis results. The area unit (mm2) was converted to HPF (1 HPF=0.25 mm2). The validation values were calculated by the median between the three validators. **Supplemental Table S1. Baseline characteristics of PCOS subjects by phenotypes** **Supplemental Table S2. The AITAH algorithm training results** **Supplemental Table S3. Interobserver variability in the AITAH algorithm validation** ## Ethics Statement This study was approved by The Regional Ethics Committee of the Northern Ostrobothnia Hospital District, Finland (65/2017), and the Research Ethics Committee of the University of Tartu, Estonia (340T-12). All experiments were performed in accordance with relevant guidelines/regulations in line with the Declaration of Helsinki. ## Author Contributions T.T.P., A.S., R.K.A., and S.L designed the study. T.T.P., A.S., R.K.A., E.K.K., and M.S. contributed to sample collection. A.A., K.K., and M.S. were involved in sample processing. O.L., J.A.K., and H.M. performed the validation. S.L. and E.K.K. performed image analysis. S.L. and R.K.A. performed the statistical analysis. All authors revised and approved the final version. ## Funding This research was funded by the Academy of Finland, the Sigrid Jusélius Foundation, Novo Nordisk Foundation, and the European Union’s Horizon 2020 research and innovation programme under the Marie Sklodowska-Curie grant (MATER, grant no. 813707). This research was also funded by the Estonian Research Council (grant no.PRG1076), Horizon 2020 innovation grant (ERIN, grant no. EU952516), Enterprise Estonia (grant no. EU48695), and MSCA-RISE-2020 project (TRENDO, grant no. 101008193). The funders did not participate in any processes of the study. ## Conflict of Interest The authors declare that the research was conducted in the absence of any commercial or financial relationships that could be construed as a potential conflict of interest. ## Supporting information Supplemental Table/Figure [[supplements/299423_file02.pdf]](pending:yes) ## Data availability statement The datasets generated during and/or analysed during the current study are not publicly available due to sensitivity of the health data. Non-personal data can be requested from the corresponding author. ## Acknowledgments This study would not have been possible without the participation of all of the subjects. We thank research nurse Elina Huikari for her help in sample collection, and Riitta Vuento for her technical assistance in the IHC staining. * Received December 5, 2023. * Revision received December 5, 2023. * Accepted December 5, 2023. * © 2023, Posted by Cold Spring Harbor Laboratory The copyright holder for this pre-print is the author. All rights reserved. The material may not be redistributed, re-used or adapted without the author's permission. ## References 1. 1.Lee, S. K., Kim, C. J., Kim, D.-J. & Kang, J. Immune Cells in the Female Reproductive Tract. Immune Netw 15, (2015). 2. 2.Vanderstraeten, A., Tuyaerts, S. & Amant, F. The immune system in the normal endometrium and implications for endometrial cancer development. Journal of Reproductive Immunology vol. 109 Preprint at doi:10.1016/j.jri.2014.12.006 (2015). [CrossRef](http://medrxiv.org/lookup/external-ref?access_num=10.1016/j.jri.2014.12.006&link_type=DOI) [PubMed](http://medrxiv.org/lookup/external-ref?access_num=25613542&link_type=MED&atom=%2Fmedrxiv%2Fearly%2F2023%2F12%2F05%2F2023.12.05.23299423.atom) 3. 3.Canning, M. B. & Billington, W. D. Hormonal regulation of immunoglobulins and plasma cells in the mouse uterus. Journal of Endocrinology 97, (1983). 4. 4.Kitaya, K., Takeuchi, T., Mizuta, S., Matsubayashi, H. & Ishikawa, T. Endometritis: new time, new concepts. Fertility and Sterility vol. 110 Preprint at doi:10.1016/j.fertnstert.2018.04.012 (2018). [CrossRef](http://medrxiv.org/lookup/external-ref?access_num=10.1016/j.fertnstert.2018.04.012&link_type=DOI) 5. 5.Xu, Y., Mei, J., Diao, L., Li, Y. & Ding, L. Chronic endometritis and reproductive failure: Role of syndecan-1. American Journal of Reproductive Immunology vol. 84 Preprint at doi:10.1111/aji.13255 (2020). [CrossRef](http://medrxiv.org/lookup/external-ref?access_num=10.1111/aji.13255&link_type=DOI) 6. 6.Bayer-Garner, I. B., Nickell, J. A. & Korourian, S. Routine Syndecan-1 Immunohistochemistry Aids in the Diagnosis of Chronic Endometritis. Arch Pathol Lab Med 128, 1000–1003 (2004). [PubMed](http://medrxiv.org/lookup/external-ref?access_num=15335255&link_type=MED&atom=%2Fmedrxiv%2Fearly%2F2023%2F12%2F05%2F2023.12.05.23299423.atom) [Web of Science](http://medrxiv.org/lookup/external-ref?access_num=000223727000010&link_type=ISI) 7. 7.Chen, Y., Fang, R., Luo, Y. & Luo, C. Analysis of the diagnostic value of CD138 for chronic endometritis, the risk factors for the pathogenesis of chronic endometritis and the effect of chronic endometritis on pregnancy: a cohort study. BMC Womens Health 16, 60 (2016). 8. 8.Li, Y. et al. Diagnosis of chronic endometritis: How many CD138 + cells/HPF in endometrial stroma affect pregnancy outcome of infertile women? American Journal of Reproductive Immunology 85, (2021). 9. 9.Bouet, P.-E. et al. Chronic endometritis in women with recurrent pregnancy loss and recurrent implantation failure: prevalence and role of office hysteroscopy and immunohistochemistry in diagnosis. Fertil Steril 105, 106–110 (2016). 10. 10.Park, H. J., Kim, Y. S., Yoon, T. K. & Lee, W. S. Chronic endometritis and infertility. Clin Exp Reprod Med 43, 185 (2016). [CrossRef](http://medrxiv.org/lookup/external-ref?access_num=10.5653/cerm.2016.43.4.185&link_type=DOI) 11. 11.Puente, E. et al. Chronic endometritis: old problem, novel insights and future challenges. Int J Fertil Steril 13, 250 (2020). 12. 12.Bayer-Garner, I. B. & Korourian, S. Plasma Cells in Chronic Endometritis are Easily Identified When Stained with Syndecan-1. Modern Pathology 14, 877–879 (2001). [CrossRef](http://medrxiv.org/lookup/external-ref?access_num=10.1038/modpathol.3880405&link_type=DOI) [PubMed](http://medrxiv.org/lookup/external-ref?access_num=11557783&link_type=MED&atom=%2Fmedrxiv%2Fearly%2F2023%2F12%2F05%2F2023.12.05.23299423.atom) [Web of Science](http://medrxiv.org/lookup/external-ref?access_num=000170967500008&link_type=ISI) 13. 13.Bera, K., Schalper, K. A., Rimm, D. L., Velcheti, V. & Madabhushi, A. Artificial intelligence in digital pathology — new tools for diagnosis and precision oncology. Nat Rev Clin Oncol 16, 703–715 (2019). [PubMed](http://medrxiv.org/lookup/external-ref?access_num=http://www.n&link_type=MED&atom=%2Fmedrxiv%2Fearly%2F2023%2F12%2F05%2F2023.12.05.23299423.atom) 14. 14.Sjöblom, N. et al. Chronic cholestasis detection by a novel tool: automated analysis of cytokeratin 7-stained liver specimens. Diagn Pathol 16, 41 (2021). 15. 15.Penttinen, A. et al. Implementation of deep neural networks to count dopamine neurons in substantia nigra. European Journal of Neuroscience 48, 2354–2361 (2018). [CrossRef](http://medrxiv.org/lookup/external-ref?access_num=10.1111/ejn.14129&link_type=DOI) 16. 16.Kangasniemi, M. H. et al. Artificial intelligence deep learning model assessment of leukocyte counts and proliferation in endometrium from women with and without polycystic ovary syndrome. F S Sci (2022) doi:10.1016/j.xfss.2022.01.006. [CrossRef](http://medrxiv.org/lookup/external-ref?access_num=10.1016/j.xfss.2022.01.006&link_type=DOI) 17. 17.Mäkelä, K. et al. Artificial intelligence identifies inflammation and confirms fibroblast foci as prognostic tissue biomarkers in idiopathic pulmonary fibrosis. Hum Pathol 107, 58–68 (2021). 18. 18.Papke, D. J., Lohmann, S., Downing, M., Hufnagl, P. & Mutter, G. L. Computational augmentation of neoplastic endometrial glands in digital pathology displays. J Pathol 253, 258–267 (2021). 19. 19.Palomba, S., Piltonen, T. T. & Giudice, L. C. Endometrial function in women with polycystic ovary syndrome: a comprehensive review. Hum Reprod Update 27, 584–618 (2021). 20. 20.Teede, H. J. et al. Recommendations from the international evidence-based guideline for the assessment and management of polycystic ovary syndrome†‡. Human Reproduction 33, 1602–1618 (2018). [CrossRef](http://medrxiv.org/lookup/external-ref?access_num=10.1093/humrep/dey256&link_type=DOI) [PubMed](http://medrxiv.org/lookup/external-ref?access_num=http://www.n&link_type=MED&atom=%2Fmedrxiv%2Fearly%2F2023%2F12%2F05%2F2023.12.05.23299423.atom) 21. 21.Jiang, N.-X. & Li, X.-L. The Disorders of Endometrial Receptivity in PCOS and Its Mechanisms. Reproductive Sciences 29, 2465–2476 (2022). 22. 22.Bashiri, A., Halper, K. I. & Orvieto, R. Recurrent Implantation Failure-update overview on etiology, diagnosis, treatment and future directions. Reproductive Biology and Endocrinology 16, (2018). 23. 23.Meltsov, A. et al. Targeted gene expression profiling for accurate endometrial receptivity testing. medRxiv (2022). 24. 24.Altmäe, S. et al. Meta-signature of human endometrial receptivity: a meta-analysis and validation study of transcriptomic biomarkers. Sci Rep 7, 10077 (2017). 25. 25.Hallager, T. et al. Conventional microscopy versus digital image analysis for histopathologic evaluation of immune cells in the endometrium. J Reprod Immunol 145, (2021). 26. 26.Teede, H. J. et al. Recommendations From the 2023 International Evidence-based Guideline for the Assessment and Management of Polycystic Ovary Syndrome. J Clin Endocrinol Metab (2023) doi:10.1210/clinem/dgad463. [CrossRef](http://medrxiv.org/lookup/external-ref?access_num=10.1210/clinem/dgad463&link_type=DOI) 27. 27.Krjutškov, K. et al. Single-cell transcriptome analysis of endometrial tissue. Human Reproduction 31, 844–853 (2016). [CrossRef](http://medrxiv.org/lookup/external-ref?access_num=10.1093/humrep/dew008&link_type=DOI) [PubMed](http://medrxiv.org/lookup/external-ref?access_num=26874359&link_type=MED&atom=%2Fmedrxiv%2Fearly%2F2023%2F12%2F05%2F2023.12.05.23299423.atom) 28. 28.Häkkinen, M. R. et al. Simultaneous analysis by LC–MS/MS of 22 ketosteroids with hydroxylamine derivatization and underivatized estradiol from human plasma, serum and prostate tissue. J Pharm Biomed Anal 164, 642–652 (2019). 29. 29.Burton, A. L. et al. Assessment of mitotic rate reporting in melanoma. The American Journal of Surgery 204, 969–975 (2012). 30. 30.Koo, T. K. & Li, M. Y. A Guideline of Selecting and Reporting Intraclass Correlation Coefficients for Reliability Research. J Chiropr Med 15, 155–163 (2016). [CrossRef](http://medrxiv.org/lookup/external-ref?access_num=10.1016/j.jcm.2016.02.012&link_type=DOI) [PubMed](http://medrxiv.org/lookup/external-ref?access_num=27330520&link_type=MED&atom=%2Fmedrxiv%2Fearly%2F2023%2F12%2F05%2F2023.12.05.23299423.atom) 31. 31.Song, D. et al. Prevalence and confounders of chronic endometritis in premenopausal women with abnormal bleeding or reproductive failure. Reprod Biomed Online 36, 78–83 (2018). 32. 32.Downing, M. J., Papke, D. J., Tyekucheva, S. & Mutter, G. L. A New Classification of Benign, Premalignant, and Malignant Endometrial Tissues Using Machine Learning Applied to 1413 Candidate Variables. International Journal of Gynecological Pathology 39, 333–343 (2020). 33. 33.McDermott, M. R., Clark, D. A. & Bienenstock, J. Evidence for a common mucosal immunologic system. II. Influence of the estrous cycle on B immunoblast migration into genital and intestinal tissues. The Journal of Immunology 124, 2536 (1980). 34. 34.Xu, X.-L., Deng, S.-L., Lian, Z.-X. & Yu, K. Estrogen Receptors in Polycystic Ovary Syndrome. Cells 10, 459 (2021). 35. 35.Alfer, J. et al. Individual dynamics of uterine natural killer cells in natural and stimulated cycles monitored using a new endometrial dating method. American Journal of Reproductive Immunology 88, (2022).