A project where we implemented the KNN algorithm classification method which predicts the likelihood of an individual developing heart disease later on in their life. We used a 80/20 split between the training and testing set, and manipulated the model by using 1,3,5,7,9,11,13,15,17, or 19 neighbours in the algorithm. From this model, we found that it was 64-95% accurate, where the best result was 13 neighbors at 87% accuracy on average. At each K-value, the program was ran 10 times, and the average mean was taken as shown in the chart below.
We were also fortunate enough to present at the Canadian Undergraduate Conference on AI (CUCAI) and get our paper published by them as well. Attached below is our published paper: https://github.com/Emilywang98/HeartDiseaseClassifier/blob/main/Application-of-Neural-Networks-for-Heart-Disease-Classification.pdf
The project was developed using following data from the Cleveland database:
-
age - age in years
-
sex - (1 = male; 0 = female)
-
cp - chest pain type
- 0: Typical angina: chest pain related decrease blood supply to the heart.
- 1: Atypical angina: chest pain not related to heart.
- 2: Non-anginal pain: typically esophageal spasms (non heart related).
- 3: Asymptomatic: chest pain not showing signs of disease
-
trestbps - resting blood pressure (in mm Hg on admission to the hospital) anything above 130-140 is typically cause for concern
-
chol - serum cholestoral in mg/dl
-
serum = LDL + HDL + .2 * triglycerides above 200 is cause for concern
-
fbs - (fasting blood sugar > 120 mg/dl) (1 = true; 0 = false) '>126' mg/dL signals diabetes
-
restecg - resting electrocardiographic results
- 0: Nothing to note
- 1: ST-T Wave abnormality (can range from mild symptoms to severe problems), signals non-normal heart beat
- 2: Possible or definite left ventricular hypertrophy (Enlarged heart's main pumping chamber)
-
thalach - maximum heart rate achieved
-
exang - exercise induced angina (1 = yes; 0 = no)
-
oldpeak - ST depression induced by exercise relative to rest looks at stress of heart during excercise unhealthy heart will stress more
-
slope - the slope of the peak exercise ST segment
- 0: Upsloping: better heart rate with excercise (uncommon)
- 1: Flatsloping: minimal change (typical healthy heart)
- 2: Downslopins: signs of unhealthy heart
-
ca - number of major vessels (0-3) colored by flourosopy colored vessel means the doctor can see the blood passing through the more blood movement the better (no clots)
-
thal - thalium stress result
- 1-3: normal
- 6: fixed defect: used to be defect but ok now
- 7: reversable defect: no proper blood movement when excercising
-
target - patient has disease or not (1=yes, 0=no) (i.e the predicted attribute)
