| Literature DB >> 34966445 |
Ebrahim Mohammed Senan1, Ibrahim Abunadi2, Mukti E Jadhav3, Suliman Mohamed Fati2.
Abstract
Cardiovascular disease (CVD) is one of the most common causes of death that kills approximately 17 million people annually. The main reasons behind CVD are myocardial infarction and the failure of the heart to pump blood normally. Doctors could diagnose heart failure (HF) through electronic medical records on the basis of patient's symptoms and clinical laboratory investigations. However, accurate diagnosis of HF requires medical resources and expert practitioners that are not always available, thus making the diagnosing challengeable. Therefore, predicting the patients' condition by using machine learning algorithms is a necessity to save time and efforts. This paper proposed a machine-learning-based approach that distinguishes the most important correlated features amongst patients' electronic clinical records. The SelectKBest function was applied with chi-squared statistical method to determine the most important features, and then feature engineering method has been applied to create new features correlated strongly in order to train machine learning models and obtain promising results. Optimised hyperparameter classification algorithms SVM, KNN, Decision Tree, Random Forest, and Logistic Regression were used to train two different datasets. The first dataset, called Cleveland, consisted of 303 records. The second dataset, which was used for predicting HF, consisted of 299 records. Experimental results showed that the Random Forest algorithm achieved accuracy, precision, recall, and F1 scores of 95%, 97.62%, 95.35%, and 96.47%, respectively, during the test phase for the second dataset. The same algorithm achieved accuracy scores of 100% for the first dataset and 97.68% for the second dataset, while 100% precision, recall, and F1 scores were reached for both datasets.Entities:
Mesh:
Year: 2021 PMID: 34966445 PMCID: PMC8712170 DOI: 10.1155/2021/8500314
Source DB: PubMed Journal: Comput Math Methods Med ISSN: 1748-670X Impact factor: 2.238
Figure 1Experimental methodology of heart disease.
Diagnosing heart disease features with metrics from the Cleveland dataset.
| Features | Description | Explanation | Type |
|---|---|---|---|
| Age | Patient age | Age of patient in year | Numeric |
| Sex | 1 = male | Nominal | |
| Patient gender | 0 = female | ||
| cp | 1 = typical angina | Nominal | |
| Chest pain | 2 = atypical angina | ||
| 3 = nonanginal pain | |||
| 4 = asymptomatic | |||
| trestbps | Patient's blood pressure at rest (mm/Hg) | Resting blood pressure (mm/Hg) | Numeric |
| chol | Patient's cholesterol (mg/dL) | Serum cholesterol (mg/dL) | Numeric |
| fbs | 1 = Fasting blood sugar > 120 mg/dL | Nominal | |
| Patient's blood sugar during fasting | 0 = Fasting blood sugar < 120 mg/dL | ||
| restecg | 0 = normal | Nominal | |
| Electrocardiographic measurement at rest | 1 = ST-T wave abnormality | ||
| 2 = probable left ventricular hypertrophy | |||
| thalach | Maximum heart rates | Maximum heart rate achieved | Numeric |
| exang | Angina due to exercise | 1 = exercise induced angina | Nominal |
| 0 = exercise induced no angina | |||
| Oldpeak | ST depression | ST depression induced by exercise relative to rest | Numeric |
| Slope | 1 = upsloping | Nominal | |
| Slope of ST | 2 = flat | ||
| 3 = downsloping | |||
| ca | Number of major vessels | Number of major vessels (0-3) colored by fluoroscopy | Numeric |
| thal | 3 = normal | Nominal | |
| Blood disorder | 6 = fixed defect | ||
| 7 = reversible defect | |||
| Target | 0 = normal | Nominal | |
| 1 = heart disease |
Heart failure features with metrics from the Allied Hospital dataset.
| Features | Explanation | Range | Measurement |
|---|---|---|---|
| Age | Age of patient in year | [40, ..., 95] | Year |
| Anaemia | 1 = haematocrit levels lower than 36% | 0, 1 | Boolean |
| 0 = haematocrit levels higher than 36% | |||
| High blood pressure | 1 = patient has hypertension | 0, 1 | Boolean |
| 0 = patient has no hypertension | |||
| Creatinine phosphokinase | Level of CPK in blood | [23, ..., 7861] | mcg/L |
| Diabetes | 1 = patient has diabetes | 0, 1 | Boolean |
| 0 = patient has no diabetes | |||
| Sex | 1 = male | 0, 1 | Boolean |
| 0 = female | |||
| Platelets | Blood platelets | [25.01, ..., 850.00] | Kiloplatelets/mL |
| Serum creatinine | Level of creatinine in blood | mg/dL | [0.50, ..., 9.40] |
| Serum sodium | Level of sodium in blood | mEq/L | [114, ..., 148] |
| Smoking | 1 = patient smokes | 0, 1 | Boolean |
| 0 = patient does not smoke | |||
| Time | Periodic follow-up of patient | Days | [4,..., 285] |
| Death event (target) | 1 = patient died during follow-up | 0, 1 | Boolean |
| 0 = patient did not die during follow-up |
mcg/L refers to micrograms per litre. mL refers to microlitre. mEq/L refers to milliequivalents per litre.
Statistical operations for the Cleveland dataset.
| Statistical | Age | Sex | cp | trestbps | chol | fbs | restecg | thalach | exang | Oldpeak | Slope | ca | thal | Target |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Count | 303 | 303 | 303 | 303 | 303 | 303 | 303 | 303 | 303 | 303 | 303 | 303 | 303 | 303 |
| Mean | 54.37 | 0.68 | 0.97 | 131.6 | 246.3 | 0.15 | 0.53 | 149.7 | 0.33 | 1.04 | 1.4 | 0.73 | 2.31 | 0.54 |
| std | 9.08 | 0.47 | 1.03 | 17.54 | 51.83 | 0.36 | 0.53 | 22.91 | 0.47 | 1.16 | 0.62 | 1.02 | 0.61 | 0.5 |
| Min | 29 | 0 | 0 | 94 | 126 | 0 | 0 | 71 | 0 | 0 | 0 | 0 | 0 | 0 |
| Max | 77 | 1 | 3 | 200 | 564 | 1 | 2 | 202 | 1 | 6.2 | 2 | 4 | 3 | 1 |
Figure 2Feature correlation of the Cleveland dataset by using heat map.
Missing values.
| Features | Missing values |
|---|---|
| Age | 0 |
| Sex | 0 |
| cp | 0 |
| trestbps | 0 |
| chol | 0 |
| fbs | 0 |
| restecg | 0 |
| thalach | 0 |
| exang | 0 |
| Oldpeak | 0 |
| Slope | 0 |
| ca | 0 |
| thal | 0 |
| Target | 0 |
| dtype: int64 | 0 |
Balancing the dataset by SMOTE.
| Dataset | ||||
|---|---|---|---|---|
| Phase | Training 80% | Testing 20% | ||
| Classes | Did not die during follow-up | Die during follow-up | Did not die during follow-up | Die during follow-up |
| Before Oversampling | 160 | 79 | 43 | 17 |
| After Oversampling | 160 | 160 | 43 | 17 |
Converting categorical data to dummy.
| Age | trestbps | chol | thalach | Oldpeak | Target | Sex_0 | Sex_1 | cp_0 | cp_1 | ... | Slope_2 | ca_0 | ca_1 | ca_2 | ca_3 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 63 | 145 | 233 | 150 | 2.3 | 1 | 0 | 1 | 0 | 0 | ... | 0 | 1 | 0 | 0 |
| 1 | 37 | 130 | 250 | 187 | 3.5 | 1 | 0 | 1 | 0 | 0 | ... | 0 | 1 | 0 | 0 |
| 2 | 41 | 130 | 204 | 172 | 1.4 | 1 | 1 | 0 | 0 | 1 | ... | 1 | 1 | 0 | 0 |
| 3 | 56 | 120 | 236 | 178 | 0.8 | 1 | 0 | 1 | 0 | 1 | ... | 1 | 1 | 0 | 0 |
| 4 | 57 | 120 | 354 | 163 | 0.6 | 1 | 1 | 0 | 1 | 0 | ... | 1 | 1 | 0 | 0 |
Preprocessing of data by using standardization method.
| Age | trestbps | chol | thalach | Oldpeak | |
|---|---|---|---|---|---|
| 0 | 0.95 | 0.76 | −0.26 | 0.02 | 1.09 |
| 1 | −1.92 | −0.09 | 0.07 | 1.63 | 2.12 |
| 2 | −1.47 | −0.09 | −0.82 | 0.98 | 0.31 |
| 3 | 0.18 | −0.66 | −0.2 | 1.24 | −0.21 |
| 4 | 0.29 | −0.66 | 2.08 | 0.58 | −0.38 |
Creation of features and arranging the best features.
| No | Feature | Score |
|---|---|---|
| 1 | exang_oldpeak2 | 652.854396 |
| 2 | exang_ca | 263.212119 |
| 3 | Sex_oldpeak2 | 252.657949 |
| 4 | thal_oldpeak2 | 247.914913 |
| 5 | exang_trestbps2 | 241.749732 |
| 6 | Thalach | 186.180286 |
| 7 | Oldpeak2 | 171.4864 |
| 8 | fbs_oldpeak2 | 164.89897 |
| 9 | Age2_oldpeak2 | 139.151372 |
| 10 | exang_chol2 | 131.365522 |
| 11 | thal_trestbps2 | 116.88462 |
| 12 | thal_chol2 | 113.985724 |
| 13 | thal_ca | 90.668503 |
| 14 | Sex_trestbps2 | 78.162433 |
| 15 | Sex_ca | 77.302537 |
| 16 | Oldpeak | 71.692782 |
| 17 | Ca | 71.020719 |
| 18 | Cp | 62.116086 |
| 19 | Age2_ca | 54.956199 |
| 20 | Age2_trestbps2 | 53.221349 |
| 21 | restecg_cp | 51.837075 |
| 22 | fbs_ca | 43.441045 |
| 23 | exang | 38.518849 |
| 24 | Age2_chol2 | 36.438097 |
| 25 | Sex_chol2 | 35.823916 |
| 26 | fbs_cp | 32.072291 |
| 27 | restecg_thalach2 | 29.718076 |
| 28 | exang_thalach2 | 27.279766 |
| 29 | Age | 22.210517 |
| 30 | Chol | 21.690747 |
| 31 | exang_slope | 20.48139 |
| 32 | exang_cp | 18.443334 |
| 33 | restecg_slope | 18.246965 |
| 34 | trestbps | 15.094591 |
| 35 | restecg_trestbps2 | 12.462827 |
| 36 | thal_thalach2 | 12.403249 |
| 37 | Slope | 9.677715 |
| 38 | restecg_oldpeak2 | 8.249627 |
| 39 | Sex | 7.72169 |
| 40 | thal_slope | 7.199342 |
| 41 | Sex_thalach2 | 5.89906 |
| 42 | fbs_trestbps2 | 5.897746 |
| 43 | thal_cp | 5.838268 |
| 44 | Thal | 5.75303 |
| 45 | thalach2 | 5.688919 |
| 46 | restecg_chol2 | 5.639162 |
| 47 | fbs_slope | 5.480661 |
| 48 | Age2_thalach2 | 5.466855 |
| 49 | fbs_thalach2 | 4.64652 |
| 50 | Age2_slope | 4.031292 |
| 51 | Sex_slope | 2.987813 |
| 52 | restecg | 2.877743 |
| 53 | Age2_cp | 2.324974 |
| 54 | fbs_chol2 | 2.116344 |
| 55 | Age2 | 2.00334 |
| 56 | trestbps2 | 1.655964 |
| 57 | chol2 | 0.877493 |
| 58 | Sex_cp | 0.564425 |
| 59 | restecg_ca | 0.256374 |
| 60 | fbs | 0.184946 |
Splitting the datasets.
| Dataset | Cleveland dataset | HF dataset | ||
|---|---|---|---|---|
| Class | Heart disease | Normal | Died during follow-up | Did not die during follow-up |
| Training | 133 | 109 | 160 | 160 |
| Testing | 32 | 29 | 43 | 17 |
Figure 3Evaluating the performance of five classifiers on the Cleveland dataset.
Results of diagnosing heart disease (Cleveland dataset) by using five machine learning algorithms.
| Classifiers | SVM | KNN | Decision Tree | Random Forest | Logistic Regression | |||||
|---|---|---|---|---|---|---|---|---|---|---|
| Criteria | Training 80% | Testing 20% | Training 80% | Testing 20% | Training 80% | Testing 20% | Training 80% | Testing 20% | Training 80% | Testing 20% |
| Accuracy (%) | 92.56 | 90.16 | 87.60 | 90.16 | 100 | 81.97 | 100 | 85.25 | 87.60 | 88.52 |
| Precision (%) | 93.45 | 90.12 | 88.82 | 90.26 | 100 | 82.43 | 100 | 85.82 | 88.19 | 88.56 |
| Recall (%) | 92.52 | 90.45 | 87.63 | 90.38 | 100 | 82.39 | 100 | 85.29 | 87.44 | 89.46 |
| F1 score | 92.98 | 90.28 | 88.23 | 90.32 | 100 | 82.41 | 100 | 85.55 | 87.81 | 89.00 |
Results of diagnosing heart disease as the category using five machine learning algorithms.
| SN | Classifiers | Division of data | Class | Precision (%) | Recall (%) | F1 score (%) | Number of patients |
|---|---|---|---|---|---|---|---|
| 1 | SVM | Training (80%) | 0 | 93 | 90 | 92 | 109 |
| 2 | 1 | 92 | 95 | 93 | 133 | ||
| 3 | Testing (20%) | 0 | 87 | 93 | 90 | 29 | |
| 4 | 1 | 93 | 88 | 90 | 32 | ||
| 5 | KNN | Training (80%) | 0 | 88 | 84 | 86 | 109 |
| 6 | 1 | 88 | 90 | 89 | 133 | ||
| 7 | Testing (20%) | 0 | 90 | 90 | 90 | 29 | |
| 8 | 1 | 91 | 91 | 91 | 32 | ||
| 9 | Decision Tree | Training (80%) | 0 | 100 | 100 | 100 | 109 |
| 10 | 1 | 100 | 100 | 100 | 133 | ||
| 11 | Testing (20%) | 0 | 78 | 86 | 82 | 29 | |
| 12 | 1 | 86 | 78 | 82 | 32 | ||
| 13 | Random Forest | Training (80%) | 0 | 100 | 100 | 100 | 109 |
| 14 | 1 | 100 | 100 | 100 | 133 | ||
| 15 | Testing (20%) | 0 | 83 | 86 | 85 | 29 | |
| 16 | 1 | 87 | 84 | 86 | 32 | ||
| 17 | Logistic Regression | Training (80%) | 0 | 88 | 83 | 86 | 109 |
| 18 | 1 | 87 | 91 | 89 | 133 | ||
| 19 | Testing (20%) | 0 | 87 | 90 | 88 | 29 | |
| 20 | 1 | 90 | 88 | 89 | 32 |
Figure 4The performance of classification algorithms for each class.
Figure 5Evaluating the performance of five classifiers on the heart failure dataset.
Prediction results of heart failure by using five machine learning algorithms.
| Classifiers | SVM | KNN | Decision Tree | Random Forest | Logistic Regression | |||||
|---|---|---|---|---|---|---|---|---|---|---|
| Criteria | Training 80% | Testing 20% | Training 80% | Testing 20% | Training 80% | Testing 20% | Training 80% | Testing 20% | Training 80% | Testing 20% |
| Accuracy (%) | 92.35 | 90.00 | 96.82 | 93.33 | 96.46 | 95.00 | 97.68 | 95.00 | 91.05 | 88.33 |
| Precision (%) | 95.41 | 93.02 | 95.76 | 93.33 | 97.11 | 93.48 | 100.00 | 97.62 | 94.52 | 93.00 |
| Recall (%) | 96.10 | 93.02 | 98.51 | 97.67 | 100.00 | 100.00 | 100.00 | 95.35 | 92.39 | 90.90 |
| F1 score | 95.75 | 93.02 | 97.12 | 95.45 | 98.53 | 96.63 | 100.00 | 96.47 | 93.44 | 91.93 |
Result prediction of heart failure as the category using five machine learning algorithms.
| SN | Classifiers | Division of data | Class | Precision (%) | Recall (%) | F1 score (%) | Number of patients |
|---|---|---|---|---|---|---|---|
| 1 | SVM | Training (80%) | 0 | 92 | 95 | 95 | 79 |
| 2 | 1 | 93 | 96 | 97 | 160 | ||
| 3 | Testing (20%) | 0 | 92 | 91 | 92 | 17 | |
| 4 | 1 | 94 | 94 | 94 | 43 | ||
| 5 | KNN | Training (80%) | 0 | 89 | 97 | 96 | 79 |
| 6 | 1 | 91 | 99 | 98 | 160 | ||
| 7 | Testing (20%) | 0 | 92 | 97 | 94 | 17 | |
| 8 | 1 | 94 | 98 | 96 | 43 | ||
| 9 | Decision Tree | Training (80%) | 0 | 97 | 100 | 98 | 79 |
| 10 | 1 | 98 | 100 | 99 | 160 | ||
| 11 | Testing (20%) | 0 | 92 | 100 | 95 | 17 | |
| 12 | 1 | 94 | 100 | 97 | 43 | ||
| 13 | Random Forest | Training (80%) | 0 | 100 | 100 | 100 | 79 |
| 14 | 1 | 100 | 100 | 100 | 160 | ||
| 15 | Testing (20%) | 0 | 98 | 96 | 97 | 17 | |
| 16 | 1 | 97 | 95 | 96 | 43 | ||
| 17 | Logistic Regression | Training (80%) | 0 | 94 | 93 | 94 | 79 |
| 18 | 1 | 96 | 91 | 93 | 160 | ||
| 19 | Testing (20%) | 0 | 93 | 90 | 91 | 17 | |
| 20 | 1 | 93 | 92 | 93 | 43 |
Figure 6The performance of classification algorithms for each class.
Accuracy of diagnosing two dataset using five machine learning algorithms.
| Dataset | SVM | KNN | Decision Tree | Random Forest | Logistic Regression | |||||
|---|---|---|---|---|---|---|---|---|---|---|
| Dataset | Training | Testing | Training | Testing | Training | Testing | Training | Testing | Training | Testing |
| Cleveland | 92.56 | 90.16 | 87.60 | 90.16 | 100 | 81.97 | 100 | 85.25 | 87.60 | 88.52 |
| HF | 92.35 | 90.00 | 96.82 | 93.33 | 96.46 | 95.00 | 97.68 | 95.00 | 91.05 | 88.33 |
Figure 7Comparison of system performance on the diagnostic accuracy in two datasets.
Comparison of the performance between the proposed system and previous studies.
| Previous studies | Accuracy (%) | Precision (%) | Recall (%) | F1 score (%) |
|---|---|---|---|---|
| Arabasadi et al. [ | 93.85 | — | 97 | — |
| Maji and Arora [ | 77.4 | — | 77.4 | — |
| Reddy et al. [ | 90 | — | 91 | — |
| Amin et al. [ | 78.15 | 78.15 | — | 80.25 |
| Feshki and Shijani [ | 91.94 | 91.9 | 93 | — |
| Pouriyeh et al. [ | 77.55 | 77.4 | 83 | 80.1 |
| Chicco and Jurman [ | 83.8 | — | 72 | 71.9 |
| Proposed model first dataset for training | 97.68 | 100 | 100 | 100 |
| Proposed model second dataset for training | 100 | 100 | 100 | 100 |
| Proposed model first dataset for testing | 90.16 | 90.26 | 90.38 | 90.32 |
| Proposed model second dataset for testing | 95 | 97.62 | 95.35 | 96.47 |
Figure 8The performance of our systems with the previous studies.