0% found this document useful (0 votes)
17 views12 pages

ML Report

This document summarizes a student project focused on predicting heart failure using machine learning. The project uses a dataset of 303 patients with 14 medical attributes to train a logistic regression model to classify individuals as having or not having heart disease. The model is evaluated on test data and achieves accuracy. Visualizations are also used to illustrate the model's predictions based on selected attributes. The project demonstrates the workflow for developing a machine learning model for medical classification tasks.

Uploaded by

Prakhar Arora
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views12 pages

ML Report

This document summarizes a student project focused on predicting heart failure using machine learning. The project uses a dataset of 303 patients with 14 medical attributes to train a logistic regression model to classify individuals as having or not having heart disease. The model is evaluated on test data and achieves accuracy. Visualizations are also used to illustrate the model's predictions based on selected attributes. The project demonstrates the workflow for developing a machine learning model for medical classification tasks.

Uploaded by

Prakhar Arora
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Heart Failure Prediction

End Term Report


By:
Prakhar Arora
K21ML-38

School of Computer Science Engineering


Lovely Professional University
Student Declaration

This is to declare that this report has been written by me. No part of the report
is copied from other sources. All information included from other sources have
been duly acknowledged. I aware that if any part of the report is found to be
copied, I will take full responsibility for it.

Name: prakhar arora


Roll-No: 38

Place: Lovely Professional University


Date: 38 November-2023
1 TABLE OF CONTENT 2

2 OBEJCTIVE 4

3 HISTORY 4

4 PROJECT DESCRIPTION 5-6

5 WORKING 6-7

6 CONCLUSION 8-12
Objective-

The objective of this report is to provide a comprehensive overview of a


machine learning project focused on the prediction of heart failure, detailing
the methodology, data analysis, model development, and performance
evaluation. This report aims to present the project's key findings, insights,
and the potential implications for healthcare applications.

History-

In recent years, there has been a growing interest in leveraging machine


learning techniques to predict and manage heart failure. This interest is
driven by the increasing prevalence of heart failure, the need for early
detection, and the potential to improve patient outcomes. Machine learning
models have shown promise in analysing various medical data sources, such
as patient demographics, clinical measurements, and diagnostic tests, to
predict the risk of heart failure. This history lesson will explore the key
milestones and developments in the field of heart failure prediction using
machine learning, highlighting the evolution of techniques and their impact
on healthcare.
Project Description-

Title: Heart Disease Prediction using Logistic Regression

Introduction:
The Heart Disease Prediction project is a machine learning-based solution
designed to predict the likelihood of an individual having heart disease based
on various medical and demographic features. This project utilizes logistic
regression, a popular classification algorithm, to make predictions.

Dataset:
The project employs a comprehensive dataset containing 303 instances with 14
different attributes. These attributes include:

• Age
• Sex
• Chest pain type (cp)
• Resting blood pressure (trestbps)
• Serum cholesterol level (chol)
• Fasting blood sugar (fbs)
• Resting electrocardiographic results (restecg)
• Maximum heart rate achieved (thalach)
• Exercise-induced angina (exang)
• ST depression induced by exercise relative to rest (oldpeak)
• Slope of the peak exercise ST segment (slope)
• Number of major vessels colored by fluoroscopy (ca)
• Thalassemia (thal)
The dataset is labelled, with the 'target' attribute denoting the presence
(1) or absence (0) of heart disease.

Libraries Used:
The project leverages various Python libraries to process and analyse the
data, train the logistic regression model, and evaluate its performance.
These libraries include:

NumPy: Used for numerical operations and array handling.


Pandas: Used to read and manipulate the dataset.
scikit-learn: Utilized for model selection, train-test splitting, logistic
regression modelling, and performance evaluation.
Matplotlib: Employed for data visualization, including plotting the logistic
regression decision boundary.

Project Workflow:

Data Preparation: The project starts with loading the dataset using
Pandas. Initial data exploration is conducted, including checking for null
values and understanding the structure of the dataset.

Data Splitting: The dataset is divided into training and testing sets using
“scikit-learn's train_test_split” function. This ensures that the model is
trained on one portion of the data and evaluated on another to assess its
generalization performance.

Logistic Regression Model: A logistic regression model is selected as the


machine learning algorithm for this binary classification task. The model
is instantiated and trained with the training data using scikit-learn's
LogisticRegression class. The 'max_iter' parameter is set to ensure
convergence.

Model Evaluation: To gauge the model's performance, it is evaluated on


the training data. Accuracy is used as the performance metric, calculated
using scikit-learn's accuracy_score function.
Predictive System: The trained logistic regression model is used to create
a predictive system. This system takes an input vector containing
relevant medical and demographic information for an individual as a
numpy array, reshapes it, and predicts the likelihood of heart disease (1
for presence, 0 for absence).

Interpretation: The system provides a binary prediction, and based on


the outcome, it offers a human-readable interpretation to convey
whether the individual is at risk of heart disease.

Visualization: The project also provides data visualization using


Matplotlib. A plot of the logistic regression decision boundary is
generated. However, it's essential to choose two relevant features for
this visualization, such as age and cholesterol, and depict how the model
separates the classes based on these features.
WORKING:

STEP 1: IMPORTING LIBRARIES

STEP2: OPENING THE CSV DATA FILE USING PANDAS METHO . READ

STEP 3: FETCHING THE INFORMATION ABOUT THE SHAPE AND DETAILS OF DATA
STEP 4: CHECKING IF THE DATA NEEDS CLEANING AND THEN DESCRIBING DATA.
STEP 5- CHECKING IF THE DATA IS DISTRIBUTED PROPERLY OR NOT.

target
1 165
0 138
Name: count, dtype: int64

STEP 6 – SPLITTING THE FEATURES AND DATA


STEP 7-SPLITTING THE DATA INTO TRAINING AND TEST DATA:

STEP 8 – TRAINING ON LOGISTIC REGRESSION


FINAL STEP 9- BUILDING A PREDICTIVE SYSTEM.

CONCLUSION: - The Heart Disease Prediction project effectively demonstrates the use of
logistic regression for classifying individuals into two categories: those with and without
heart disease. It showcases the project workflow, data preparation, model training, and a
user-friendly predictive system. Additionally, the visual representation of the decision
boundary helps users understand how the model makes predictions based on selected
features.

This project can serve as a foundation for further enhancements and can be extended to
include additional features, explore different machine learning algorithms, or implement a
more comprehensive user interface for broader applications in the field of medical
diagnosis.

You might also like