Skip to content

About

Keratoconus progression prediction web app using logistic regression with SHAP explainability

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Keratoconus 1- and 2-Year Progression Predictor

Interactive demonstration of the machine learning model described in:

Gil P, Gil JQ, Mendes L, Alves N, Rosa A, Murta J. "Predicting Keratoconus Progression Within 1–2 Years Using Baseline Tomography and an Explainable Open-Access Machine Learning Model."

Features

  • Two models: 1-year (BAD-D, Age, ARC 3mm) and 2-year (Kmax, Age, Pachy Min), with input validation against the training data range
  • Classification — higher or lower risk of progression within each horizon, with the model score (linear predictor of a class-balanced model; threshold 0; not a probability)
  • SHAP waterfall plot — bar-chart breakdown of individual feature contributions
  • SHAP decision plot — cumulative path from base value to final prediction
  • Privacy-safe — no patient data required at runtime; the SHAP reference is the study cohort's mean of each predictor (stored in boundaries*.pkl), so each SHAP value is the coefficient times the predictor's deviation from the cohort mean

Live Demo

Deployed on Streamlit Community Cloud.

Run Locally

pip install -r requirements.txt
streamlit run app.py

Model

  • Algorithm: Logistic Regression (scikit-learn)
  • Training: SMOTE-balanced (k=5, ratio=1.0) with StandardScaler preprocessing
  • Data: 412 eyes of 248 patients (85 progressing within 1 year, 135 within 2 years)
  • 1-year model: BAD-D, Age at Baseline, ARC (3mm Zone); standardised coefficients +0.3225, −0.7027, −0.7370
  • 2-year model: Kmax, Age at Baseline, Pachy Min; standardised coefficients +0.7544, −0.6277, −0.3232
  • Penalty: scikit-learn default L2 (C = 1.0)

Project Structure

├── app.py                 # Streamlit application (privacy-safe, no patient data)
├── app_realData.py        # Reference version (requires local X_train.pkl, not included)
├── requirements.txt       # Python dependencies
├── logistic_model.pkl     # 1-year logistic regression model
├── scaler.pkl             # 1-year StandardScaler (fitted on the balanced training sample)
├── boundaries.pkl         # 1-year feature boundaries and cohort means (min/max/mean/std)
├── logistic_model_twoYear.pkl, scaler_twoYear.pkl, boundaries_twoYear.pkl   # 2-year equivalents
└── .streamlit/
    └── config.toml        # Streamlit theme and server configuration

Dependencies

  • streamlit
  • numpy
  • scikit-learn, joblib
  • shap
  • matplotlib

Disclaimer

Not for clinical use. This application is a research demonstration intended solely to illustrate the algorithm described in the accompanying publication. It is not a certified or validated medical device and must not be used for clinical decision-making.

License

This project is part of ongoing PhD research at Aibili.

About

Keratoconus progression prediction web app using logistic regression with SHAP explainability

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages