An interpretable radiomics–machine learning model for early risk stratification of invasive fungal infections in community-acquired pneumonia: a dual-center study Authors: Wenzhang He, Yulin Xiong, Xuan Huang, Haoran Luo, Shaoquan Zhou, Yongbo Tu, Tie Deng, Min Gu Published: 2026 ABSTRACT To develop and validate an interpretable HRCT radiomics-based machine learning model for early risk stratification and identification of invasive fungal infection (IFI) in patients with community-acquired pneumonia (CAP). A total of 570 CAP patients who underwent HRCT from July 2022 to August 2024 in Center 1 and Center 2 were recruited. A VB-net pneumonia automatic segmentation algorithm was employed. Three models, a radiomics model (HRCT-derived radiomics features), a clinical model (clinical variables), and a combined model (integrating both), were developed. The performance of the model was evaluated through receiver operating characteristic analysis with respect to the area under the curve (AUC). Clinical utility was evaluated by using decision curve analysis. The Shapley Additive Explanations tool was employed. A total of 239 (mean age: 62.1 ± 19.3 years; 134 male), 101 (mean age: 57.5 ± 17.3 years; 44 male), and 230 (mean age: 68.4 ± 15.3 years; 153 male) patients were included in the training, internal validation, and external validation datasets, respectively. Based on the linear discriminant analysis classifier, the AUCs of the clinical, radiomics, and combined models were 0.719, 0.724, and 0.808, respectively, in the internal validation dataset; and 0.707, 0.709, and 0.786, respectively, in the external validation dataset. The combined model yielded a superior net benefit relative to both the clinical and radiomics models alone. Age exerted the greatest influence on the predictions of the combined model, while the top three influential radiomics features were all high-order texture features. A radiomics-based machine learning model provides moderate incremental value as an adjunctive tool for early IFI risk stratification in patients with CAP before definitive microbiological or pathological confirmation, with favorable interpretability.Supplementary InformationThe online version contains supplementary material available at https://doi.org/10.1038/s41598-026-56091-7. Introduction Community-acquired pneumonia (CAP) represents a global health priority, ranking among the top five causes of mortality worldwide and imposing substantial socioeconomic burdens1. CAP exhibits considerable etiological diversity, with potential involvement of either single or polymicrobial pathogens, resulting in marked heterogeneity in both clinical course and patient prognosis 2,3. A subset of patients, especially immunodeficient individuals, frequently present with co-occurring invasive fungal infection (IFI) which is associated with substantial morbidity, having a mortality rate of 40% to 50%4. The current diagnostic workflow, dependent on culture methods with suboptimal sensitivity (30–50%) and serological tests requiring 6–8 h processing time, demonstrates significant limitations5,6. This diagnostic inadequacy creates a critical 72–96 h window of uncertainty, during which mortality risk escalates5,7. This underscores the urgent need for advanced diagnostic frameworks capable of rapid, precise pathogen differentiation. High-resolution computed tomography (HRCT) plays a pivotal role in evaluating pulmonary infections due to its ability to provide detailed morphological information8,9. Characteristic CT manifestations of invasive fungal pneumonia typically include multiple nodules surrounded by peripheral ground-glass opacities and/or wedge-shaped consolidations10. Nevertheless, these radiographic features lack specificity and often demonstrate significant overlap with other pulmonary infectious processes. In polymicrobial infections, the radiological manifestations of co-existing pathogens can mask distinctive fungal signatures, resulting in reduced diagnostic recognition. Radiomics, an emerging field in medical imaging, offers a promising solution by extracting high-dimensional quantitative features from medical images and analyzing them by using machine learning algorithms11. Radiomic features invisible to the naked eye can reveal differences at the protein, cellular, and tissue levels12,13. Yan et al. established CT radiomics as a viable predictor of pulmonary invasive fungal infections in immunocompromised hosts14. In another research, Yang et al. demonstrated that machine learning-enhanced radiomics improves severe CAP identification15. Subsequent multicenter studies have validated radiomics’ diagnostic utility in distinguishing pathogens causing pulmonary infections16–18. To our knowledge, few interpretable machine learning approaches that integrate both imaging biomarkers and clinical parameters have been established for differentiating CAP-related IFI. While several combined predictive models have been proposed for infectious diseases, few have been specifically developed and validated for this particular task using multicenter data with interpretability to support clinical decision-making. By leveraging advanced computational techniques, we seek to identify robust imaging biomarkers that can identify IFI with high precision. This study aimed to develop and validate a radiomics-based model for early risk stratification of IFI in patients with CAP based on multicenter datasets. In addition, the study aimed to explore the interpretability of the radiomics model by Sapley Additive exPlanations analysis. Materials and methods The study was in line with the Declaration of Helsinki and was approved by the Institutional Review Board of Chongqing general hospital, Chongqing University [No. KYS2022-009-01]. Patients The inclusion criteria were as follows: (I) age 18 years and over; (II) meeting the diagnostic criteria for CAP; (III) CT scan with thin section (slice thickness less than 1.5 mm); (IV) definitive evidence of pulmonary infiltration/consolidation on HRCT; and (V) pathogen detection tests on the day of hospital admission (including identifying pathogens by deep sputum culture, blood culture, bronchoalveolar lavage culture, histopathology, and macrogenomic sequencing). The detailed diagnostic criteria for CAP with and without IFI are provided in Supplementary Information S1.A total of 1212 CAP patients who underwent HRCT examination from July 2022 to August 2024 in Chongqing General Hospital (Center 1) and Chongqing University Central Hospital (Center 2) were initially recruited. The exclusion criteria were as follows: (I) the interval between CT examination and pathogen specimen testing was more than 1 day (n = 276); (II) patient data missing exceeds 30% (n = 27); (III) patients who had received any antibiotic therapy within 7 days prior to CT scanning and pathogen testing were excluded (n = 265); (IV) CT image quality is insufficient for clinical diagnosis (n = 74). The patient selection process is depicted in Fig. 1. Ultimately, 340 patients from Center 1 (development cohort) were randomly divided into the training dataset (n = 239) and the internal validation dataset (n = 101) in a 7:3 ratio. An independent cohort of 230 patients from Center 2 served as the external validation dataset. Fig. 1Patient enrollment flowchart. Patient enrollment flowchart. Volume segmentation of the region of interest (ROI) The detailed HRCT acquisition information is provided in Supplementary Information S2. For lesion segmentation related to pneumonia, a VB-net pneumonia automatic segmentation algorithm was employed, which was developed by United Imaging Intelligence’s one-stop research platform (uAI Research Portal, V20230515, https://urp.united-imaging.com/) (VB-net pneumonia automatic segmentation algorithm details shown in Supplementary Information S3)19. Previously, in a pneumonia infection segmentation task, it was proven to highly overlap with the manual sketch, and the similarity coefficient of dice was 91.6%. To ensure segmentation accuracy, the algorithm-generated segmentations were manually reviewed and refined by two chest radiologists with 9 and 25 years of experience in chest imaging, respectively. The first radiologist performed the initial review and correction of the AI-generated ROIs, and the second radiologist subsequently conducted a blinded independent review to verify and confirm the final ROI boundaries. Any discrepancies were resolved by consensus until a unanimous annotation was achieved. Lesion boundaries and regions were annotated on the basis of the radiologists’ clinical expertise and medical knowledge. The Dice similarity coefficient for the target volumes independently corrected by the two radiologists was 0.923 (95% CI: 0.901–0.945), and the intraclass correlation coefficient was 0.937 (95% CI: 0.912–0.956), indicating excellent interobserver agreement. Figure S1 shows the ROI segmentation example. ROI segmentation and delineation criteria. Initial lesion segmentation was generated using the VB-net pneumonia automatic segmentation algorithm. The ROI was defined as the entire infection-related pulmonary lesion on HRCT, including consolidation, ground-glass opacity, patchy infiltrates, nodules, and other parenchymal abnormalities considered attributable to the same active infectious process. Segmentation was performed slice by slice on lung window images to generate a three-dimensional ROI. Intralesional necrotic, cavitary, or hypoattenuation components were retained when located within the lesion boundary, in order to preserve lesion heterogeneity. Large pulmonary vessels, major bronchi, pleural effusion, hilar or mediastinal structures, chest wall, and noninfectious lesions such as pre-existing fibrosis or calcification were excluded whenever possible. For multifocal disease, all lesions related to the same infectious episode were included in the final ROI. ROI segmentation was primarily conducted on lung window images, while mediastinal window images were additionally reviewed when necessary to clarify ambiguous lesion boundaries. The lesions were manually segmented slice by slice to construct a three-dimensional ROI for radiomics analysis. Only regions considered to represent active infection were included in the ROI. Radiomics features extraction and selection Radiomics feature extraction method and feature details are presented in Supplementary Information S4. A total of 2,264 radiomic features were extracted. To mitigate overfitting and reduce model complexity, univariable feature selection was firstly performed using the Mann–Whitney U test, and the false discovery rate (FDR) was controlled using the Benjamini–Hochberg procedure to account for multiple comparisons. Only radiomics features with an adjusted P-value < 0.05 were considered statistically significant and retained for further analysis. Subsequently, Pearson correlation coefficient analysis was conducted to assess feature redundancy; for pairs of features exhibiting high correlation (|r| > 0.95), the feature with the higher P value from the Mann–Whitney U test was excluded. Finally, the most informative radiomic features for predicting the endpoint outcome were identified using the least absolute shrinkage and selection operator regression. The optimal penalty parameter (lambda) was determined through 10-fold cross-validation. To ensure the integrity of the model evaluation, all feature selection procedures were strictly performed within the training dataset. Selection of the clinical variables Clinical variables for each patient were extracted from the electronic medical record system, including radiological features (ROI Volume and ROI Average HU Value), epidemiologic factors (sex, age, nonproductive cough, hemoptysis, dyspnea, chest pain, confusion, chest tightness, myalgia, duration of symptoms, and fever), and laboratory findings (white blood cell count, neutrophil count, lymphocyte count, neutrophil-to-lymphocyte ratio, monocyte count, eosinophil count, basophil count, red blood cell count, hemoglobin, and C-reactive protein. Univariate logistic regression analysis was performed to evaluate the association between each clinical variable and fungal infection status. Variables demonstrating a significant association (P < 0.05) were subsequently included in the multivariate regression analysis, and variables with P < 0.05 in the multivariate model were selected for further analysis. Model development and evaluation Prior to model development, multiple well-established and widely applied machine learning algorithms were evaluated, including linear discriminant analysis (LDA), k-nearest neighbor (KNN), logistic regression (LR), naïve Bayes (NB), random forest (RF), and support vector machine (SVM) classifiers. These models were compared within the development cohort using 4-fold cross-validation to ensure robustness and generalizability. To mitigate the inherent class imbalance, we implemented a weighted learning strategy across all models. For LR, SVM, and RF, the loss functions were penalized by incorporating a class-weighting parameter inversely proportional to class frequencies. For LDA and NB, the prior probabilities were manually adjusted to 0.5 to ensure equal consideration of both classes. For KNN, a distance-based weighting scheme was employed to refine the classification boundary. The predictive performance of the classifiers was primarily quantified using AUC. The optimal classifier was selected based on its validation AUC and the consistency of its performance across both the training and validation datasets. This selection strategy prioritized generalizability over raw training performance to minimize potential overfitting, thereby enhancing the robustness of the model when applied to unseen data. Based on the selected machine learning classifier, three distinct predictive models were constructed in the training dataset: a clinical model utilizing only the selected clinical variables, a radiomics model incorporating solely the selected radiomic features, and a combined model that integrated both clinical and radiomic features. The performance of these models was evaluated and compared in both the internal and external validation datasets through receiver operating characteristic analysis with respect to the area under the curve (AUC). Additionally, the detailed sensitivity, specificity, positive predictive value, and negative predictive value for each model were computed at the optimal cutoff point, which was determined using the maximum Youden index (defined as sensitivity + specificity − 1) within the training dataset. Model calibration was assessed using the Brier score, which quantifies the mean squared difference between the predicted probabilities and the actual endpoints (i.e., fungal infection status), with lower values indicating better calibration. The goodness-of-fit was evaluated via calibration analysis, assessing the agreement between predicted probabilities and observed outcomes using the Hosmer–Lemeshow test. Clinical utility was evaluated using decision curve analysis by comparing the net benefits of the models across a range of threshold probabilities. The Net Reclassification Improvement and Integrated Discrimination Improvement were also calculated to assess the added clinical value of the combined model. SHAP analysis In order to assess the contribution of each feature in a predictive model, the SHapley Additive exPlanations (SHAP) analysis was performed to enhance model interpretability. Based on the concept of Shapley values from cooperative game theory, SHAP quantifies the impact of each feature on model predictions by decomposing the output into additive contributions of individual variables. This approach provides both global insights into overall feature importance and local explanations of specific predictions, offering a transparent, visual interpretation of model behavior. Statistical analysis All statistical analyses were performed using SPSS software (version 21.0). One-way analysis of variance was used to compare quantitative variables across groups, and the chi-square test was used for categorical variables. Differences between two AUCs were assessed using the DeLong test. All statistical tests were two-sided, and a P value less than 0.05 was considered indicative of statistical significance. Model development and validation were conducted on the InferScholar platform (version 3.5, Infervision). SHAP analysis and decision curve analysis were conducted using R software (version 3.6.3) with the shapviz and rmda packages, respectively. Results Patient characteristics The prevalence of invasive fungal infection was 18.8% (45 of 239) in the training dataset, 18.8% (19 of 101) in the internal validation dataset, and 20.0% (46 of 230) in the external validation dataset, with no significant differences in fungal infection prevalence observed across the three datasets. The study mainly involved mold-related invasive fungal infections, although the exact species distribution could not be fully characterized because microbiological confirmation was unavailable in some cases. As summarized in Table 1, the external validation dataset demonstrated significantly higher values for ROI volume, male prevalence, age, prevalence of productive cough, white blood cell count, and neutrophil-to-lymphocyte ratio compared with the training and internal validation datasets. Conversely, the prevalence of nonproductive cough, chest tightness, myalgia, fever, duration of symptoms, hemoglobin level, and lymphocyte count were significantly lower in the external validation dataset than in the training and internal validation datasets. No significant differences were observed in the remaining clinical variables across the datasets. Table 1Comparison of patient characteristics across the training, internal validation and external validation datasets.Clinical variablesTraining dataset(n = 239)Internal validationdataset (n = 101)External validationdataset (n = 230)P-valueRadiological feature ROI Volume (Mean ± SD, cm3)218.3 ± 282.8157.5 ± 191.9340.8 ± 341.3 < 0.001 ROI Average HU Value (Mean ± SD, HU)-508.1 ± 115.0-497.2 ± 131.1-499.3 ± 149.5 0.722 Epidemiologic factors Gender, male, n (%)134 (56.1)44 (43.6)153 (66.5) < 0.001 Age (Mean ± SD, years)62.1 ± 19.357.5 ± 17.368.4 ± 15.3 < 0.001 Non-productive cough, yes, n (%)30 (12.6)12 (11.9)7 (3.0) < 0.001 Productive cough, yes, n (%)193 (80.8)84 (83.2)223 (97.0) < 0.001 Hemoptysis, yes, n (%)22 (9.2)9 (8.9)17 (7.4) 0.764 Dyspnea, yes, n (%)115 (48.1)46 (39.6)74 (32.2) 0.001 Chest pain, yes, n (%)35 (16.3)15 (14.9)26 (11.3) 0.503 Confusion, yes, n (%)2 (0.8)0 (0)1 (0.4) 0.603 Chest tightness, yes, n (%)203/3679/22220/10 < 0.001 Myalgia, yes, n (%)190/4979/22227/3 < 0.001 Duration of Symptoms (Median, Q1, Q3, days)7.0 (4.0, 15.0)7.0 (4.0, 15.0)5.0 (3.0, 10.0) < 0.001 Fever, yes, n (%)139 (58.2)61 (60.4)102 (44.3) 0.003 Laboratory findings White Blood Cell (Median, Q1, Q3, 10^9)7.50 (5.59, 9.98)7.44 (5.51, 10.04)8.36 (6.49, 11.24) 0.022 Neutrophil (Median, Q1, Q3, 10^9)5.57 (4.00, 8.05)5.49 (3.76, 7.77)6.48 (4.65, 9.27) 0.003 Lymphocyte (Median, Q1, Q3, 10^9)1.16 (0.85, 1.55)1.19 (0.89, 1.63)0.99 (0.59, 1.42) 0.011 Monocyte (Median, Q1, Q3, 10^9)0.53 (0.38, 0.69)0.50 (0.35, 0.70)0.52 (0.35, 0.73) 0.452 Eosinophil (Median, Q1, Q3, 10^9)0.05 (0.01, 0.12)0.06 (0.01, 0.15)0.04 (0.01, 0.15) 0.627 Basophil (Median, Q1, Q3, 10^9)0.02 (0.01, 0.03)0.02 (0.01, 0.03)0.02 (0.01, 0.03) 0.767 Red Blood Cell (Median, Q1, Q3, 10^12)4.38 (3.95, 4.80)4.44 (4.18, 4.77)4.18 (3.70, 4.62) 0.917 Hemoglobin (Median, Q1, Q3, g/L)131.0 (118.0, 144.0)132.0 (120.0, 141.0)125.0 (109.0, 139.0) < 0.001 C-reactive Protein (Median, Q1, Q3, mg/L)31.9 (10.8, 62.9)31.9 (9.5, 73.9)34.7 (8.8, 83.7) 0.665 Neutrophil/Lymphocyte Ratio (Median, Q1, Q3)4.82 (3.16, 7.60)4.75 (2.90, 6.98)6.49 (3.57, 13.26) < 0.001 ROI, Region of interest; HU, Hounsfield Unit. Table 1Comparison of patient characteristics across the training, internal validation and external validation datasets.Clinical variablesTraining dataset(n = 239)Internal validationdataset (n = 101)External validationdataset (n = 230)P-valueRadiological feature ROI Volume (Mean ± SD, cm3)218.3 ± 282.8157.5 ± 191.9340.8 ± 341.3 < 0.001 ROI Average HU Value (Mean ± SD, HU)-508.1 ± 115.0-497.2 ± 131.1-499.3 ± 149.5 0.722 Epidemiologic factors Gender, male, n (%)134 (56.1)44 (43.6)153 (66.5) < 0.001 Age (Mean ± SD, years)62.1 ± 19.357.5 ± 17.368.4 ± 15.3 < 0.001 Non-productive cough, yes, n (%)30 (12.6)12 (11.9)7 (3.0) < 0.001 Productive cough, yes, n (%)193 (80.8)84 (83.2)223 (97.0) < 0.001 Hemoptysis, yes, n (%)22 (9.2)9 (8.9)17 (7.4) 0.764 Dyspnea, yes, n (%)115 (48.1)46 (39.6)74 (32.2) 0.001 Chest pain, yes, n (%)35 (16.3)15 (14.9)26 (11.3) 0.503 Confusion, yes, n (%)2 (0.8)0 (0)1 (0.4) 0.603 Chest tightness, yes, n (%)203/3679/22220/10 < 0.001 Myalgia, yes, n (%)190/4979/22227/3 < 0.001 Duration of Symptoms (Median, Q1, Q3, days)7.0 (4.0, 15.0)7.0 (4.0, 15.0)5.0 (3.0, 10.0) < 0.001 Fever, yes, n (%)139 (58.2)61 (60.4)102 (44.3) 0.003 Laboratory findings White Blood Cell (Median, Q1, Q3, 10^9)7.50 (5.59, 9.98)7.44 (5.51, 10.04)8.36 (6.49, 11.24) 0.022 Neutrophil (Median, Q1, Q3, 10^9)5.57 (4.00, 8.05)5.49 (3.76, 7.77)6.48 (4.65, 9.27) 0.003 Lymphocyte (Median, Q1, Q3, 10^9)1.16 (0.85, 1.55)1.19 (0.89, 1.63)0.99 (0.59, 1.42) 0.011 Monocyte (Median, Q1, Q3, 10^9)0.53 (0.38, 0.69)0.50 (0.35, 0.70)0.52 (0.35, 0.73) 0.452 Eosinophil (Median, Q1, Q3, 10^9)0.05 (0.01, 0.12)0.06 (0.01, 0.15)0.04 (0.01, 0.15) 0.627 Basophil (Median, Q1, Q3, 10^9)0.02 (0.01, 0.03)0.02 (0.01, 0.03)0.02 (0.01, 0.03) 0.767 Red Blood Cell (Median, Q1, Q3, 10^12)4.38 (3.95, 4.80)4.44 (4.18, 4.77)4.18 (3.70, 4.62) 0.917 Hemoglobin (Median, Q1, Q3, g/L)131.0 (118.0, 144.0)132.0 (120.0, 141.0)125.0 (109.0, 139.0) < 0.001 C-reactive Protein (Median, Q1, Q3, mg/L)31.9 (10.8, 62.9)31.9 (9.5, 73.9)34.7 (8.8, 83.7) 0.665 Neutrophil/Lymphocyte Ratio (Median, Q1, Q3)4.82 (3.16, 7.60)4.75 (2.90, 6.98)6.49 (3.57, 13.26) < 0.001 ROI, Region of interest; HU, Hounsfield Unit. Comparison of patient characteristics across the training, internal validation and external validation datasets. ROI, Region of interest; HU, Hounsfield Unit. Selection of radiomics features Following significance testing and Pearson correlation analysis, 63 radiomics features were retained for least absolute shrinkage and selection operator regression analysis. As shown in Fig. 2, a total of six radiomics features associated with fungal infection, each with a nonzero coefficient, were selected for model development using the optimal tuning parameter (lambda = 0.0536). Heatmap of the selected radiomics features, based on standardized feature values, was presented in Figure S2. Fig. 2Selection of radiomics features using the least absolute shrinkage and selection operator regression. (A). Selection of the optimal tuning parameter lambda. (B). The coefficient profile plot of 6 non-zero coefficients against the optimal log(lambda) sequence. Selection of radiomics features using the least absolute shrinkage and selection operator regression. (A). Selection of the optimal tuning parameter lambda. (B). The coefficient profile plot of 6 non-zero coefficients against the optimal log(lambda) sequence. Selection of clinical variables A total of 24 clinical variables were collected and analyzed using univariate logistic regression. As shown in Table 2, ROI volume, dyspnea, age, and sex were significantly associated with invasive fungal infection in the multivariate regression analysis and were subsequently incorporated into the development of the clinical and combined models. Table 2Univariate and multivariate analysis of the clinical variables.VariableUnivariateMultivariateOdds ratio95% CI P Odds ratio95% CI P ROI Average HU Value1.0000.998–1.001 0.746 ROI Volume3.1371.829–5.382 < 0.001 2.3371.316–4.148 0.006 Chest pain0.6870.367–1.291 0.244 Chest tightness0.9550.522–1.748 0.882 Confusion0.0000.000–0.000 0.998 Duration of Symptoms1.0121.001–1.023 0.028 1.0110.999–1.022 0.062 Dyspnea1.8671.270–2.745 0.002 1.7751.178–2.675 0.006 Fever0.8260.587–1.163 0.274 1.0390.995–1.085 0.081 Age1.0261.014–1.039 < 0.001 1.0161.001–1.030 0.032 Hemoptysis0.7870.372–1.663 0.530 Myalgia0.2900.123–0.684 0.005 0.4740.194–1.157 0.101 Non-productive cough0.3820.149–0.983 0.046 0.6040.226–1.617 0.316 Gender1.8871.248–2.853 0.003 1.5881.011–2.494 0.045 Productive cough1.5940.813–3.123 0.175 Basophil Count1.8310.165–20.347 0.623 C reactive Protein1.1650.739–1.836 0.510 Eosinophil Count0.8050.553–1.173 0.259 Hemoglobin0.5740.391–0.842 0.005 Lymphocyte Count0.7780.531–1.141 0.199 Monocyte Count1.0260.683–1.539 0.903 Neutrophil Count1.3180.918–1.892 0.134 Red Blood Cell Count0.5560.385–0.801 0.002 0.8390.619–1.138 0.259 White Blood Cell Count1.1760.831–1.664 0.360 NLR1.0070.995–1.020 0.260 ROI, Region of interest; HU, Hounsfield Unit; CI, confidence interval; NLR, neutrophil-to-lymphocyte ratio. Table 2Univariate and multivariate analysis of the clinical variables.VariableUnivariateMultivariateOdds ratio95% CI P Odds ratio95% CI P ROI Average HU Value1.0000.998–1.001 0.746 ROI Volume3.1371.829–5.382 < 0.001 2.3371.316–4.148 0.006 Chest pain0.6870.367–1.291 0.244 Chest tightness0.9550.522–1.748 0.882 Confusion0.0000.000–0.000 0.998 Duration of Symptoms1.0121.001–1.023 0.028 1.0110.999–1.022 0.062 Dyspnea1.8671.270–2.745 0.002 1.7751.178–2.675 0.006 Fever0.8260.587–1.163 0.274 1.0390.995–1.085 0.081 Age1.0261.014–1.039 < 0.001 1.0161.001–1.030 0.032 Hemoptysis0.7870.372–1.663 0.530 Myalgia0.2900.123–0.684 0.005 0.4740.194–1.157 0.101 Non-productive cough0.3820.149–0.983 0.046 0.6040.226–1.617 0.316 Gender1.8871.248–2.853 0.003 1.5881.011–2.494 0.045 Productive cough1.5940.813–3.123 0.175 Basophil Count1.8310.165–20.347 0.623 C reactive Protein1.1650.739–1.836 0.510 Eosinophil Count0.8050.553–1.173 0.259 Hemoglobin0.5740.391–0.842 0.005 Lymphocyte Count0.7780.531–1.141 0.199 Monocyte Count1.0260.683–1.539 0.903 Neutrophil Count1.3180.918–1.892 0.134 Red Blood Cell Count0.5560.385–0.801 0.002 0.8390.619–1.138 0.259 White Blood Cell Count1.1760.831–1.664 0.360 NLR1.0070.995–1.020 0.260 ROI, Region of interest; HU, Hounsfield Unit; CI, confidence interval; NLR, neutrophil-to-lymphocyte ratio. Univariate and multivariate analysis of the clinical variables. ROI, Region of interest; HU, Hounsfield Unit; CI, confidence interval; NLR, neutrophil-to-lymphocyte ratio. Machine learning classifier selection The receiver operating characteristic (ROC) analysis of the radiomics models based on LDA, KNN, LR, NB, RF, and SVM classifiers in four-fold cross-validation was presented in Fig. 3. The corresponding AUCs for each model were summarized in Table 3. Model robustness was assessed by comparing AUCs between the training and validation datasets. Although several complex models, such as RF and SVM, achieved competitive performance in the training dataset, they exhibited significant decreased generalizability in the validation dataset, suggesting potential overfitting. In contrast, the LDA- and LR-based models demonstrated more stable performance across datasets. Notably, the LDA model achieved the highest AUC in the validation dataset. Considering the relatively small sample size and high dimensionality of radiomics features, simpler linear classifiers such as LDA are less prone to overfitting and may provide better generalizability. In addition, LDA is computationally efficient, requires minimal hyperparameter tuning, and offers better interpretability, which facilitates clinical implementation. Therefore, the LDA classifier was selected as the optimal machine learning algorithm for constructing the clinical, radiomics, and combined models in this study. Fig. 3Comparison of different machine learning classifiers in the development cohort via 4-fold cross-validation. Comparison of different machine learning classifiers in the development cohort via 4-fold cross-validation. Table 3Detailed performance of the machine learning classifiers for invasive fungal infection identification in the development cohort through cross-validation.ClassifierTrainingValidationSignificant overfittingAUC95% CIP-valueAUC95% CIP-valueLDA0.7580.709–0.803 reference 0.7410.691–0.787 reference No (P = 0.066)KNN0.9060.870–0.935 < 0.001 0.6560.603–0.707 0.018 Yes (P < 0.001)LR0.7230.672–0.770 0.055 0.6450.591–0.696 0.004 No (P = 0.100)NB0.7480.698–0.793 0.639 0.7110.660–0.759 0.220 Yes (P < 0.001)RF1.0000.989-1.000 < 0.001 0.7070.655–0.755 0.194 Yes (P < 0.001)SVM0.8910.853–0.922 < 0.001 0.6060.552–0.658 0.001 Yes (P < 0.001)AUC, areas under the receiver operating characteristic curves; CI, confidence interval; LDA, confidence interval; Linear discriminant analysis; KNN, k-nearest neighbor; LR, logistic regression; NB, naïve Bayes; RF, random forest; SVM, support vector machine. Table 3Detailed performance of the machine learning classifiers for invasive fungal infection identification in the development cohort through cross-validation.ClassifierTrainingValidationSignificant overfittingAUC95% CIP-valueAUC95% CIP-valueLDA0.7580.709–0.803 reference 0.7410.691–0.787 reference No (P = 0.066)KNN0.9060.870–0.935 < 0.001 0.6560.603–0.707 0.018 Yes (P < 0.001)LR0.7230.672–0.770 0.055 0.6450.591–0.696 0.004 No (P = 0.100)NB0.7480.698–0.793 0.639 0.7110.660–0.759 0.220 Yes (P < 0.001)RF1.0000.989-1.000 < 0.001 0.7070.655–0.755 0.194 Yes (P < 0.001)SVM0.8910.853–0.922 < 0.001 0.6060.552–0.658 0.001 Yes (P < 0.001)AUC, areas under the receiver operating characteristic curves; CI, confidence interval; LDA, confidence interval; Linear discriminant analysis; KNN, k-nearest neighbor; LR, logistic regression; NB, naïve Bayes; RF, random forest; SVM, support vector machine. Detailed performance of the machine learning classifiers for invasive fungal infection identification in the development cohort through cross-validation. AUC, areas under the receiver operating characteristic curves; CI, confidence interval; LDA, confidence interval; Linear discriminant analysis; KNN, k-nearest neighbor; LR, logistic regression; NB, naïve Bayes; RF, random forest; SVM, support vector machine. Model performance evaluation As shown in Fig. 4, receiver operating characteristic (ROC) analysis demonstrated that the AUCs for the clinical, radiomics, and combined models were 0.777 (95% CI: 0.719–0.828), 0.765 (95% CI: 0.706–0.817), and 0.836 (95% CI: 0.783–0.881), respectively, in the training dataset; 0.719 (95% CI: 0.621–0.804), 0.724 (95% CI: 0.626–0.808), and 0.808 (95% CI: 0.718–0.880), respectively, in the internal validation dataset; and 0.707 (95% CI: 0.644–0.765), 0.709 (95% CI: 0.646–0.767), and 0.786 (95% CI: 0.728–0.837), respectively, in the external validation dataset. In the external validation cohort, the combined model achieved the best diagnostic performance (AUC 0.786, 95% CI 0.728–0.837), with a modest improvement over the clinical model (AUC 0.707, 95% CI 0.644–0.765) and the radiomics model (AUC 0.709, 95% CI 0.646–0.767). In the external validation dataset, the continuous Net Reclassification Improvement and Integrated Discrimination Improvement of the combined model compared with the radiomics model were 0.580 (95% CI, 0.269–0.890; p < 0.001) and 0.095 (95% CI, 0.030–0.160; p = 0.004), respectively, indicating meaningful improvement in risk reclassification and discrimination. Sensitivity, specificity, positive predictive value, and negative predictive value for the models in the training and validation datasets are summarized in Table 4. Fig. 4ROC analysis of the predictive models in (A) the training dataset, (B) the internal validation dataset and (C) the external validation dataset. ROC analysis of the predictive models in (A) the training dataset, (B) the internal validation dataset and (C) the external validation dataset. Table 4Model performance comparison in the training, internal validation and external validation datasets.DatasetModelAUC (95% CI)P-valueSENSPEPPVNPVTrainingClinical0.777 (0.719–0.828) 0.007 75.6%74.7%41.0%93.0%Radiomics0.765 (0.706–0.817) 0.010 66.7%71.7%35.3%90.3%Combined0.836 (0.783–0.881) reference 77.8%74.2%41.2%93.5%Internal validationClinical0.719 (0.621–0.804) 0.030 52.6%72.0%30.3%86.8%Radiomics0.724 (0.626–0.808) 0.048 57.9%74.4%34.4%88.4%Combined0.808 (0.718–0.880) reference 73.7%74.4%40.0%92.4%External validationClinical0.707 (0.644–0.765) 0.001 60.9%72.4%35.4%88.2%Radiomics0.709 (0.646–0.767) 0.042 52.2%71.4%31.2%85.7%Combined0.786 (0.728–0.837) reference 69.6%78.9%45.1%91.3%AUC, areas under the receiver operating characteristic curves; CI, confidence interval; SEN, sensitivity; SPE, specificity; PPV, positive predictive value; NPV, negative predictive value. Table 4Model performance comparison in the training, internal validation and external validation datasets.DatasetModelAUC (95% CI)P-valueSENSPEPPVNPVTrainingClinical0.777 (0.719–0.828) 0.007 75.6%74.7%41.0%93.0%Radiomics0.765 (0.706–0.817) 0.010 66.7%71.7%35.3%90.3%Combined0.836 (0.783–0.881) reference 77.8%74.2%41.2%93.5%Internal validationClinical0.719 (0.621–0.804) 0.030 52.6%72.0%30.3%86.8%Radiomics0.724 (0.626–0.808) 0.048 57.9%74.4%34.4%88.4%Combined0.808 (0.718–0.880) reference 73.7%74.4%40.0%92.4%External validationClinical0.707 (0.644–0.765) 0.001 60.9%72.4%35.4%88.2%Radiomics0.709 (0.646–0.767) 0.042 52.2%71.4%31.2%85.7%Combined0.786 (0.728–0.837) reference 69.6%78.9%45.1%91.3%AUC, areas under the receiver operating characteristic curves; CI, confidence interval; SEN, sensitivity; SPE, specificity; PPV, positive predictive value; NPV, negative predictive value. Model performance comparison in the training, internal validation and external validation datasets. AUC, areas under the receiver operating characteristic curves; CI, confidence interval; SEN, sensitivity; SPE, specificity; PPV, positive predictive value; NPV, negative predictive value. Calibration and decision curve analysis Good calibration was observed for all models. The Brier scores for the clinical, radiomics, and combined models were 0.168, 0.166, and 0.152, respectively, in the internal validation dataset, and 0.162, 0.154, and 0.134, respectively, in the external validation dataset. The Hosmer–Lemeshow test also indicated no evidence of significant deviation from an ideal fitting of the proposed models (all p > 0.05). Decision curve analysis in the validation datasets demonstrated that the combined model provided higher net benefit across nearly the entire range of threshold probabilities compared with both the clinical and radiomics models (Fig. 5). Fig. 5Decision curve analysis of the clinical model, radiomics model and combined model. (A) In the internal validation dataset, (B) in the external validation dataset. Decision curve analysis of the clinical model, radiomics model and combined model. (A) In the internal validation dataset, (B) in the external validation dataset. SHAP analysis The feature importance and individual contributions to positive and negative invasive fungal infection predictions in the combined model are illustrated in the summary plot, with the mean SHAP value for each feature also displayed (Fig. 6). Age exerted the greatest influence on the predictions of the combined model, while the three most important radiomics features were all high-order texture features. Among them, curvatureflow_glszm_ZoneEntropy reflected intralesional heterogeneity, indicating increased complexity and irregularity of intensity distribution. specklenoise_gldm_HighGrayLevelEmphasis and recursivegaussian_glrlm_ShortRunHighGrayLevelEmphasis were associated with high-intensity regions and fine textural patterns, suggesting the presence of dense, locally heterogeneous structures within the lesion. We hypothesize that these high-order features were macroscopic reflections of intralesional heterogeneity. Fig. 6SHAP analysis of the combined model. (A). The detailed contribution to the class 0 model prediction, where the colors represent the magnitude of the feature values. (B). The average SHAP value of each feature in the combined model. SHAP, SHapley additive explanations. SHAP analysis of the combined model. (A). The detailed contribution to the class 0 model prediction, where the colors represent the magnitude of the feature values. (B). The average SHAP value of each feature in the combined model. SHAP, SHapley additive explanations. Discussion This study developed an integrated machine learning model combining HRCT radiomics features and clinical variables to enable early risk stratification of invasive fungal infection (IFI) in community-acquired pneumonia (CAP). Because the model is based on routinely available HRCT images and clinical variables, it can be applied immediately after imaging acquisition, potentially allowing IFI risk stratification several days earlier than conventional diagnostic methods such as histopathology or microbial culture, which typically require 3–7 days. Comparative evaluation of six machine learning classifiers identified the Linear Discriminant Analysis (LDA) algorithm as demonstrating superior diagnosing performance and robustness, leading to its selection as our primary modeling framework. Through SHapley Additive exPlanations (SHAP) interpretability analysis, we determined that the model’s decision-making was predominantly driven by four key predictors: patient age along with three high-order radiomics features. In this study, significant differences in baseline characteristics were observed between the training, internal validation, and external validation datasets. Variations in ROI volume may impact volume-dependent features, such as shape and first-order metrics. The lower frequency of dyspnea in the external cohort may suggest a higher proportion of early or less symptomatic cases, while differences in age and gender may reflect variations in patient populations across centers. Such heterogeneity may influence model performance and introduce potential bias. However, it also reflects real-world clinical diversity and provides a more rigorous evaluation of model generalizability. Our combined model, including clinical variables and radiomics features, showed robust and consistent performance with the AUC only exhibited a marginal decrease from 0.808 in the internal validation dataset to 0.786 in the external validation dataset. Because IFI in CAP is clinically challenging and often difficult to confirm early using conventional microbiological or pathological methods, even a modest but consistent improvement in discrimination, reclassification, and net benefit may offer adjunctive clinical value for early risk stratification and individualized assessment, given the challenges of early IFI diagnosis in CAP. Current gold-standard diagnostic methods for IFI, including histopathological examination and microbial cultures, typically require 3–7 days to yield results7. Such diagnostic delays carry grave consequences, as mortality risk increases by 33% for every 24-hour delay in initiating appropriate antifungal therapy20. Notably, invasive aspergillosis complicates 19% of severe influenza cases, with associated mortality rates doubling compared to controls21. Current guidelines emphasize the importance of diagnosis-driven therapy for high-risk patients with evidence of IFI22. However, conventional CT interpretation faces limitations, radiologist agreement for characteristic signs like the halo sign remains suboptimal, and most early IFI cases lack pathognomonic imaging features23,24. Our model overcomes these challenges by extracting and quantifying subvisual biological information from HRCT images that reflect lesion heterogeneity. Importantly, while polymicrobial infections are common, HRCT provides direct visualization of pulmonary pathology. Our approach leverages existing HRCT data without requiring additional examinations, thereby enabling early IFI risk stratification without imposing additional economic or physiological burdens on patients, while simultaneously avoiding diagnostic delays inherent to conventional methods. Recent retrospective studies have highlighted the diagnostic potential of radiomics in detecting IFI in pulmonary diseases. Most research supports integrated models that combine clinical, radiological, and radiomic features, demonstrating their incremental diagnostic value. For instance, Yan et al. showed that a combined deep learning and radiomics approach effectively differentiated IFIs from bacterial infections in patients with hematologic malignancies, achieving an AUC of 0.844 in internal validation which significantly outperforming radiomics (AUC of 0.767) and clinical models (AUC of 0.696)14. Similarly, Gong et al. reported that radiomics could discriminate IFI from bacterial pneumonia with high accuracy (AUC of 0.911 and accuracy of 0.837) in an internal validation cohort16. Zhang et al. further validated the efficacy of a combined model integrating clinical, CT radiomic, and deep learning features for predicting invasive pulmonary aspergillosis25. In our study, a combined clinical-radiological model exhibited robust diagnostic performance for IFI in CAP. Furthermore, validation in an independent external cohort supported the model’s generalizability and reliability. Only a limited number of clinical variables were retained in the final model. This likely reflects, at least in part, collinearity among candidate predictors, particularly among inflammatory and immune-related markers, which may reduce the apparent independent contribution of individual variables in multivariable modeling. In addition, the predictive value of biomarkers such as CRP, NLR, and immune markers may be influenced by cohort-specific factors, including differences in disease severity, timing of testing, prior treatment, and center-level practice patterns. Therefore, their exclusion from the final model should not be interpreted as evidence of a lack of clinical relevance, but rather as a reflection of their limited incremental contribution within the present dataset. Advanced age constitutes a major independent risk factor for IFI. Elderly patients typically present with a greater comorbidity burden, including chronic obstructive pulmonary disease, diabetes mellitus, and prolonged glucocorticoid/immunosuppressant use, all of which collectively compromise host defenses against fungal pathogens26,27. At the immunological level, aging is characterized by progressive T-cell dysfunction (evidenced by CD4+/CD8 + ratio disturbances) and diminished neutrophil capacity28,29. Clinically, these vulnerabilities translate to more severe disease presentations, as reflected by larger pulmonary infiltrates and increased dyspnea frequency. An intriguing gender disparity exists in IFI epidemiology, the incidence of IFI is higher in male patients30. Current evidence suggests estrogen-mediated protection in females through augmentation of innate immune cell31. SHAP analysis is an interpretable machine learning method based on game theory32,33. To address the “black box” nature of machine learning models, we employed SHAP interpretability analysis to evaluate features in our model and quantify their respective SHAP values. This approach offers two key clinical advantages:1 it enhances physicians’ understanding of the model’s decision-making logic, thereby mitigating concerns about algorithmic opacity;2 for individual patients, it provides intuitive visualization of personalized risk factor combinations. This study had some limitations. Firstly, the retrospective design may introduce selection bias, information bias, and unmeasured confounding. Although we included an external validation cohort from a second center, all data originated from two hospitals in the same regional healthcare system, lacking geographically diverse or truly independent cohorts. Therefore, the model’s generalizability is limited and should not be overstated. Prospective, multi-center, cross-regional validation is required to confirm robustness and clinical applicability. Second, despite feature selection, internal validation, and independent external validation, potential overfitting cannot be completely excluded, particularly given the relatively limited sample size and high-dimensional radiomics features. Third, microbiological confirmation posed challenges in our cohort. Although we rigorously excluded IFI through standardized diagnostic criteria, approximately 40%–60% of cases lacked definitive pathogen identification. This diagnostic gap may reflect either technical limitations in conventional microbiological methods or infections caused by fastidious or atypical pathogens. Because microbiological confirmation was unavailable in a proportion of cases, the fungal species spectrum in this cohort could not be fully characterized. A significant methodological consideration is the exclusion of COPD as a covariate in our predictive model. This decision was based on two factors:1 the majority of patients in our cohort presented with first-episode pneumonia, and documentation of pre-existing COPD in the medical records was incomplete; and2 COPD-related data were not systematically recorded for all patients, which may have introduced substantial misclassification bias if included in the model. Another limitation involves the modeling strategy. Although several machine learning algorithms were compared, advanced integration and deep learning frameworks were not explored. While such methods can capture complex nonlinear relationships, they often require larger datasets to ensure robustness and avoid overfitting. Given our sample size, we prioritized an interpretable pipeline to enhance clinical applicability and reproducibility. Future studies will investigate multimodal integration strategies to further optimize predictive performance. Conclusions A radiomics-based machine learning model can effectively support early risk stratification and diagnostic suspicion of IFI in patients with CAP, with favorable interpretability. The combined model outperformed the radiomics and clinical models and may serve as a preliminary adjunctive tool for early, individualized IFI risk assessment before definitive microbiological or pathological confirmation. Furthermore, SHAP analysis improved model interpretability and helped illustrate the contribution of key predictors, supporting the adjunctive clinical utility of the model with modest incremental performance. Supplementary Information Below is the link to the electronic supplementary material. Supplementary Material 1 Supplementary Material 1