Skip to content

This project focuses on predicting the risk of suffering a stroke using a machine learning model trained on a real-world health dataset. The model analyzes key personal, medical, and lifestyle factors to determine whether an individual is at risk. The goal is to support early detection.

Notifications You must be signed in to change notification settings

Bootcamp-IA-P4/brainstroke-navm

Repository files navigation

Banner centrado

📌 Index

Section Link
🔍 About About the Project
✨ Features Main Features
🐞 Issues Current Issues
📁 Structure Folder Structure
🧠 Improvements Possible Improvements
🗺️ Diagram Architecture Diagram
⚙️ Usage Installation and Usage
📊 Performance Model Performance: XGBoost & Neural Network
🧪 Testing Testing
🎥 Demo Demo
🚀 Deployment Render Deployment
🐳 Docker Dockerization
🤝 Team Collaborators

🧠 About the Project

This project focuses on predicting the risk of suffering a stroke using a machine learning model trained on a real-world health dataset. The model analyzes key personal, medical, and lifestyle factors to determine whether an individual is at risk. The goal is to support early detection and prevention by providing fast, data-driven assessments through a user-friendly web interface.


🔍 Main Features

✅ Complete EDA process with data cleaning and visualizations.
✅ Binary classification using XGBoost Classifier.
✅ Backend built with Python and FastApi.
✅ Frontend developed with Node and React. ✅ Database integration using Supabase.
✅ Modular and scalable project structure.


🐞 Current Issues

❌The model's accuracy is limited due to the small dataset size. Increasing the amount and diversity of data could significantly improve performance.


💡 Possible Improvements

✅ Add user authentication and data history


📁 Folder Structure

# Clasificación_Multiclase_equipo_6
📂 Clasificaci-n_Multiclase_equipo_6
├── 📂 .venv/
├── 📂 .github/
├── 📂 client/
│   └── 📂 public/
│   └── 📂 src/
│       └── 📂 assets/
│       └── 📂 components/
│               └── About.jsx/
│               └── AssesmentForm.jsx/
│               └── Header.jsx/
│               └── Hero.jsx/
│               └── PredictionHistory.jsx/
│       └── App.jsx/
│       └── main.jsx/
├── 📂 data/  
│   └── csv_final.csv
├── 📂 eda/
│   └── EDA.ipynb
│── 📂 model/
│   └── modelo_xgb.pkl
│   └── models.ipynb
│   └── encoded.py              
├── 📂 server/
│   └── 📂 database/
│         └── db_connection.py
│         └── save_user.py
│   └── requirements.txt
│   └── main.py
│   └── dockerfile
├── 📂 tests/
│   └── test_model.py
├── 📜 .env 
├── 📜 README.md  
├── 📜 .gitignore  
├── 📜 requirements.txt
├── 📜 dockerfile
├── 📜 docker-compose.yaml
├── 📜 .dockerignore

🧠 Architecture Diagram

Diagrama de arquitectura
---

⚙️ Installation and Usage

1️⃣ Clone the repository

git clone https://github.com/Bootcamp-IA-P4/brainstroke-navm.git
cd brainstroke-navm

2️⃣ Create and activate the virtual environment

python -m venv .venv
source .venv/Scripts/activate # Windows
source .venv/bin/activate  # Linux/Mac

3️⃣ Install backend dependencies and run the API

pip install -r requirements.txt
uvicorn server.main:app --reload

4️⃣ Install and run the frontend

cd client
npm install
npm run dev

📊 Model Performance: XGBoost & Neural Network

🔸 XGBoost Classifier

  • Type: Binary Classification
  • Target: Predict stroke risk based on tabular health data
  • Framework: scikit-learn, xgboost
  • Performance:
    XGBoost Metrics

🔸 Neural Network (MobileNetV2 - Transfer Learning)

  • Type: Convolutional Neural Network (CNN)
  • Task: Multiclass classification of brain CT images
  • Classes: Bleeding, Ischemia, Normal
  • Input: 224x224 RGB images
  • Base Model: Pretrained MobileNetV2
  • Final Layer: nn.Linear(model.last_channel, 3)
  • Loss Function: CrossEntropyLoss
  • Optimizer: Adam (lr=1e-4)
  • Epochs: 6
  • Dataset: Custom-labeled CT image dataset
  • Model File: model/model2.pth
metrics

🧐 Testing

Copy the following command to run the tests:

python -m unittest discover
test

📂 Demo

🔗 ▶️ Ver Demo


🚀 Deployment on Render

🔹 You can view the live frontend of the project here:
🌐 https://brainstroke-navm-1-front.onrender.com

🔹 You can access the API documentation here:
🛠️ https://brainstroke-navm.onrender.com

ℹ️ Note: It might take a few seconds to load when idle, as free Render services may enter sleep mode.


🐋 Dockerization

This application is Dockerized. To run it, execute the following command:

docker-compose up --build
docker

🧑‍💻 Collaborators

This project was developed by the following contributors:


(⬆️ Back to top)

About

This project focuses on predicting the risk of suffering a stroke using a machine learning model trained on a real-world health dataset. The model analyzes key personal, medical, and lifestyle factors to determine whether an individual is at risk. The goal is to support early detection.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 5