Published On February 3, 2023
Journal Issue LJER Volume 23 Issue 1

Investigating Machine Learning Models for Effective Dataset Training in Cardiac Arrest Prediction

Sixtus A Okafor
Sixtus A Okafor
Article Fingerprint
Research ID 840D8

IntelliPaper

Abstract

Inaccuracy of data coupled with invasiveness in diagnosis of cardiac arrest is an issue of concern in clinical setting. In this study, the identification and prediction of cardiac arrest based on existing data was investigated using Machine learning (ML) algorithms. Three classic models of machine learning (Gradient Boost, Random Forest and XG Boost) models were used. Numerical variables were encoded using Label Encoder function from Scikit learn using the three models to train the data. A panda was used for data loading. After training, Gradient boosting, Random Forest and XG Boost models possess an accuracy of prediction values of 88, 89 and 85% with and an error prediction values of 23, 20 and 27, respectively. Hence fitting Gradient boosting model is the best machine learning model for training data and prediction of cardiac arrest due to its high accuracy and low error value.

Explore Digital Article Text

I. INTRODUCTION

Artificial intelligence (AI) is a simulation of human intelligence in machines programmed to think and mimic human actions (Seetharam, Kagiyama and Sengupta, 2019). It is a computer system that is able to perform tasks that ordinarily require human intelligence such as receiving perceptions from the environment and performing actions. AI uses machine learning algorithms, heuristics, pattern matching, rules, deep learning, cognitive computing and software (Seetharamet al., 2019). It is, specifically, the ability of computer algorithms to approximate based on input data and deep learning (Nadrljanski and Foster 2022). Artificial intelligence has been deployed in healthcare (Mayo 2016), defence, security surveillance (Retsonet al., 2019) to mention a few. These algorithms recognize behaviour patterns and create their own logic (Murdoch and Detsky, 2013).

To gain useful insights and predictions, machine learning models are trained using extensive amounts of input data. Retsonet al (2018) reported that AI algorithms behave differently from humans with a goal for the algorithm to learn exclusively from the input data and understand what it has been programmed to do and some deep learning algorithms to nature as black boxes; hence the algorithms can predict with extreme precision, but offer little to no comprehensible explanation to the logic behind its decisions aside from the data and type of algorithm used. A neural network also called artificial neural network (ANN) or multi-layer perceptron (MLP) is a supervised machine learning model that has the ability to represent complex nonlinear relationships in the input data.

It was originally developed to model the biological brain, but diverged to be most effectively used for classification and regression tasks (Rumelhart,

Hinton and Williams 1986). AI employs artificial neural network (ANN) to simulate the network of neurons that mimic the human brain so for computer to be able to learn things and make decisions in a humanlike manner (Seetharamet al., 2019;Chandran, 2019). ANNs are created by programming of regular interconnected computers to behave like brain cells as shown in Figure 1.

Figure 1: Artificial Neural Network data generated from various interconnected computers (artificial neurons) sent to the (hidden), processed and then displays the information as output (Chandran, 2019)

The development of AI techniques in the sub domains of machine learning and deep learning has attracted the attention of clinicians to create new integrated, reliable and efficient methods for providing quality healthcare delivery (Al-sharqiet al, 2018; Chandran, 2019). The techniques have also been deployed in cardiac Computed Tomography for patients with suspected cardiac arrest diseases (CAD). However, machine learning algorithms have shown a potential in clinical practice and training to take non-invasive approaches for detection of functional information beyond atherosclerotic plaque characterization with anomalies (Singh et al, 2020). Supervised learning plays an important role not only in the operation of many biological networks but also in operation of artificial neural networks (Seetharam et al, 2019).

Moreover, supervised learning has been widely applied to solve many problems. In supervised learning, manually set labels help the machine achieve the desired results. Therefore, supervised learning is applicable to medical diagnosis and treatment, with clinical guiding significance (Narulaet al, 2016; Nature 2016). Unsupervised learning does not require label of data set, hence the machine must find the label itself.

Furthermore, unsupervised learning algorithms have been successfully implemented in problems such as CVD prediction, diagnosis and treatment, and cardiovascular image analysis (Al-sharqi et al, 2018). Reinforcement learning required human to propose a goal and AI to achieve this goal through supervised and unsupervised learning (Li, Hu and Zhang 2017), after which there is a feedback mechanism described as a 'reward' (Seetharam et al, 2019).

The aim of reinforcement learning is not to reach the proposed goal, but to maximize the reward for the model during the learning process. This reinforcement learning has been deployed in intensive care units (ICU) to optimize the process by which patients are off mechanical ventilation (Al-sharqiet al, 2018; Seetharam et al, 2019).

Deep learning (DL) supervised ML technique and characterized by automated algorithms to extract meaningful patterns from data collections (Krittanawong, Zhang and Wang 2017). It mimics the complexity of a human brain to learn complex hierarchical representations from data that has multiple levels of abstraction (Thomas, Diamond and Vieco, 2018). The programmer enters known data into the machine in a way that allows algorithms to respond correctly even when faced with fully new data.

The neural network learns through experience, reads data, builds hierarchical architectures, and provides advanced input-output levels. It captures complex non-linear relationships between input-output variables. The average error of outcomes and their predictions can be minimized by estimating the weights of input and outcome data (Johnson, Torres and Glicksberg 2018). DL plays a prominent role in Facebook's image recognition program, speech recognition in Apple's Siri and Amazon's Alexa, Google brain and robots to mention a few (Jiang, Jiang and Zhi, 2017). In the medical context, the most widespread deep learning algorithms are convolution neural networks (CNN), recurrent neural networks, deep belief networks, and deep neural networks (Kulkarni and Vijaykumar, 2016). In this work, identifying and predicting cardiac arrest using Machine learning (ML) algorithms was investigated.

II. MATERIALS AND METHODS

2.1 Encoding of Input Variables as Numerical Values

The input data such as age, sex, chest pain type, resting blood pressure, cholesterol level, fasting blood sugar, maximum heart rate, exercise induce angina, oldpeak, slope of the peak ST segment and cardiac arrest data were trained. The variable were encoded to numerical values using Label Encoder function from Scikit learn which assigned numeric values to each of the variable.

2.2 Dataset Preparation

A Panda was employed to load the dataset and checked for any missing values. If feature is in the right data type as shown in Table 1, the code snippet used to retrieve information from the dataset.

{"code_caption":[{"type":"text","content":"Table 1: Code Snippet Used to Retrieve Dataset Information"}],"code_content":[{"type":"text","content":"check for importantant information\nheart.info()\n\n\<class 'pandas.core.frame.DataFrame'>\nRangeIndex: 918 entries, 0 to 917\nData columns (total 12 columns):\n# Column Non-Null Count Dtype\n--- ---- ----\n0 Age 918 non-null int64\n1 Sex 918 non-null object\n2 ChestPainType 918 non-null object\n3 RestingBP 918 non-null int64\n4 Cholesterol 918 non-null int64\n5 FastingBS 918 non-null int64\n6 RestingECG 918 non-null object\n7 MaxHR 918 non-null int64\n8 ExerciseAngina 918 non-null object\n9 Oldpeak 918 non-null float64\n10 ST_Slope 918 non-null object\n11 CardiacArrest 918 non-null int64\ndtypes: float64(1), int64(6), object(5)\nmemory usage: 86.2+ KB"}],"code_language":"txt"}

2.3 Machine Learning Modelling

Trained data was tested by the three tree-based machine learning models (Gradient Boost Model, Random Forest Model and XGBoost Model) using the exact set of data and compared their performances based on their classification report.

III. RESULTS AND DISCUSSION

Fitting gradient boosting model on trained data is presented in Table 1. The classification report of gradient boosting of an accuracy of 88% was obtained. In the gradient boost confusion matrix, the gradient boost model has a true negative and positive values of 69 and 92, while false negative and positive values of 8 and 15, respectively. The summation of true values referto as correct prediction while error prediction value obtained as summation of false values as presented in Figure 2.

{"code_caption":[{"type":"text","content":"Table 1: Fitting Gradient Boosting on Trained Data"}],"code_content":[{"type":"text","content":"# Instantiate the Gradient Boosting model\ngradient_boost = GradientBoostingClassifier()\n\n# Fit on the train and test set\ngradient_boost.fit(x_train, y_train);\n\n# Check for performance\nperformance_check(y_test, x_test, gradient_boost, 'GradientBoost')\n\nprecision recall f1-score support\n0 0.82 0.90 0.86 77\n1 0.92 0.86 0.89 107\naccuracy\nmacro avg 0.87 0.88 0.87 184\nweighted avg 0.88 0.88 0.88 184"}],"code_language":"txt"}

Figure 2: Gradient Boost Confusion Matrix

Table 2 represent fitting random forest model of trained data. Based on the classification reports of trained data, the Random forest gave an accuracy of 89% was obtained. The Gradient boosting for Random forest Confusion matrix as presented in Figure 3 revealed a true negative and positive values of 69 and 95, with false positive and negative values of 12 and 8, respectively. A corect prediction value of 164 and an error prediction value of 20 were obtained. Hence, random forest model slightly outperforms the gradient boosting model.

Table 2: Fitting Random Forest on Trained Data

RF = RandomForestClassifier()RF.fit(x_train, y_train);
# Check for performanceperformance_check(y_test, x_test, RF,"RandomForest")
precisionrecallf1-scoresupport
00.850.900.8777
10.920.890.90107
accuracy0.89184
macro avg0.890.890.89184
weighted avg0.890.890.89184

Figure 3: Random Forest Model Confusion Matrix

The XGBoost model classification report shows the accuracy of 85% as shown in Table 3. The accuracy of XGBoost model was found to be less than that of Gradient boost and Random forest models. The XGBoostmodel confusion matrix of trained data revealed a correct prediction of 157 [67+90] with an error prediction value of 27 [10+17] as shown in Figure 4. Thus, Gradient boosting model perform better than XGBoost model in prediction of cardiac arrest.

Table 3: XGBoost Model on Trained Data

# Check for performanceperformance_check(y_test, x_test, xgb, 'XGBoost')
precisionrecallf1-scoresupport
00.800.870.8377
10.900.840.87107
accuracy0.85184
macro avg0.850.860.85184
weighted avg0.860.850.85184

{"image_source":{"path":"images/0e6c0858f54536cc2d1aa77a2938db49e1881e9f6f6efb2d7682ad93f0d7c78a.jpg"},"content":"","chart_caption":[{"type":"text","content":"Figure 4: Confusion Matrix of the XGBoost Model"}],"chart_footnote":[]}

Comparing the three models of machine learning on trained data, Random forest model perform better than Gradient boosting and XGBoost models. This may be attributed to its high accuracy and low error prediction value. It can be deduced during the training period that the machine's output compared to the human provided description of what should be observed.

The three tree-based machine learning models to train data, building on this to analyse data such as age, resting BP, cholesterol, chest pain type, fasting blood sugar, maximum heart rate, exercise induce angina, oldpeak, slope of the peak ST segment to predict the occurrence of cardiac arrest in a given subject. Studies in neuroscience mainly for cardiac arrest correlate human brain to artificial neural network of machine learning models to mimic the brain based on tremendous amount of information for a training set.

IV. CONCLUSION

Based on this study, the following can be drawn:

  • Machine learning algorithm can accurately predict cardiac arrest better than other previous techniques.

  • While there are various machine learning techniques for different applications, certain model works better in certain environment or situations.

Conflict of Interest

The authors declare no conflict of interest.

Ethical Approval

Not applicable

Data Availability

The datasets used in this study are openly available at [repository link] and the source code is available on GitHub at [GitHub link].

Funding

This work did not receive any external funding.

References

17 Cites in Article

Cite this article

Generating citation...

Related Research

  • DDC Code: 006.312 LCC Code: QA76.9.D343
  • Version of record

    v1.0

  • Issue date

    03 February 2023

  • Language

    en

Iconic historic building with domed tower in London, UK.
Open Access
Research Article
CC-BY-NC 4.0
Views 941
Downloads 42
Special Issue

Launch a focused special issue to highlight research, emerging trends, and expert insights in your academic field.

Support