Cleveland Exploratory Data Analysis
By: Shubam Sumbria
Tags: Data Science, Python, Exploratory Data Analysis, Data Visualization, Heart Disease

Cleveland Heart Disease dataset (UCI Repository) — Exploratory Data Analysis

About Dataset:

Data set dates from 1988 and comprises four databases: Cleveland, Hungary, Switzerland, and Long Beach V. It contains 76 attributes, including the predicted attribute, but all published experiments refer to using a subset of 14 of them. The “target” field refers to the presence of heart disease in the patient. It is integer valued 0 = disease and 1 = no disease.

Creators: Hungarian Institute of Cardiology. Budapest: Andras Janosi, M.D. University Hospital, Zurich, Switzerland: William Steinbrunn, M.D. University Hospital, Basel, Switzerland: Matthias Pfisterer, M.D. V.A. Medical Center, Long Beach and Cleveland Clinic Foundation: Robert Detrano, M.D., Ph.D. Donor:

David W. Aha (aha ‘@’ ics.uci.edu) (714) 856–8779

UCI Machine Learning Repository for heart Disease dataset.

Attribute Information:

— -

1. age: age in years

2. sex: 1 = male; 0 = female

3. cp: chest pain type

- Value 1: typical angina

- Value 2: atypical angina

- Value 3: non-anginal pain

- Value 4: asymptomatic

4. trestbps: resting blood pressure (in mm Hg on admission to the hospital)

5. chol: serum cholesterols in mg/dl

6. fbs: fasting blood sugar > 120 mg/dl (1 = true; 0 = false)

7. restecg: resting electrocardiographic results

- Value 0: normal

- Value 1: having ST-T wave abnormality (T wave inversions and/or ST elevation or depression of > 0.05 mV)

- Value 2: showing probable or definite left ventricular hypertrophy by Estes’ criteria

8. thalach: maximum heart rate achieved

9. exang: exercise induced angina (1 = yes; 0 = no)

10. oldpeak: ST depression induced by exercise relative to rest

11. slope: the slope of the peak exercise ST segment

- Value 1: upsloping

- Value 2: flat

- Value 3: Downsloping

12. ca: number of major vessels (0–3) colored by fluoroscopy

13. thal: 3 = normal; 6 = fixed defect; 7 = reversible defect

— -

*Note that it’s quite an old dataset (1988)*

Exploratory Data Analysis:

No. of people with heart disease vs No. of people without heart disease:

We have 165 people with heart disease and 138 people without heart disease, so it balances our data.

2. Correlation Matrix Heatmap:

3. Correlation with Target:

Observations from correlation:

fbs and chol are the least correlated with the target variable.

All other variables have a significant correlation with the target variable.

4. Categorical Values Histogram:

Observations from the above plot:

cp {Chest pain} : People with cp 1, 2, 3 are more likely to have heart disease than people with cp 0.

: People with cp 1, 2, 3 are more likely to have heart disease than people with cp 0. restecg {resting EKG results} : People with a value of 1 (reporting an abnormal heart rhythm, which can range from mild symptoms to severe problems) are more likely to have heart disease.

: People with a value of 1 (reporting an abnormal heart rhythm, which can range from mild symptoms to severe problems) are more likely to have heart disease. exang {exercise-induced angina} : People with a value of 0 (No — angina induced by exercise) have more heart disease than people with a value of 1 (Yes — angina induced by exercise)

: People with a value of 0 (No — angina induced by exercise) have more heart disease than people with a value of 1 (Yes — angina induced by exercise) slope {the slope of the ST segment of peak exercise} : People with a slope value of 2 (Downsloping: signs of an unhealthy heart) are more likely to have heart disease than people with a slope value of 2 slope is 0 (Upsloping: best heart rate with exercise) or 1 (Flatsloping: minimal change (typical healthy heart)).

: People with a slope value of 2 (Downsloping: signs of an unhealthy heart) are more likely to have heart disease than people with a slope value of 2 slope is 0 (Upsloping: best heart rate with exercise) or 1 (Flatsloping: minimal change (typical healthy heart)). ca {number of major vessels (0–3) stained by fluoroscopy} : The more blood movement the better, so people with ca equal to 0 are more likely to have heart disease.

: The more blood movement the better, so people with ca equal to 0 are more likely to have heart disease. thal {thallium stress result}: People with a thal value of 2 (defect corrected: once was a defect but ok now) are more likely to have heart disease.

5. Continuous Values Histogram:

Observations from the above plot:

trestbps : resting blood pressure on anything above 120–140 is of concern.

: resting blood pressure on anything above 120–140 is of concern. chol : greater than 200 is of concern.

: greater than 200 is of concern. thalach : People with a maximum heart rate of over 140 are more likely to have heart disease.

: People with a maximum heart rate of over 140 are more likely to have heart disease. the old peak of exercise-induced ST depression vs. rest looks at heart stress during exercise an unhealthy heart will stress more.

6. Scatter Plot (Age and Max Heart Rate Relation):

Observation from above plot:

Outliers

7. Scatter Plot (Age and Serum cholesterol (mg/dl) Relation):

8. Scatter Plot (Age and Resting Blood Pressure Relation):

OBSERVATION from above plots (8 & 9):

Both Resting Blood Pressure and Serum Cholesterol shows positive correlation, but not that much. Also, Resting Blood Pressure and Serum Cholesterol have few Outliers, which we will remove in preprocessing steps.

My Jupyter notebook for code reference:

Currently working on Comparative Analysis of various Research proposals at the task of Heart Disease Prediction. Checkout my GitHub Profile for more details.

If you find this story informative, please leave a comment. ✨

Thanks for reading! 🤗