How ronisnotasianfr/cologrowth-ml works
1. Repository purpose
This repo is an end-to-end machine learning research pipeline for predicting colon cancer proliferation class, with an emphasis on leakage-free modeling and cross-cohort validation. It is organized more like a scientific workflow than a production service.
2. Core data sources and domains
The architecture centers on two public genomics cohorts: GEO GSE39582 as the main training/validation cohort and TCGA-COAD as an external validation cohort. Inputs combine high-dimensional gene expression with a small set of clinical variables such as age, sex, and tumor stage.
3. Preprocessing boundary
src/preprocess.py is the main ingestion and feature-engineering layer. It handles probe/gene mapping, expression normalization/alignment, target construction from a proliferation score, and filtering out the 10 hallmark cell-cycle genes used to define the label. This is the key boundary where target leakage is actively prevented.
4. Modeling layer
src/model.py defines the candidate classifiers used throughout the project: logistic regression, random forest, XGBoost, and an MLP. The file likely serves as a model factory or helper layer so training and evaluation can reuse consistent estimator definitions.
5. Training orchestration
src/train.py is the main training driver. It runs nested cross-validation and wraps preprocessing steps such as scaling, variance filtering, and feature selection inside a scikit-learn pipeline so that all learned transformations stay fold-local. This is the repo’s main anti-leakage control point during model selection.
6. Internal evaluation
src/evaluate.py consumes trained models and holdout data to generate standard classification outputs such as ROC curves, confusion matrices, and interpretability artifacts like SHAP plots. This is the post-training analysis layer for the internal GEO cohort.
7. External generalization and calibration
src/external_validation.py is a distinct deployment-style evaluation path: models trained on GEO are applied to TCGA, then calibrated with Platt scaling using a calibration/evaluation split. This module bridges the cross-platform domain shift between microarray and RNA-seq and measures whether the model transfers beyond its training distribution.
8. Clinical outcome analysis
src/survival.py connects predicted or derived proliferation groups to patient survival outcomes. It produces Kaplan-Meier plots and log-rank statistics, making survival analysis a separate downstream validation subsystem rather than part of classification training.
9. Scientific workflow notebooks
The notebooks/ directory contains the exploratory and iterative research workflow: EDA, preprocessing exploration, model training experiments, and evaluation. These are not the production path, but they document how the pipeline was developed and validated interactively.
10. Research artifact generation
The paper/ directory is a publication-generation subsystem. build_paper.py, build_pdf.py, and paper_metrics.py turn computed experiment metrics and figures into a Word document, LaTeX source, and PDF manuscript. In the architecture, this sits downstream of modeling and evaluation and consumes the results products.
11. Outputs and artifacts
Although not fully shown in the tree, the README indicates a typical artifact flow into saved models, result plots/tables, and paper outputs. The expected storage boundaries are processed data in memory or under data/, persisted model checkpoints, and analysis artifacts under results/ and paper/.
12. Technology stack
The codebase is Python 3.8–3.12 and is built around scikit-learn, with XGBoost as an additional estimator backend. The overall runtime is a local research environment rather than a server or distributed system, and the repo’s structure is driven by reproducible ML experiments, external validation, and manuscript generation.
Main entry points: preprocess.py Preprocess · train.py Training · paper_metrics.py Paper metrics · external_validation.py External val
Components 19
Data & targets
Cohorts and clinical inputs used to build the prediction problem.
- GSE39582 · Main training and internal validation cohort from GEO.
- TCGA-COAD · Independent validation cohort used to test transfer across platforms.
- Clinical vars · Age, sex, stage, and other low-dimensional clinical features.
Modeling pipeline
Leakage-aware preprocessing, training, and internal evaluation for the GEO cohort.
- Preprocess · Ingestion, probe/gene mapping, normalization, target construction, and leakage prevention.
src/preprocess.py - Model defs · Reusable classifier definitions for logistic regression, random forest, XGBoost, and MLP.
src/model.py - Training · Leakage-safe training driver with fold-local scaling, filtering, and feature selection.
src/train.py - Evaluate · Internal holdout evaluation with ROC curves, confusion matrices, and SHAP artifacts.
src/evaluate.py
Generalization
Cross-cohort validation and calibration on the external TCGA cohort.
- External val · Applies GEO-trained models to TCGA and performs calibration with Platt scaling.
src/external_validation.py
Downstream analysis
Survival analysis and manuscript generation from experiment outputs.
- Survival · Kaplan-Meier analysis and log-rank testing on predicted or derived groups.
src/survival.py - Paper metrics · Collects experiment metrics and figures for manuscript generation.
paper/paper_metrics.py - Build paper · Assembles the Word manuscript from computed results and narrative content.
paper/build_paper.py - Build PDF · Compiles the LaTeX manuscript into a PDF artifact.
paper/build_pdf.py - Manuscript docx · Generated Word document for the research paper.
paper/colon_cancer_growth_prediction_research_paper.docx - Manuscript tex · Generated LaTeX source for the research paper.
paper/colon_cancer_growth_prediction_research_paper.tex - Manuscript pdf · Generated PDF version of the research paper.
paper/colon_cancer_growth_prediction_research_paper.pdf
Exploration
Interactive notebooks used for iterative research and documentation.
- EDA notebook · Exploratory analysis and cohort understanding.
notebooks/01_eda.ipynb - Prep notebook · Interactive preprocessing and feature-engineering exploration.
notebooks/02_preprocessing.ipynb - Train notebook · Model training experiments and comparison workflow.
notebooks/03_model_training.ipynb - Eval notebook · Evaluation and interpretation exploration.
notebooks/04_evaluation.ipynb
Connections 20
- GSE39582 → Preprocess: ingest · Main cohort is cleaned and transformed into model-ready data.
- TCGA-COAD → Preprocess: align · External cohort is mapped into a compatible feature space.
- Clinical vars → Preprocess: join · Clinical covariates are merged with expression-derived features.
- Preprocess → Training: features · Leakage-safe feature tables feed nested cross-validation.
- Model defs → Training: estimators · Training selects among the candidate classifiers.
- Training → Evaluate: best model · Selected models are scored and interpreted on internal data.
- Training → External val: trained model · GEO-trained model is exported to the external validation path.
- External val → Survival: risk groups · Transferred predictions can be used for downstream outcome analysis.
- Evaluate → Paper metrics: results · Internal metrics and figures are collected for reporting.
- External val → Paper metrics: external results · Cross-cohort performance contributes to manuscript metrics.
- Survival → Paper metrics: survival stats · Kaplan-Meier and log-rank outputs are summarized for the paper.
- Paper metrics → Build paper: input · Aggregated metrics drive Word manuscript assembly.
- Paper metrics → Build PDF: input · Aggregated metrics drive LaTeX/PDF assembly.
- Build paper → Manuscript docx: writes · Creates the Word manuscript artifact.
- Build paper → Manuscript tex: writes · Creates the LaTeX manuscript source.
- Build PDF → Manuscript pdf: writes · Compiles the final PDF manuscript.
- EDA notebook → Preprocess: explore · Notebook work informs preprocessing decisions.
- Prep notebook → Preprocess: prototype · Interactive preprocessing experiments reflect the main ingestion logic.
- Train notebook → Training: prototype · Training experiments mirror the scripted pipeline.
- Eval notebook → Evaluate: explore · Notebook work informs evaluation and interpretation.