Development and validation of an explainable model for Mycoplasma pneumoniae infection in children Authors: Xin Yang, Liwen Zhang, Yong Yin, Hejun Jiang, Guijun Yang, Zhichao Sun, Yunqin Zhang, Juan Cui, Guifang Zhou, Na Wang, Jing Chen Published: 2026 ABSTRACT This study aimed to develop an explainable early diagnostic model for Mycoplasma pneumoniae (MP) infection in children and assess clinicians’ perceptions before and after its deployment. Data were collected from children with acute fever or cough at Linyi Maternal and Child Healthcare Hospital and Shanghai Children’s Medical Center in 2023. Serology-defined MP infection was determined based on a fourfold or greater change in MP-IgM or MP-IgG titers between the acute and convalescent phases. Patients were split into training and test sets at a 7:3 ratio, and temporal validation was performed using data collected in 2024. PCR testing was not systematically available in this cohort and was therefore not used as a comparator or reference standard. Recursive Feature Elimination (RFE) optimized feature selection. Seven models were developed; the best was chosen based on AUC value and interpreted using SHAP. Models were deployed via Streamlit, and clinician feedback was surveyed before and after three months of use. The optimal model, using 11 features, achieved AUCs of 0.89 in the internal test set and 0.84 in the temporal validation cohort for identifying serology-defined MP infection, with TNFβ and IL-2 emerging as high-impact features. Separate models for under and over 60-month-old children also performed well. Clinicians’ trust in the model significantly increased after three months (P < 0.001) and was correlated with usage frequency (P < 0.01). We developed explainable models to support the early identification of serology-defined MP infection in children. TNFβ and IL-2 may represent informative immune-related features, although further PCR-based validation and mechanistic studies are needed. Clinician trust and usage increased after model deploymentSupplementary InformationThe online version contains supplementary material available at 10.1038/s41598-026-56179-0. Introduction Mycoplasma pneumoniae (MP) is a significant pathogen of community-acquired pneumonia (CAP) in children, which accounts for 10% to 40% of hospitalized cases in children with CAP and it is a widely recognized clinical issue among pediatricians1,2. The severity of the MP infection varies widely and can progress to severe, refractory pneumonia, which may lead to serious sequelae3. Early diagnosis and timely, effective treatment are crucial to reducing the risk of severe infections4. Common laboratory tests for MP include culture, serology, and nucleic acid amplification tests such as PCR. Culture has high specificity but requires specialized conditions, is time-consuming, and has limited sensitivity5. Serology remains widely used in clinical practice, but its interpretation is influenced by antibody kinetics, age, immune status, and the timing of specimen collection. MP-IgM usually appears within approximately one week after infection but may be delayed, persist for months, or be absent in some mild or recurrent infections. MP-IgG appears later and persists for a long time, requiring a fourfold increase in convalescent and acute phase sera for meaningful interpretation, suitable for retrospective diagnosis6. PCR can provide more rapid direct detection of MP nucleic acids and represents an important clinical benchmark when available; however, PCR and serology may be discordant because they capture different aspects and phases of infection. Therefore, the early diagnosis of MP infection remains challenging, particularly in settings where PCR is unavailable, delayed, or not routinely performed. In recent years, machine learning (ML) methods derived from electronic medical records (EMR) have gained attention and recognition from clinicians. The widespread use of EMRs in hospitals has made the collection of clinical data more accurate and convenient. Recent studies have shown that machine learning (ML) methods applied in medical decision support have achieved remarkable results across various diseases and tasks7–9. Previous machine learning research on respiratory infections has primarily focused on outcome prediction and image processing9–12. Research on the use of machine learning methods for diagnosing Mycoplasma pneumoniae infection, as well as acute respiratory infections and community-acquired pneumonia, remains very limited. Lhommet et al. attempted to develop a data-driven approach to differentiate viral and bacterial pneumonia at the time of patient presentation. Unfortunately, neither experts nor AI models have been successful in predicting the microbial causes of acute respiratory infections13. In another study, Mai and colleagues used MetaMap to predict viral etiologies in 1685 hospitalized pediatric patients. However, the results were unsatisfactory. The predictive model demonstrated an Area Under the Curve (AUC) of 0.53 to 0.72 for six common viruses14. Despite the power of machine learning methods due to their complex models, they are still limited by their “black box” nature, which makes them difficult to interpret directly. To overcome these “black box” issues, the SHapley Additive explanations (SHAP) method is used to explain ML model outputs and visualize predictions for individual variables. SHAP is a unified method for interpreting ML model outputs15,16. Methods Study population This study prospectively collected data from patients presenting with acute fever (≤ 15 days duration) with or without acute cough (≤ 15 days duration) at the Respiratory Departments of Linyi Maternal and Child Healthcare Hospital and Shanghai Children’s Medical Center from January to December 2023 as the derivation cohort. Patients enrolled from January to February 2024 using the same eligibility criteria were used as a temporal validation cohort. Participants were excluded if they met any of the following criteria: (1) Concurrent rheumatologic or immune-related diseases such as systemic lupus erythematosus, arthritis, acute glomerulonephritis, etc. (2) Concurrent hematological disorders, such as congenital agammaglobulinemia, leukemia, etc. (3) Fever caused by non-respiratory infections, such as Kawasaki disease, infectious mononucleosis, urinary tract infections, etc. (4) Participants with congenital respiratory system malformations. (5) Patients who refused to participate in the study. (6) Participants with missing data. A total of 1660 patients were ultimately included in the study. This study was performed in accordance with the Declaration of Helsinki, with approvals of the IRB of Shanghai Children’s Medical Center Affiliated to Shanghai Jiao Tong University School of Medicine (SCMCIRB-K2024126-1). Written informed consent was obtained from each participating individual’s guardian. Data collection Blood and throat swab specimens from all patients were collected on the day of the visit and sent to the laboratory department at Shanghai Children’s Medical Center for testing. Clinical and demographic information were collected by researchers on the day of the visit and recorded in the Case Report Form (CRF). Ultimately, 30 features were included in the study: age (months), gender, height (cm), weight (kg), IFNα, IFNβ, IL-10, IL12p70, IL-17, IL-18, IL-2, IL-4, IL-6, IL-8, TNFα, TNFβ, SAA, PCT, ESR, SF, LDH, CRP, duration of fever (days), peak temperature (°C), duration of cough (days), duration of gasp (days), and blood oxygen saturation (%). Variable definitions Patients’ height and weight were measured on the day of the visit. Concentrations of IFNα, IFNβ, IL-10, IL12p70, IL-17, IL-18, IL-2, IL-4, IL-6, IL-8, TNFα, TNFβ, SAA, PCT, ESR, SF, LDH, and CRP in the patients’ blood were measured on the day of visit, with reports issued by the laboratory department of Shanghai Children’s Medical Center. Duration of fever referred to the time from the first occurrence of fever during this illness to the day of the visit. Duration of cough referred to the time from the first occurrence of cough during this illness to the day of the visit. If chronic conditions such as asthma that could cause coughing were present, it referred to the total duration of cough symptoms. Duration of gasp referred to the time from the first occurrence of gasp during this illness to the day of the visit. If chronic conditions such as asthma that could cause gasp were present, it referred to the total duration of gasp symptoms. For patients without the above symptoms, the duration of symptoms was recorded as zero. Blood oxygen saturation was measured in patients at rest and without supplemental oxygen at the time of the visit. The primary outcome was serology-defined MP infection. A fourfold or greater increase or decrease in MP-IgM or MP-IgG titers between the acute and convalescent phases was used as the serological reference standard for serology-defined MP infection6. Because PCR testing was not systematically performed for all participants, PCR-based diagnosis could not be used as the reference standard or as a comparator in the present study. Therefore, the model developed in this study should be interpreted as predicting serology-defined MP infection rather than microbiologically confirmed MP infection. Model development We designated participants visiting from January 2023 to December 2023 (n = 1346) as the derivation cohort, and those admitted from January 2024 to February 2024 (n = 314) as the temporal validation cohort. The derivation cohort was divided into training and testing sets using a 7:3 ratio through random stratified sampling based on whether they were infected with MP. Ultimately, 942 patients were allocated to the training set and 404 to the testing set. All 30 features mentioned were included in the initial models. Decision tree, extra trees, XGboost (XGB), gradient boosting (GBC), random forest (RF), logistic regression, and support vector machines (SVM) were used to develop diagnostic models for serology-defined MP infection. The purpose of the model was early diagnostic support, not prediction of disease severity. The reliability of the models was assessed using AUC. Initially, all 30 features were incorporated into the seven models to generate preliminary models. Subsequently, the importance of features was ranked within each model. For all models, variables were incorporated in descending order of importance, and five-fold cross-validation was performed on the training set to evaluate the impact of the number of variables included on model performance. A curve of the average AUC across cross-validation was plotted against the number of features included. The number of features to include was finalized when the change in average AUC became insignificant or started to decrease. If more than 15 variables were included without satisfying the termination conditions, the number of variables included was capped at 15. Finally, the performance of the seven final models on the test set was evaluated, and the model with the highest AUC was selected as the optimal model. The optimal model was globally interpreted using the SHAP method. Considering previously reported differences in MP infection status between populations above and below five years of age, and the results of this study’s whole participants analysis, we developed models for both age groups using the same process1. Finally, the effectiveness of the optimal model was evaluated in the temporal validation cohort. Model deployment and evaluation We deployed the optimal model remotely using the Python Streamlit library on Streamlit Cloud. After deployment, the model was trialed by forty physicians from Shanghai Children’s Medical Center. Surveys were conducted before deployment (March 2024) and in June 2024 to assess users’ trust in the diagnostic tool and the average weekly usage of the tool over the four months. Trust was defined as the level of belief in the diagnostic tool’s results, scored out of 10, with higher scores indicating greater trust. Additionally, we gathered users’ suggestions for model development to aid in our future research. The specific research process is illustrated in Fig. 1. Fig. 1Flowchart of the study. Flowchart of the study. Data analysis Data analysis was conducted using Python 3 and R 4.3.1. Continuous variables are represented by mean and standard deviation, and compared using the Wilcoxon rank test. Categorical variables were expressed in numbers and percentages and compared using the Pearson’s chi-squared test. The area under the curve (AUC) was used to evaluate predictive capability, and the optimal cutoff value was determined by maximizing the Youden index (sensitivity + specificity − 1). Results Baseline Table 1 provides a detailed description of the baseline characteristics of the study population. Among the 1660 patients included in this study, 918 patients (55.3%) were classified as having serology-defined MP infection, and 742 patients (44.7%) were classified as not having MP infection. Patients with MP infection were significantly older and had greater height and weight compared to those without the MP infection. Several immune and inflammatory markers also differed between the two groups. Specifically, IFNα, IL-12p70, IL-2R, IL-4, IL-5, PCT, LDH, cough duration, and gasp duration were lower in the MP infection group, whereas IFNβ, IL-17, IL-2, IL-6, IL-8, TNFα, TNFβ, SAA, ESR, SF, fever duration, and peak temperature were higher. Table 1Baseline characteristics of all participants according to serology-defined Mycoplasma pneumoniae infection status.CharacteristicOverall, N = 16601Non-MP infection, N = 7421Serology-defined MP infection, N = 9181p-value2Age (months)71 (40)56 (40)83 (36)< 0.001Sex< 0.001 Male844 (51%)416 (56%)428 (47%) Female816 (49%)326 (44%)490 (53%)Height (cm)115 (25)106 (26)123 (21)< 0.001Weight (kg)23 (13)19 (12)25 (12)< 0.001IFNα (pg/ml)12 (37)16 (53)9 (15)0.028IFNβ (pg/ml)27 (91)18 (47)33 (115)< 0.001IL-10 (pg/ml)16 (38)19 (50)13 (23)0.3IL-12p70 (pg/ml)4.20 (18.53)4.85 (27.45)3.67 (3.44)< 0.001IL-17 (pg/ml)9.6 (15.1)7.7 (6.6)11.1 (19.4)< 0.001IL-18 (pg/ml)9.2 (25.7)12.1 (37.8)6.9 (5.1)> 0.9IL-1β (pg/ml)30.1 (321.4)6.3 (15.9)49.4 (431.1)0.2IL-2 (U/ml)5.42 (4.54)4.48 (4.70)6.18 (4.25)< 0.001IL-2R (pg/ml)393 (257)447 (262)350 (244)< 0.001IL-4 (pg/ml)6.7 (8.1)7.2 (8.9)6.2 (7.4)< 0.001IL-5 (pg/ml)6 (9)7 (9)6 (9)< 0.001IL-6 (pg/ml)23 (125)14 (36)31 (165)< 0.001IL-8 (pg/ml)164 (672)113 (401)205 (827)0.042TNFα (pg/ml)4.04 (9.62)3.10 (3.19)4.80 (12.57)0.013TNFβ (pg/ml)5.24 (3.75)4.54 (3.95)5.81 (3.47)< 0.001SAA (mg/L)58 (73)55 (72)61 (73)< 0.001PCT (ng/ml)0.18 (0.62)0.25 (0.90)0.13 (0.19)< 0.001ESR (mm/h)25 (16)22 (17)27 (15)< 0.001SF (ng/ml)132 (155)130 (177)134 (136)0.002LDH (U/ml)296 (95)298 (81)295 (105)0.002CRP (mg/L)10 (16)10 (18)9 (15)0.5Fever (days)5.8 (4.3)5.1 (5.2)6.3 (3.3)< 0.001Peak temperature (℃)39.75 (12.25)39.17 (0.99)40.22 (16.44)< 0.001Cough (days)13 (101)16 (150)10 (10)< 0.001Gasp (days)1.86 (18.89)3.09 (28.06)0.86 (2.75)< 0.001SpO2 (%)97.08 (1.78)97.05 (1.96)97.10 (1.63)0.31 Mean (SD); n (%).2 Wilcoxon rank sum test; Pearson’s Chi-squared test. Table 1Baseline characteristics of all participants according to serology-defined Mycoplasma pneumoniae infection status.CharacteristicOverall, N = 16601Non-MP infection, N = 7421Serology-defined MP infection, N = 9181p-value2Age (months)71 (40)56 (40)83 (36)< 0.001Sex< 0.001 Male844 (51%)416 (56%)428 (47%) Female816 (49%)326 (44%)490 (53%)Height (cm)115 (25)106 (26)123 (21)< 0.001Weight (kg)23 (13)19 (12)25 (12)< 0.001IFNα (pg/ml)12 (37)16 (53)9 (15)0.028IFNβ (pg/ml)27 (91)18 (47)33 (115)< 0.001IL-10 (pg/ml)16 (38)19 (50)13 (23)0.3IL-12p70 (pg/ml)4.20 (18.53)4.85 (27.45)3.67 (3.44)< 0.001IL-17 (pg/ml)9.6 (15.1)7.7 (6.6)11.1 (19.4)< 0.001IL-18 (pg/ml)9.2 (25.7)12.1 (37.8)6.9 (5.1)> 0.9IL-1β (pg/ml)30.1 (321.4)6.3 (15.9)49.4 (431.1)0.2IL-2 (U/ml)5.42 (4.54)4.48 (4.70)6.18 (4.25)< 0.001IL-2R (pg/ml)393 (257)447 (262)350 (244)< 0.001IL-4 (pg/ml)6.7 (8.1)7.2 (8.9)6.2 (7.4)< 0.001IL-5 (pg/ml)6 (9)7 (9)6 (9)< 0.001IL-6 (pg/ml)23 (125)14 (36)31 (165)< 0.001IL-8 (pg/ml)164 (672)113 (401)205 (827)0.042TNFα (pg/ml)4.04 (9.62)3.10 (3.19)4.80 (12.57)0.013TNFβ (pg/ml)5.24 (3.75)4.54 (3.95)5.81 (3.47)< 0.001SAA (mg/L)58 (73)55 (72)61 (73)< 0.001PCT (ng/ml)0.18 (0.62)0.25 (0.90)0.13 (0.19)< 0.001ESR (mm/h)25 (16)22 (17)27 (15)< 0.001SF (ng/ml)132 (155)130 (177)134 (136)0.002LDH (U/ml)296 (95)298 (81)295 (105)0.002CRP (mg/L)10 (16)10 (18)9 (15)0.5Fever (days)5.8 (4.3)5.1 (5.2)6.3 (3.3)< 0.001Peak temperature (℃)39.75 (12.25)39.17 (0.99)40.22 (16.44)< 0.001Cough (days)13 (101)16 (150)10 (10)< 0.001Gasp (days)1.86 (18.89)3.09 (28.06)0.86 (2.75)< 0.001SpO2 (%)97.08 (1.78)97.05 (1.96)97.10 (1.63)0.31 Mean (SD); n (%).2 Wilcoxon rank sum test; Pearson’s Chi-squared test. Baseline characteristics of all participants according to serology-defined Mycoplasma pneumoniae infection status. 1 Mean (SD); n (%). 2 Wilcoxon rank sum test; Pearson’s Chi-squared test. Development of the optimal model for the entire participants Figure 2A showed the feature importance ranking for the seven initial models including all features across the entire population. TNFβ ranked as the most important feature in the XGB, Decision Tree, GBC, and Random Forest models, and it was ranked third, fifth, and third, respectively, in the Extra Trees, Logistic Regression, and SVM models, suggesting a unique role for TNFβ in pediatric Mycoplasma pneumoniae infections. Common infection-related inflammatory markers such as CRP, SF, SAA, and LDH did not perform well in the feature importance rankings. Figure 2B displayed the changes in the average AUC during five-fold cross-validation on the training set for the seven models as the number of features included varies across the entire population. Apart from the decision tree model, whose average AUC fluctuated with changes in the number of features included, the average AUCs of the other models tended to stabilize as more features were included. Based on the results from Fig. 2B, the number of features ultimately included in each model was determined, with details provided in Supplementary Material 1. Figure 2C presented the AUC curves for the seven final models on the test set. The GBC model had the highest AUC value, at 0.89, and was selected as the ultimate optimal model for global interpretation of features. Fig. 2(A) The feature importance ranking for the seven initial models, with higher ranks indicating greater importance. (B) The changes in average AUC during five-fold cross-validation on the training set for the seven models as the number of included features varied. (C) The ROC curves for the seven final models on the test set. (A) The feature importance ranking for the seven initial models, with higher ranks indicating greater importance. (B) The changes in average AUC during five-fold cross-validation on the training set for the seven models as the number of included features varied. (C) The ROC curves for the seven final models on the test set. Global explanation of the optimal model for the entire participants Figure 3 showed the global interpretation of the 11 features included in the optimal model for the entire participants. The vertical axis represented SHAP values, while the horizontal axis represented the actual values of the features (though the model training used standardized values, actual values were only used here for plotting). Positive SHAP values correspond to the positive class (MP infection). As shown in the figure, when TNFβ exceeded 4.6pg/ml, decisions lean towards a MP infection classification; when ESR was either below 15.1 mm/h or above 46.3 mm/h, decisions lean towards a non-Mycoplasma pneumoniae infection classification. Additionally, when height exceeded 105 cm or age was greater than 60 months, decisions lean towards a MP infection classification. Taking into account previously reported differences in MP infection between populations above and below five years of age, we modeled separately using 60 months of age as a cutoff1. Fig. 3Global explanation of the optimal model for the entire participants. Global explanation of the optimal model for the entire participants. Age-stratified optimal models We used the same methodology as described in Sect. 3.2 to develop the final models, with the specific process detailed in Supplementary Material 2. Figure 4 displayed the ROC curves of the seven final models on the test set. In the population over 60 months of age, the Extra Trees model had the highest AUC value (Fig. 4A) at 0.84, while in the population under 60 months of age, the Gradient Boosting Classifier (GBC) had the highest AUC value (Fig. 4B) at 0.88. Therefore, Extra Trees was selected as the optimal model for the population over 60 months of age, and GBC was chosen as the optimal model for the population under 60 months of age. In the temporal validation cohort, the AUC values for the entire population, children over 60 months of age, and children under 60 months of age were 0.84, 0.80, and 0.83, respectively (Supplementary materials 3). Fig. 4The ROC curves for the seven final models on the test sets for populations above and below 60 months of age. The ROC curves for the seven final models on the test sets for populations above and below 60 months of age. Global interpretation of age-stratified diagnostic models Figure 5 showed the global interpretation of features included in the age-stratified optimal models. The vertical axis represented SHAP values, while the horizontal axis showed the actual values of the features (standardized values were used during model training, but actual values were used here for plotting). Positive SHAP values correspond to the positive class (MP infection). In the optimal model for those over 60 months of age (Fig. 5A), TNFβ levels above 5 pg/ml and IL-2 levels above 5 U/L both strongly indicated MP infection. Similar findings were observed in the optimal model for those under 60 months of age (Fig. 5B). In the population over 60 months of age, the duration of fever showed significant importance, while no similar observation was made in the population under 60 months. Fig. 5 Global interpretation of age-stratified diagnostic models using SHAP methods. (A) Global interpretation of the optimal model for ages over 60 months. (B) Global interpretation of the optimal model for ages under 60 months. Global interpretation of age-stratified diagnostic models using SHAP methods. (A) Global interpretation of the optimal model for ages over 60 months. (B) Global interpretation of the optimal model for ages under 60 months. User evaluation after model deployment Supplementary material 4.A showed the interface of our developed MP infection diagnostic assistant (https://mp-for-scmc.streamlit.app/). After the user entered the child’s age in months, different diagnostic models were invoked based on whether the age was over 60 months, providing the optimal cutoff values calculated by the Youden index, along with the corresponding sensitivity and specificity. Supplementary material 4.B presented the results of our survey among users. Before using the diagnostic assistant, the average trust level of clinicians in this tool was 5, even after we had fully presented our research findings. Three months later, the average trust level (Supplementary material 4.B) increased to 6.3 (P < 0.001). Additionally, we found that the increase in trust was significantly positively correlated with the average weekly usage of the diagnostic tool (Supplementary material 4.A) (P < 0.01). Discussion The early diagnosis of MP infection in children remains challenging. Serological tests are widely used in clinical practice, but antibody responses may be delayed, persist for months, or be absent in some mild or recurrent infections6. In the present study, the diagnostic outcome was based on paired serology; therefore, the model should be interpreted as identifying children with serology-defined MP infection rather than microbiologically confirmed MP infection. PCR provides rapid direct detection of MP nucleic acids and would be an important benchmark if systematically available. However, because PCR testing was not routinely performed for all participants in this cohort, we could not directly compare the proposed model with PCR-based diagnosis. Accordingly, the model is best positioned as an adjunctive decision-support tool, particularly when PCR is unavailable, delayed, or not routinely requested, rather than as a replacement for PCR or other microbiological tests. In this study, TNFβ and IL-2 emerged as high-impact features in the explainable model. This finding is biologically plausible in the context of previous immunological studies showing that pediatric Mycoplasma pneumoniae pneumonia is associated with dysregulated cellular immune responses, Th1/Th2 imbalance, and altered cytokine profiles. Prior studies have reported changes in Th1/Th2-related cytokines, including IL-2, in children with Mycoplasma pneumoniae pneumonia, and have shown that cytokine signatures may be associated with radiographic manifestations and disease severity17–19. IL-2 is closely related to T-cell activation and immune regulation, and previous studies have reported altered IL-2 levels in children with MP infection, although the direction and magnitude of change may vary according to disease severity, sample type, and timing of measurement. In contrast, most previous pediatric MPP studies have focused on TNFα rather than TNFβ. Therefore, the prominence of TNFβ in our model should be regarded as a hypothesis-generating finding that may reflect broader TNF-family-related immune activation. Further mechanistic studies and independent validation cohorts are needed to clarify whether TNFβ has a direct role in MP pathogenesis or primarily serves as a predictive biomarker. To our knowledge, this is the first prospective study in China aimed at investigating and comparing seven ML models for a comprehensive Mycoplasma pneumoniae diagnostic analysis in a cohort of children with acute respiratory infections. Compared to previous studies, this study includes a broader and more comprehensive set of inflammatory markers. The performance of our model was comparable to or higher than that reported in previous ML-based studies of pediatric MP prediction, suggesting its potential value as an adjunctive decision-support tool. In previous studies, Chen et al. developed a Mycoplasma pneumoniae diagnostic model for patients with suspected acute respiratory infections using five features (age, duration of fever, erythrocyte sedimentation rate, white blood cell count, and neutrophil ratio), with an AUC of 0.7520. Chang et al. established a Mycoplasma pneumoniae diagnostic model for children of all ages using features such as age, duration of fever, C-reactive protein (CRP), white blood cell count, platelet count, lymphocyte percentage, peak fever temperature, and maximum heart rate, with an AUC of 0.87, slightly lower than the 0.89 achieved in our study for children of all ages21. Currently, the clinical application and subsequent evaluation of machine learning models present significant challenges. This study utilized streamlit library for remote deployment of the model and surveyed clinicians’ regarding their perceptions of the model developed in this research. We found that despite data support, clinicians still did not trust diagnostic models developed based on data analysis, preferring to use traditional methods that have been validated multiple times, as recommended in guidelines. For instance, they preferred to use MP-IgM to diagnose MP infection, although the model showed promising performance in identifying serology-defined MP infection in this cohort22. After prolonged use of this diagnostic assistant by clinicians, their trust in the tool significantly increased, suggesting that the adoption of new diagnostic tools in clinical practice may require considerable time and cost and the effectiveness of the model appears to accelerate this process. Simultaneously, clinicians have provided crucial suggestions such as focusing on children who are MP-RNA (-) but retrospectively diagnosed with MP infection, offering valuable directions for future research. This model (as shown in Fig. 1) provides new insights and approaches for similar studies. The clinical value of an ML-based diagnostic model depends on how it is positioned relative to existing laboratory tests. If rapid PCR testing is available and routinely performed, PCR would remain a more direct method for detecting MP nucleic acids. In that setting, the incremental value of ML may lie in integrating clinical symptoms, inflammatory markers, and host immune responses to support pre-test risk stratification, interpretation of discordant results, or prioritization of further testing. In contrast, in settings where PCR is not readily available, the model may provide an earlier probabilistic estimate before paired serological confirmation is possible. Therefore, future studies should systematically collect PCR results and evaluate whether the model adds diagnostic value beyond PCR, serology, or their combination. Several limitations should be acknowledged. First, the reference standard in this study was based on paired serology rather than systematic microbiological confirmation. Because PCR was not performed for all participants, we could not directly compare the ML-based model with PCR-based diagnosis. Therefore, the model should be interpreted as predicting serology-defined MP infection, and its performance for microbiologically confirmed MP infection remains to be determined. Second, although participants were recruited from two hospitals, the validation cohort was temporal rather than a fully independent multicenter external validation cohort. This may limit the generalizability of the findings to other institutions, regions, laboratory platforms, or patient populations. Future studies should include prospective multicenter validation with standardized PCR and serological testing to clarify the incremental value of the model over existing diagnostic strategies. Moreover, although all inflammation markers included in this study were collected on the day of patient consultation, we did not know whether patients had taken antibiotics or anti-inflammatory drugs prior to their visit, or if they had visited other hospitals, and we could not align these covariates. Although this is a common phenomenon from the perspective of actual clinical practice, it may introduce certain biases into the research from a research standpoint and more data on these covariates might be needed to explore how the timing of visit affects the diagnostic model. Additionally, due to the lack of guidelines or consensus on selecting features for the model, it is unclear how many features should be included in the model. While more features can provide more information for the predictive model, including a large number of features may limit the model’s generalizability, whereas including fewer features might reduce the accuracy of predictions. Conclusions This study developed and temporally validated explainable models for the early identification of serology-defined MP infection in children under and over 60 months of age. TNFβ and IL-2 emerged as informative immune-related features, but their biological roles require further validation. Future studies incorporating systematic PCR testing and independent multicenter validation are needed to determine the model’s clinical value relative to established microbiological diagnostic methods. Supplementary Information Below is the link to the electronic supplementary material. Supplementary Material 1 Supplementary Material 1