Abstract
Background:
Advanced fibrosis (F2–F4) drives morbidity and mortality in metabolic dysfunction-associated steatotic liver disease (MASLD). Population-wide screening is impractical due to patient volume and health care costs. We hypothesized that machine learning (ML) algorithms trained on routine demographic and clinical data could identify patients at risk of significant fibrosis, reducing reliance on blood draws or transient elastography (TE).
Methods:
As part of the Liver Beware study, 4,193 patients prospectively underwent TE. Clinical and demographic data, such as age, BMI, race, diabetes, and hypertension, were collected immediately prior to elastography. Data were split into training (60%), validation (20%), and test (20%) sets. Six ML algorithms were evaluated: logistic regression, logistic regression with SMOTE, XGBoost, random forest, SVM, and ensemble voting classifier. Performance was assessed by accuracy, sensitivity, specificity, precision, and area under the curve (AUC).
Results:
XGBoost had the most well-balanced test performance with 72.2% accuracy, 59.7% sensitivity, 73.4% specificity, 17.4% precision, and AUC of 0.72. Random forest had the highest accuracy (91.1%) but low sensitivity (1.4%). XGBoost identified obesity, diabetes, and hypertension as the leading predictors of risk of fibrosis.
Conclusions:
ML algorithms based on readily available demographic and clinical data can identify patients at high risk of fibrosis with acceptable accuracy. This scalable approach enables triaging for further testing such as TE, trading marginal AUC reduction for maximal accessibility compared with biomarker-dependent scores (eg, SAFE, Agile 4/3+). Implementation and cost-effectiveness studies are needed to refine referral thresholds and evaluate real-world impact.
Keywords: liver fibrosis, machine learning, metabolic dysfunction-associated steatotic liver disease (MASLD)
Lay Summary
Metabolic liver disease (MASLD) is becoming more common and can lead to serious liver damage if not caught early. We used machine learning to predict serious liver damage (fibrosis) in people with fatty liver disease using common health data such as age, weight, and diabetes status. Our best model, XGBoost, showed promising accuracy and could help physicians identify at-risk patients to intervene earlier and prevent worsening liver disease.
Introduction
Metabolic dysfunction-associated steatotic liver disease (MASLD) encompasses a spectrum of liver pathologies, ranging from steatosis to advanced fibrosis and cirrhosis (1–3). MASLD is a leading cause of chronic liver disease, with global prevalence estimated to be over 30% (4–7). Increasing MASLD prevalence has led to a concurrent increase in liver-related mortality (8,9). Mitigation of morbidity in MASLD is difficult, in large part due to the asymptomatic nature of the disease, specifically the development of fibrosis. This prolonged asymptomatic period may lead to diagnostic delay, resulting in a lack of intervention during a reversible phase of the disease (3,10–12).
Given the prevalence of MASLD, there exists a need for population-based screening methods that can accurately identify patients at risk of advanced fibrosis. Currently available technologies such as transient elastography (TE) (eg, FibroScan) (13–15) and liver biopsy (13,16–18) may be impractical to implement at a population level due to associated costs and required resources. Lab-based scores such as fibrosis-4 (FIB-4) and AST-to-platelet ratio index (APRI) are currently the most practical methods to apply at large scale, but even these rely upon various health care resources such as laboratory facilities, analytical technology, disposable supplies, and available phlebotomists. Consequently, such screening tools may not be able to effectively match population need for large-scale screening (19).
Machine learning (ML)–based methods (15,20) appear able to predict liver fibrosis in various populations, including those with diabetic retinopathy (8), severe obesity (3), and autoimmune hepatitis (21). These methods present a unique opportunity to develop low-cost, low-resource utilization screening methods that could be applied at scale (22–24). In this study, we aimed to address this need by systematically developing and evaluating ML algorithms capable of predicting liver fibrosis (F2–F4) in MASLD based only on readily available clinical and demographic data, without the need for lab draws or other fibrosis assessment methods.
Methods
Patient population and data set
Data for this analysis were collected during the Liver Beware community screening study, conducted from 2022 to 2024 (25). In brief, patients were recruited to undergo TE assessment for liver fibrosis. Immediately prior to TE, various demographic and clinical data were collected. We collected data on 4,193 patients in one single, retrospective cohort who all underwent FibroScan. To develop and evaluate our predictive models, we randomly partitioned this cohort—using stratified sampling on the binary fibrosis‐stage outcome—to preserve case/control balance across splits. Sixty percent of the data (n ≈ 2,516) formed the training set, which was used to fit all model parameters and to perform any internal cross‐validation during hyperparameter tuning. Twenty percent (n ≈ 838) comprised the validation set, which guided our choice of class‐weight or SMOTE parameters, tree depths, regularization strengths, and voting weights; receiver operating characteristic (ROC) curves and areas under the curve (AUCs) on this subset informed model selection but were not reported as final performance metrics to avoid optimism bias. The validation set was used to monitor model performance during development and prevent overfitting. The remaining 20% (n ≈ 839) was held out entirely as an independent test set—it was never consulted during model training or tuning—and served as the basis for our primary evaluation (ROC curves, AUC, confusion matrices, and feature‐importance analyses). The test set was reserved for final performance evaluation to assess generalizability to unseen data. Patient data were labelled no fibrosis (F0–F1) or presence of fibrosis (F2–F4) based on TE results.
Predictor variables and data processing
Eleven variables were used as predictors. Continuous measures were age, height, weight, and BMI. Categorical factors included self-reported race, prior cardiac disease, diabetes, hyperlipidemia, hypertension, alcohol use category, and obesity status. These choices reflect well-established ties between metabolic syndrome features—particularly hypertension, type 2 diabetes, dyslipidemia, and obesity with MASLD (26–29). Age and race added demographic context, while BMI and cardiac history gave a more complete picture of each participant's metabolic risk profile (30). A comprehensive preprocessing pipeline was implemented using the ColumnTransformer framework from Scikit Learn (Supplementary Figure 1 online). For numerical features, standardization was applied to achieve 0 mean and unit variance after mean imputation for missing values. Categorical variables underwent most-frequent value imputation followed by one-hot encoding with unknown level handling. All preprocessing steps (mean imputation and scaling for continuous variables; most‐frequent imputation and one‐hot encoding for categorical variables) were learned only on the training set and then applied via identical pipelines to both validation and test data. No external or temporal hold‐out cohorts were used. This design ensured that our reported test‐set performance reflected an unbiased estimate of how each final model would generalize to truly unseen patient data.
Model development
Six ML approaches were developed and evaluated on Python version 3.9.7. The first two approaches implemented logistic regression with L2 regularization, utilizing class weights adjusted inversely proportional to class frequencies. Maximum iterations were set to 1,000 for convergence, with the random state fixed at 42 for reproducibility. The third approach employed XGBoost classification with scale_pos_weight parameter calibrated to handle class imbalance. The model utilized a learning rate optimized through validation, maximum depth of 1 to prevent overfitting, and 200 estimators with early stopping protocol. Binary log loss served as the evaluation metric. The fourth approach implemented a random forest classifier comprising 500 decision trees with balanced class weights and bootstrap sampling enabled. The random state was maintained at 42, with all cores utilized for parallel processing. The fifth approach utilized a support vector machine with linear kernel implementation and balanced class weights. All input features were standardized through the preprocessing pipeline. The sixth approach implemented an ensemble voting classifier using a soft voting mechanism, combining predictions from logistic regression, XGBoost, and random forest (Figure 1). Parallel processing was enabled, with equal weights assigned to each model.
Figure 1: Ensemble (soft voting) model feature importance plot.

Model evaluation
Performance assessment integrated multiple complementary metrics with 95% CIs calculated through 1,000 bootstrap iterations. These metrics included accuracy for overall correct classification rate, sensitivity (recall) for true positive rate of F2–F4 cases, specificity for true negative rate of F0–F1 cases, and precision for positive predictive value. Confusion matrices were generated for detailed error analysis. Additional model evaluation included ROC curve analysis with AUC calculations to assess discriminative ability and feature importance analysis to identify key predictive factors. Feature importance was calculated using XGBoost's built-in feature importance metric, which quantifies each variable's contribution to model predictions on a relative scale from 0 to 1.
Ethics
Ethical approval for this study was obtained from the University of British Columbia Clinical Research Ethics Board. The research was conducted in accordance with the Declaration of Helsinki.
Results
Participant characteristics
Our study enrolled 4,193 adults (≥19 years). Baseline demographic and clinical characteristics of the study population are summarized in Table 1. Just over half were women (54.9%). The median age was 62 years (IQR 51–69), and the median BMI was 25.4 kg/m² (IQR 22.8–28.5), with over one third (34.7%) classified as obese. Participants self-identified primarily as Asian (41.9%), white (32.8%), or South Asian (20.3%), while the remaining 5.0% reported other racial backgrounds. Metabolic health issues were widespread across the group; 12.1% had diabetes, 26.5% had hypertension, and 28.8% had hyperlipidemia. A smaller subset of 8.1% had a history of cardiac disease. Notably, 13.6% of participants reported drinking more than 6 ounces of alcohol per day. Steatosis was observed in 59.6% of participants, with 15.5% classified as having mild steatosis (S1), 17.6% moderate steatosis (S2), and 26.6% severe steatosis (S3). Advanced fibrosis (F2–F4) was present in 8.6% of the population, including 6.6% with moderate fibrosis (F2), 1.4% with severe fibrosis (F3), and 0.6% with cirrhosis (F4). Most participants (91.4%) had no fibrosis or only mild fibrosis (F0–F1).
Table 1:
Descriptive statistics of participants (n = 4,193)
| Characteristic | No. (%)* |
|---|---|
| Continuous variables, median (IQR) | |
| Age | 62 (51–69) |
| Height | 166 (160–173) |
| Weight | 70.5 (60.3–83.5) |
| BMI | 25.4 (22.8–28.5) |
| Categorical variables | |
| Gender | |
| Male | 1,890 (45.08) |
| Female | 2,303 (54.92) |
| Race | |
| Asian | 1,756 (41.88) |
| Other | 208 (4.96) |
| South Asian | 852 (20.32) |
| White | 1,377 (32.84) |
| Cardiac disease | |
| No | 3,854 (91.92) |
| Yes | 339 (8.08) |
| Diabetes | |
| No | 3,686 (87.91) |
| Yes | 507 (12.09) |
| Hyperlipidemia | |
| No | 2,984 (71.17) |
| Yes | 1,209 (28.83) |
| Hypertension | |
| No | 3,082 (73.50) |
| Yes | 1,111 (26.50) |
| Alcohol consumption | |
| No | 3,623 (86.41) |
| Yes | 570 (13.59) |
| Steatosis degree | |
| S0 | 1,693 (40.38) |
| S1 | 649 (15.48) |
| S2 | 736 (17.55) |
| S3 | 1,115 (26.59) |
| Estimated fibrosis degree | |
| F0–F1 | 3,832 (91.39) |
| F2 | 275 (6.56) |
| F3 | 60 (1.43) |
| F4 | 26 (0.62) |
| Estimated fibrosis stage | |
| F0–F1 | 3,832 (91.39) |
| F2–F4 | 361 (8.61) |
| Obesity | |
| Yes | 1,455 (34.70) |
| No | 2,738 (65.30) |
*Unless otherwise specified
Derivation of data sets
The performance of the six ML models for predicting significant liver fibrosis (F2–F4) is summarized in Tables 2A (validation set) and 2B (test set) (Note: n = 839 indicates that the validation and test sets each contained 839 patients).
Table 2A:
Performance of machine learning models for predicting liver fibrosis, validation set results (n = 839)*
| Percentage (95% CI) | ||||
|---|---|---|---|---|
| Model | Accuracy | Sensitivity | Specificity | Precision |
| XGBoost† | 73.8 (71.0–76.5) | 61.1 (50.0–71.7) | 75.0 (71.7–78.0) | 18.6 (13.9–23.6) |
| Logistic regression | 71.3 (68.3–74.3) | 61.1 (50.0–72.6) | 72.2 (69.3–75.5) | 17.1 (12.5–22.1) |
| Random forest | 90.9 (88.9–92.9) | 1.4 (0.0–4.5) | 99.3 (98.7–99.9) | 16.7 (0.0–50.0) |
| Support vector machine | 70.1 (67.1–72.9) | 73.6 (62.6–83.8) | 69.8 (66.4–73.2) | 18.6 (14.6–22.9) |
| Voting classifier | 85.0 (82.4–87.4) | 47.2 (35.5–58.8) | 88.5 (86.3–90.7) | 27.9 (20.5–36.9) |
| SMOTE-LR | 72.5 (69.6–75.3) | 66.7 (56.3–77.9) | 73.0 (69.6–76.2) | 18.8 (14.5–23.8) |
n = 839 indicates that the validation and test sets each contained 839 patients
Unless otherwise specified
Table 2B:
Performance of machine learning models for predicting liver fibrosis, test set results (n = 839)*
| Percentage (95% CI) | ||||
|---|---|---|---|---|
| Model | Accuracy | Sensitivity | Specificity | Precision |
| XGBoost‡ | 72.2 (69.4–75.2) | 59.7 (48.2–70.4) | 73.4 (70.4–76.5) | 17.4 (12.6–22.1) |
| Logistic regression | 69.6 (66.4–72.5) | 63.9 (53.4–74.3) | 70.1 (67.0–73.5) | 16.7 (12.4–21.2) |
| Random forest | 91.1 (89.0–93.0) | 1.4 (0.0–4.7) | 99.5 (99.0–99.9) | 20.0 (0.0–66.7) |
| Support vector machine | 66.4 (63.1–69.7) | 59.7 (49.1–70.3) | 67.0 (63.8–70.4) | 14.5 (10.7–18.4) |
| Voting classifier | 82.7 (80.0–85.1) | 36.1 (25.0–47.3) | 87.1 (84.7–89.3) | 20.8 (14.0–28.3) |
| SMOTE-LR | 70.4 (67.2–73.7) | 65.3 (53.8–76.8) | 70.9 (67.9–74.1) | 17.4 (13.1–22.1) |
n = 839 indicates that the validation and test sets each contained 839 patients
Selected as the final model based on balanced performance across metrics
Individual model performances
Logistic regression model
In the validation data set, the logistic regression model correctly classified 71.28 % of cases as having advanced (F2–F4) or non-advanced (F0–F1) fibrosis (95% CI 68.3%–74.3%). The model had a sensitivity of 61.11% (95% CI 50.0%–72.6%), specificity of 72.23% (95% CI 69.3%–75.5%), and precision of 17.12% (95% CI 12.5%–22.1%) (Table 2A).
In the test data set, the logistic regression model demonstrated an accuracy of 69.61% (95% CI 66.4%–72.5%). The model also demonstrated a sensitivity of 63.89% (95% CI 53.4%–74.3%), specificity of 70.14% (95% CI 67.0%–73.5%), and precision of 16.73% (95% CI 12.4%–21.2%) (Table 2B).
XGBoost model
In the validation data set, the XGBoost model correctly classified 73.78% of cases as having advanced (F2–F4) or non-advanced (F0–F1) fibrosis (95% CI: 71.0%–76.5%). Like the logistic regression model, the XGBoost model also demonstrated a sensitivity of 61.11% (95% CI: 50.0%–71.7%), a slightly higher specificity of 74.97% (95% CI 71.7%–78.0%), and precision of 18.64% (95% CI 13.9%–23.6%) (Table 2A).
In the test data set, the XGBoost model demonstrated an accuracy of 72.23% (95% CI 69.4%–75.2%). The model also demonstrated a sensitivity of 59.72% (95% CI 48.2%–70.4%), specificity of 73.40% (95% CI 70.4%–76.5%), and precision of 17.41% (95% CI 12.6%–22.1%) (Table 2B).
Random forest classifier model
In the validation data set, the random forest classifier model correctly classified 90.94% of cases as having advanced (F2–F4) or non-advanced (F0–F1) fibrosis (95% CI 88.9%–92.9%). This model demonstrated a sensitivity of 1.39% (95% CI 0%–4.5%), specificity of 99.35% (95% CI 98.7%–99.9%), and precision of 16.67% (95% CI 0%–50.0%) (Table 2A).
In the test data set, the random forest classifier model demonstrated an accuracy 91.06% (95% CI: 89.0%–93.0%). The model also demonstrated a sensitivity of 1.39% (95% CI: 0%–4.7%), specificity of 99.48% (95% CI: 99.0%–99.9%), and precision of 20.00% (95% CI: 0%–66.7%) (Table 2B).
SVM model
In the validation data set, the SVM model correctly classified 70.08% of cases as having advanced (F2–F4) or non-advanced (F0–F1) fibrosis (95% CI 67.1%–72.9%). This model demonstrated a sensitivity of 73.61% (95% CI 62.6%–83.8%), specificity of 69.75% (95% CI 66.4%–73.2%), and precision of 18.60% (95% CI 14.6%–22.9%) (Table 2A).
In the test data set, the SVM model demonstrated an accuracy of 66.39% (95% CI 63.1%–69.7%). The model also demonstrated a sensitivity of 59.72% (95% CI 49.1%–70.3%), specificity of 67.01% (95% CI 63.8%–70.4%), and precision of 14.53% (95% CI 10.7%–18.4%) (Table 2B).
Ensemble voting classifier model
The ensemble voting classifier combined multiple models. In the validation data set, the ensemble voting classifier model correctly classified 84.98% of cases as having advanced (F2–F4) or non-advanced (F0–F1) fibrosis (95% CI 82.4%–87.4%). This model demonstrated a sensitivity of 47.22% (95% CI 35.5%–58.8%), specificity of 88.53% (95% CI 86.3%–90.7%), and precision of 27.87% (95% CI 20.5%–36.9%) (Table 2A).
In the test data set, the ensemble voting classifier model demonstrated an accuracy of 82.72% (95% CI 80.0%–85.1%). The model also demonstrated a sensitivity of 36.11% (95% CI 25.0%–47.3%), specificity of 87.09% (95% CI 84.7%–89.3%), and precision of 20.80% (95% CI 14.0%–28.3%) (Table 2B).
SMOTE-enhanced logistic model
Adding synthetic minority oversampling, the SMOTE-enhanced logistic regression correctly classified 72.47% of cases as having advanced (F2–F4) or non-advanced (F0–F1) fibrosis (95% CI 69.6%–75.3%). This model demonstrated a sensitivity of 66.67% (95% CI 56.3%–77.9%), specificity of 73.01% (95% CI 69.6%–76.2%), and precision of 18.82% (95% CI 14.5%–23.8%) (Table 2A).
In the test data set, the SMOTE-enhanced logistic model demonstrated an accuracy of 70.44% (95% CI 67.2%–73.7%). The model also demonstrated a sensitivity of 65.28% (95% CI 53.8%–76.8%), specificity of 70.93% (95% CI 67.9%–74.1%), and precision of 17.41% (95% CI 13.1%–22.1%) (Table 2B).
Feature importance analysis
In the ensemble voting classifier model, shuffling obesity produced the greatest reduction in model validation accuracy, followed by alcohol consumption and BMI (Figure 1). In the logistic regression model, obesity was found to be the most dominant factor in predicting risk of liver fibrosis with alcohol consumption and BMI representing the next most important predictors (Figure 2). In the SMOTE-logistic regression model, obesity was again shown to be the top predictor of risk of fibrosis (Figure 3). In the random forest model, obesity and alcohol were the most important predictors of risk of fibrosis, while BMI and weight status were strong secondary predictors (Figure 4). In the SVM model, separation of fibrosis classes was achieved almost entirely based on obesity—with the remainder of the variable essentially redundant in this analysis—again demonstrating the importance of obesity in predicting this outcome (Figure 5). Feature importance analysis of the XGBoost model revealed obesity as the strongest predictor of advanced fibrosis (importance score: 0.57), followed by diabetes status (0.16), hypertension status (0.07), and weight (0.06) (Figure 6).
Figure 2: Logistic regression (balanced) model feature importance plot. Ensemble (soft voting) model feature importance plot.

Figure 3: Logistic regression (SMOTE) model feature importance plot.

Figure 4: Random forest (balanced) model feature importance plot.

Figure 5: SVM (linear, balanced) model feature importance plot.

Figure 6: XGBoost model feature importance plot.

Receiver operating characteristic analysis
The XGBoost model achieved consistent discriminative ability between identifying advanced and non-advanced fibrosis with AUC values of 0.72 (95% CI: 0.69–0.75) in the test set (Figure 7), which was substantially above chance (0.5). Higher AUC values were achieved with the SMOTE-enhanced logistic regression model (AUC = 0.75) and class-weighted logistic regression model (AUC = 0.74) (Figure 7).
Figure 7: Receiver operator characteristic curves for each machine learning model.

Despite higher AUC values in other models, we selected XGBoost as our final predictor model for multiple reasons. Firstly, XGBoost natively handles non-linear interactions and missing values for manual resampling, which permits a more flexible model that may capture complex patterns in both continuous and sparse one-hot encoded categorical variables. Secondly, by incorporating scale_pos_weight to counter the minority class imbalance, XGBoost achieved a strong balance between sensitivity and specificity, which was demonstrated in its ROC curve, without the risk of overfitting. Finally, XGBoost's built-in feature importance metrics offer direct insight into variable contributions, which enables convenient interpretation in a clinical context. Importantly, all pipeline-based models—which included XGBoost—received raw x_test as input, while the SMOTE-logistic regression model required a separate preprocessor.transform (X_test) step to match its training representation. Using this approach, we ensured each classifier was evaluated specifically on the feature its space learned in order to produce valid ROC curves for direct comparison and ultimately supported XGBoost as our final predictor model.
Discussion
This study demonstrated that ML models using basic clinical and demographic data can accurately triage patients with MASLD for risk of clinically significant fibrosis (F2–F4). Among six machine learning model types, XGBoost provided the most clinically useful balance for a screening/triage role on the test set (accuracy: 72.23%, sensitivity: 59.72%, specificity: 73.40%, AUC 0.72). In contrast, models with higher headline accuracy, such as the ensemble voting classifier (accuracy: 82.72%, specificity: 87.09%) and random forest (accuracy: 91.06%, specificity: 99.48%), exhibited markedly lower sensitivity (36.11% and 1.39%, respectively) and would therefore fail to identify many F2–F4 cases, undermining their value in initial risk stratification. These results support XGBoost as a pragmatic front-end tool to identify patients at risk of advanced fibrosis.
Why XGBoost performed best
XGBoost's superior performance can be explained by several features of its architecture. Its gradient-boosting framework can model complex, non-linear relationships between clinical risk factors and fibrosis stages, while its regularization mechanisms help reduce overfitting. Its built-in ability to handle class imbalance through the scale_pos_weight parameter contributed to a more balanced sensitivity–specificity profile, avoiding the pitfalls seen in models that favoured the majority class. Importantly, feature importance analyses revealed clinically coherent predictors, with obesity, diabetes, and hypertension consistently emerging as the strongest drivers of fibrosis risk. The model's alignment with established risk factors enhances the model's interpretability and supports its use in clinical triage.
Comparison with prior work
Our findings are consistent with ML studies in MASLD-related populations that have shown effective discrimination when more robust clinical/serological data are available. For example, XGBoost performed strongly in cohorts of patients with obesity that also included liver-specific biomarkers (3), while registry-based work likewise reported solid AUCs with non-invasive biomarker sets (20). High performance has also been demonstrated with random forest and related models, but these approaches are more cumbersome owing to their reliance on serological data for imputation. Conversely, our model demonstrated a balanced sensitivity–specificity profile, independent of serological data, to correctly identify patients at risk of advanced fibrosis in large-scale population screening.
Positioning against existing tools
Other non-ML model tools used to predict risk of advanced fibrosis include the well-known FIB-4 and APRI calculators. In addition, there are more novel MASLD-specific scores such as SAFE (steatosis-associated fibrosis estimator) and Agile 4/3+, which also demonstrate strong discrimination but also depend on laboratory data in their algorithms (31,32). These screening tools use dual thresholds to maximize rule-out (high sensitivity/negative predictive value) and rule-in (high specificity/positive value), leaving an indeterminate zone that still requires follow-up (32–35). Furthermore, these tools still depend on laboratory data, which again may pose challenges to population-level screening (36). By relying on easily obtained data (age, BMI/weight, self-reported cardiometabolic conditions, alcohol category), our models can be used in primary care and community settings to “widen the funnel” and target confirmatory testing (ie, tissue elastography) to those at highest risk.
On the held-out test set, XGBoost achieved AUC 0.72, sensitivity 59.7%, and specificity 73.4% using only intake variables (age, BMI/weight, common cardiometabolic comorbidities, alcohol category), balancing misses and workload for a screening gateway. Using the cohort's 8.6% prevalence of F2–F4, this operating point translates to approximately 51 true positives, 35 missed cases, 243 false positives, and 671 true negatives per 1,000 people screened or about 294 referrals for confirmation, which is an acceptable trade-off when the priority is to avoid missed advanced disease and elastography slots are scarce.
Rural and remote implementation
One practical application of ML models is use in rural and remote communities, as patients from these communities face long travel distances, intermittent access to phlebotomy and TE, and limited specialist availability. Using our ML model, we suggest a practical, two-step workflow to optimize access to care for such populations. The first step involves point-of-contact triage where health care practitioners may collect data on age, height/weight (BMI), and brief comorbidity/alcohol history, which is imputed into the ML tool to identify higher-risk individuals. Subsequently, in the second step, flagged patients are referred for expedited TE—hence optimizing use of this limited resource. Thresholds can be tuned to context: Where TE access is more widely available, a sensitivity-favoured cut-point can minimize missed cases; conversely, when access to TE is scarcer, a more specific cut-point can prioritize high-risk individuals. Such a model may help promote MASLD screening and prevention in communities historically underserved by lab-dependent strategies.
Taken together, we view these different screening tools as complementary rather than competing. Using such pathways, as previously outlined, may reduce indeterminate results and conserve specialist referrals while ensuring effective community-level screening (37,38). Future studies should examine head-to-head comparisons of sequential versus single-tool pathways, including decision curve and cost-effectiveness analyses.
Strengths and limitations
A major strength of this study is its use of a large, real-world community cohort (n = 4,193) with diverse demographic and clinical profiles, improving the relevance of findings to everyday care settings. The study design incorporated a stratified train–validation–test split and a head-to-head comparison of six ML approaches (logistic regression, SMOTE-enhanced logistic regression, XGBoost, random forest, SVM, and ensemble voting), each evaluated using multiple performance metrics with 1,000-bootstrap CIs. By emphasizing commonly available clinical and demographic variables without laboratory data, the models are feasible for broad screening and triage, including outside tertiary centres. The analysis also explicitly addressed class imbalance through class weighting, SMOTE, and XGBoost's scale_pos_weight, helping ensure the minority class (F2–F4) was represented during learning. Together, these features support generalizability of the approach; however, external validation in other health systems and regions remains an important next step.
Several limitations should be considered. First, class imbalance in this real-world cohort (F2–F4 prevalence: 8.6%) complicates model training and evaluation; despite mitigation strategies (class weighting, SMOTE, and scale_pos_weight in XGBoost), overall sensitivity remains constrained by the minority class size. Second, we restricted predictors to 11 commonly available, non-laboratory variables to maximize ease of use of the ML model; however, other variables are also likely significant, and adding select laboratory or imaging features could further improve discrimination in settings where those data are available. Third, TE was used to define F0–F1 versus F2–F4, rather than histology, which may introduce label misclassification relative to biopsy. Fourth, this was a single-region, retrospective cohort from Greater Vancouver with no external or temporal hold-out cohorts, limiting generalizability and necessitating external validation in other health systems and populations. Fifth, operating thresholds were optimized for internal performance; decision curve analysis was not performed and should be included prospectively to quantify net benefit across clinically relevant thresholds. Some predictors (eg, alcohol use and comorbidities) were self-reported, which may introduce measurement error that attenuates discrimination and calibration. Although we report cohort composition, we did not evaluate subgroup performance (eg, by sex, age, or race); future work should report subgroup discrimination and error rates to assess fairness and equity. Finally, at the reported operating point, precision was modest (eg, XGBoost 17.4% on test), implying multiple confirmatory assessments per true F2–F4 case; prospective threshold tuning should align referral volume with local capacity and priorities.
Future directions
Future work should include prospective and external validation across diverse health systems and populations, paired with real-world implementation (eg, electronic health record–integrated prompts) to evaluate workflow fit and clinical impact. Because this study intentionally relied on readily available non-laboratory variables to maximize ease of uptake, a pragmatic next step is to assess model performance metrics with the imputation of available laboratory or imaging data. This may determine whether hybrid ML models possess improved discrimination without significantly sacrificing scalability.
Operationally, sites may adjust operating thresholds and recalibrate models to local TE prevalence and capacity to balance missed cases against referral volume. In parallel, cost-effectiveness and scalability evaluations are needed to quantify system-level value under different screening pathways (ML-first triage to TE versus usual care). Finally, future studies should report subgroup performance (eg, by sex, age, race) and consider decision curve analysis to characterize net benefit across clinically relevant thresholds. Together, these steps will determine whether a lab-independent ML front end, optionally enhanced with targeted biomarkers, can deliver earlier detection and more efficient triage for MASLD at scale.
Conclusion
Using only readily available clinical and demographic variables without laboratory tests or imaging, we developed and compared six machine learning models to triage MASLD patients for clinically significant fibrosis (F2–F4) in a large, real-world cohort of 4,193 participants. Among these, XGBoost provided the most clinically useful balance for front-line screening, with an accuracy of 72.2%, sensitivity of 59.7%, specificity of 73.4%, and AUC of 0.72. In contrast, alternative models with higher overall accuracy, such as random forest and ensemble voting, had very low sensitivity and would miss many cases in a screening context. Importantly, the features driving prediction aligned with established clinical risk factors, with obesity, diabetes, and hypertension emerging as the most important predictors. These results support a simple two-step pathway: rapid machine learning-based risk stratification at the point of care, including in primary care, community outreach, and rural or remote settings, followed by targeted confirmatory testing such as transient elastography for patients flagged at higher risk. This approach exchanges a small decrement in accuracy for a substantial gain in scalability and feasibility, making it particularly well suited for settings where laboratory resources are limited and access to elastography is scarce. Future research should include prospective validation across diverse populations, integration into electronic health records to test real-world workflow, cost-effectiveness analyses, and local threshold calibration to account for differences in disease prevalence and testing capacity.
In summary, a lab-independent ML front end offers a practical and scalable method to triage MASLD patients for advanced fibrosis, enabling earlier detection and intervention where it is most needed.
Acknowledgements:
The authors would like to thank Liver Canada (formerly the Canadian Liver Foundation) for supporting the initial scans and data collection that made this study possible. The authors also thank Jane Tjandra, Michelle Tsang, and Monica Chui for their invaluable contributions as project coordinators of the Liver Beware project. Their leadership and coordination of data collection were essential to the successful execution of this study.
Funding Statement
N/A
Contributions:
Conceptualization, D Chahal; Data curation, T Wen; Methodology, D Chahal; Writing – Original Draft, NW Tjandra, DMP Di Fonzo; Writing – Review & Editing, NW Tjandra, DMP Di Fonzo.
Ethics Approval:
The study protocol was approved by the University of British Columbia Clinical Research Ethics Board (REB No. H21-00634).
Informed Consent:
Informed consent was obtained from all participants prior to participation in the Liver Beware study. For this retrospective analysis, data were analyzed in deidentified form in accordance with the approved ethics protocol.
Registry and the Registration No. of the Study/Trial:
N/A
Data Accessibility:
Data from the current study are available upon reasonable request to the corresponding author.
Funding:
N/A
Disclosures:
EM Yoshida was an investigator in clinical trials sponsored by Intercept Inc, Genfit Inc, Madrigal Inc, Allergan Inc, Pfizer Inc, and Novodisc Inc, and received an unrestricted grant from Paladin Laboratories. D Chahal conducts metabolic dysfunction-associated steatohepatitis/metabolic dysfunction-associated steatotic liver disease industry trials for Merck Inc, 89Bio Inc, and Gilead Inc. D Chahal also has a specialty pharmaceutical FibroScan collaboration with SRx Healthcare Inc. The other authors have no conflicts of interests related to this publication.
Peer Review:
This article has been peer reviewed.
Animal Studies:
N/A
Supplemental Material
References
- 1.Zhu K, Bedi H, Chahal D, Yoshida EM, Kwan P. Sa1566 prevalence and severity of metabolic associated steatotic liver disease and fibrosis in population screening with vibration controlled transient elastography. Gastroenterology. 2024;166:S–477. 10.1016/S0016-5085(24)01569-5 [DOI] [Google Scholar]
- 2.European Association for the Study of the Liver, European Association for the Study of Diabetes, European Association for the Study of Obesity. EASL-EASD-EASO clinical practice guidelines on the management of metabolic dysfunction-associated steatotic liver disease (MASLD): executive summary. Diabetologia. 2024;67:2375–92. 10.1007/s00125-024-06196-3 [DOI] [PMC free article] [PubMed] [Google Scholar]
- 3.Lu CH, Wang W, Li YJ, et al. Machine learning models for predicting significant liver fibrosis in patients with severe obesity and nonalcoholic fatty liver disease. Obes Surg. 2024;34(12):4393–404. 10.1007/s11695-024-07548-z. Medline: [DOI] [PubMed] [Google Scholar]
- 4.Wong VW, Ekstedt M, Wong GL, Hagström H. Changing epidemiology, global trends and implications for outcomes of NAFLD. J Hepatol. 2023;79(3):842–52. 10.1016/j.jhep.2023.04.036. Medline: [DOI] [PubMed] [Google Scholar]
- 5.Memedovich KA, Shaheen AA, Swain MG, Clement FM. Projected healthcare system cost burden of metabolic dysfunction-associated steatotic liver disease in Canada. Gastro Hep Adv. 2024;3(7):965–72. 10.1016/j.gastha.2024.05.010. Medline: [DOI] [PMC free article] [PubMed] [Google Scholar]
- 6.Cusi K. Time to include nonalcoholic steatohepatitis in the management of patients with type 2 diabetes. Diabetes Care. 2020;43(2):275–9. 10.2337/dci19-0064. Medline: [DOI] [PubMed] [Google Scholar]
- 7.Chan WK, Chuah KH, Rajaram RB, Lim LL, Ratnasingam J, Vethakkan SR. Metabolic dysfunction-associated steatotic liver disease (MASLD): a state-of-the-art review. J Obes Metab Syndr. 2023;32(3):197–213. 10.7570/jomes23052. Medline: [DOI] [PMC free article] [PubMed] [Google Scholar]
- 8.Zhu G, Yang N, Yi Q, et al. Explainable machine learning model for predicting the risk of significant liver fibrosis in patients with diabetic retinopathy. BMC Med Inform Decis Mak. 2024;24(1):332. 10.1186/s12911-024-02749-z. Medline: [DOI] [PMC free article] [PubMed] [Google Scholar]
- 9.Taylor RS, Taylor RJ, Bayliss S, et al. Association between fibrosis stage and outcomes of patients with nonalcoholic fatty liver disease: a systematic review and meta-analysis. Gastroenterology. 2020;158(6):1611–25.e12. 10.1053/j.gastro.2020.01.043. Medline: [DOI] [PubMed] [Google Scholar]
- 10.Dietrich CG, Rau M, Geier A.. Screening for nonalcoholic fatty liver disease—when, who and how? World J Gastroenterol. 2021;27(35):5803–21. 10.3748/wjg.v27.i35.5803. Medline: [DOI] [PMC free article] [PubMed] [Google Scholar]
- 11.Shieh C, Halegoua-De Marzio DL, Hung ML, Fenkel JM, Herrine SK. Timely diagnosis and staging of non-alcoholic fatty liver disease using transient elastography and clinical parameters. JGH Open. 2020;4(5):1002–6. 10.1002/jgh3.12385. Medline: [DOI] [PMC free article] [PubMed] [Google Scholar]
- 12.Tjandra NW, Di Fonzo DMP, Wen T, et al. Assessment of metabolic dysfunction-associated steatotic liver disease and liver fibrosis: a cross-sectional study in asymptomatic individuals in Greater Vancouver. J Clin Transl Hepatol. 2025;13(7):535–41. 10.14218/JCTH.2025.00109. Medline: [DOI] [PMC free article] [PubMed] [Google Scholar]
- 13.van Son KC, Te Nijenhuis-Noort LC, Boone SC, et al. Prevalence of metabolic dysfunction-associated steatotic liver disease (MASLD) in a middle-aged population with overweight and normal liver enzymes, and diagnostic accuracy of noninvasive proxies. Medicine (Baltimore). 2024;103(1):e34934. 10.1097/MD.0000000000034934. Medline: [DOI] [PMC free article] [PubMed] [Google Scholar]
- 14.Oeda S, Takahashi H, Imajo K, et al. Accuracy of liver stiffness measurement and controlled attenuation parameter using FibroScan® M/XL probes to diagnose liver fibrosis and steatosis in patients with nonalcoholic fatty liver disease: a multicenter prospective study. J Gastroenterol. 2020;55(4):428–40. 10.1007/s00535-019-01635-0. Medline: [DOI] [PubMed] [Google Scholar]
- 15.Chen H, Zhang J, Chen X, et al. Development and validation of machine learning models for MASLD: based on multiple potential screening indicators. Front Endocrinol (Lausanne). 2025;15:1449064. 10.3389/fendo.2024.1449064. Medline: [DOI] [PMC free article] [PubMed] [Google Scholar]
- 16.Musso G, Gambino R, Cassader M, Pagano G.. Meta-analysis: natural history of non-alcoholic fatty liver disease (NAFLD) and diagnostic accuracy of non-invasive tests for liver disease severity. Ann Med. 2011;43(8):617–49. 10.3109/07853890.2010.518623. Medline: [DOI] [PubMed] [Google Scholar]
- 17.Oeda S, Tanaka K, Oshima A, Matsumoto Y, Sueoka E, Takahashi H. Diagnostic accuracy of FibroScan and factors affecting measurements. Diagnostics (Basel). 2020;10(11):940. 10.3390/diagnostics10110940. Medline: [DOI] [PMC free article] [PubMed] [Google Scholar]
- 18.Brunt EM, Clouston AD, Goodman Z, et al. Complexity of ballooned hepatocyte feature recognition: defining a training atlas for artificial intelligence-based imaging in NAFLD. J Hepatol. 2022;76(5):1030–41. 10.1016/j.jhep.2022.01.011. Medline: [DOI] [PMC free article] [PubMed] [Google Scholar]
- 19.Lee J, Vali Y, Boursier J, et al. Prognostic accuracy of FIB-4, NAFLD fibrosis score and APRI for NAFLD-related events: a systematic review. Liver Int. 2021;41(2):261–70. 10.1111/liv.14669. Medline: [DOI] [PMC free article] [PubMed] [Google Scholar]
- 20.McTeer M, Applegate D, Mesenbrink P, et al. Machine learning approaches to enhance diagnosis and staging of patients with MASLD using routinely available clinical information. PLoS One. 2024;19(2):e0299487. 10.1371/journal.pone.0299487. Medline: [DOI] [PMC free article] [PubMed] [Google Scholar]
- 21.Wei Q, Li W, He S, et al. An exploratory machine learning model for predicting advanced liver fibrosis in autoimmune hepatitis patients: a preliminary study. Ann Hepatol. 2025;30(1):101754. 10.1016/j.aohep.2024.101754. Medline: [DOI] [PubMed] [Google Scholar]
- 22.Decharatanachart P, Chaiteerakij R, Tiyarattanachai T, Treeprasertsuk S. Application of artificial intelligence in chronic liver diseases: a systematic review and meta-analysis. BMC Gastroenterol. 2021;21(1):10. 10.1186/s12876-020-01585-5. Medline: [DOI] [PMC free article] [PubMed] [Google Scholar]
- 23.Spann A, Yasodhara A, Kang J, et al. Applying machine learning in liver disease and transplantation: a comprehensive review. Hepatology. 2020;71(3):1093–105. 10.1002/hep.31103. Medline: [DOI] [PubMed] [Google Scholar]
- 24.Le Berre C, Sandborn WJ, Aridhi S, et al. Application of artificial intelligence to gastroenterology and hepatology. Gastroenterology. 2020;158(1):76–94.e2. 10.1053/j.gastro.2019.08.058 [DOI] [PubMed] [Google Scholar]
- 25.Tjandra NW, Di Fonzo DMP, Wen T, et al. Assessment of metabolic dysfunction-associated steatotic liver disease and liver fibrosis: a cross-sectional study in asymptomatic individuals in Greater Vancouver. J Clin Transl Hepatol. 2025;13(7):535–41. Medline: [DOI] [PMC free article] [PubMed] [Google Scholar]
- 26.Chan KE, Koh TJL, Tang ASP, et al. Global prevalence and clinical characteristics of metabolic-associated fatty liver disease: a meta-analysis and systematic review of 10 739 607 individuals. J Clin Endocrinol Metab. 2022;107(9):2691–700. 10.1210/clinem/dgac321. Medline: [DOI] [PubMed] [Google Scholar]
- 27.Chew NWS, Ng CH, Tan DJH, et al. The global burden of metabolic disease: data from 2000 to 2019. Cell Metab. 2023;35(3):414–28.e3. 10.1016/j.cmet.2023.02.003. Medline: [DOI] [PubMed] [Google Scholar]
- 28.Zhang H, Zhou XD, Shapiro MD, et al. Global burden of metabolic diseases, 1990–2021. Metabolism. 2024;160:155999. 10.1016/j.metabol.2024.155999. Medline: [DOI] [PubMed] [Google Scholar]
- 29.Lytvyak E, Straube S, Modi R, Lee KK. Trends in obesity across Canada from 2005 to 2018: a consecutive cross-sectional population-based study. CMAJ Open. 2022;10(2):E439–49. 10.9778/cmajo.20210205. Medline: [DOI] [PMC free article] [PubMed] [Google Scholar]
- 30.Targher G, Byrne CD, Tilg H. MASLD: a systemic metabolic disorder with cardiovascular and malignant complications. Gut. 2024;73(4):691–702. 10.1136/gutjnl-2023-330595. Medline: [DOI] [PubMed] [Google Scholar]
- 31.Stanford Medicine Medical Calculators. SAFE—steatosis-associated fibrosis estimator calculator. https://medcalculators.stanford.edu/safe (Accessed December 22, 2025).
- 32.Sripongpun P, Kim WR, Mannalithara A, et al. The steatosis-associated fibrosis estimator (SAFE) score: a tool to detect low-risk NAFLD in primary care. Hepatology. 2023;77(1):256–67. 10.1002/hep.32545. Medline: [DOI] [PMC free article] [PubMed] [Google Scholar]
- 33.Li M, Lin Y, Yu H, et al. The steatosis-associated fibrosis estimator (SAFE) outperformed the FIB-4 score in screening the population for liver disease. Ann Hepatol. 2024;29(5):101516. 10.1016/j.aohep.2024.101516. Medline: [DOI] [PubMed] [Google Scholar]
- 34.Charu V, Liang JW, Mannalithara A, Kwong A, Tian L, Kim WR. Benchmarking clinical risk prediction algorithms with ensemble machine learning for the noninvasive diagnosis of liver fibrosis in NAFLD. Hepatology. 2024;80(5):1184–95. 10.1097/HEP.0000000000000908. Medline: [DOI] [PubMed] [Google Scholar]
- 35.Kim WR, Mannalithara A, Charu V, et al. Optimal population screening strategies for liver fibrosis associated with metabolic dysfunction-associated steatotic liver disease. Am J Gastroenterol. 2025;120(10):2312–20. 10.14309/ajg.0000000000003268. Medline: [DOI] [PMC free article] [PubMed] [Google Scholar]
- 36.Park H, Kim M, Kim HL, Cho S, Yoon EL, Jun DW. Diagnostic performances of fibrosis-4 index and nonalcoholic fatty liver disease fibrosis score in metabolic dysfunction-associated steatotic liver disease in Asian primary care clinics. Hepatol Res. 2024;54(11):1027–34. 10.1111/hepr.14054. Medline: [DOI] [PubMed] [Google Scholar]
- 37.Destrempes F, Gesnik M, Chayer B, et al. Quantitative ultrasound, elastography, and machine learning for assessment of steatosis, inflammation, and fibrosis in chronic liver disease. PLoS One. 2022;17(1):e0262291. 10.1371/journal.pone.0262291. Medline: [DOI] [PMC free article] [PubMed] [Google Scholar]
- 38.Su TH, Wu CH, Kao JH. Artificial intelligence in precision medicine in hepatology. J Gastroenterol Hepatol. 2021;36(3):569–80. 10.1111/jgh.15415. Medline: [DOI] [PubMed] [Google Scholar]
Associated Data
This section collects any data citations, data availability statements, or supplementary materials included in this article.
Supplementary Materials
Data Availability Statement
Data from the current study are available upon reasonable request to the corresponding author.
