Heart Disease Prediction Using Machine Learning
Heart Disease Prediction Using Machine Learning |
Heart Disease Prediction Using Machine Learning
Data visualization package
A
machine learning model which will predict whether patient having a heart disease or not. When applied
clear nearest neighbour algorithm for this application so let us start. So
first step input packages it imported numpy brand as a metal clip packages
number, pandas are packages are data science packages and metal of lip is a
data visualization packages so in this application when used K nearest neighbor
classifier, So I imported then since this is a Google collab environment, So I
cannot drive data set from on this environment so with help of this command I
have plotted data set this is the data set.
Testing
I
uploaded after that and this data is saved in DF variable. So after that this
is a div dot info let's run. So DF without info gave us insights of that data
set, like the features in this data set we have 14 features, so and 14 columns
like this. After that data pre-processing data pre-processing a required for
the understand standard well data. So we are doing feature engineering and this
features we are gonna target so then print a split.
This is a command which is used for the Train
and test training and testing means the data set divided into training part and
testing part. And then I use standard scalar this is used for a standard value
for understanding better way let's shake like this 1 0 1 0 so it is giving a
whether patient having a yes if he having a chest pain then 1 and if a having
not chest pain then 0.
Logistic reggression |
Cross validation
Then
we are doing cross-validation, In heart disease prediction cross-validation in this kev used in the
scikit-learn model, so we created k near a score for K in range 1 to 21 for a
Miss K value will be 1 to 21 and the classifier saved in k variable K. The
cross-validation score will experiment 10 times. Let's assume K is equal to 1
then k is equal to 1 then, it will iterate 10 times. 10 times we will give we
will get a mean score that is iteration 1, then it will again perform 21 times
and then we got the perfect value. This is a data visualization tool metro clip.
we got messed up image so let's open image into second tap so as you can see
the 1 2 3 numbers are there means K is equal to 1, k is equal to 2 and K is
equal to 3 4 5 and so on. So we can see the highest value in this graph it's 12
and K is equal to 12 and it's score is 0.85 %. So added 12 iteration where it's
run this is also wrong so our model is 85% accurate.
Comments
Post a Comment