Comparative ML analysis of serum metabolomics for multi-class classification of Type 2 Diabetes (T2D), Inflammatory Bowel Disease (IBD), and Colorectal Cancer (CRC) — with batch correction, nested cross-validation, and bootstrapped confidence intervals.
This project addresses a clinically important challenge: distinguishing between three metabolic/inflammatory conditions — T2D, IBD, and CRC — using serum metabolomics data alone. Because samples originate from different study cohorts, batch effects are a major confound and are corrected using ComBat before any model training.
The full pipeline trains and rigorously evaluates 8 classifiers under a nested 5-fold cross-validation framework with inner hyperparameter tuning, producing bootstrapped 95% confidence intervals on ROC-AUC. Both binary (one-vs-rest) and multiclass variants are implemented.
Raw CSV datasets (IBD / T2D / CRC)
│
▼
Feature alignment (union of metabolites)
│
▼
┌──────────────────────────────────────┐
│ Per outer fold (5-fold, parallel) │
│ ┌─────────────────────────────────┐ │
│ │ 1. ComBat batch correction │ │
│ │ 2. RF-based iterative imputation│ │
│ │ 3. log1p transform │ │
│ │ 4. Pareto scaling │ │
│ └─────────────────────────────────┘ │
└──────────────────────────────────────┘
│
▼
Inner 3-fold CV → hyperparameter search
│
▼
8 classifiers evaluated in parallel
│
▼
Metrics: Accuracy · F1 (macro) · ROC-AUC
Bootstrap 95% CI on ROC-AUC (n=1000)
| Model | Tuning |
|---|---|
| Logistic Regression | Grid search (C, penalty, solver) |
| SVM (Linear) | Grid search (C, class_weight) |
| SVM (RBF) | Random search (C, gamma) |
| Random Forest | Random search (n_estimators, max_depth, …) |
| XGBoost | Random search (learning_rate, subsample, …) |
| k-Nearest Neighbours | Grid search (k, weights, metric) |
| MLP (Neural Network) | Random search (layers, alpha, lr) |
| PLS-DA | Grid search (n_components) |
- Python ≥ 3.8
- R ≥ 4.0 (for
Interactions.Ronly)
# 1. Clone the repo
git clone https://github.com/RabmitDas/Multi_disease_prediction.git
cd Multi_disease_prediction
# 2. Create and activate a virtual environment
python -m venv venv
source venv/bin/activate # macOS / Linux
# venv\Scripts\activate # Windows
# 3. Install Python dependencies
pip install -r requirements.txt
# 4. (Optional) R dependencies
Rscript -e "install.packages(c('ggplot2', 'dplyr'))" # adjust as neededCreate a requirements.txt in the repo root with:
numpy
pandas
scikit-learn
xgboost
matplotlib
joblib
pycombat
python Multiclass.pyBefore running, update the OUT_DIR and dataset paths in Multiclass.py:
OUT_DIR = "/path/to/your/data" # line ~40
paths = {
"IBD": f"{OUT_DIR}/IBD101_Y.csv",
"T2D": f"{OUT_DIR}/T2D101_Y.csv",
"CRC": f"{OUT_DIR}/CRC101_Y.csv",
}Outputs (written to OUT_DIR):
Pooled_Multiclass_Model_Metrics_ComBat_Tuned.csv— summary metrics for all modelsPooled_Multiclass_Detailed_Results_Tuned.csv— per-fold breakdownPooled_Multiclass_ROC_ComBat_Tuned.png— ROC curves (1200 dpi)
python Binary.pyRscript Interactions.RMulti_disease_prediction/
├── Multiclass.py # Main pipeline: 8 models, nested CV, ComBat
├── Binary.py # Binary (one-vs-rest) classification variant
├── Interactions.R # R script for metabolite interaction analysis
├── requirements.txt # Python dependencies ← add this
├── LICENSE
├── CONTRIBUTING.md
├── CHANGELOG.md
└── README.md
- Add
requirements.txt - Add data download/access instructions
- Fill in results table with actual metrics
- Add ROC curve figure to
assets/ - Refactor hardcoded
OUT_DIRto a CLI argument - Add a Jupyter notebook for interactive exploration
Distributed under the MIT License. See LICENSE for more information.
If you use this code in your research, please cite:
@misc{das2026multidisease,
author = {Das, Rabmit},
title = {Multi-Disease Prediction via Serum Metabolomics},
year = {2026},
url = {https://github.com/RabmitDas/Multi_disease_prediction}
}- ComBat / pycombat for batch effect correction
- scikit-learn for ML utilities
- XGBoost for gradient boosting