HeartSense is a machine learning–powered system designed to predict the risk of heart disease using clinical health parameters. The project combines data analysis, predictive modeling, and a user-friendly interface to deliver fast and accurate cardiovascular risk assessments.
- Multiple Machine Learning Models for improved prediction accuracy
- Web-Based Interface for interactive predictions
- Command-Line Support for quick testing and automation
- Clinical Data Analysis using real-world health indicators
- Model Comparison & Evaluation with performance metrics
- Secure Handling of sensitive healthcare data
HeartSense helps healthcare professionals, researchers, and individuals assess heart disease risk through machine learning.
The system evaluates clinical parameters such as age, cholesterol, blood pressure, and heart rate to estimate cardiovascular disease probability.
Before running the project, ensure you have:
- Python 3.8 or higher
- pip (Python package manager)
- Git
git clone https://github.com/Aradhya-21/HeartSense.git
cd HeartSenseWindows:
python -m venv venv
venv\Scripts\activateMac/Linux:
python3 -m venv venv
source venv/bin/activatepip install -r requirements.txtpython app.pyOpen your browser and visit:
http://localhost:5000
python predict.py --age 45 --sex 1 --cp 2 --trestbps 130 --chol 250 --fbs 0 --restecg 1 --thalach 150 --exang 0 --oldpeak 2.3 --slope 1 --ca 1 --thal 2Navigate to the notebooks/ directory for:
- Data analysis
- Feature engineering
- Model experimentation
- Visualization
HeartSense uses the Cleveland Heart Disease Dataset from the UCI Machine Learning Repository.
- 303 patient records
- 14 clinical attributes
- Age
- Sex
- Chest pain type
- Resting blood pressure
- Cholesterol levels
- Fasting blood sugar
- Resting ECG results
- Maximum heart rate achieved
- Exercise-induced angina
- ST depression induced by exercise
- Peak exercise ST segment slope
- Number of major vessels colored by fluoroscopy
- Thalassemia
The project compares multiple algorithms to identify the best-performing model:
- Random Forest Classifier
- Logistic Regression
- Support Vector Machine (SVM)
- Gradient Boosting (XGBoost)
- Neural Networks
- K-Nearest Neighbors (KNN)
| Metric | Score |
|---|---|
| Accuracy | 88.5% |
| Precision | 89.2% |
| Recall | 87.8% |
| F1-Score | 88.5% |
| AUC-ROC | 0.93 |
HeartSense/
├── app.py # Flask web application
├── predict.py # Command-line prediction script
├── train_model.py # Model training script
├── requirements.txt # Project dependencies
├── data/
│ └── processed/ # Processed dataset files
├── models/ # Saved trained models
├── notebooks/ # Data exploration notebooks
├── src/
│ ├── preprocessing.py # Data preprocessing logic
│ ├── models.py # Model definitions
│ └── utils.py # Utility functions
├── static/ # CSS, JS, and image assets
├── templates/ # HTML templates
└── tests/ # Unit tests
- Create the model inside
src/models.py - Add training logic in
train_model.py - Update prediction handling in
predict.pyandapp.py
- Add your dataset to the
data/folder - Update preprocessing paths in
src/preprocessing.py - Retrain models:
python train_model.pyContributions are welcome.
- Fork the repository
- Create a feature branch
git checkout -b feature/AmazingFeature- Commit your changes
git commit -m "Add AmazingFeature"- Push to GitHub
git push origin feature/AmazingFeature- Open a Pull Request
This project is licensed under the MIT License.
See the LICENSE file for more details.
- UCI Machine Learning Repository for the dataset
- The Scikit-learn community for ML tools
- Flask framework contributors
- Open-source contributors and developers
If you encounter any issues:
- Visit the GitHub Issues page
- Check for existing solutions
- Create a new issue if needed
HeartSense has the potential to evolve into a more advanced healthcare intelligence platform. Future improvements can enhance prediction accuracy, usability, scalability, and real-world healthcare integration.
Develop Android and iOS applications to allow users to access heart disease prediction features directly from smartphones.
Integrate with smartwatches and fitness trackers to collect real-time health metrics such as heart rate, oxygen levels, and activity data.
Implement advanced deep learning techniques such as Artificial Neural Networks (ANN) and Recurrent Neural Networks (RNN) for improved predictive performance.
Build a rich dashboard with visual charts and health trend analysis to help users understand their cardiovascular risk factors.
Expand accessibility by supporting multiple languages for a broader global audience.
Deploy the application on cloud platforms such as �entity�["company","Amazon Web Services","AWS cloud platform"]� (AWS), �entity�["company","Google Cloud Platform","Cloud computing platform by Google"]�, or �entity�["company","Microsoft Azure","Cloud computing platform by Microsoft"]� to improve scalability and availability.
Add secure login systems, encrypted health records, and role-based access for healthcare professionals.
Enable integration with Electronic Health Record (EHR) systems to automatically fetch patient data.
Implement automated retraining pipelines so the model improves over time with new healthcare datasets.
Introduce an AI-powered assistant that provides personalized recommendations based on patient health inputs.