Explainable Cancer Diagnosis ML
Educational, non-clinical tabular ML system with validation-governed selection, a locked evaluation contract, malignant-class explanations, and fail-closed artifacts.

- Project type
- Governed ML / Explainability
- Core stack
- Python, scikit-learn, SHAP
- Delivery
- Frontend showcase
Case Study
The problem, implementation decisions, measured evidence, and next improvements.
Overview
A governed ML evidence path spanning deterministic data splits, validation-only selection, locked evaluation, malignant-class explainability, checksum validation, strict API contracts, and a read-only frontend showcase.
Problem
ML portfolio results are difficult to trust when model selection, test evaluation, class semantics, and generated artifacts are not governed as one reproducible contract.
Solution
Built a deterministic 398/85/86 split, selected Logistic Regression using validation ROC-AUC only, evaluated the frozen model once on 86 governed test rows, and aligned malignant-class scores and SHAP explanations across the pipeline, FastAPI, and React.
Technical Decisions
- The split assignment is pinned by SHA-256 497e9350c039abd8f56c26e0fd3d6abf962bb8008fce5379f0b1790a9684df9c.
- The UI calls outputs uncalibrated malignant-class model scores, never confidence, clinical risk, or individual probability.
Outcome
The locked evaluation records ROC-AUC 0.9953703703703703, PR-AUC 0.99375, malignant sensitivity 0.96875, specificity 1.0, and confusion matrix [[31, 1], [0, 54]], with a read-only public showcase and explicit educational limits.
What It Proves
ML governance, leakage-safe evaluation, SHAP orientation, artifact integrity, FastAPI contracts, reproducibility, and careful communication of model limits.
Key Features
- Validation ROC-AUC alone selects the model before the governed test result is inspected.
- Malignant-class score and SHAP semantics are explicit and tested across model, API, and frontend contracts.
- A schema-1 manifest validates 16 artifacts and fails closed on missing, stale, path-invalid, or checksum-invalid evidence.
Architecture
- 01
Governed dataset split
- 02
Train-only preprocessing
- 03
Validation-only selection
- 04
Locked evaluation
- 05
Malignant-class SHAP
- 06
Artifact manifest
- 07
FastAPI and read-only React
Tech Stack
- Python
- scikit-learn
- SHAP
- FastAPI
- React
- PyTorch
- Artifact governance
Verification
- Deterministic split: 398 train, 85 validation, 86 governed test rows
- Selected model: logistic_regression; evidence version: bbb5977c47501cd9a962
- Locked metrics: ROC-AUC 0.9953703703703703, PR-AUC 0.99375, sensitivity 0.96875, specificity 1.0
- Class order [malignant, benign]; confusion matrix [[31, 1], [0, 54]]
Security & Privacy
- The public Vercel surface is a read-only frontend showcase with no public live inference.
- FastAPI validates trusted repository-generated artifacts before loading code-bearing model files.
Limitations
- This is an educational and non-clinical portfolio system, not a medical device or diagnostic product.
- The small bundled dataset has no external, prospective, fairness, demographic, or clinical validation.
- Scores are uncalibrated and SHAP explains model behavior, not biology or causality.
Future Improvements
- Add approved external validation without changing the locked portfolio regression contract.
- Study calibration and subgroup behavior before considering any broader interpretation.
Claims are pinned to the public repository evidence contract and read-only showcase; no clinical validity or real-patient deployment is claimed.