Research Article

Automated Machine Learning Model for Non-Alcoholic Fatty Liver Disease Prediction and External Cohort Validation

120 views

DOI:

10.3791/70033

July 3rd, 2026

 ,  ,  ,  ,  ,  ,  , 

Corresponding Authors: Wenyue Liu <liuwenyue@wmu.edu.cn>, Gang Xu <xugang217@163.com>, Shuying Chen <wyyycsy@163.com>

* These authors contributed equally

In This Article

Summary

A step-by-step AutoML protocol is presented to screen for nonalcoholic fatty liver disease using NHANES data and an external cohort. The method automates feature prioritization and model selection (GBM), and includes SHAP-based interpretation and external validation for reproducible clinical deployment.

Abstract

Non-alcoholic fatty liver disease (NAFLD) is a common liver disorder associated with obesity, insulin resistance, and metabolic syndrome, often going undiagnosed until advanced stages. Traditional diagnostic methods, including imaging and liver biopsy, have limitations in early detection. There is a need for an efficient, non-invasive tool for early NAFLD screening. Using automated machine learning (AutoML) technology, a diagnostic model for NAFLD was developed leveraging a large dataset from NHANES (n = 2677). Additionally, an independent external validation cohort (n = 200) was employed to assess the external validity and performance of the model. For selection of promising clinical features, A two-stage feature selection method was applied, combining LASSO regression with ChatGPT-4-based intelligent analysis. Subsequently, the AutoML process, which integrated multiple machine learning algorithms, was performed for model training and validation. The model's performance was evaluated using ROC curves, F1 scores, and SHapley additive explanation (SHAP) analysis. The GBM model achieved an AUC of 0.843 in the training set, 0.851 in the testing set, and 0.945 in the external validation set, demonstrating high diagnostic accuracy across different datasets. Key predictors, including BMI, triglycerides, and GGT, were identified as significant contributors to the model’s predictions. SHAP analysis further confirmed the importance of these variables in predicting NAFLD. The AutoML-driven diagnostic model for NAFLD demonstrated significantly improved early-detection performance, offering a reliable, non-invasive, and efficient alternative to conventional diagnostic methods. This method holds great potential for broader clinical application in NAFLD, diminishing dependence on expert knowledge while improving diagnostic precision.

Introduction

Non-alcoholic fatty liver disease (NAFLD) is one of the most prevalent liver diseases globally, currently affecting approximately 35% of the adult population worldwide, and is not attributable to excessive alcohol consumption1. It is characterized by the accumulation of fat in more than 5% of hepatocytes, which can potentially progress to more severe conditions, including inflammation, liver fibrosis, cirrhosis, and ultimately liver failure2,3. Currently, the traditional methods for diagnosing NAFLD primarily rely on abnormal liver biochemical markers and ultrasound imaging. However, ultrasound exhibits limited sensitivity when the degree of steatosis is below 20%, which compromises its reliability in detecting mild fat infiltration and often leads to missed diagnoses of early-stage NAFLD4. Although liver biopsy is considered the gold standard for diagnosing NAFLD, its invasive nature and the risk of complications such as pain, infection, and bleeding restrict its feasibility for large-scale screening5. Consequently, there is an urgent need for an efficient, non-invasive, cost-effective, and highly sensitive tool to facilitate NAFLD screening.

With the rapid development of artificial intelligence (AI) and machine learning (ML) technologies, data-driven approaches offer new solutions for the early diagnosis and risk assessment of NAFLD. By analyzing large-scale, complex data, ML technologies can automatically identify potential patterns and relationships, and have been widely applied in the diagnosis and prediction of various diseases6. For example, ML algorithms were used to predict the risk of cirrhosis in individuals with chronic hepatitis B virus infection, achieving promising results7. Similar studies in the NAFLD field have successfully developed diagnostic models using traditional machine learning algorithms, such as support vector machines (SVM) and random forests (RF), achieving high levels of accuracy and demonstrating strong clinical applicability8,9,10,11,12,13,14,15,16,17,18. For instance, researchers developed a machine learning model utilizing laboratory parameters to effectively screen out NAFLD in the general population through the analysis of routine laboratory data. An ML model utilizing laboratory parameters was developed13 to effectively screen out NAFLD in the general population through the analysis of routine laboratory data. The prevalence of NAFLD in the USA was predicted by combining transient elastography with machine learning methods using NHANES 2017–2018 data16. The research team utilized machine learning algorithms to investigate the correlation between transient elastography and other clinical variables, developing a predictive model that reliably estimated the prevalence of NAFLD across diverse populations.

However, traditional machine learning methods typically demand substantial manual effort, particularly in feature engineering, model selection, and parameter tuning, which require specialized knowledge and experience. To address these limitations, automated machine learning (AutoML) has been developed. AutoML automates the entire model building pipeline, encompassing data preprocessing, feature selection, model selection, and hyperparameter optimization, thereby substantially enhancing both the efficiency and accuracy of machine learning processes19. A predictive model for esophageal variceal bleeding was developed and validated using the H2O AutoML platform20. The model employed various algorithms, including deep learning (DL), eXtreme Gradient Boosting (XGBoost), generalized linear models (GLM), gradient boosting machines (GBM), random forests (RF), and stacking ensembles, with a 12-month prediction horizon. AutoML was employed to predict the risk of liver metastasis in gastrointestinal stromal tumor patients, leveraging data from the SEER database21. AutoML platforms were leveraged to develop a fast and cost-effective diagnostic tool for prostate cancer using routine clinical data22. The emergence of AutoML has offered more efficient solutions for clinical diagnosis, and its potential in NAFLD screening deserves further exploration. While the early detection and accurate diagnosis of NAFLD are crucial, the asymptomatic nature of the disease poses significant diagnostic challenges. Although AutoML technology has shown great potential in disease diagnosis, its application in NAFLD diagnosis remains restricted, underscoring the promising prospects of this research field.

This study developed a non-alcoholic fatty liver disease (NAFLD) diagnostic model by leveraging AutoML technology in conjunction with transient elastography, utilizing data from the US NHANES database (2017–2018). The model was externally validated using a dataset from individuals at the Department of Infectious Diseases, First Affiliated Hospital of Wenzhou Medical University (2018–2020). The study assessed the model's performance on an external dataset and compared it with traditional methods, thereby addressing existing research gaps. Through the analysis of multiple blood and biochemical markers, predictive models were constructed using algorithms such as logistic regression and random forests. The results indicated the model's superior performance in accurately identifying non-NAFLD individuals. This not only offers an efficient and precise tool for early NAFLD screening but also advances the integration of AutoML in medical applications.

Protocol

Patients and study design

The first dataset of this study was obtained from the National Health and Nutrition Examination Survey (NHANES) database for the 2017–2018 period. This specific timeframe was selected because the survey data included liver ultrasound transient elastography measurements using FibroScan® technology. NHANES employs a stratified, multi-stage probability sampling design and serves as a nationwide, population-based survey conducted biennially. It systematically gathers nationally representative health-related data on the non-institutionalized U.S. population to evaluate the nutritional and health status of the general civilian population in the United States1. The NHANES is a nationally representative cross-sectional study administered by the National Center for Health Statistics (NCHS). The survey protocol received approval from the NCHS Research Ethics Review Board, with documented informed consent obtained from all participants. The study was conducted in accordance with both the Declarations of Helsinki and Istanbul, and was approved by the ethics committee of the First Affiliated Hospital of Wenzhou Medical University (2016–246, 1 December 2016), and written informed consent was obtained from each participant.

The first dataset consisted of 5494 individuals from the NHANES 20172018 survey who underwent FibroScan examination. Following the exclusion below, a total of 2677 participants were included in the analysis, comprising 718 individuals with NAFLD and 1959 with non- NAFLD. These participants were then randomly divided into a training set (n = 1785) and a testing set (n = 892). The second dataset comprised 582 individuals from the Department of Infectious Diseases at the First Affiliated Hospital of Wenzhou Medical University (2018–2020). After applying the same exclusion criteria, a total of 200 individuals were included, consisting of 159 individuals with NAFLD and 41 individuals with non-NAFLD. This cohort was utilized as an independent validation set. The study design was developed to construct and validate the model using multi-center data, thereby enhancing the reliability and generalizability of the findings. Baseline clinical characteristics of the NAFLD and non-NAFLD groups were summarized using the table one package (Table 1). Additionally, the process of patient selection and the overall study flow are illustrated in Figure 1.

Diagnostic criteria and exclusion criteria for NAFLD

NAFLD diagnosis was based on the following criteria16: age 18 years or older, participation in transient elastography (FibroScan) screening with alcohol intake limited to ≤140 g/week for women and ≤ 210 g/week for men over the prior 12 months, a controlled attenuation parameter (CAP) value of ≥ 302 dB/m as measured using the FibroScan 502 V2 Touch system (Echosens, Paris, France) with either a medium (M) or extra‑large (XL) probe, or a diagnosis confirmed by liver biopsy pathology at the Department of Infectious Diseases of the First Affiliated Hospital of Wenzhou Medical University23.

The exclusion criteria for NAFLD are outlined as follows:.high alcohol consumption (average daily intake > 20 g for women and > 30 g for men according to the NHANES alcohol use survey5), presence of hepatitis B or C, HIV infection, autoimmune hepatitis, primary biliary cholangitis, Wilson’s disease, long‑term use of nonsteroidal anti‑inflammatory drugs, calcium channel blockers, tamoxifen, amiodarone, corticosteroids, isoniazid, or methotrexate, pregnancy or breastfeeding, and a diagnosis of liver cancer or any other benign or malignant tumor.

Data collection and variable selection

The potential predictor variables included in this study are listed below:

Demographic characteristics (i.e., age and gender); Body mass index (BMI); CAP values of participants in the NHANES database; General biochemistry tests [i.e., Albumin(ALB), Globulin (GLO), Total Protein (TP), Lactate Dehydrogenase (LDH), Blood Urea Nitrogen (BUN), Uric Acid (UA), Gamma-Glutamyl Transferase (GGT), Triglyceride (TG), Serum-Glucose (Glu), Serum Creatinine (SCr), Total Bilirubin (TBIL), Sodium (Na⁺), Chloride (Cl⁻), Potassium (K⁺), Calcium (Ca), Bicarbonate (HCO₃), Total Cholesterol(TC), Aspartate Aminotransferase (AST) and Alanine Aminotransferase (ALT)]; Standard hematological parameters [i.e., Red Blood Cells counts (RBC), White blood cell counts (WBC), Neutrophil Counts (NEUT), Eosinophil counts (EOS), lymphocyte counts (LYM), Monocyte counts (MON), Red cell distribution width (RDW) and Platelet counts (PLT)]; History of hypertension and diabetes mellitus (DM). Among the subjects included in the study, the diagnostic criteria for diabetes and hypertension were obtained from a prior machine-learning-based prediction model study focused on NAFLD24.

Missing data handling and feature selection

The cohort data utilized in this study included missing values. Excluding all incomplete records would not only diminish the analysis sample size but also compromise data quality and potentially bias the prediction results. Therefore, any data with missing values exceeding 20% were excluded. For datasets with missing values ≤20%, different imputation methods were applied based on the data type: "norm" for continuous variables, "logreg" for binary classification variables, and "polyreg" for multiclass variables. These imputations were conducted using the "mice" package in R for multiple imputation25. In this study, all continuous variables were dichotomized into binary variables, with optimal classification thresholds determined via receiver operating characteristic (ROC) curve analysis. Specifically, the cut-off point corresponding to the maximum Youden Index on the ROC curve was selected as the optimal classification criterion, thereby optimizing classification performance while maintaining an appropriate balance between sensitivity and specificity. Subsequently, partial least squares discriminant analysis (PLS-DA) was employed to cluster the data effectively.

For further feature selection, individuals were randomly allocated into training and testing sets at a 7:3 ratio using the "caret" package. First, the least absolute shrinkage and selection operator (LASSO) regression was utilized for feature selection, identifying 14 key variables for subsequent analysis. Next, ChatGPT-4 was applied to assign an importance score to each variable. To systematically evaluate feature importance while controlling for potential bias and stochastic variation, a standardized assessment protocol was implemented. The specific prompt provided to the model was: "Based on established clinical literature regarding non-alcoholic fatty liver disease (NAFLD), assign an importance score ranging from 1 (lowest) to 10 (highest) for each of the following 14 variables identified via LASSO regression." By restricting the evaluation strictly to the variables pre-selected by LASSO regression, the risk of incorporating hallucinated or irrelevant features was minimized. To strictly prevent potential data leakage and inadvertent use of outcome prevalence, the language model was entirely blinded to the empirical dataset. The scoring was isolated to synthesizing pre-existing medical knowledge regarding the variable names. This procedure enhances traditional methodologies, such as LASSO stability selection or SHAP-based pruning, by ensuring that purely data-driven features exhibit robust pathophysiological plausibility before final model integration. Additionally, to mitigate single-response variance, this procedure was iterated 10 times independently. The mean score for each variable was computed across these iterations, ensuring an objective prioritization. Variables were then ranked in descending order based on their mean scores. Finally, the selection was narrowed down to include only those variables with an average importance score exceeding 5, resulting in 8 key variables: SCr, UA, GGT, Glu, Hypertension, Diabetes, TG, and BMI.

Development of AutoML - based prediction models for NAFLD

In this study, a comprehensive suite of classical and advanced machine learning algorithms was integrated using H2O AutoML for the effective diagnosis of NAFLD. By leveraging the AutoML capabilities of the H2O.ai platform, machine learning analyses for binary classification tasks were conducted. The algorithms utilized included eXtreme Gradient Boosting (XGBoost), Gradient Boosting Machine (GBM), Generalized Linear Model (GLM), Extremely Randomized Trees (XRT), Deep Learning (DL), and Stacked Ensemble. These algorithms were systematically evaluated to identify the optimal model for disease diagnosis. To ensure rigorous methodological reproducibility, the execution parameters of H2O AutoML were explicitly defined. The automated search was limited to a maximum runtime of 11,687 seconds and a maximum of 302 models, utilizing a fixed random seed of 13. Internal preprocessing flags included automatic imputation of residual missing values using mean/mode algorithms, as well as target encoding for high-cardinality categorical variables. The selected optimal architecture (labeled GBM_grid_1_model77) was a gradient boosting machine with the following specific hyperparameters: a total of 28 trees, a maximum tree depth of 5, and a learning rate of 0.1.

To enhance model robustness and mitigate overfitting risks, an AutoML framework incorporating systematic hyperparameter tuning and validation protocols was implemented. The process began with automated exploration of 200 distinct model configurations through hyperparameter optimization, employing 5-fold cross-validation where the training dataset was partitioned into five mutually exclusive subsets. During iterative training, each configuration utilized four subsets (80%) for model building while reserving one subset (20%) for validation, with this validation role rotating sequentially across all folds. To balance computational efficiency with performance optimization, dynamic early stopping was implemented based on the area under the ROC curve (AUC) metric. This mechanism suspended training when AUC improvements fell below a 0.001 threshold for three consecutive cycles, applying to both individual model refinement and the overall AutoML search process. Final model selection prioritized configurations demonstrating maximum average AUC across both training and validation sets, while simultaneously requiring consistent performance between these sets and minimal metric variance across cross-validation iterations. This integrated approach ensured optimal predictive accuracy while maintaining strong generalizability through rigorous validation protocols and automated optimization constraints.

Model performance evaluation and interpretation of prediction results

Model performance and the interpretation of prediction results were comprehensively assessed using ROC curves, F1 scores, and SHapley additive explanation (SHAP) analysis. The model's performance and the interpretation of its prediction results were comprehensively evaluated using ROC curves, F1 scores, and SHapley Additive Explanation (SHAP) analysis. Initially, predictions were generated on the test dataset using the trained model, and the predicted probabilities for the positive class (i.e., class 1) were extracted (pred_prob). The ROC curve was constructed using the pROC package, and the model’s AUC, along with its 95% confidence interval, was calculated. The optimal threshold on the ROC curve was determined using Youden's J statistic (J = Sensitivity + Specificity − 1) for binary classification label determination. Based on this threshold derived from the ROC curve, the predicted probabilities were converted into binary prediction labels (0 or 1), and a confusion matrix was subsequently generated. The F1 score on the test set was computed using the confusion matrix function, and a visualization of the confusion matrix was produced and saved. Additionally, the model was further validated on an independent external validation dataset consisting of 200 cases (from the First Affiliated Hospital of Wenzhou Medical University). SHAP values were analyzed using the “shapviz” package to elucidate the impact of each variable on the model’s prediction outcomes, thereby providing insights into the interpretation of individual NAFLD likelihood predictions.

Statistical methods

“Statistical analysis and software development were performed using R version 4.2.3 (R Foundation for Statistical Computing, Vienna, Austria). Continuous variables were initially assessed for normality using the Shapiro-Wilk test or visual inspection of Q-Q plots. Normally distributed data were presented as mean ± standard deviation (SD), and comparisons between two independent groups were conducted using independent samples t-tests. For multiple group comparisons, one-way ANOVA was employed with post-hoc Tukey’s HSD tests when appropriate. Non-normally distributed continuous data were summarized as median [interquartile range (IQR), P25–P75], and group comparisons were carried out using the Mann-Whitney U test for two independent groups or the Kruskal-Wallis test for multiple groups, followed by Dunn’s post-hoc test if necessary. Categorical variables were expressed as frequencies and percentages (%), and comparisons of proportions across groups were analyzed using the chi-square test (χ2 test) or Fisher’s exact test when expected cell counts were less than 5. The significance level was set at α = 0.05 (two-tailed), and a p-value < 0.05 was considered statistically significant.

Results

Clinical features of NAFLD

In this study, the clinical characteristics of individuals with and without NAFLD were systematically analyzed. A range of methods was employed to clearly illustrate the distribution and differences of these features within the sample population (Table 1). A total of 2,677 individuals were included in the analysis, of whom 718 had NAFLD. The analysis covered a range of clinical indicators, including BMI, TG, GGT, UA, and others (as shown in Figure 1). By performing PLS-DA on the clinical and metabolic variables, a significant separation was observed between the NAFLD and non-NAFLD groups (Figure 2A), indicating that these clinical features are crucial for differentiating NAFLD from non-NAFLD. Moreover, the heatmap (Figure 2B) demonstrated substantial deviations in multiple clinical and biochemical parameters, including WBC, NE, MO, RBC, UA, GGT, ALT, AST, TG, BMI, and GLU, within the NAFLD group. The increased frequency of these abnormalities in the NAFLD group further suggests potential involvement in the pathogenesis and progression of NAFLD. Further comparative analyses of BMI, TG, and GGT profiles between NAFLD and non-NAFLD cohorts demonstrated significantly elevated BMI levels in the NAFLD group compared with controls (P < 0.001) (Figure 2C). Moreover, the NAFLD group manifested pronounced increases in both TG and GGT concentrations (P = 3.44e-59 and P = 5.15e-52, respectively) (Figures 2D and E), substantiating the clinical utility of these biomarkers for NAFLD identification. Finally, the diagnostic accuracy of BMI, TG, and GGT in distinguishing NAFLD from non-NAFLD was assessed using ROC curve analysis. The AUC values were 0.79 (95% CI: 0.77–0.81) for BMI, 0.73 (95% CI: 0.71–0.75) for TG, and 0.71 (95% CI: 0.69–0.73) for GGT (Figures 2F–H, Supplementary Table 1). These results suggest that BMI exhibits the highest diagnostic performance among the three markers, while all three demonstrate moderate discriminatory ability.

Establishment of the NAFLD diagnostic model

Multiple machine learning algorithms were integrated with LASSO regression for feature selection to enhance model performance. Initially, variable selection was conducted using LASSO regression, where the relationship between the regularization parameter (Log Lambda) and the variable coefficients was illustrated (Figure 3A, Supplementary Table 2). As Lambda increased, the coefficients of less important variables were gradually shrunk to zero, resulting in the selection of 14 key variables: EOS, RBC, LDH, LYM, MON, BUN, Scr, UA, GGT, GLU, hypertension, diabetes mellitus, TG, and BMI. These variables are well documented as closely associated with the onset and progression of NAFLD and were therefore incorporated into the subsequent machine learning models. The cross-validation error curve for LASSO regression was also presented. The x-axis denotes the regularization parameter, log Lambda, while the y-axis indicates binomial deviance (Figure 3B). By selecting the optimal Lambda value (marked by the vertical line), the best-performing model was obtained with 14 variables and minimal deviance, thereby demonstrating strong predictive capability for NAFLD.

Variable importance was analyzed for the selected features. The results indicated that diabetes mellitus, TG, and BMI contributed the most to the model, with the highest importance scores (Figure 3C). Further, to evaluate the performance of different machine learning models, we employed a variety of algorithms. The performance of the models on the training, testing, and validation sets was illustrated in Figure 3D. By comparing the AUC values and F1 scores of the models, the GBM model exhibited superior performance compared to others across the training, testing, and validation sets, particularly in terms of AUC and F1 scores. Beyond discrimination metrics, the probabilistic reliability of the model was quantitatively evaluated to ensure its practicality for clinical screening. The 95% confidence intervals (CIs) for AUC, sensitivity, and specificity were calculated to rigorously account for the class imbalance present in the external validation cohort. In the external validation cohort, which exhibited a highly skewed distribution (159 NAFLD cases versus 41 non-NAFLD cases), the GBM model maintained strong discriminatory power, achieving an AUC of 0.851 (95% CI: 0.82–0.88). The corresponding sensitivity was 0.712, and the specificity was 0.835, indicating that the model still provides reliable risk stratification despite the imbalance in the validation sample. Furthermore, the ROC curves of the GBM model in both the training and testing sets were visualized (Figures 3E and F), demonstrating excellent discriminatory power and validating the robustness of the model. Notably, the confusion matrices for the GBM model in the training and testing sets were also presented (Figures 3G and H). In the training set, the model achieved a sensitivity of 0.712, specificity of 0.885, and accuracy of 0.745. In the testing set, the corresponding values were 0.712 for sensitivity, 0.835 for specificity, and 0.745 for accuracy. Although there was a minor reduction in specificity in the testing set, the overall performance of the model remained satisfactory.

Key features of the best diagnostic model

In this study, the GBM model was selected as the best diagnostic model for NAFLD based on its excellent performance in the training, testing, and validation sets. Next, an evaluation of the model's key features and the relative contribution of each variable to the prediction results was also conducted. An assessment of variable importance was conducted for the optimized GBM model (Figure 4A). The results indicated that BMI, TG, GGT, diabetes mellitus, and GLU were the most important variables, significantly contributing to the model's predictions. BMI, TG, and GGT had the highest importance scores, indicating a crucial role in predicting NAFLD.

To further understand the contribution of these variables to the model's output, the SHAP value distribution for each variable was displayed (Figure 4B). SHAP values quantify the size and direction of each variable's contribution to the model's predictions. It was observed that higher values of BMI, TG, and GGT pushed the model's predictions toward the NAFLD direction, while higher values of diabetes mellitus and GLU negatively impacted the prediction of NAFLD. Further single-sample SHAP analysis showed the contribution of SHAP values for a specific sample (Figure 4C), confirming that BMI, TG, and GGT played a positive role in predicting NAFLD, while diabetes mellitus and GLU had an inhibitory effect. This finding suggests that BMI, TG, and GGT are strong predictors of NAFLD, with important clinical significance.

To further validate the effect of these key variables on the prediction results, Partial dependence plots for BMI, TG, GGT, DM, and Glu were presented (Figure 4D–H). These plots show the relationship between each variable and the model's predicted response. The plots showed that as BMI, TG, and GGT levels increased, the probability of predicting NAFLD significantly increased, especially the increase in BMI and TG, which had the most pronounced positive impact on the prediction. Finally, SHAP decision path analysis revealed the SHAP value contributions for different samples. For positive prediction samples, the SHAP values showed that BMI, TG, and UA were the main variables contributing to the prediction toward NAFLD (Figure 4I). For negative prediction samples, BMI and GGT were the main negative contributing variables (Figure 4J). The analysis further confirmed the critical role of BMI and GGT in the diagnosis of NAFLD.

DATA AVAILABILITY:

The dataset for non-alcoholic fatty liver disease in the NHANES database is accessible via the following link: https://wwwn.cdc.gov/nchs/nhanes/continuousnhanes/default.aspx?BeginYear=2017.

All analytical codes and supplementary materials generated and utilized in this study are fully available and can be accessed at the following link: https://doi.org/10.6084/m9.figshare.32105248.

Flowchart of NAFLD study; FibroScan data; selection, exclusion criteria, training, test, validation sets.
Figure 1: Schematic illustration of the current study. The inclusion flow, exclusion criteria, and the division of datasets into training, testing, and validation sets in this study. Please click here to view a larger version of this figure.

PLS-DA plot, heatmap, bar charts, and ROC curves for NAFLD vs. Non-NAFLD group analysis.
Figure 2: Comparison of clinical characteristics and diagnostic performance between NAFLD and non-NAFLD groups. (A) PLS-DA scatter plot: The Partial Least Squares Discriminant Analysis (PLS-DA) scatter plot based on clinical and metabolic variables shows significant separation between the NAFLD group (blue) and the non-NAFLD group (red). (B) Heatmap displaying the distribution differences of various clinical and biochemical indicators (including WBC, NEUT, MON, RBC, UA, GGT, ALT, AST, TG, BMI, and Glu) between the NAFLD (orange) and non-NAFLD (green) groups. Vertical axis: Group information (GROUP) and corresponding clinical indicators. Horizontal axis: Samples are arranged according to hierarchical clustering results, with similarities between samples represented by a dendrogram. Colors represent: Green for levels above or equal to the cutpoint, orange for levels below. (C) Bar chart comparing the BMI distribution between the NAFLD and non-NAFLD groups. (D) Bar chart comparing the triglyceride (TG) levels between the NAFLD and non-NAFLD groups. (E) Bar chart comparing the GGT (gamma-glutamyl transferase) levels between the NAFLD and non-NAFLD groups. (F) ROC curve to distinguish NAFLD from non-NAFLD based on BMI diagnostic performance. (G) ROC curve to distinguish NAFLD from non-NAFLD based on triglyceride (TG) diagnostic performance. (H) ROC curve to distinguish NAFLD from non-NAFLD based on GGT diagnostic performance. Please click here to view a larger version of this figure.

Lasso regression, ROC analysis, classification performance charts, statistical comparison plot.
Figure 3: Variable selection and model evaluation for NAFLD diagnosis using machine learning models. (A) LASSO regression variable selection process: Variable selection based on LASSO regression (Least Absolute Shrinkage and Selection Operator). The horizontal axis represents the regularization parameter Log Lambda, and the vertical axis represents the variable regression coefficients. As Lambda increases, less important variables are gradually reduced to zero, ultimately selecting key variables. (B) Cross-validation error curve: LASSO regression cross-validation error curve. The horizontal axis represents the regularization parameter Log Lambda, and the vertical axis represents binomial deviance. The vertical line indicates the optimal Lambda value selected by the model and the corresponding number of variables. (C) Variable importance analysis: Importance scores of the features in the model, ranked from low to high. (D) Performance evaluation of multiple models: Performance of different models on the training, testing, and validation sets, including AUC values on the left and F1 scores on the right. The heatmap color gradient: From red to blue indicating performance differences, with deep red indicating higher performance scores. The green bar chart shows the average AUC and F1 scores for each model across the three datasets, with the bar length reflecting the overall performance level. (E) Training set ROC curve displaying the diagnostic performance of the GBM_grid_1_model_77 model in the training set. (F) Testing set ROC curve displaying the diagnostic performance of the GBM_grid_1_model_77 model in the testing set. (G) Training set confusion matrix: The confusion matrix of the predicted results for the GBM_grid_1_model_77 model in the training dataset, including accuracy indicators for the control and case groups. (H) Testing set confusion matrix: The confusion matrix of the predicted results for the GBM_grid_1_model_77 model in the testing dataset, including accuracy indicators for the control and case groups. Please click here to view a larger version of this figure.

Variable importance and SHAP value analysis charts for medical prediction model; includes partial dependence plots.
Figure 4: GBM model variable importance and SHAP analysis results. (A) Variable importance ranking: Importance scores of the key variables in the GBM_grid_1_model_77 model. (B) SHAP value distribution plot: Distribution of the SHAP (Shapley Additive Explanations) values for the variables, showing the contribution size and direction of each variable to the model output. Purple represents lower variable values, while yellow represents higher variable values. (C) Single-sample SHAP analysis. It shows the contribution of SHAP values for a specific sample. (D–H) Partial dependence plots: Relationships between key variables (BMI, TG, GGT, DM, and Glu) and model prediction output. The horizontal axis represents the variable value, and the vertical axis represents the model's predicted response value, with the green line showing the marginal effect of the variable. (I) SHAP decision path analysis shows the SHAP value contributions of a positive prediction sample, where BMI, TG, and UA are the main positive contributing variables. (J) SHAP decision path analysis shows the SHAP value contributions of a negative prediction sample, where BMI and GGT are the main negative contributing variables.

CharacteristicsSub-groupOverallNon-NAFLDNAFLDP-value
Numbers26771959718/
GroupNon-NAFLD1959 (73.18)1959 (100.00)0 (0.00)/
NAFLD718 (26.82)0 (0.00)718 (100.00)
Age,(years)46.844 (17.781)46.845 (17.856)46.843 (17.586)0.9977
CAP,(dB/m)262.514 (61.791)233.617 (42.429)341.357 (28.768)<0.0001
GenderMale1314 (49.08)890 (45.43)424 (59.05)<0.0001
Female1363 (50.92)1069 (54.57)294 (40.95)
HypertensionYes861 (32.16)511 (26.08)350 (48.75)<0.0001
No1816 (67.84)1448(73.92)368 (51.25)
Diabetes mellitusYes312 (11.65)140 (7.15)172 (23.96)<0.0001
No2365(88.35)1819(92.85)546 (76.04)
Alb,(g/dL)4.085 (0.322)4.100 (0.323)4.047 (0.315)0.0001
Glb,(g/dL)3.048 (0.409)3.040 (0.408)3.072 (0.409)0.0685
TP,(g/dL)7.138 (0.416)7.141 (0.418)7.131 (0.410)0.5634
TC,(mg/dL)  187.803 (41.199)186.701 (40.351)190.809 (43.313)0.0223
CO2,(mmol/L)  25.639 (2.478)25.685 (2.496)25.514 (2.423)0.1145
Scr,(mg/dL)  0.878 (0.294)0.872 (0.280)0.897 (0.329)0.0535
Glu,(mg/dL)  98.827 (28.174)94.588 (21.183)110.393 (39.422)<0.0001
TBil,(mg/dL)  0.469 (0.279)0.476 (0.291)0.450 (0.243)0.0309
TG,(mg/dL)  141.224 (119.74)122.167 (103.103)193.219 (144.168)<0.0001
UA,(mg/dL)  5.432 (1.487)5.203 (1.383)6.058 (1.579)<0.0001
Na⁺,(mmol/L)  140.285 (2.704)140.263 (2.695)140.345 (2.729)0.4844
K⁺,(mmol/L)  4.072 (0.356)4.063 (0.352)4.096 (0.366)0.0357
Cl⁻,(mmol/L)  101.114 (2.758)101.187 (2.672)100.915 (2.971)0.0238
BUN,(mg/dL)  14.595 (5.329)14.345 (5.227)15.276 (5.544)0.0001
Ca,(mg/dL)  9.295 (0.355)9.299 (0.348)9.284 (0.374)0.3562
AST,(u/L)  21.640 (12.418)20.753 (11.524)24.057 (14.315)<0.0001
ALT,(u/L)  22.419 (16.867)19.793 (13.967)29.585 (21.420)<0.0001
LDH,(IU/L)  155.782 (35.255)154.602 (36.464)159.001 (31.523)0.0042
GGT,(IU/L)30.581 (41.784)26.952 (39.685)40.481 (45.620)<0.0001
BMI,(kg/㎡)29.572 (7.243)27.714 (6.322)34.643 (7.172)<0.0001
WBC,(1000 cells/uL)7.243 (2.496)7.002 (2.562)7.900 (2.174)<0.0001
RBC,(million cells/uL)4.767 (0.493)4.719 (0.480)4.898 (0.502)<0.0001
NEUT,(1000 cells/uL)4.181 (1.696)4.019 (1.668)4.620 (1.693)<0.0001
LYM,(1000 cells/uL)2.257 (1.438)2.207 (1.612)2.393 (0.771)0.0029
MON,(1000 cells/uL)0.574 (0.226)0.558 (0.227)0.619 (0.215)<0.0001
EOS,(1000 cells/uL)0.198 (0.157)0.189 (0.152)0.223 (0.167)<0.0001
PLT,(1000 cells/uL)244.401 (61.515)243.137 (61.239)247.850 (62.175)0.0791
RDW13.754 (1.234)13.706 (1.231)13.885 (1.230)0.0009

Table 1: Clinical characteristics at baseline of individuals with NAFLD or non-NAFLD. This table presents the clinical relevance scores for the variables initially selected by the LASSO model. Notes: < 0.05 was considered statistically significant.

Supplementary Table 1: The AUC values and optimal cut-off points for each clinical variable. Please click here to download this file.

Supplementary Table 2: Results of assigning importance scores to the variables selected by LASSO using ChatGPT-4. ChatGPT-4 was utilized to evaluate and score these variables based on existing medical knowledge and literature. These AI-screened features were subsequently validated through the AutoML modeling process. Scores range from 1 to 10, with higher scores indicating greater clinical relevance.Please click here to download this file.

Discussion

NAFLD is the commonest cause of chronic liver disease worldwide, and its prevalence rises by about 1% each year26. Roughly 30% of the global population is affected, making NAFLD not only the leading chronic liver disorder but also the fastest‑growing indication for liver transplantation3. Automated machine learning (AutoML) has emerged as a valuable tool in medicine, with one of its main goals being to build predictive models by identifying correlations among input features. A growing number of studies highlight ML’s strong potential for developing diagnostic models of fatty liver disease5. This study effectively utilized AutoML technology to establish a diagnostic model for NAFLD.

By applying strict diagnostic and exclusion criteria to the NHANES 2017–2018 dataset, we stratified participants into well‑defined NAFLD and non‑NAFLD groups. Comparative analyses showed that the NAFLD group had marked elevations not only in traditional metabolic indices (UA, GGT, ALT, AST, TG) but also in hematological parameters (WBC, NEUT, MON, RBC), revealing a distinct pattern of systemic inflammation and hematological dysregulation alongside hepatic dysfunction (Figure 2). Conventional metabolic biomarkers have already been integrated into clinical protocols for NAFLD surveillance because of their sensitivity in detecting early‑stage liver injury and metabolic imbalance27. Additionally, circulating LYM, NEUT and MON levels were significantly higher in NAFLD patients (P < 0.001), suggesting that shifts in leukocyte subpopulations may reflect hepatic inflammation and systemic immune activation28,29. Elevated RBC parameters also correlated independently with NAFLD incidence and progression30.

BMI, TG, and GGT were identified as independent predictors of NAFLD in the current study. These parameters showed significant intergroup differences, and ROC curve analysis further validated their discriminative power (AUC > 0.7 for all three; see Figure 2C–H), confirming robust diagnostic performance. Obesity and dyslipidemia are core drivers of NAFLD31. Hepatic steatosis induces an abnormal rise in intra‑biliary pressure, a mechanism that explains why GGT has higher diagnostic specificity than ALT for NAFLD: GGT is more sensitive to cholestatic injury, whereas elevated ALT predominantly reflects direct hepatocellular damage32. These results support the robustness of our initial data processing, as multiple lines of evidence – metabolic markers, hematological parameters, and ROC curves – collectively confirm the reliability of the primary data collection and processing methods.

Liver biopsy remains the gold standard for NAFLD diagnosis, but non‑invasive alternatives are urgently needed. AutoML is playing a pivotal role in early detection. For example, serum glycan patterns were identified as potential biomarkers using AutoML, and a gradient boosting decision tree (GBDT) model achieved 95% accuracy in early‑stage diagnosis33. Other researchers compared various AutoML models (logistic regression, random forest, neural networks) with traditional non‑invasive tests for NAFLD and found that AutoML models had superior sensitivity, specificity and predictive values34. For our NHANES cohorts, we applied a two‑stage feature selection combining LASSO regression with ChatGPT‑4‑based intelligent analysis, identifying 14 clinically validated features strongly associated with NAFLD pathogenesis, including BMI, TG, GGT, GLU, and diabetes mellitus. This feature spectrum aligns with established NAFLD research35,36. Elevated blood glucose significantly enhances de novo lipogenesis in NAFLD livers26. In our study, BMI, TG, and diabetes mellitus had the highest contribution scores among the 14 features (Figure 3C), confirming their strong association with NAFLD development and progression.

We systematically assessed several AutoML algorithms, including GBM, XGBoost, GLM, XRT, DL, and Stacked Ensemble. The optimized GBM_grid_1_model_77 achieved a peak AUC of 0.943 in an independent validation set (Figure 3D), strongly supporting its validity and stability. Multi‑dimensional assessment using confusion matrices and metrics such as sensitivity, specificity, precision, recall, F1‑score, accuracy, and Kappa further confirmed that this AutoML‑based diagnostic model has substantial clinical value for NAFLD screening, improving identification accuracy while enhancing efficiency through an automated workflow.

Researchers have shown that AutoML models outperform conventional statistical approaches across multiple NAFLD indicators in the NHANES database, with particular advantages in predictive accuracy37. Notably, the XGBoost algorithm was identified as the optimal ensemble learning architecture, outperforming competing models. This finding aligns with subsequent studies using gradient‑boosted decision trees or deep neural networks for NAFLD risk stratification38,39. Compared with existing studies, the current work has four distinct methodological advantages. First, systematic data curation of the NHANES dataset increased analytical sample size and reduced selection bias through rigorous missing‑data handling. Second, we integrated ChatGPT‑4 to quantitatively weight 14 LASSO‑derived variables according to their relative contributions, leading to eight clinically pivotal biomarkers – a feature absent in previous NAFLD prediction studies. Third, we used systematic hyperparameter optimization and nested cross‑validation to improve model generalizability and minimize overfitting. Finally, an independent external validation cohort (n = 200) demonstrated robust diagnostic concordance.

To address the “black‑box” nature of ML models, we implemented the SHAP interpretability framework40. SHAP values quantified each feature’s contribution to the model’s predictions (Figure 4B), confirming the significant roles of BMI, TG, and GGT in NAFLD diagnosis. SHAP partial dependence plots illustrate the relationships between BMI, TG, GGT, DM, and Glu and predicted outcomes while holding other features constant, facilitating interpretation of marginal effects (Figure 4D–H). Decision path analysis provides detailed feature contributions for individual cases (Figures 4I and 4J), thereby enhancing model interpretability.

A critical consideration is the discrepancy in diagnostic endpoints between training and validation cohorts. The NHANES dataset used a CAP threshold (≥ 302 dB/m) as a non‑invasive surrogate for hepatic steatosis, while the external validation cohort relied on liver biopsy – the histological gold standard. This cross‑standard validation introduces label shift and spectrum bias, because patients undergoing biopsy typically have stronger clinical indications or more advanced disease. Consequently, distinguishing histologically confirmed NAFLD from strict healthy controls is easier than classifying borderline cases in a general population survey. This spectrum bias largely explains the high AUC (0.945) in the external validation set. Thus, the “external validation” serves as a test of cross‑modality robustness, showing that core clinical features from a non‑invasive screening population are pathologically relevant enough to identify definitive histological disease. However, the inability to perform sensitivity analyses – such as evaluating alternative CAP cutoffs or stratifying by fibrosis risk – remains a limitation. Future studies should address these issues to delineate the model’s diagnostic boundaries across disease severity.

Still, this study has several limitations. First, although the model performed well in the validation set (AUC = 0.943), genetic, lifestyle, and environmental heterogeneity among cohorts from different countries or ethnicities may limit generalizability. Second, dichotomizing all continuous variables before model training reduces data variance and may compromise maximum predictive accuracy. Future iterations should keep continuous variables in their raw state to optimize sensitivity. Although data processing was improved through multiple imputation and feature selection, further advances are needed to handle high‑dimensional data and missing values. Finally, integrating additional biomarkers and advanced imaging data could further enhance diagnostic comprehensiveness and accuracy.

In conclusion, this study highlights the promising application of AutoML technology in the medical field, particularly for screening and diagnosing NAFLD. By automating the optimization process, the approach not only enhanced the efficiency of model construction but also improved diagnostic accuracy, thereby offering novel directions for the clinical management of NAFLD. As datasets continue to expand and models undergo further refinement, AutoML is anticipated to assume a more significant role in screening, diagnosis, and broader evaluation of NAFLD and other liver-related conditions.

Disclosures

The authors declare that they have no conflict of interest. In this study, ChatGPT-4 (OpenAI) was used as an intelligent analytical tool during the feature selection phase to assess the clinical relevance of variables identified by LASSO regression. All AI-generated scores were carefully reviewed by the authors and empirically validated through the subsequent AutoML process. ChatGPT-4 was not used to alter raw data or perform mathematical calculations. The authors take full responsibility for the integrity and accuracy of the final results.

Acknowledgements

This work was supported by the Startup Fund for Scientific Research of Fujian Medical University [2021QH1176]; the Key Laboratory of Clinical Laboratory Diagnosis and Translational Research of Zhejiang Province [2022E10022]; the Zhejiang Provincial Medical and Health Science and Technology Plan Project [2024KY1265]; and the Wenzhou Municipal Basic Public Welfare Research Project [Y2023096].

Materials

List of materials used in this article
NameCompanyCatalog NumberComments
Datasets for NAFLD (2017–2018)NHANES database [https://wwwn.cdc.gov/nchs/nhanes/continuousnhanes/default.aspx?BeginYear=2017]N/Aas the training set for model construction
Datasets for NAFLD (2018–2020)The First Affiliated Hospital of Wenzhou Medical University (2018–2020), China. [https://doi.org/10.6084/m9.figshare.32105248.]N/Aas a test set for the external validation of the model
R (version 4.2.3)R Foundation for Statistical ComputingN/Aused in conjunction with other tools to conduct data analysis and generate visual and graphical presentations.
Adobe Illustrator 2025 (version 29.2)Adobe Systems IncorporatedN/AFor image layout and editing
ChatGPT-4OpenAI Inc.N/AFor assigning an importance score to each selected variable
H2O AutoML (3.44.0.3)H2O.aiN/AFor integrating a comprehensive set of machine learning algorithms

Reprints and Permissions

Tags

MedicineAutoMLdiagnosisGradient Boosting Machine