Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

🫀 Fatty Liver AI Differentiation — Feasibility Pilot Study

AI-based differentiation of Alcohol-Associated (AFLD) vs. Metabolic-Associated (MASLD) fatty liver disease using NHANES 2017–2018 data.


📋 Overview

This pilot study explores whether routine clinical variables from population-level survey data can be used to train machine learning classifiers to distinguish between two major subtypes of fatty liver disease:

Label Type Criteria
0 Metabolic-Associated (MASLD-like) BMI > 30 AND HbA1c > 6.0 AND Alcohol < 20 g/day
1 Alcohol-Associated (AFLD-like) Alcohol > 40 g/day AND AST/ALT ratio > 1.5

📁 Project Structure

fatty_liver_pilot/
├── fatty_liver_pilot.py        # Main analysis pipeline (10 steps)
├── fatty_liver_cleaned.csv     # Cleaned & labeled dataset output
├── results_summary.md          # Full results summary (Markdown)
├── roc_curve.png               # Figure 1: ROC curves (all 3 models)
├── feature_importance.png      # Figure 2: Gradient Boosting feature importance
├── pipeline_diagram.png        # Figure 3: Pipeline overview
├── DEMO_J.XPT                  # NHANES Demographics
├── ALQ_J.XPT                   # NHANES Alcohol Questionnaire
├── BMX_J.XPT                   # NHANES Body Measures (BMI)
├── BIOPRO_J.XPT                # NHANES Biochemistry (AST, ALT)
├── GHB_J.XPT                   # NHANES Glycohemoglobin (HbA1c)
├── TRIGLY_J.XPT                # NHANES Triglycerides
└── README.md

🔬 Data Source

NHANES 2017–2018 (National Health and Nutrition Examination Survey)
https://wwwn.cdc.gov/nchs/nhanes/continuousnhanes/default.aspx?BeginYear=2017

File NHANES Module Variables Used
DEMO_J.XPT Demographics Age (RIDAGEYR), Sex (RIAGENDR)
ALQ_J.XPT Alcohol Questionnaire Avg drinks/day (ALQ130)
BMX_J.XPT Body Measures BMI (BMXBMI)
BIOPRO_J.XPT Biochemistry AST (LBXSATSI), ALT (LBXSASSI)
GHB_J.XPT Glycohemoglobin HbA1c (LBXGH)
TRIGLY_J.XPT Triglycerides Triglycerides (LBXTR)

🧬 Clinical Features

Feature Description Clinical Relevance
BMI Body Mass Index Obesity — core MASLD criterion
AST Aspartate aminotransferase (U/L) Liver injury marker
ALT Alanine aminotransferase (U/L) Liver injury marker
HbA1c Glycohemoglobin (%) Long-term glucose control
Triglycerides Lipid profile (mg/dL) Elevated in metabolic syndrome
Alcohol_g_per_day Self-reported alcohol intake Primary AFLD driver
AST_ALT_ratio AST ÷ ALT (derived) Ratio > 1.5–2.0 hallmark of AFLD
Age Age at screening (years) Disease prevalence/severity
Sex Biological sex (1=M, 2=F) Alcohol metabolism differences

🤖 ML Pipeline (10 Steps)

Step 1  → Load & merge XPT files on SEQN
Step 2  → Select clinical variables
Step 3  → Feature engineering (AST/ALT ratio, cleaning)
Step 4  → Create proxy labels (AFLD-like vs MASLD-like)
Step 5  → Prepare ML dataset (70/30 stratified split)
Step 6  → Train 3 models
Step 7  → Evaluate (AUROC, Accuracy, Sensitivity, Specificity)
Step 8  → Generate plots (ROC curve, Feature Importance)
Step 9  → Output interpretation & summary
Step 10 → Save cleaned CSV + results_summary.md

📊 Models Trained

Model Description
Logistic Regression Linear baseline, max_iter=1000
Random Forest Ensemble of 200 decision trees
Gradient Boosting 100 sequentially boosted trees

📈 Results

See results_summary.md for full metrics.

Figure Description
ROC Curve ROC curves — all 3 models
Feature Importance Gradient Boosting feature importance

⚙️ Requirements

python >= 3.8
numpy
pandas
scikit-learn
matplotlib
seaborn

Install dependencies:

pip install numpy pandas scikit-learn matplotlib seaborn

🚀 Running the Pipeline

# Clone the repo
git clone https://github.com/Pranav-error/fatty_liver_pilot.git
cd fatty_liver_pilot

# Install dependencies
pip install numpy pandas scikit-learn matplotlib seaborn

# Run the full pipeline
python fatty_liver_pilot.py

Note: The NHANES .XPT files must be present in the same directory as the script. They are included in this repository.


⚠️ Limitations

  • NHANES is a population survey — not a clinical hospital dataset
  • Proxy labels are rule-based approximations, not verified clinical diagnoses
  • Self-reported alcohol intake may be underreported
  • Randomly assigned labels for unclassified cases introduce noise
  • Requires validation on prospective clinical or hospital datasets

📄 License

This project is intended for educational and research feasibility purposes only.


👤 Author

Pilot Study — February 2026
Data: NHANES 2017–2018 (CDC, Public Domain)

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages