[15a331]: / README.md

Download this file

158 lines (119 with data), 3.6 kB

Stroke Risk Predictor

Table of Contents

Overview

Machine learning-based web application designed to assess stroke risk based on health and lifestyle factors. The system processes patient data through a CatBoost model to provide risk assessments, helping healthcare professionals identify potential stroke risks early for timely intervention.

Interface

Web App Interface

Features

  • Comprehensive health data analysis
  • Advanced feature engineering implementation
  • Multiple model evaluation framework
  • High-recall optimization
  • Flask-based web interface
  • Google Cloud Platform deployment
  • Automated testing suite
  • Containerized deployment

Model Details

Current implemented models evaluated:
1. Logistic Regression
2. XGBoost
3. CatBoost (selected as final model)

Prerequisites

  • Python 3.9+ (check .python-version file for the current required version)
  • Docker
  • Google Cloud SDK
  • Flask
  • scikit-learn
  • CatBoost

Installation

  1. Install uv:
    ```bash
    # On Unix/macOS
    curl -LsSf https://astral.sh/uv/install.sh | sh

# On Windows (PowerShell)
irm https://astral.sh/uv/install.ps1 | iex
```

  1. Clone the repository:
    bash git clone https://github.com/vytautas-bunevicius/stroke-risk-predictor.git cd stroke-risk-predictor

  2. Create and activate virtual environment:
    bash uv venv source .venv/bin/activate # On Unix/macOS # or .venv\Scripts\activate # On Windows

  3. Install dependencies:
    bash uv pip install -r requirements.txt

Using pip (Alternative)

  1. Clone the repository:
    bash git clone https://github.com/vytautas-bunevicius/stroke-risk-predictor.git cd stroke-risk-predictor

  2. Create and activate virtual environment:
    bash python3 -m venv venv source venv/bin/activate # On Unix/macOS # or venv\Scripts\activate # On Windows

  3. Install dependencies:
    bash pip install -r requirements.txt

Development Setup

Environment Configuration

  1. Create .env file in project root:
    env FLASK_ENV=development MODEL_PATH=models/catboost_model.pkl PORT=5000

  2. Configure Google Cloud services:

  3. App Engine
  4. Cloud Storage (for model storage)
  5. Secret Manager

Local Execution

Run the application locally:

python src/app.py

Visit http://localhost:5000 in your browser.

Deployment

The application is deployed on Google Cloud Platform App Engine:

  1. Configure deployment:
    bash gcloud config set project your-project-id

  2. Deploy:
    bash gcloud app deploy

Testing

Run the test suite:

python -m pytest tests/

License

This project is released under the Unlicense. This means you can copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

See the UNLICENSE file for more details.