Skip to content

Repository files navigation

Glioblastoma-ML-model

Survival prediction for Glioblastoma (GBM) patients using an ensemble of classical ML models trained on radiomic, imaging-derived, and clinical features. The pipeline combines Random Forest, XGBoost, and Logistic Regression (via voting/stacking ensembles) with CNN-based imaging feature extraction, LDA-based feature selection, SMOTE for class balancing, and Optuna for hyperparameter tuning. Model quality is evaluated with classification accuracy/F1 and the survival-analysis concordance index (C-index).

Overview

Glioblastoma is an aggressive brain tumor with highly variable survival outcomes. Instead of predicting exact survival time, this project buckets patients into survival-percentile categories (quartiles of Survival_from_surgery_days) and treats prognosis as a multi-class classification problem, which is more robust to the limited sample sizes typical of GBM cohorts. Predicted class probabilities are then mapped to a survival-time estimate to compute a concordance index against the true survival times.

Dataset

Built on public TCIA (The Cancer Imaging Archive) collections for Glioblastoma:

  • MRI & Radiomic Data (UPENN-GBM / UCSF-PDGM) — multi-parametric MRI (T1, T1GD, T2, FLAIR, DSC, DTI), ~69GB / 630 participants / 10,645 NIfTI files, with tumor sub-region segmentations (ED/ET/NC). Radiomic features per modality/region are extracted with CaPTk (radiomic/radiomic_features_CaPTk/*.csv). Download · DOI
  • UPENN-GBM clinical info (UPENN-GBM_clinical_info_v2.1.csv) — demographics, molecular markers, and survival/follow-up data.
  • Histopathology images (34 patients, 71 images) — whole-slide NDPI scans (Histopathology/) converted for downstream tiling/analysis. Download · DOI

Radiomic feature tables and clinical data are merged on PatientID into a single modeling table (stackAndModel/merged_data.csv, cnn_stacked.csv).

Pipeline / Methodology

  1. Data preparation (radiomic/, Brats/, clinical.ipynb, csv_segm.ipynb) — DICOM→NIfTI conversion, radiomic feature extraction per tumor sub-region/MRI sequence, merging of radiomics with clinical metadata, EDA and cleaning of missing/inconsistent values (EDA/).
  2. CNN feature extraction (stackAndModel/Cnn.ipynb, MRI/) — a 3D CNN is used as a feature extractor over segmented tumor volumes; the resulting embeddings are merged with radiomic/clinical features.
  3. Target construction — survival time (Survival_from_surgery_days_UPDATED) is bucketed into 4 percentile-based classes (quartiles) to form the classification target.
  4. Feature selection — Linear Discriminant Analysis (LDA) ranks features by discriminative importance; the top-N features are selected for modeling (feature-count sweep in stack.ipynb/Cnn.ipynb).
  5. Class balancing — SMOTE (via imbalanced-learn) oversamples minority survival classes to counter class imbalance before training.
  6. Modeling — Random Forest, XGBoost, and Logistic Regression (SVM in some experiments) are combined via VotingClassifier (soft-voting ensemble) and StackingClassifier.
  7. Hyperparameter tuning — Optuna searches RF/XGBoost/Logistic-Regression hyperparameters, optimizing cross-validated accuracy (stackAndModel/optunamain.ipynb, stack.ipynb).
  8. Evaluation — accuracy, balanced accuracy, and classification reports for the classification task; predicted class probabilities are mapped to a survival-time estimate to compute the concordance index (lifelines.utils.concordance_index) as the survival-specific metric.
  9. Interpretability — SHAP (TreeExplainer / permutation explainer) explains ensemble/XGBoost predictions and visualizes global feature importance.
  10. Visualization — Matplotlib/Seaborn for class distributions, correlation matrices, and Optuna trial results (see stackAndModel/*.png).

The best-performing ensemble model is serialized to stackAndModel/best_ensemble_model.pkl.

Tech Stack

  • Language: Python (Jupyter notebooks)
  • ML/Modeling: scikit-learn (RandomForest, LogisticRegression, SVC, VotingClassifier, StackingClassifier, LDA), XGBoost, PyTorch (CNN feature extractor), Optuna (hyperparameter tuning), imbalanced-learn (SMOTE)
  • Survival metrics: lifelines (concordance_index)
  • Interpretability: SHAP
  • Imaging/Radiomics: CaPTk (radiomic feature extraction), NiBabel (NIfTI I/O)
  • Data/Viz: pandas, NumPy, Matplotlib, Seaborn
  • Model persistence: joblib

Repository Structure

Brats/                  BraTS/UCSF-PDGM radiomics experiments and metadata
EDA/                    Exploratory analysis of clinical and tumor statistics
Histopathology/         NDPI whole-slide image handling
MRI/                    DICOM/NIfTI conversion utilities
radiomic/               CaPTk-extracted radiomic feature CSVs (per modality/region) + EDA
stackAndModel/          Core modeling pipeline: CNN features, LDA, SMOTE, Optuna,
                        ensemble/stacking classifiers, SHAP explainability
clinical.ipynb, radiomics.ipynb, csv_segm.ipynb   Data prep / merging notebooks
*.csv                   Clinical info and radiomics feature manifests

How to Run

This is a notebook-driven research project (no packaged CLI/API). To reproduce:

  1. Clone the repo and obtain the underlying TCIA data (UPENN-GBM clinical info, MRI/radiomics/histopathology collections linked above — not included in this repo due to size).
  2. Install dependencies:
    pip install pandas numpy scikit-learn xgboost torch optuna imbalanced-learn lifelines shap matplotlib seaborn joblib nibabel jupyter
  3. Run the data-preparation notebooks (clinical.ipynb, csv_segm.ipynb, radiomic/eda.ipynb) to merge clinical and radiomic data into stackAndModel/merged_data.csv / cnn_stacked.csv.
  4. Run stackAndModel/Cnn.ipynb (or stackAndModel/stack.ipynb) for the full pipeline: LDA feature ranking -> SMOTE balancing -> ensemble/stacking training -> Optuna tuning (optunamain.ipynb) -> SHAP explainability -> concordance index evaluation.
  5. The trained ensemble is saved to stackAndModel/best_ensemble_model.pkl and can be reloaded with joblib.load.

Results

Metrics reported in stackAndModel/Cnn.ipynb for the 4-class survival-percentile task (CNN + radiomic + clinical features, LDA-selected, SMOTE-balanced):

Metric Ensemble (Voting) Stacking
Balanced Accuracy 0.99 0.97
Concordance Index 0.88 0.88
Accuracy — 0.98

Other experiments in stack.ipynb / optunamain.ipynb (different feature subsets/target binning, without CNN features) report accuracies roughly in the 0.3–0.6 range and concordance indices around 0.85–0.86, showing how strongly results depend on the chosen feature set and modality combination — see the individual notebooks for exact configurations. These are research/experimental results on a limited cohort and have not been externally validated.

Notes

  • Brats/, MRI/, and Histopathology/ contain exploratory data-processing notebooks that fed into the final pipeline but are not part of the production model itself.
  • Raw imaging data (NIfTI, NDPI) is not included in the repo due to size; notebooks assume local access to the TCIA collections above.

References

  1. Glioblastoma: An Update in Pathology, Molecular Mechanisms and Biomarkers
  2. Epidemiology of Glioblastoma Multiforme
  3. Survival Prediction using Machine Learning & Deep Learning
  4. MRI-Based Survival Analysis

License

MIT — see LICENSE.

About

Survival Prediction of GlioBlastoma Patients using Ensemble architecture of random forest, xgboost and logistic regression classifiers. Uses Optuna for tuning, SMOTE for imbalances, CNN for feature extraction, LDA for feature pre-processing, MPL and Seaborn for visualizations and concordance index as the performance metrics.

Topics

Resources

Stars

5 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages