Skip to content
Pranav-errorPublic

About

Interpretable Prediction of Mitotic Activity in Breast Cancer Histopathology using EBM and NAM

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔬 Interpretable Prediction of Mitotic Activity in Breast Cancer Histopathology

Using Explainable Boosting Machines (EBM) and Neural Additive Models (NAM)

Interpretable AI that predicts mitotic activity from H&E staining patterns — and explains WHY


🎯 Overview

This project builds a fully interpretable pipeline for predicting mitotic activity in breast cancer histopathology:

  1. U-Net (Attention U-Net) segments mitotic figures in H&E-stained tissue
  2. Feature Extraction derives 65 clinically-grounded features (color, texture, heterogeneity)
  3. EBM (tree-based GAM) and NAM (neural GAM) predict mitotic activity with full transparency

Key Findings

  • Tautology Discovery: Cancer grade = f(mitosis count) by definition → 100% accuracy is trivially expected and not a valid ML result
  • Grade-Free Prediction: Reframing as count regression yields R² = 0.75 (5-fold CV) using only H&E staining features
  • Binary Classification: Low vs High mitotic activity achieves 89.8% ± 1.8% CV accuracy
  • Interpretability: EBM risk curves and NAM shape functions reveal which staining patterns drive predictions

📊 Results Summary

Experiment Model Metric Value
Count Regression EBM 5-Fold CV R² 0.750 ± 0.057
Count Regression EBM Pearson r 0.806 (p=1.6e-26)
Binary (≤3 vs >3) EBM 5-Fold CV Accuracy 89.8% ± 1.8%
Binary (≤3 vs >3) EBM 5-Fold CV F1 0.787 ± 0.033
Count Regression NAM Test R² 0.625
Binary (≤3 vs >3) NAM Test Accuracy 82.0%
Grade (color/texture only) EBM 5-Fold CV Accuracy 87.7% ± 1.4%
Grade (with count — tautological) EBM 5-Fold CV Accuracy 100.0% ± 0.0%

Ablation Study (Count Regression)

Feature Group # Features CV R²
Heterogeneity (std) 3 0.721 ± 0.051
Texture (contrast, ratio) 2 0.638 ± 0.074
Color (R, G, B, I) 4 0.623 ± 0.081
Color + Texture 6 0.647 ± 0.073
All 9 features 9 0.750 ± 0.057

📂 Repository Structure

EBM/
├── README.md                          ← You are here
├── GT_EXPERIMENT_LOG.md               ← Full experiment log (Phases 1-8)
├── paper_results.md                   ← Grade-based experiment results
├── gradefree_results.md               ← Grade-free experiment results
│
├── # ── Core Scripts ──
├── extract_gt_features.py             ← Feature extraction from GT masks
├── retrain_on_gt_features.py          ← EBM + NAM training on GT features
├── paper_experiments.py               ← Paper experiments (grade-based)
├── grade_free_experiments.py          ← Grade-free experiments (regression + binary)
├── phase4_deep_analysis.py            ← Deep analysis (CV, receipts, correlations)
├── train_unet_v4.py                   ← U-Net v4 training script
├── predict_new_image.py               ← Inference on new images
│
├── # ── Trained Models ──
├── mitosis_detector_v4.keras          ← Attention U-Net (23 MB)
├── ebm_cancer_grader_gt.pkl           ← EBM on GT features (3.1 MB)
├── nam_cancer_grader_gt.keras         ← NAM on GT features (1.5 MB)
├── ebm_cancer_grader.pkl              ← EBM on U-Net features (2.8 MB)
├── nam_cancer_grader.keras            ← NAM on U-Net features (832 KB)
│
├── # ── Feature CSVs ──
├── mitosis_features_gt.csv            ← 1,107 images × 65 GT features
├── mitosis_blob_features_gt.csv       ← 2,048 blobs × 28 features
├── mitosis_features.csv               ← 1,104 images × 10 U-Net features
│
├── # ── Publication Figures ──
├── plots_gradefree/                   ← 8 figures (grade-free experiments)
├── plots_paper/                       ← 7 figures (grade-based experiments)
├── plots_gt/                          ← 16 figures (GT analysis, CV, receipts)
├── plots/                             ← Original EBM plots
├── plots_nam/                         ← Original NAM plots
│
├── # ── Data (not in repo — too large) ──
├── original_images/                   ← 1,107 H&E patches (523 MB)
├── bw_masks/                          ← 504 GT annotation masks (18 MB)
└── generated_bw_masks/                ← U-Net predictions (30 MB)

🔬 Dataset

  • 1,107 H&E-stained histopathology patches from 10 patients
  • 2,048 annotated mitotic figures (5 subtypes)
  • 504 images with mitosis, 603 without
  • Image resolution: 1376 × 1539 pixels
  • Source: Roboflow-hosted breast cancer mitosis dataset
Grade Count %
Grade 1 (≤3 mitoses) 868 78.4%
Grade 2 (4–9 mitoses) 221 20.0%
Grade 3 (≥10 mitoses) 18 1.6%

🔑 The Tautology Insight

Cancer grading (Nottingham) defines grades by mitosis count:

  • Grade 1: ≤3 mitoses per 10 HPF
  • Grade 2: 4–9 mitoses per 10 HPF
  • Grade 3: ≥10 mitoses per 10 HPF

0/1,107 exceptions. Any model given mitosis_count as a feature trivially achieves 100%. This is not a novel ML result.

Our contribution: remove count features and show that H&E staining patterns alone (color, texture, heterogeneity) predict mitotic activity with R² = 0.75 — revealing a genuine biological signal.


⚡ Quick Start

# Activate environment
conda activate tf_env

# Run grade-free experiments (regression + binary)
python grade_free_experiments.py

# Run grade-based paper experiments
python paper_experiments.py

# Extract features from GT masks
python extract_gt_features.py

# Predict on a new image
python predict_new_image.py original_images/test/<image>.jpg

📈 Key Visualizations

Publication Figures (31 total)

Set Folder Count Description
Grade-Free plots_gradefree/ 8 Regression scatter, risk curves, ablation, confusion matrices
Grade-Based plots_paper/ 7 Ablation, risk curves, pipeline architecture
GT Analysis plots_gt/ 16 CV results, patient receipts, feature correlations

🛠️ Methods

Feature Extraction (11 selected from 65)

Group Features Clinical Meaning
Proliferation gt_mitosis_count, total_mitotic_area Direct mitotic activity
Color avg_mean_R, avg_mean_G, avg_mean_B, avg_mean_intensity H&E staining absorption
Texture avg_patch_contrast, avg_intensity_ratio Nuclear vs background contrast
Heterogeneity std_mean_R, std_intensity_ratio, std_mean_intensity Tumor diversity

Models

  • EBM (ExplainableBoostingClassifier/Regressor): Tree-based GAM from InterpretML. Produces additive risk curves per feature.
  • NAM (Neural Additive Model): Custom Keras implementation. Each feature gets its own sub-network, outputs summed additively.
  • U-Net v4: Attention U-Net (128×128) for mitosis segmentation from bounding box annotations.

📚 Documentation

File Description
GT_EXPERIMENT_LOG.md Living experiment log — all phases, all results
paper_results.md Grade-based experiment results
gradefree_results.md Grade-free experiment results
EBM_vs_NAM_COMPARISON.md Model comparison analysis
EXPLAINABILITY_RESULTS.md Interpretability deep dive

⚠️ Known Limitations

  1. Patient leakage: All 10 patients appear in all splits (train/valid/test). Leave-One-Patient-Out CV needed.
  2. Grade 3 imbalance: Only 18/1,107 images (1.6%). Binary framing mitigates.
  3. Small cohort: 10 patients. Image-level diversity (1,107) partially compensates.
  4. Single dataset: No external validation. Future work.

📖 References

  • Nottingham Grading: Elston CW, Ellis IO (1991). Histopathology, 19(5), 403-410.
  • EBM: Nori et al. (2019). InterpretML: A Unified Framework for ML Interpretability. GitHub
  • NAM: Agarwal et al. (2021). Neural Additive Models. NeurIPS 2021.
  • U-Net: Ronneberger et al. (2015). U-Net: Convolutional Networks for Biomedical Image Segmentation. MICCAI.

📞 Citation

@software{interpretable_mitotic_activity_2026,
  title   = {Interpretable Prediction of Mitotic Activity in Breast Cancer Histopathology},
  author  = {Sai Pranav},
  year    = {2026},
  note    = {EBM + NAM for glass-box mitotic activity prediction from H&E staining features}
}

Last updated: 5 March 2026 — Phase 8 Complete ✅

About

Interpretable Prediction of Mitotic Activity in Breast Cancer Histopathology using EBM and NAM

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages