# A-Tuning Ensemble Machine Learning Technique for Cerebral Stroke Prediction
## 4 Implementation and Evaluation
### Model Evaluation  
This section discusses the two experiments' outcomes regarding the prediction of cerebral stroke. The first experiment was performed before hyper-parameter optimization, and the second, after hyper-parameter optimization. The accuracy of cerebral stroke prediction has been improved by using the proposed tuning ensemble RXLM based on the tuning RF, XGBoost, and LightGBM. The evaluation of the proposed tuning ensemble RXLM and the tuning three RF, XGBoost, and LightGBM was performed using the ten-fold cross-validation method that uses more than one train-test split of the data to evaluate the RF, XGBoost, LightGBM, and the proposed ensemble models. The ten-fold cross-validation uses one-fold as a test set and nine folds as train sets. It selected various values for the train-test split function's random state seed parameter. Figures 2-5 showed the first experiment's results. In this experiment, we evaluated the RF, XGBoost, LightGBM, and RXLM with measurement metrics before hyper-parameters optimization. The ensemble RXLM had 96.08%, 99.2%, 95.5%, 96.65%, 96.06%, 92.16%, and 92.2% for accuracy, AUC, recall, precision, F1-score, Kappa, MCC, respectively. The RF  
had 94.49%, 98.84%, 96.56%, 92.73, 94.6%, 88.98%, and 89.06% for accuracy, AUC, recall, precision, F1-score, Kappa, MCC, respectively. The XGBoost achieved 95.29%, 99.13%, 96.38%, 94.36%, 95.35%, 90.59%, and 90.63% for accuracy, AUC, recall, precision, F1-score, Kappa, MCC, respectively. The LightGBM achieved 94.82%, 98.89%, 96.19%, 93.64%, 94.89%, 89.64%, and 89.69% for accuracy, AUC, recall, precision, F1-score, Kappa, MCC, respectively. The accuracy of the RF, XGBoost, and LightGBM was 94.49%, 95.29%, and 94.82 %, respectively. The accuracy, precision, F1-score, Kappa, and MCC of ensemble RXLM were the highest, at 96.08%, 96.65%, 96.06%, 92.16%, and 92.2%, respectively. The XGBoost achieved the highest AUC, at 99.13%. The RF achieved the highest recall, at 96.56%. The RF had the lowest accuracy, AUC, precision, F1-score, Kappa, and MCC, at 94.4%, 98.84%, 92.73%, 94.6%, 88.98%, and 89.06%. The RXLM had the lowest recall, at 95.5%. Figures 6-9 showed the results of the second experiment. In the second experiment, we used the random search technique to evaluate the RF, XGBoost, LightGBM, and RXLM with measurement metrics after tuning the hyper-parameters on the training set. The proposed ensemble RXLM achieved 96.34%, 99.38%, 96.12%, 96.55%, 96.33%, 92.68%, and 92.69% for accuracy, AUC, recall, precision, F1-score, Kappa, MCC, respectively. The RF had 84.73%, 92.75%, 89.27%, 81.88%, 85.4%, 69.46%, and 69.78% for accuracy, AUC, recall, precision, F1-score, Kappa, MCC, respectively. The XGBoost had 92.42%, 99.12%, 98.65%, 87.74%, 92.87%, 84.84%, and 85.52% for accuracy, AUC, recall, precision, F1-score, Kappa, MCC, respectively. The LightGBM had 95.18%, 98.86%, 94.91%, 95.45%, 95.17%, 90.37%, and 90.39% for accuracy, AUC, recall, precision, F1-score, Kappa, MCC, respectively. The accuracy, AUC, precision, F1-score, Kappa, and MCC of ensemble RXLM were the highest, at 96.34%, 99.38%, 96.55%, 96.33%, 92.68%, and 92.69%, respectively. The XGBoost achieved the highest recall, at 98.65%. The RF had the lowest accuracy, AUC, recall, precision, F1-score, Kappa, and MCC, at 84.73%, 92.75%, 89.27%, 81.88%, 85.4%, 69.46%, and 69.78%, respectively. Figure 4: The metrics of the LightGBM model before hyper-parameters tuning. Figure 5: The metrics of the RXLM model before hyper-parameters tuning. Figure 8: The metrics of the LightGBM model after tuning the hyper-parameters. Figure 6: The metrics of the RF model after tuning the hyper-parameters. Figure 7: The metrics of the XGBoost model after tuning the hyper-parameters. Using the confusion matrix (CM) of the first experiment, an examination of the proposed RBSVM and the five ML models is depicted in Figures 10-13 by contrasting the actual and predicted labels of the stroke and no-stroke classes of the test dataset. The stroke class had 968 rows, and the no-stroke class had 976.