Heart-disease-prediction System using SVM (ML)
Heart Disease Prediction: AI-powered web app using SVM to assess heart disease risk. FastAPI backend, Bootstrap UI, MongoDB for history tracking. Predict, store, and analyze with ease!
Created on 8th April 2025
•
Heart-disease-prediction System using SVM (ML)
Heart Disease Prediction: AI-powered web app using SVM to assess heart disease risk. FastAPI backend, Bootstrap UI, MongoDB for history tracking. Predict, store, and analyze with ease!
The problem Heart-disease-prediction System using SVM (ML) solves
-
Early Detection of Heart Disease:
Heart disease is a leading cause of death worldwide. Many cases go undiagnosed due to lack of regular check-ups and complex diagnostic procedures. Our system allows early detection using basic medical input, reducing dependency on expensive or inaccessible lab tests. -
Accessibility for Remote Users:
People in rural or underserved areas often lack access to cardiologists or advanced diagnostics. This system empowers local clinics and individuals to assess risk levels from any internet-enabled device. -
Fast and Accurate Predictions:
Traditional diagnosis can take time and multiple clinical tests. Our AI-based system, powered by Support Vector Machine (SVM), processes data instantly and offers high-accuracy predictions within seconds. -
Reduces Human Error in Diagnosis:
Doctors, although highly skilled, can occasionally misdiagnose due to fatigue or data overload. An AI model supports clinical decisions by offering consistent data-driven predictions. -
Cost-Effective Solution:
Our tool uses open-source libraries and minimal computational resources, making it highly affordable for deployment in public health initiatives and low-income communities. -
Preventive Healthcare Encouragement:
This tool can be integrated into health apps or kiosks to encourage people to self-check and monitor their heart health regularly, promoting prevention over treatment. -
Educational Tool for Medical Students:
The system can serve as a learning tool for students in understanding how patient data and symptoms relate to cardiovascular risk using machine learning. -
Reduces Hospital Burden:
By filtering low-risk patients digitally, hospitals can prioritize serious cases and manage their resources better, especially during high patient inflow situations.
Challenges we ran into
-
Accuracy Trade-Offs Between Models:
Initially, we experimented with multiple classification models including XGBoost and K-Nearest Neighbors (KNN). However, they yielded relatively lower accuracy. After rigorous tuning and cross-validation, we settled on Support Vector Machine (SVM), which consistently gave higher accuracy and better generalization on our dataset. -
Backend Integration Issues:
Integrating the machine learning model with the FastAPI backend was challenging. There were multiple instances of API response delays due to inefficient data serialization and large model file handling. We overcame this by optimizing the model file size and using asynchronous processing where necessary. -
Data Preprocessing Bugs:
Handling missing or inconsistent values in the dataset led to repeated crashes during training. We added custom exception handling and validation logic to ensure clean and structured inputs for the model pipeline. -
Authentication Security Hurdles:
Implementing JWT-based authentication while ensuring end-to-end data security introduced complexity. We had to fine-tune the token expiration, refresh mechanisms, and securely store user data to prevent unauthorized access. -
Real-Time Prediction Latency:
Ensuring that the system responded in real-time during prediction was a key challenge. The model’s initial load time was slow, which we optimized using Docker containerization and keeping the model loaded in memory during API runtime. -
Frontend State Management:
On the React side, managing UI state between components, especially during data loading and prediction phases, caused unexpected behavior. We resolved it by incorporating Redux for state management and improving user feedback through loaders and status messages. -
Deployment Complications:
Containerizing the entire application and deploying it in a cloud environment had some hurdles, particularly with network configurations and Docker image optimizations.