SlideShare a Scribd company logo
1 of 16
Heart disease classification
Project- 2
Presented by-
Sneha Dey
Dept of CSE, B.tech, 3rd year
(Seacom Engineering College)
ABOUT THE PROJECT
Machine Learning is used across many spheres around the world. The healthcare industry is no exception. Machine
Learning can play an essential role in predicting presence/absence of Locomotor disorders, Heart diseases and more. Such
information, if predicted well in advance, can provide important insights to doctors who can then adapt their diagnosis and
treatment per patient basis.
In this project, Iโ€™ll discuss where I worked on predicting potential Heart Diseases in people using Machine Learning
algorithms. The algorithms included K Neighbors Classifier and Support Vector Classifier and applying PCA on
these 2 models.
Objective
Improve cardiovascular health and quality of life through prevention, detection, and treatment.
Early identification and treatment of heart attacks and strokes.
Prevention of repeat cardiovascular events and reduction in deaths from cardiovascular disease.
IMPORTING LIBRARIES AND DATASET
I imported several libraries for the project and all the necessary Machine Learning algorithms.
In the dataset,there are a total of 13 features and 1 target variable. Also, there are no missing values so we donโ€™t need to take
care of any null values. Next, I used describe() method.
dataset.describe()
The method revealed
that the range of each
variable is different. The
maximum value of age is
77 but for chol it is 564.
Thus, feature scaling
must be performed on
the dataset.
Confusion Matrix
To begin with, letโ€™s see the correlation matrix of features and try to analyse it. The figure size is defined to 12 x 8 by using
rcParams. Then, I used pyplot to show the correlation matrix. Using xticks and yticks, Iโ€™ve added names to the
correlation matrix. colorbar() shows the colorbar for the matrix.
Itโ€™s easy to see that there is no single feature
that has a very high correlation with our target
value. Also, some of the features have a
negative correlation with the target value and
some have positive.
Histogram
The best part about this type of plot is that it just takes a single command to draw the plots and it provides so much
information in return. Just use dataset.hist().
Letโ€™s take a look at the plots. It shows
how each feature and label is
distributed along different ranges,
which further confirms the need for
scaling. Next, wherever you see discrete
bars, it basically means that each of
these is actually a categorical variable.
We will need to handle these
categorical variables before applying
Machine Learning. Our target labels
have two classes, 0 for no disease and 1
for disease.
Predict the Target class
Itโ€™s really essential that the dataset we are working on should be approximately balanced. An extremely imbalanced dataset
can render the whole model training useless and thus, will be of no use.
For x-axis I used the unique() values from the target column and
then set their name using xticks. For y-axis, I used value_count()
to get the values for each class. I colored the bars as green and red.
From the plot, we can see that the classes are almost balanced and we
are good to proceed with data processing.
Bar plot for Count of male and female
As per dataset,
0 โ€“ female and 1 โ€“ male
The plot shows the number of male is
mostly 2X greater than female patients in
the active study.
Scatter plot between Age and Maximum heart rate
A scatter plot is a type of plot or mathematical diagram using Cartesian coordinates to display values for typically two
variables- Age and Maximum Heart Rate.
The plot shows the ages between 40 to 70 is more
effective patients due to Maximum Heart Rate.
Data Processing and Splitting
To work with categorical variables, we should break each categorical column into dummy columns with 1s and 0s.
In this project, I took 4 algorithms and varied their various parameters and compared the final models.
I split the dataset into 67% training data and 33% testing data.
Support Vector Machine
I will run the model on the train and test set using SVC( Support Vector Classifier) and then use the test set to see what kind
of prediction results we get using the test data set.This classifier aims at forming a hyperplane that can separate the classes
as much as possible by adjusting the distance between the data points and the hyperplane. There are several kernels based
on which the hyperplane is decided. I tried four kernels namely, linear, poly, rbf, and sigmoid.
Once I had the scores for each, I used the rainbow method to select different colors for each bar and plot a bar graph of the
scores achieved by each.
As can be seen from the plot above, the linear
kernel performed the best for this dataset and
achieved a score of 83%
K โ€“ nearest neighbor classifier
This classifier looks for the classes of K nearest neighbors of a given data point and based on the majority class, it assigns a
class to this data point. However, the number of neighbors can be varied. I varied them from 1 to 20 neighbors and
calculated the test score in each case.Then, I plot a line graph of the number of neighbors and the test score achieved in each
case.
As you can see, we achieved the maximum score of 87%
when the number of neighbors was chosen to be 8.
SVM with PCA
The PCA/SVM-based method involves PCA-based data selection and image feature extraction for SVM classification; this
method can be used to solve the detection problems inherent in imprecise, uncertain, and incoherent data from multiple
sensors.
As you can see, we achieved the maximum score
of 80% the best for this dataset as per accuracy
check.
KNN with PCA
I am using KNN to classify and I also now have implemented PCA to reduce the dimensionality.As one closest neighbor is
red circle. Basically, with lower K value, - KNN model is trying to fit the model to data very closely and trying to find.
As you can see, we achieved the maximum
score of 56% when the number of neighbors
was chosen to be 20.
ACCURACY
1. Support Vector Classifier: 83%
2. K Neighbours Classifier: 87%
3. SVM with PCA: 80%
4. KNN with PCA: 56%
K Neighbours Classifier scored the best score of 87%
inference
K-Neighbours Classifier is amongst the most popular learning method grouped by similarities to build
machine learning models particularly for Heart disease prediction and document classification.
THANK YOU

More Related Content

What's hot

Machine Learning and Real-World Applications
Machine Learning and Real-World ApplicationsMachine Learning and Real-World Applications
Machine Learning and Real-World ApplicationsMachinePulse
ย 
WEKA: Credibility Evaluating Whats Been Learned
WEKA: Credibility Evaluating Whats Been LearnedWEKA: Credibility Evaluating Whats Been Learned
WEKA: Credibility Evaluating Whats Been LearnedDataminingTools Inc
ย 
How to understand and implement regression analysis
How to understand and implement regression analysisHow to understand and implement regression analysis
How to understand and implement regression analysisClaireWhittaker5
ย 
PCA (Principal component analysis)
PCA (Principal component analysis)PCA (Principal component analysis)
PCA (Principal component analysis)Learnbay Datascience
ย 
A tour of the top 10 algorithms for machine learning newbies
A tour of the top 10 algorithms for machine learning newbiesA tour of the top 10 algorithms for machine learning newbies
A tour of the top 10 algorithms for machine learning newbiesVimal Gupta
ย 
Housing price prediction
Housing price predictionHousing price prediction
Housing price predictionAbhimanyu Dwivedi
ย 
Supervised learning
Supervised learningSupervised learning
Supervised learningAlia Hamwi
ย 
Applications in Machine Learning
Applications in Machine LearningApplications in Machine Learning
Applications in Machine LearningJoel Graff
ย 
Data Trend Analysis by Assigning Polynomial Function For Given Data Set
Data Trend Analysis by Assigning Polynomial Function For Given Data SetData Trend Analysis by Assigning Polynomial Function For Given Data Set
Data Trend Analysis by Assigning Polynomial Function For Given Data SetIJCERT
ย 
Steering Model Selection with Visual Diagnostics: Women in Analytics 2019
Steering Model Selection with Visual Diagnostics: Women in Analytics 2019Steering Model Selection with Visual Diagnostics: Women in Analytics 2019
Steering Model Selection with Visual Diagnostics: Women in Analytics 2019Rebecca Bilbro
ย 
Slides distancecovariance
Slides distancecovarianceSlides distancecovariance
Slides distancecovarianceShrey Nishchal
ย 
Random forest algorithm
Random forest algorithmRandom forest algorithm
Random forest algorithmRashid Ansari
ย 
WEKA: Practicalย Machineย Learningย Toolsย Andย Techniques
WEKA: Practicalย Machineย Learningย Toolsย Andย TechniquesWEKA: Practicalย Machineย Learningย Toolsย Andย Techniques
WEKA: Practicalย Machineย Learningย Toolsย Andย TechniquesDataminingTools Inc
ย 
Data mining Part 1
Data mining Part 1Data mining Part 1
Data mining Part 1Gautam Kumar
ย 
Selecting the Right Type of Algorithm for Various Applications - Phdassistance
Selecting the Right Type of Algorithm for Various Applications - PhdassistanceSelecting the Right Type of Algorithm for Various Applications - Phdassistance
Selecting the Right Type of Algorithm for Various Applications - PhdassistancePhD Assistance
ย 
Missing data handling
Missing data handlingMissing data handling
Missing data handlingQuantUniversity
ย 
Random forest
Random forestRandom forest
Random forestMusa Hawamdah
ย 
House Sale Price Prediction
House Sale Price PredictionHouse Sale Price Prediction
House Sale Price Predictionsriram30691
ย 

What's hot (19)

Pca analysis
Pca analysisPca analysis
Pca analysis
ย 
Machine Learning and Real-World Applications
Machine Learning and Real-World ApplicationsMachine Learning and Real-World Applications
Machine Learning and Real-World Applications
ย 
WEKA: Credibility Evaluating Whats Been Learned
WEKA: Credibility Evaluating Whats Been LearnedWEKA: Credibility Evaluating Whats Been Learned
WEKA: Credibility Evaluating Whats Been Learned
ย 
How to understand and implement regression analysis
How to understand and implement regression analysisHow to understand and implement regression analysis
How to understand and implement regression analysis
ย 
PCA (Principal component analysis)
PCA (Principal component analysis)PCA (Principal component analysis)
PCA (Principal component analysis)
ย 
A tour of the top 10 algorithms for machine learning newbies
A tour of the top 10 algorithms for machine learning newbiesA tour of the top 10 algorithms for machine learning newbies
A tour of the top 10 algorithms for machine learning newbies
ย 
Housing price prediction
Housing price predictionHousing price prediction
Housing price prediction
ย 
Supervised learning
Supervised learningSupervised learning
Supervised learning
ย 
Applications in Machine Learning
Applications in Machine LearningApplications in Machine Learning
Applications in Machine Learning
ย 
Data Trend Analysis by Assigning Polynomial Function For Given Data Set
Data Trend Analysis by Assigning Polynomial Function For Given Data SetData Trend Analysis by Assigning Polynomial Function For Given Data Set
Data Trend Analysis by Assigning Polynomial Function For Given Data Set
ย 
Steering Model Selection with Visual Diagnostics: Women in Analytics 2019
Steering Model Selection with Visual Diagnostics: Women in Analytics 2019Steering Model Selection with Visual Diagnostics: Women in Analytics 2019
Steering Model Selection with Visual Diagnostics: Women in Analytics 2019
ย 
Slides distancecovariance
Slides distancecovarianceSlides distancecovariance
Slides distancecovariance
ย 
Random forest algorithm
Random forest algorithmRandom forest algorithm
Random forest algorithm
ย 
WEKA: Practicalย Machineย Learningย Toolsย Andย Techniques
WEKA: Practicalย Machineย Learningย Toolsย Andย TechniquesWEKA: Practicalย Machineย Learningย Toolsย Andย Techniques
WEKA: Practicalย Machineย Learningย Toolsย Andย Techniques
ย 
Data mining Part 1
Data mining Part 1Data mining Part 1
Data mining Part 1
ย 
Selecting the Right Type of Algorithm for Various Applications - Phdassistance
Selecting the Right Type of Algorithm for Various Applications - PhdassistanceSelecting the Right Type of Algorithm for Various Applications - Phdassistance
Selecting the Right Type of Algorithm for Various Applications - Phdassistance
ย 
Missing data handling
Missing data handlingMissing data handling
Missing data handling
ย 
Random forest
Random forestRandom forest
Random forest
ย 
House Sale Price Prediction
House Sale Price PredictionHouse Sale Price Prediction
House Sale Price Prediction
ย 

Similar to Heart disease classification

Statistical Data Analysis on a Data Set (Diabetes 130-US hospitals for years ...
Statistical Data Analysis on a Data Set (Diabetes 130-US hospitals for years ...Statistical Data Analysis on a Data Set (Diabetes 130-US hospitals for years ...
Statistical Data Analysis on a Data Set (Diabetes 130-US hospitals for years ...Seval ร‡apraz
ย 
Machine Learning.pdf
Machine Learning.pdfMachine Learning.pdf
Machine Learning.pdfBeyaNasr1
ย 
Performance Comparision of Machine Learning Algorithms
Performance Comparision of Machine Learning AlgorithmsPerformance Comparision of Machine Learning Algorithms
Performance Comparision of Machine Learning AlgorithmsDinusha Dilanka
ย 
Predict Backorder on a supply chain data for an Organization
Predict Backorder on a supply chain data for an OrganizationPredict Backorder on a supply chain data for an Organization
Predict Backorder on a supply chain data for an OrganizationPiyush Srivastava
ย 
Data Science Project: Advancements in Fetal Health Classification
Data Science Project: Advancements in Fetal Health ClassificationData Science Project: Advancements in Fetal Health Classification
Data Science Project: Advancements in Fetal Health ClassificationBoston Institute of Analytics
ย 
GENETIC ALGORITHM FOR FUNCTION APPROXIMATION: AN EXPERIMENTAL INVESTIGATION
GENETIC ALGORITHM FOR FUNCTION APPROXIMATION: AN EXPERIMENTAL INVESTIGATIONGENETIC ALGORITHM FOR FUNCTION APPROXIMATION: AN EXPERIMENTAL INVESTIGATION
GENETIC ALGORITHM FOR FUNCTION APPROXIMATION: AN EXPERIMENTAL INVESTIGATIONijaia
ย 
Parameter Optimisation for Automated Feature Point Detection
Parameter Optimisation for Automated Feature Point DetectionParameter Optimisation for Automated Feature Point Detection
Parameter Optimisation for Automated Feature Point DetectionDario Panada
ย 
German credit score shivaram prakash
German credit score shivaram prakashGerman credit score shivaram prakash
German credit score shivaram prakashShivaram Prakash
ย 
PythonML.pptx
PythonML.pptxPythonML.pptx
PythonML.pptxHussain395748
ย 
Singular Value Decomposition (SVD).pptx
Singular Value Decomposition (SVD).pptxSingular Value Decomposition (SVD).pptx
Singular Value Decomposition (SVD).pptxrajalakshmi5921
ย 
EDAB Module 5 Singular Value Decomposition (SVD).pptx
EDAB Module 5 Singular Value Decomposition (SVD).pptxEDAB Module 5 Singular Value Decomposition (SVD).pptx
EDAB Module 5 Singular Value Decomposition (SVD).pptxrajalakshmi5921
ย 
Machine learning Mind Map
Machine learning Mind MapMachine learning Mind Map
Machine learning Mind MapAshish Patel
ย 
Decoding the Heart: Student Presentation on Heart Attack Prediction with Data...
Decoding the Heart: Student Presentation on Heart Attack Prediction with Data...Decoding the Heart: Student Presentation on Heart Attack Prediction with Data...
Decoding the Heart: Student Presentation on Heart Attack Prediction with Data...Boston Institute of Analytics
ย 
HEALTH PREDICTION ANALYSIS USING DATA MINING
HEALTH PREDICTION ANALYSIS USING DATA  MININGHEALTH PREDICTION ANALYSIS USING DATA  MINING
HEALTH PREDICTION ANALYSIS USING DATA MININGAshish Salve
ย 
SVM - Functional Verification
SVM - Functional VerificationSVM - Functional Verification
SVM - Functional VerificationSai Kiran Kadam
ย 
IRJET- Disease Prediction using Machine Learning
IRJET-  Disease Prediction using Machine LearningIRJET-  Disease Prediction using Machine Learning
IRJET- Disease Prediction using Machine LearningIRJET Journal
ย 
Machine Learning.pptx
Machine Learning.pptxMachine Learning.pptx
Machine Learning.pptxNitinSharma134320
ย 
Simplified Knowledge Prediction: Application of Machine Learning in Real Life
Simplified Knowledge Prediction: Application of Machine Learning in Real LifeSimplified Knowledge Prediction: Application of Machine Learning in Real Life
Simplified Knowledge Prediction: Application of Machine Learning in Real LifePeea Bal Chakraborty
ย 
ML MODULE 2.pdf
ML MODULE 2.pdfML MODULE 2.pdf
ML MODULE 2.pdfShiwani Gupta
ย 
An Approach to Mixed Dataset Clustering and Validation with ART-2 Artificial ...
An Approach to Mixed Dataset Clustering and Validation with ART-2 Artificial ...An Approach to Mixed Dataset Clustering and Validation with ART-2 Artificial ...
An Approach to Mixed Dataset Clustering and Validation with ART-2 Artificial ...Happiest Minds Technologies
ย 

Similar to Heart disease classification (20)

Statistical Data Analysis on a Data Set (Diabetes 130-US hospitals for years ...
Statistical Data Analysis on a Data Set (Diabetes 130-US hospitals for years ...Statistical Data Analysis on a Data Set (Diabetes 130-US hospitals for years ...
Statistical Data Analysis on a Data Set (Diabetes 130-US hospitals for years ...
ย 
Machine Learning.pdf
Machine Learning.pdfMachine Learning.pdf
Machine Learning.pdf
ย 
Performance Comparision of Machine Learning Algorithms
Performance Comparision of Machine Learning AlgorithmsPerformance Comparision of Machine Learning Algorithms
Performance Comparision of Machine Learning Algorithms
ย 
Predict Backorder on a supply chain data for an Organization
Predict Backorder on a supply chain data for an OrganizationPredict Backorder on a supply chain data for an Organization
Predict Backorder on a supply chain data for an Organization
ย 
Data Science Project: Advancements in Fetal Health Classification
Data Science Project: Advancements in Fetal Health ClassificationData Science Project: Advancements in Fetal Health Classification
Data Science Project: Advancements in Fetal Health Classification
ย 
GENETIC ALGORITHM FOR FUNCTION APPROXIMATION: AN EXPERIMENTAL INVESTIGATION
GENETIC ALGORITHM FOR FUNCTION APPROXIMATION: AN EXPERIMENTAL INVESTIGATIONGENETIC ALGORITHM FOR FUNCTION APPROXIMATION: AN EXPERIMENTAL INVESTIGATION
GENETIC ALGORITHM FOR FUNCTION APPROXIMATION: AN EXPERIMENTAL INVESTIGATION
ย 
Parameter Optimisation for Automated Feature Point Detection
Parameter Optimisation for Automated Feature Point DetectionParameter Optimisation for Automated Feature Point Detection
Parameter Optimisation for Automated Feature Point Detection
ย 
German credit score shivaram prakash
German credit score shivaram prakashGerman credit score shivaram prakash
German credit score shivaram prakash
ย 
PythonML.pptx
PythonML.pptxPythonML.pptx
PythonML.pptx
ย 
Singular Value Decomposition (SVD).pptx
Singular Value Decomposition (SVD).pptxSingular Value Decomposition (SVD).pptx
Singular Value Decomposition (SVD).pptx
ย 
EDAB Module 5 Singular Value Decomposition (SVD).pptx
EDAB Module 5 Singular Value Decomposition (SVD).pptxEDAB Module 5 Singular Value Decomposition (SVD).pptx
EDAB Module 5 Singular Value Decomposition (SVD).pptx
ย 
Machine learning Mind Map
Machine learning Mind MapMachine learning Mind Map
Machine learning Mind Map
ย 
Decoding the Heart: Student Presentation on Heart Attack Prediction with Data...
Decoding the Heart: Student Presentation on Heart Attack Prediction with Data...Decoding the Heart: Student Presentation on Heart Attack Prediction with Data...
Decoding the Heart: Student Presentation on Heart Attack Prediction with Data...
ย 
HEALTH PREDICTION ANALYSIS USING DATA MINING
HEALTH PREDICTION ANALYSIS USING DATA  MININGHEALTH PREDICTION ANALYSIS USING DATA  MINING
HEALTH PREDICTION ANALYSIS USING DATA MINING
ย 
SVM - Functional Verification
SVM - Functional VerificationSVM - Functional Verification
SVM - Functional Verification
ย 
IRJET- Disease Prediction using Machine Learning
IRJET-  Disease Prediction using Machine LearningIRJET-  Disease Prediction using Machine Learning
IRJET- Disease Prediction using Machine Learning
ย 
Machine Learning.pptx
Machine Learning.pptxMachine Learning.pptx
Machine Learning.pptx
ย 
Simplified Knowledge Prediction: Application of Machine Learning in Real Life
Simplified Knowledge Prediction: Application of Machine Learning in Real LifeSimplified Knowledge Prediction: Application of Machine Learning in Real Life
Simplified Knowledge Prediction: Application of Machine Learning in Real Life
ย 
ML MODULE 2.pdf
ML MODULE 2.pdfML MODULE 2.pdf
ML MODULE 2.pdf
ย 
An Approach to Mixed Dataset Clustering and Validation with ART-2 Artificial ...
An Approach to Mixed Dataset Clustering and Validation with ART-2 Artificial ...An Approach to Mixed Dataset Clustering and Validation with ART-2 Artificial ...
An Approach to Mixed Dataset Clustering and Validation with ART-2 Artificial ...
ย 

Recently uploaded

Chintamani Call Girls: ๐Ÿ“ 7737669865 ๐Ÿ“ High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: ๐Ÿ“ 7737669865 ๐Ÿ“ High Profile Model Escorts | Bangalore ...Chintamani Call Girls: ๐Ÿ“ 7737669865 ๐Ÿ“ High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: ๐Ÿ“ 7737669865 ๐Ÿ“ High Profile Model Escorts | Bangalore ...amitlee9823
ย 
Call Girls in Sarai Kale Khan Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9205541914 ๐Ÿ”( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9205541914 ๐Ÿ”( Delhi) Escorts S...Call Girls in Sarai Kale Khan Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9205541914 ๐Ÿ”( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9205541914 ๐Ÿ”( Delhi) Escorts S...Delhi Call girls
ย 
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...SUHANI PANDEY
ย 
Determinants of health, dimensions of health, positive health and spectrum of...
Determinants of health, dimensions of health, positive health and spectrum of...Determinants of health, dimensions of health, positive health and spectrum of...
Determinants of health, dimensions of health, positive health and spectrum of...shambhavirathore45
ย 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAroojKhan71
ย 
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 nightCheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 nightDelhi Call girls
ย 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxolyaivanovalion
ย 
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Valters Lauzums
ย 
Call Girls Bannerghatta Road Just Call ๐Ÿ‘— 7737669865 ๐Ÿ‘— Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call ๐Ÿ‘— 7737669865 ๐Ÿ‘— Top Class Call Girl Ser...Call Girls Bannerghatta Road Just Call ๐Ÿ‘— 7737669865 ๐Ÿ‘— Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call ๐Ÿ‘— 7737669865 ๐Ÿ‘— Top Class Call Girl Ser...amitlee9823
ย 
Generative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusGenerative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusTimothy Spann
ย 
CHEAP Call Girls in Saket (-DELHI )๐Ÿ” 9953056974๐Ÿ”(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )๐Ÿ” 9953056974๐Ÿ”(=)/CALL GIRLS SERVICECHEAP Call Girls in Saket (-DELHI )๐Ÿ” 9953056974๐Ÿ”(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )๐Ÿ” 9953056974๐Ÿ”(=)/CALL GIRLS SERVICE9953056974 Low Rate Call Girls In Saket, Delhi NCR
ย 
100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptxAnupama Kate
ย 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfLars Albertsson
ย 
Zuja dropshipping via API with DroFx.pptx
Zuja dropshipping via API with DroFx.pptxZuja dropshipping via API with DroFx.pptx
Zuja dropshipping via API with DroFx.pptxolyaivanovalion
ย 
Sampling (random) method and Non random.ppt
Sampling (random) method and Non random.pptSampling (random) method and Non random.ppt
Sampling (random) method and Non random.pptDr. Soumendra Kumar Patra
ย 
Delhi Call Girls CP 9711199171 โ˜Žโœ”๐Ÿ‘Œโœ” Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 โ˜Žโœ”๐Ÿ‘Œโœ” Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 โ˜Žโœ”๐Ÿ‘Œโœ” Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 โ˜Žโœ”๐Ÿ‘Œโœ” Whatsapp Hard And Sexy Vip Callshivangimorya083
ย 
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptxBPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptxMohammedJunaid861692
ย 
Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Researchmichael115558
ย 
FESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfFESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfMarinCaroMartnezBerg
ย 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz1
ย 

Recently uploaded (20)

Chintamani Call Girls: ๐Ÿ“ 7737669865 ๐Ÿ“ High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: ๐Ÿ“ 7737669865 ๐Ÿ“ High Profile Model Escorts | Bangalore ...Chintamani Call Girls: ๐Ÿ“ 7737669865 ๐Ÿ“ High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: ๐Ÿ“ 7737669865 ๐Ÿ“ High Profile Model Escorts | Bangalore ...
ย 
Call Girls in Sarai Kale Khan Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9205541914 ๐Ÿ”( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9205541914 ๐Ÿ”( Delhi) Escorts S...Call Girls in Sarai Kale Khan Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9205541914 ๐Ÿ”( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9205541914 ๐Ÿ”( Delhi) Escorts S...
ย 
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
ย 
Determinants of health, dimensions of health, positive health and spectrum of...
Determinants of health, dimensions of health, positive health and spectrum of...Determinants of health, dimensions of health, positive health and spectrum of...
Determinants of health, dimensions of health, positive health and spectrum of...
ย 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
ย 
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 nightCheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
ย 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptx
ย 
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
ย 
Call Girls Bannerghatta Road Just Call ๐Ÿ‘— 7737669865 ๐Ÿ‘— Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call ๐Ÿ‘— 7737669865 ๐Ÿ‘— Top Class Call Girl Ser...Call Girls Bannerghatta Road Just Call ๐Ÿ‘— 7737669865 ๐Ÿ‘— Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call ๐Ÿ‘— 7737669865 ๐Ÿ‘— Top Class Call Girl Ser...
ย 
Generative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusGenerative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and Milvus
ย 
CHEAP Call Girls in Saket (-DELHI )๐Ÿ” 9953056974๐Ÿ”(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )๐Ÿ” 9953056974๐Ÿ”(=)/CALL GIRLS SERVICECHEAP Call Girls in Saket (-DELHI )๐Ÿ” 9953056974๐Ÿ”(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )๐Ÿ” 9953056974๐Ÿ”(=)/CALL GIRLS SERVICE
ย 
100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx
ย 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdf
ย 
Zuja dropshipping via API with DroFx.pptx
Zuja dropshipping via API with DroFx.pptxZuja dropshipping via API with DroFx.pptx
Zuja dropshipping via API with DroFx.pptx
ย 
Sampling (random) method and Non random.ppt
Sampling (random) method and Non random.pptSampling (random) method and Non random.ppt
Sampling (random) method and Non random.ppt
ย 
Delhi Call Girls CP 9711199171 โ˜Žโœ”๐Ÿ‘Œโœ” Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 โ˜Žโœ”๐Ÿ‘Œโœ” Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 โ˜Žโœ”๐Ÿ‘Œโœ” Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 โ˜Žโœ”๐Ÿ‘Œโœ” Whatsapp Hard And Sexy Vip Call
ย 
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptxBPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
ย 
Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Research
ย 
FESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfFESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdf
ย 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signals
ย 

Heart disease classification

  • 1. Heart disease classification Project- 2 Presented by- Sneha Dey Dept of CSE, B.tech, 3rd year (Seacom Engineering College)
  • 2. ABOUT THE PROJECT Machine Learning is used across many spheres around the world. The healthcare industry is no exception. Machine Learning can play an essential role in predicting presence/absence of Locomotor disorders, Heart diseases and more. Such information, if predicted well in advance, can provide important insights to doctors who can then adapt their diagnosis and treatment per patient basis. In this project, Iโ€™ll discuss where I worked on predicting potential Heart Diseases in people using Machine Learning algorithms. The algorithms included K Neighbors Classifier and Support Vector Classifier and applying PCA on these 2 models. Objective Improve cardiovascular health and quality of life through prevention, detection, and treatment. Early identification and treatment of heart attacks and strokes. Prevention of repeat cardiovascular events and reduction in deaths from cardiovascular disease.
  • 3. IMPORTING LIBRARIES AND DATASET I imported several libraries for the project and all the necessary Machine Learning algorithms. In the dataset,there are a total of 13 features and 1 target variable. Also, there are no missing values so we donโ€™t need to take care of any null values. Next, I used describe() method. dataset.describe() The method revealed that the range of each variable is different. The maximum value of age is 77 but for chol it is 564. Thus, feature scaling must be performed on the dataset.
  • 4. Confusion Matrix To begin with, letโ€™s see the correlation matrix of features and try to analyse it. The figure size is defined to 12 x 8 by using rcParams. Then, I used pyplot to show the correlation matrix. Using xticks and yticks, Iโ€™ve added names to the correlation matrix. colorbar() shows the colorbar for the matrix. Itโ€™s easy to see that there is no single feature that has a very high correlation with our target value. Also, some of the features have a negative correlation with the target value and some have positive.
  • 5. Histogram The best part about this type of plot is that it just takes a single command to draw the plots and it provides so much information in return. Just use dataset.hist(). Letโ€™s take a look at the plots. It shows how each feature and label is distributed along different ranges, which further confirms the need for scaling. Next, wherever you see discrete bars, it basically means that each of these is actually a categorical variable. We will need to handle these categorical variables before applying Machine Learning. Our target labels have two classes, 0 for no disease and 1 for disease.
  • 6. Predict the Target class Itโ€™s really essential that the dataset we are working on should be approximately balanced. An extremely imbalanced dataset can render the whole model training useless and thus, will be of no use. For x-axis I used the unique() values from the target column and then set their name using xticks. For y-axis, I used value_count() to get the values for each class. I colored the bars as green and red. From the plot, we can see that the classes are almost balanced and we are good to proceed with data processing.
  • 7. Bar plot for Count of male and female As per dataset, 0 โ€“ female and 1 โ€“ male The plot shows the number of male is mostly 2X greater than female patients in the active study.
  • 8. Scatter plot between Age and Maximum heart rate A scatter plot is a type of plot or mathematical diagram using Cartesian coordinates to display values for typically two variables- Age and Maximum Heart Rate. The plot shows the ages between 40 to 70 is more effective patients due to Maximum Heart Rate.
  • 9. Data Processing and Splitting To work with categorical variables, we should break each categorical column into dummy columns with 1s and 0s. In this project, I took 4 algorithms and varied their various parameters and compared the final models. I split the dataset into 67% training data and 33% testing data.
  • 10. Support Vector Machine I will run the model on the train and test set using SVC( Support Vector Classifier) and then use the test set to see what kind of prediction results we get using the test data set.This classifier aims at forming a hyperplane that can separate the classes as much as possible by adjusting the distance between the data points and the hyperplane. There are several kernels based on which the hyperplane is decided. I tried four kernels namely, linear, poly, rbf, and sigmoid. Once I had the scores for each, I used the rainbow method to select different colors for each bar and plot a bar graph of the scores achieved by each. As can be seen from the plot above, the linear kernel performed the best for this dataset and achieved a score of 83%
  • 11. K โ€“ nearest neighbor classifier This classifier looks for the classes of K nearest neighbors of a given data point and based on the majority class, it assigns a class to this data point. However, the number of neighbors can be varied. I varied them from 1 to 20 neighbors and calculated the test score in each case.Then, I plot a line graph of the number of neighbors and the test score achieved in each case. As you can see, we achieved the maximum score of 87% when the number of neighbors was chosen to be 8.
  • 12. SVM with PCA The PCA/SVM-based method involves PCA-based data selection and image feature extraction for SVM classification; this method can be used to solve the detection problems inherent in imprecise, uncertain, and incoherent data from multiple sensors. As you can see, we achieved the maximum score of 80% the best for this dataset as per accuracy check.
  • 13. KNN with PCA I am using KNN to classify and I also now have implemented PCA to reduce the dimensionality.As one closest neighbor is red circle. Basically, with lower K value, - KNN model is trying to fit the model to data very closely and trying to find. As you can see, we achieved the maximum score of 56% when the number of neighbors was chosen to be 20.
  • 14. ACCURACY 1. Support Vector Classifier: 83% 2. K Neighbours Classifier: 87% 3. SVM with PCA: 80% 4. KNN with PCA: 56% K Neighbours Classifier scored the best score of 87%
  • 15. inference K-Neighbours Classifier is amongst the most popular learning method grouped by similarities to build machine learning models particularly for Heart disease prediction and document classification.