Research Article

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

DOI:

10.3791/70033

July 3rd, 2026

* These authors contributed equally

In This Article

Summary

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,

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

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,

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

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,

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.

Access restricted. Please log in or start a trial to view this content.

Protocol

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,

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.

Access restricted. Please log in or start a trial to view this content.

Results

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,

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 s...

Access restricted. Please log in or start a trial to view this content.

Discussion

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,

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 correlatio...

Access restricted. Please log in or start a trial to view this content.

Disclosures

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,

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

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,

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].

Access restricted. Please log in or start a trial to view this content.

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

Request permission to reuse the text or figures of this JoVE article

Request Permission

Tags

MedicineAutoMLdiagnosisGradient Boosting Machine

Related Articles