Skip to content

ritikajha89/clinical-ml-lab

Repository files navigation

Clinical ML and Data Science Lab

CI Python License: MIT

A small, fully reproducible lab that shows how I build and evaluate a clinical machine-learning model, and how I run data-science analytics on clinical-style data. Everything uses synthetic, seeded data, so it runs anywhere with no private patient information.

What is inside

  1. Modeling (clinlab.train, clinlab.evaluate)

    • Leakage-safe pipeline (scaler fit inside cross-validation folds).
    • 5-fold stratified cross-validation and a small grid search over logistic-regression and random-forest baselines; model selection by cross-validated ROC-AUC.
    • Held-out test metrics: accuracy, precision, recall, F1, ROC-AUC, and Brier score for calibration, plus a best-F1 threshold search and an error analysis of the most confident wrong predictions.
  2. Clinical analytics (clinlab.analytics, via DuckDB SQL)

    • Overall outcome summary (improvement and readmission rates).
    • Subgroup rates by age group.
    • A treatment A/B comparison (standard vs intervention) with a two-proportion z-test.
    • Data-quality gates (null and duplicate IDs, invalid arms, admission-logic violations).
  3. Serving (clinlab.api)

    • A FastAPI /predict endpoint that loads the trained model bundle and returns a probability.

Quick start

python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"

pytest -q                          # run the tests
python scripts/run_training.py     # train, evaluate, write artifacts/metrics.json
python scripts/run_analytics.py    # run the SQL analytics suite
uvicorn clinlab.api:app --reload   # serve /health and /predict

Notes on validity

The dataset is synthetic and generated by scikit-learn's make_classification; feature names are clinical only for readability. See reports/MODEL_CARD.md. This is an engineering and evaluation reference, not a clinically valid model, and must not be used for patient care.

License

MIT - see LICENSE.

About

Reproducible clinical ML and data-science lab: modeling, calibration, and SQL/DuckDB analytics.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages