How jnr-10/oasis-alzheimers-ml works
1. Repository purpose and split architecture
- This is a Python ML pipeline for OASIS-1 Alzheimer’s detection.
- The codebase is organized into two main flows:
- Phase 1: tabular-only clinical baseline.
- Phase 2: enhanced pipeline that adds MRI-derived imaging biomarkers to the clinical features.
2. Primary data sources
- Raw input comes from the OASIS-1 dataset, split across multiple disc folders (oasis1-disc1 … oasis1-disc12) plus raw tabular exports under data/raw/.
- data/raw/combined_oasis.csv appears to be the consolidated tabular dataset used by preprocessing.
- Phase 2 consumes imaging feature CSVs in data/enhanced_features/, including the final merged dataset oasis1_full_enhanced_features.csv.
3. Tabular preprocessing boundary
- scripts/preprocess_oasis1.py and src/preprocessor.py define the Phase 1 feature preparation boundary.
- The key transformation called out in the README is CDR-to-binary target conversion: CDR=0 becomes healthy, and CDR>0 becomes dementia.
- src/data_loader.py likely centralizes loading of the processed tabular splits and feature sets for training/evaluation.
4. Imaging feature extraction subsystem
- The src/imaging/ package is the main Phase 2 subsystem.
- io_utils.py handles Analyze→NIfTI conversion, so the pipeline is not just ML; it also normalizes raw MRI file formats before feature extraction.
- qc.py provides quality control checks, which is important because imaging pipelines are sensitive to corrupted or mismatched scans.
- merge_utils.py suggests explicit safeguards around combining imaging outputs with clinical rows, likely preventing session/sample misalignment.
5. MRI feature engineering flow
- tissue_features.py extracts global tissue metrics such as GM/WM/CSF volumes, fractions, ratios, and voxel counts.
- regional_features.py extracts ROI-level biomarkers such as hippocampus, ventricles, entorhinal cortex, and temporal lobe measurements.
- atlas_utils.py is the atlas-mapping layer, likely translating anatomical regions into indices/labels used by regional extraction.
- The final Phase 2 feature space is described as 116 total features: 12 clinical, 57 tissue, and 47 regional.
6. Dataset assembly and feature manifests
- Phase 2 produces intermediate artifacts in data/enhanced_features/:
- full_imaging_manifest.csv
- full_tissue_features.csv
- full_regional_features.csv
- oasis1_full_enhanced_features.csv
- This implies a staged pipeline: raw scans → extracted imaging feature tables → merged manifest/final dataset.
- The manifest file is a useful architectural boundary because it likely tracks which disc/session/scan contributed to each row.
7. Modeling subsystem
- src/models.py contains the 8-classifier model zoo: Random Forest, Logistic Regression, SVM, XGBoost, Gradient Boosting, KNN, Naive Bayes, and AdaBoost.
- The training scripts are split by experiment stage:
- scripts/train_all_models.py for Phase 1.
- scripts/train_phase2_enhanced.py for Phase 2 and ablation variants.
- The architecture is classic supervised classification rather than end-to-end deep learning.
8. Evaluation and comparative experiments
- scripts/evaluate.py and scripts/evaluate_all_models.py support single-model and batch evaluation.
- scripts/compare_models.py and scripts/ablation_study.py indicate a strong emphasis on model comparison and feature dependence analysis.
- The key experimental branches in Phase 2 are:
- full feature set,
- no-MMSE variant,
- imaging-only variant.
9. Audit and reproducibility controls
- scripts/pre_training_audit.py is a distinct integrity gate before training the enhanced pipeline.
- src/imaging/qc.py and src/imaging/merge_utils.py imply the repo treats data validity as part of the architecture, not just preprocessing noise.
- scripts/run_full_oasis1_pipeline.py and scripts/run_all_datasets.sh suggest the pipeline is designed to be run end-to-end from raw inputs to final models.
10. Artifacts and output boundaries
- Phase 1 outputs are organized under data/processed/oasis1/ and corresponding model/result directories.
- Phase 2 outputs are organized under data/enhanced_features/ plus model/result folders for:
- all features,
- no MMSE,
- imaging only.
- The repo also includes a published report file, PHASE2_CLINICAL_ACCURACY_REPORT.md, which is part of the analysis deliverable rather than runtime code.
11. Documentation and feature dictionary
- docs/OASIS1_IMAGING_FEATURE_DICTIONARY.md is an important schema reference for interpreting extracted biomarkers.
- docs/PROJECT_PROGRESS_REPORT.md and the clinical accuracy report show that the repo tracks both technical and clinical performance outcomes.
- For an architecture diagram, the documentation layer should sit alongside the pipeline because it defines feature semantics and experiment interpretation.
12. Implementation footprint
- The project is a Python-based offline ML pipeline, driven mostly by scripts under scripts/ and reusable modules under src/.
- requirements.txt defines the runtime dependency boundary.
- The system is batch-oriented: it ingests raw data, computes features, trains classical ML models, evaluates them, and writes CSV/model/report artifacts for later review.
Main entry points: run_full_oasis1_pipeline.py Full run · train_phase2_enhanced.py Train phase2 · qc.py QC · preprocess_oasis1.py Prep script
Components 25
Data
Raw, staged, and enhanced CSV artifacts
- Raw OASIS · Source OASIS-1 disc folders and raw tabular exports feeding both phases
data/raw - Combined CSV · Consolidated clinical dataset used for preprocessing
data/raw/combined_oasis.csv - Processed data · Phase 1 processed dataset outputs used by downstream training
- Enhanced data · Staged Phase 2 CSV artifacts including manifest, tissue, regional, and final merged datasets
data/enhanced_features
Phase 1
Clinical/tabular baseline pipeline
- Preprocess · Phase 1 clinical feature preparation and CDR-to-binary target conversion
src/preprocessor.py - Prep script · CLI entrypoint for OASIS-1 preprocessing
scripts/preprocess_oasis1.py - Data loader · Loads processed splits and feature sets for training and evaluation
src/data_loader.py
Phase 2
Clinical plus MRI-enhanced pipeline
- Format IO · Analyze-to-NIfTI conversion and scan normalization
src/imaging/io_utils.py - QC · Quality-control checks on MRI inputs and extracted outputs
src/imaging/qc.py - Atlas map · Maps anatomical regions to labels and indices for ROI features
src/imaging/atlas_utils.py - Tissue feats · Global GM/WM/CSF metrics, ratios, fractions, and voxel counts
src/imaging/tissue_features.py - Regional feats · ROI-level biomarkers such as hippocampus, ventricles, and entorhinal cortex
src/imaging/regional_features.py - Merge · Aligns imaging outputs with clinical rows and guards against sample/session mismatch
src/imaging/merge_utils.py
Modeling
Classical classifiers, training, and evaluation
- Model zoo · Classical supervised classifiers including RF, LR, SVM, XGBoost, GB, KNN, NB, and AdaBoost
src/models.py - Train phase1 · Batch training for the clinical baseline experiment
scripts/train_all_models.py - Train phase2 · Enhanced training and ablation variants for the MRI-augmented pipeline
scripts/train_phase2_enhanced.py - Evaluate · Single-model and batch evaluation workflows
scripts/evaluate.py - Eval all · Compares all candidate models across experiments
scripts/evaluate_all_models.py - Compare · Model comparison and ablation analysis for Phase 2 variants
scripts/compare_models.py
Orchestration
End-to-end runners and audit gates
- Audit · Pre-training audit for enhanced pipeline data validity
scripts/pre_training_audit.py - Full run · End-to-end OASIS-1 pipeline execution from raw inputs to final artifacts
scripts/run_full_oasis1_pipeline.py - Batch run · Runs the pipeline across datasets or experiment variants
scripts/run_all_datasets.sh
Docs
Feature semantics and project reporting
- Feature dict · Reference for imaging biomarker definitions and interpretation
docs/OASIS1_IMAGING_FEATURE_DICTIONARY.md - Progress · Project progress and experiment tracking documentation
docs/PROJECT_PROGRESS_REPORT.md - Clinical report · Published Phase 2 clinical accuracy report
PHASE2_CLINICAL_ACCURACY_REPORT.md
Connections 29
- Raw OASIS → Combined CSV: consolidates · Raw dataset exports are consolidated into the tabular input
- Combined CSV → Prep script: inputs · Clinical CSV feeds Phase 1 preprocessing
- Prep script → Preprocess: uses · Script delegates feature preparation to preprocessing module
- Preprocess → Processed data: writes · Processed baseline data is stored for downstream training
- Processed data → Data loader: loads · Training and evaluation consume processed splits via loader
- Data loader → Train phase1: feeds · Loader provides datasets to baseline training
- Train phase1 → Model zoo: fits · Baseline script trains the model zoo
- Model zoo → Evaluate: scores · Evaluations consume model outputs and predictions
- Evaluate → Eval all: batch mode · Single-model evaluation and batch benchmarking are related workflows
- Raw OASIS → Format IO: scan normalizes · Raw MRI sources are normalized before feature extraction
- Format IO → QC: checks · Converted scans pass quality-control checks
- QC → Atlas map: validates · QC guards region mapping and downstream extraction assumptions
- Atlas map → Regional feats: maps · Atlas labels drive ROI feature extraction
- QC → Tissue feats: approves · Quality-checked imaging inputs are used for tissue metrics
- Tissue feats → Merge: produces · Global tissue features are merged into the Phase 2 table
- Regional feats → Merge: produces · Regional ROI features are merged into the Phase 2 table
- Merge → Enhanced data: writes · Merged imaging-clinical artifacts are persisted as staged CSVs
- Enhanced data → Audit: audits · Enhanced data is checked before training
- Audit → Train phase2: gates · Audit must pass before enhanced training proceeds
- Train phase2 → Compare: analyzes · Phase 2 training feeds comparison and ablation studies
- Compare → Eval all: benchmarks · Comparison relies on batch evaluation across models and variants
- Full run → Prep script: orchestrates · End-to-end runner invokes preprocessing
- Full run → Audit: orchestrates · Runner includes the pre-training audit gate
- Full run → Train phase2: orchestrates · Runner advances into enhanced training
- Batch run → Full run: repeats · Batch wrapper executes the full pipeline across datasets
- Feature dict → Regional feats: defines · Documentation describes region-level biomarkers
- Feature dict → Tissue feats: defines · Documentation describes tissue-level biomarkers
- Progress → Train phase2: tracks · Project progress documents the enhanced experiment status
- Clinical report → Compare: summarizes · Clinical report captures comparative Phase 2 findings