Machine Learning Project: Heart Disease Prediction System (HDPS) using Logistic Regression from Scratch

This article will provide you with a complete Machine Learning Project named Heart Disease Prediction System which uses Logistic Regression algorithm from Scratch.

    05 FEB 2022 • 4 MIN READ
Heart Disease Prediction System Homepage

Heart Disease Prediction System (HDPS) is a web-based Machine Learning Project with a user-friendly interface that is built with Django. It predicts whether the patient has heart disease or not using Machine Learning (ML) Algorithm Logistic Regression. 

Features of HDPS

Tools and Technology Used to build HDPS

Front-End Tools

Back-End Tools


For HDPS Demonstration follow this video

HDPS Project Demonstration Video

For Explanation of HDPS follow this video

HDPS Project Explanation Video

Algorithm Used 

To train the model, the Machine Learning algorithm Logistic Regression is used. You can easily import Logistic Regression from scikit-learn library, but the project has implemented Logistic Regression right from scratch.

Logistic regression is a supervised learning classification algorithm used for predicting the categorical dependent variable using a given set of independent variables.

Logistic regression predicts the output of a categorical dependent variable. Therefore the outcome must be a categorical or discrete value. It can be either Yes or No, 0 or 1, true or False, etc. but instead of giving the exact value as 0 and 1, it gives the probabilistic values which lie between 0 and 1

logistic regression in hpdsLogistic regression basic concept

In HDPS data is extracted from the patient which includes different 13 parameters like blood pressure, age, sex, etc. This data is then fed to the trained model which provides the outcome in the form of probability ranging value 0-1.

13 different attributes include :

13 attributes of heart disease prediction system13 different attributes of HDPS

For source code please refer to this GitHub Repo.

Detail process design of HDPS 

All Machine Learning algorithm needs training to predict the result. Firstly, the model is trained with data set, which was collected from the Kaggle UCI repository. After training our model the model now becomes ready to take input and process it.

Process Design of HDPSProcess Design of HDPS

The input is given to the trained model. The model classifies data based on probability, a value greater than 0.5 is considered to have a high probability of heart disease, and a value less than 0.5 has less probability of having heart disease. The result is then displayed to the user. 

Accuracy of the system 

The accuracy of a system is given by the number of correct predictions by the total number of predictions made multiplied by 100.

The accuracy of HDPS is 71.287% which is not that high due to the low number of datasets and implementation of the algorithm from scratch.

accuracy of hdpsAccuracy of Heart Disease Prediction System (HDPS)

True Positive: True Positive are those examples that were actually positives and were predicted as positives. True Positive of our model was 29.


False Positive: False Positives also known as Type 1 error are those examples that were actually negatives but our model predicted them as positive. False Positive of our model was 6.


False Negative: False Negatives also known as Type 2 error are those examples that were actually positives but our model predicted them as negative. False Negative of our model was 23.



Limitations of HDPS 


tech django machine learning project tutorials


warning   You need to Sign Up to Comment

Related Blogs

See all    
What is Web 3.0? Advantage, disadvantage and how does it work?
Create a comment and reply system in Django.
Free Hosting(VPS) in Microsoft Azure using Terraform