Cardiovascular diseases (CVDs) are the number 1 cause of death globally, taking an estimated 17.9 million lives each year, which accounts for 31% of all deaths worlwide. Heart failure is a common event caused by CVDs and this dataset contains 12 features that can be used to predict mortality by heart failure.
Most cardiovascular diseases can be prevented by addressing behavioural risk factors such as tobacco use, unhealthy diet and obesity, physical inactivity and harmful use of alcohol using population-wide strategies.
People with cardiovascular disease or who are at high cardiovascular risk (due to the presence of one or more risk factors such as hypertension, diabetes, hyperlipidaemia or already established disease) need early detection and management wherein a machine learning model can be of great help.
So in this project I tried to develop an accurate model that could predict if a patient would die of heart failure or not given the input features.
The data used was gotten from kaggle https://www.kaggle.com/datasets/andrewmvd/heart-failure-clinical-data.
In this project I tested 6 different classification algorithms namely:
- Logistic Regression
- Decision Tree
- Random Forest
- XGBoost
- GradientBoostClassifier
- SupportVectorClassifier
The final model used for the app was the Gradient Boost Classifier model which had an accuracy score of 0.833.
To run a demo do the following:
- Clone the repository.
- Install the requirements from the requirements.txt file:
pip install -r requirements.txt
- Then from your command line run:
python app.py
Then you can view the site on your local server: http://127.0.0.1:5000/
The site can be deployed to heroku and can also be viewed here: https://heart-failure-predictors.herokuapp.com/