HCV‑ML‑App


Summary

HCV‑ML‑App is a non‑invasive decision‑support system that predicts liver fibrosis stage (Low / Moderate / Advanced) from routine clinical and laboratory inputs. The pipeline applies log‑transform, imputation, min‑max scaling and SMOTE; selects 14 clinically meaningful features via Ant Colony Optimization (ACO); and classifies with a Random Forest model that achieved 87.1% accuracy in cross‑validation. The trained model is exposed through a Flask REST API and consumed by a React Native mobile app; deployment is containerized with Docker Compose.

ML‑Driven Fibrosis Stage Prediction for Hepatitis C on Mobile Devices

React Native Flask API Python Random Forest ACO Feature Selection Docker Compose

Data & Labeling

  • Dataset: Egyptian HCV (UCI) — demographic, hematologic, enzymes, viral load.
  • Labels regrouped to 3 classes: Low (F0–F1), Moderate (F2), Advanced (F3–F4).
  • Key inputs among the selected 14: ALT series, AST, RNA (log1p), RBC, WBC, Platelets, BMI.

Model Pipeline

  • Preprocess: log transform (RNA), mean impute, min‑max scale, SMOTE.
  • Feature Selection: ACO swarm search → compact 14‑feature subset.
  • Classifier: Random Forest (n_estimators=100, class_weight="balanced").
  • Result: Accuracy 87.1% (best among RF / XGBoost / Logistic Regression).

App Architecture

  • Frontend: React Native single‑form UI (14 numeric fields), real‑time validation, instant result display.
  • Backend: Flask REST endpoint applies the same preprocessing and loads serialized RF model.
  • Deployment: Dockerized services; portable to on‑prem or cloud.

Key Points

  • Designed for speed and interpretability (feature importances available).
  • Best separation at extremes (Low vs Advanced); Moderate remains clinically ambiguous.
  • Intended as decision support, not a diagnostic replacement.

Quick Start

# Backend (Flask) python -m venv .venv && source .venv/bin/activate # Windows: .venv\Scripts\activate pip install -r requirements.txt python app.py # or: uvicorn if ASGI wrapper is used # Mobile (React Native) npm install # or yarn npm run start # Docker (example) docker compose up --build

Notes & Limitations

  • Trained on a single cohort; prospective external validation is pending.
  • Input ranges/units must match training schema; site‑specific calibration may be needed.
  • Use as clinical decision support; not a substitute for physician judgment.