Grey wolf optimized stacked ensemble machine learning based model for enhanced efficiency and reliability of predicting early heart disease

Heart disease is one of the foremost reasons for death globally. Machine learning (ML) can be used to predict heart diseases early, which can help improve patient outcomes. This research proposes a novel machine learning method for predicting heart disease using a combination of Grey Wolf Optimization (GWO) and stacked ensemble techniques. GWO is a metaheuristic algorithm that can be used to optimize the parameters of machine-learning models. The stacked ensemble technique is a combination of multiple machine learning models to improve the overall accuracy of the prediction. The model proposed was evaluated using a dataset of heart patients. The results showed that the model achieved a 93% accuracy, which was significantly higher compared to traditional machine learning methods. The proposed method also had a higher precision of 91%, sensitivity of 95.3%, F1 score of 92.9%, and Matthew coefficient of 0.83, less in Log_Loss 2.87 than the traditional methods. The results of this research suggest that the proposed model is a promising new approach for predicting heart diseases. This method is more accurate and reliable than traditional methods and has the potential to improve patient outcomes.


Introduction
Healthcare is a vast area of research that includes cardiovascular diseases, diabetes, drugs, and cancer.For these diseases, different factors and features are considered, and different datasets are available online.As described by the World Health Organisation (WHO), the leading cause of death globally is cardiovascular disease [1].According to the WHO [1], every year around 17.9 million deaths occur due to heart disease.This indicates a global death count of 31%.In the CDC report [2], 80% of the deaths were due to heart attacks.Predicting patients with heart disease is important for reducing their risk.Therefore, it is necessary to identify patients with heart disease and treat them with the utmost care to decrease the risk of death.Apart from the traditional method of diagnosing the disease, other methods, such as machine learning (ML), help identify high-risk patients.
Patients with heart complications must be treated early to diagnose cardiovascular disease.This study mainly focused on applying ML to a heart disease dataset optimized by Grey Wolf Optimization (GWO) [3].Among various diagnostic methods, this study specifically investigates the feasibility of accurate heart disease prediction through machine learning.
To achieve accurate disease prediction, the system first employs the Grey Wolf Optimizer (GWO) algorithm to carefully select the most relevant features, effectively eliminating those that are redundant or irrelevant.This refined set of features is then fed into a stacked machine learning (ML) classifier for robust prediction.GWO, inspired by the social hierarchy and hunting strategies of grey wolves, offers distinct advantages over traditional optimization algorithms like PSO and GA: Reduced complexity: GWO operates with fewer parameters, simplifying its implementation and comprehension.Straightforward principles: Its core concepts are easy to grasp, making it accessible to a wider range of users.Effortless implementation: It can be readily integrated into various ML frameworks without extensive configuration.This combination of GWO's efficient feature selection and the stacked ML classifier's predictive power fosters a powerful and streamlined approach to disease prediction [3].
Different machine-learning techniques are involved in the detection of heart diseases.It is essential to accurately detect diseases using ML techniques.Misdiagnosis may lead to an increased risk for heart patients.Physicians and radiologists stereotypically use physical tests and the medical history of the patients for diagnosing the disease, and later procedural and diagnostic tests will be carried out based on the symptoms.Artificial intelligence led to the development of ML models that are accurate in predicting heart disease.
Most models use existing statistical algorithms to examine large datasets of patients, which include all kinds of medical information about the patient.From supervised classification to unsupervised anomaly detection, researchers have embraced a diverse toolbox of ML techniques in their pursuit of improved heart disease identification.Several ML algorithms are trained for predicting disease, including Decision Tree (DT), Naïve Bayes (NB), Logistic Regression (LR), Random Forest (RF), Support Vector Machine (SVM), and K-Nearest Neighbor (KNN).These models work on huge patient databases and are used to categorize risk features and improve a predictive model for identifying the risks.
SGD approximates gradient descent by estimating the model improvement direction using a single data point instead of the entire dataset.This leads to computational efficiency for large-scale learning but introduces inherent randomness [31].While SGD sacrifices quick convergence for the optimal solution, its statistical properties and implicit bias often result in good predictions and competitive performance.However, additional computation during each iteration and potential accuracy loss due to gradient compression techniques are trade-offs to consider [31].While SGD saves time in calculations, it comes with the cost of potentially taking longer to reach the best result.Additionally, using tricks like gradient compression for further efficiency might compromise the accuracy of the final model [32].
Robust optimization in the field of machine learning pertains to the capacity of a learning algorithm to exhibit high performance across diverse data types [33].This entails striking a balance between performance and supplementary costs, such as an increased number of data samples, intricate objective functions, or protracted optimization iterations [34,35].The potential loss of interpretability arises from the intricate nature of robust optimization problems [36].In comparison to standard approaches, the resulting solutions may exhibit reduced interpretability [37].Consequently, comprehending the reasoning behind the decisions made by the model and identifying potential issues becomes more challenging [38].The internal complexity of robust models further exacerbates the difficulty in debugging and enhancing their performance.Additionally, certain robust optimization techniques may necessitate specialized expertise or software tools.Moreover, specific implementations can be sensitive to hyperparameter settings, thereby increasing the difficulty in attaining optimal performance [39].
Various studies have been involved in developing ML-based models for predicting heart disease, where diagnostic tests are inaccessible.ML uses classification techniques to predict data.These classification techniques use training data to predict a developed model.
There are various classification techniques, such as traditional methods, hybrid methods, deep learning, and ensemble techniques.All these models aim to achieve maximum accuracy in healthcare.
The process begins with initializing parameters like the number of wolves and iterations.Base-level classifiers: A set of base-level classifiers, such as Random Forest (RF), Support Vector Machine (SVM), etc., are used to evaluate the initial population of features.The performance evaluation is analyzed.Among the ML methods, Random Forest produced 88% accuracy.GWO is a swarm intelligence technique inspired by the hunting behaviour of grey wolves in nature.It's used to optimize complex problems and can be applied to feature selection, which involves choosing a subset of relevant features from a larger dataset.Three coefficients, alpha, beta, and delta, are used to control the movement of the wolves in the GWO algorithm.The fitness of each wolf (feature subset) is calculated based on its classification performance using the base-level classifiers.The positions of the wolves are updated based on their position and the positions of the alpha, beta, and delta wolves.The continuous positions of the wolves are converted into discrete feature indices.The process stops if a stopping criterion, such as a maximum number of iterations or a desired fitness level, is met.If the stopping criteria are not met, alpha, beta, and gamma are updated, and the fitness is recalculated with the updated feature subset.This loop continues until the stopping criteria are satisfied, and the feature subset with the highest fitness is returned as the optimal feature subset.The feature indices are reranked based on their fitness values.The performance of the selected features is evaluated using meta-learners, which are models that combine the predictions of multiple base-level classifiers.
The contributions of the paper • The proposed GWO was used to optimize the considered dataset.• Ensemble machine-learning techniques were stacked.Approximately 18 ML models were stacked to achieve the desired accuracy.• The proposed model performance and other stateof-the-art models are analyzed and compared.
The remaining section of this paper is organized as follows: Section 2 deals with related works that include various existing models.Section 3 explains the materials and methods involved in the study, including the ML techniques, GWO algorithm basics, performance metrics, and the dataset.Section 4 explains the experimental results, analysis, and discussion.To end, Section 5 completes the research.

Various situation
Various studies have explained the effective and realworld applications of ML in heart disease detection.The study involved a dataset from the UCI repository, which is available publicly to everyone [4].ML techniques are very useful in the medical field for increasing accuracy and reducing computational costs.Consider Verma et al., who projected a model that used particle swarm optimization (PSO) [5] and ML techniques for heart disease prediction, which obtained 90.28% accuracy.
Al-Tashi et al. [6] and El Bakrawy [7] worked on GWO with single ML techniques and achieved 89.33% and 87.45%, respectively.Garavand et al. [8] worked with ML techniques and reached 85%.Dissanayake et al. [9] Sabab et al. [10] and Garavand et al. [8] worked with the single ML algorithm and feature selection method.They achieved 88.52%, 87.8%, and 84% accuracy, respectively.Saqlain et al. used the Fisher score algorithm [11] for selecting features and SVM for prediction.This study achieved 81.91% accuracy and 88.68% specificity.Latha and Jeeva developed a hybrid model that used four ML algorithms, namely NB, BN, RF, and MP, which achieved 85.45% accuracy [12].Itoo and Garg [13] proposed a model that stacked ensemble models like LR, KNN, and NB for predicting heart disease.The model achieved 90% accuracy.
Liu et al. [14] applied 10 classifiers for the stacking ensemble model.The stacked model achieved 89.86% accuracy in predicting heart disease.PAL and GANG-WAR [15] reached 82.95% accuracy in predicting heart disease by applying stacked models to the dataset.About nine base learners were involved in this study.Six base learners like Rf, Extra Tree Classifier, KNN, XGB, SGD, Adaboost, and MLP were applied by PA & PRIYA [16] and obtained 90.2% accuracy.Harika et al. [17] proposed an ensemble framework for rapid prediction of heart disease.The model obtained 87.05% for stacked ensemble, 84.74% for ANN, 81.35% for NB, and 79.66% for SVM.Karadeniz et al [18] adopted a data-driven approach, utilizing a Lasso graph for feature selection and Ledoit-Wolf shrinkage for improved predictive performance in predicting heart disease.The models yielded 88.7 and 88.8 accuracy, respectively.
Talukdar & Singh [40] addresses the rise in mortality rate, with cardiovascular disease being a significant contributor, and the need to predict and treat heart disease using medical data and analytical insights.The study introduces an artificial neural network methodology for identifying potential cardiovascular disease risk factors and generating a predicted list of risk features most likely to result in cardiovascular disease.The model achieved 81% accuracy which used a backpropagation algorithm along with MLP.Taylan et.al [41] proposed a methodology that combines machine learning, neuro-fuzzy, and statistical methods to predict cardiovascular diseases with high accuracy, exceeding 90%.Hossain et.al., [42] aimed to analyze patient data to accurately predict heart disease and identify the most significant attributes for prediction using the Correlation-based Feature Subset Selection Technique with Best First Search.Distinct artificial intelligence techniques are applied and compared, with random forest using selected features achieving the highest accuracy rate of 90% for heart disease prediction.Jawalkar et.al., [43] proposed an ML approach for heart disease prediction using a decision tree-based random forest classifier with loss optimization.The paper does not explicitly mention the specific traditional methods that were compared to the proposed approach.The model achieved 86% precision and 86% recall.The existing study in this section is tabulated in Table 1.
A thorough investigation of existing models for predicting heart disease shows that stacked ensemble models achieve an accuracy of up to 90%.However, the authors could have explored other ensemble methods, such as bagging and boosting.Additionally, different evaluation metrics, such as ROC and AUC, are missing.The existing models also do not analyze feature importance to understand which features are most predictive of heart disease, and they do not compare the proposed framework to various state-of-the-art methods.
From the overhead studies, it is evident that these models do not achieve greater accuracy, and feature optimization is not performed.Our study employed feature optimization and stacking, which will be explained in further sections.This study aimed to identify high-risk patients with heart disease.To address limitations identified in prior research, this study developed a model that optimizes stacked ensemble ML for specific applications.

Proposed method
Figure 1 illustrates the framework of the proposed model.This model has two phases.In the first phase, data were obtained from the UCI repository and then preprocessed.The preprocessed data are used for GWO, which optimizes the dataset.In the second phase, the optimized data were applied to stacked ensemble ML techniques.About 18 ensemble techniques were stacked.The generation of the model, followed by a performance analysis of the results obtained from the model, was compared with the basic ML learners.Each step is elucidated in detail in the subsequent sections.

Dataset preparation
In the proposed model, the open-source heart disease dataset is retrieved from the UCI repository.The dataset included 1190 examples of records.The dataset consisted of 13 independent features and one dependent target class [4].Table 2 lists the attributes of the datasets.This dataset was obtained by combining various clinical test outputs, namely, serum cholesterol, vessel count, thalassemia, and fasting blood sugar.From the electrocardiogram, ST depression and sloping ST segments were achieved.

Statistical analysis and preprocessing
The dataset was initially loaded and analyzed.In this study, outlier detection was performed as the first stage of data pre-processing.Z-score outlier detection is used to boost the efficiency of the model.According to the experimental rule, a data point in a collection with a z-score of more than 3 is regarded as an outlier.The dimension of a data point's deviation from the mean value is called the z-score, which is called the standard score.It displays the range of values for an attribute in the dataset Beunza et al., [19] Z score = x − μ σ (1) One-hot encoding was used for categorical features, such as the slope of the ST segment (slope), chest pain (cp), sex, and resting electrocardiogram (restecg).It transforms an attribute into a form that can be understood by ML algorithms by turning it into a numerical format.Two sets of data were pre-processed for preliminary analysis before feature scaling.A standard scaler was used to standardize the attribute values for the initial set of data.The min-max scaler was used to normalize the values for the other set.The numbers in the min-max scale range from 0 to 1, where 0 represents the smallest value discovered and 1 represents the maximum.The remaining information consists of decimals between 0 and 1, as shown in Equation 1,2.The statistics for the numerical columns are presented in Figure 2.
Both cholesterol and resting blood pressure had outliers, as can be seen from the description above.While both variables had the lowest value of 0, cholesterol also had an outlier on the upper side, with 603 as the maximum value.The outliers were removed.Once the outliers are removed the shape of the dataset includes 1171 records.To select the best models to be utilized in level 0 of the stacked ensemble approach, we will develop various baseline models and perform 10-fold cross-validation at this stage.After comprehensive preprocessing, we tested the dataset on various established machine learning models: Logistic Regression (LR), K-Nearest Neighbors (KNN), Support Vector Machines (SVM), Naive Bayes (NB), Random Forest (RF), XGBoost (XGB), Decision Trees (DT), and Neural Networks (NN).Each model underwent classification, and their performance was thoroughly evaluated using the metrics outlined in Table 3.

Stacked ML classifiers
Basic and popular ML techniques in the healthcare sector for predicting disease are highly capable and have greater heterogeneity Taha et al., [20].Building upon the power of ensemble learning, this work explores a two-stage stacking technique, where multiple ML models are sequentially combined for enhanced robustness and accuracy.This study investigated the impact of feature optimization on stacked ensemble performance.Stage 1 utilized all features, while Stage 2 employed the GWO algorithm to identify the most informative features, refining the data input for the stacked ensembles in the final step.Tables 4 and 5    applied to obtain linear and non-linear data.A decision hyperplane is employed by SVC for class recognition.This method is robust, as it accurately discourses the bias and variance in the data.In KNN, data are clustered and neighbours are defined by K. Based on the similarity measure, new instances can be classified.The predictions from various decision trees combined for the final prediction were made using a gradient boosting machine.The eigenvalues were divided into K intervals, and the results were classified in this model.This increases the speed of prediction and decreases storage.AdaBoost iteratively corrects its mistakes by leveraging wrongly classified samples.It assigns higher weights to these samples, guiding subsequent classifiers to focus on areas where the previous one faltered.This process continues until a desired level of accuracy is achieved.Multi-Layer Perceptron (MLPs) excel at classifying data by mapping inputs to specific classes.
They apply interconnected layers of neurons to learn complex relationships within the data.The extra-tree classifier builds its predictive power by constructing numerous decision trees.Unlike traditional random forests, it samples data without replacement, ensuring each tree has a unique data sample.Extreme Gradient Boosting (XGB) tackles classification through an efficient boosting technique.It builds an ensemble of decision trees iteratively, focusing on improving predictive accuracy for previously misclassified samples.The performance is better than other state-of-the-art ML models Chiu et al. [21].
Combining various categories of classification techniques using a meta-classifier is known as stacking Verma & Pal [22].The idea is to merge weak learners to attain robust generalization ability.During stacking, the results of the base learners are fused.The firstlevel learners are the base learners, and combinations of base learners are meta-learners, also called secondlevel learners.The base learners were trained using this dataset.The output from these base learners is passed on as input features for second-level learners.
A new dataset with original labels for training metalearners.The 13 individual models were trained using the available dataset.

GWO algorithm
Mirjalili et al. [23] established the GWO after being inspired by the behaviour of grey wolf packs in 2014.
The interesting characteristic of the grey wolf is the exceptional hunting and looking for prey.The group of wolves, called canines, plays a different role and completes their tasks by cooperating with other wolves.The GWO comprises four levels in hierarchical order, as shown in Figure 3.The most important is wolf α, which decides on hunting activities.The second step is wolf β, which is subordinate to wolf α, and β is the best candidate for α in making decisions.The third rank is wolf δ, which is a subordinate of wolf α and β.The wolf δ is responsible for scouting and hunting.The last and fourth values are the wolf ω values.This wolf maintains its pack.Wolf hunting is categorized into tracking, chasing, and prey attacks.Wolf α, β, δ are responsible for each reiteration, and the mathematical model is described as [23] (3) Equation 3 explains the distance between the prey and the grey wolf.The current iterations are denoted as t.
The location of the grey wolf iteration at t is denoted by X p (t) and position is denoted by X (t).Prey location was updated using Equation 4. The A and C coefficient vectors were calculated using Equations 5 and 6, respectively.The components of a are reduced linearly from 2 to 0 after a few iterations.Random vectors are r 1 and r 2 in [0,1].The main role of this random vector is to increase the randomness Finally, the trade-off between exploitation and exploration is achieved by updating a vector, which is given by Equation 7.
The random vectors r 1 and r 2 let the wolves reach any position.As a result, a grey wolf can update its position inside the space surrounding the prey in any random location based on Equations 3 and 4.

GWO Optimized Stacked ML classification
Feature selection is a method used to reduce the number of suitable features, which boosts the classification by obtaining the feature subset from the initial features.
It ignores the less important features that help reduce computational and memory costs.This algorithm is a meta-heuristic that replicates the process of grey wolves that live in groups of five to twelve individuals.Emmanuel et al. [24] use search and optimization problems.Algorithm 1 operates in two phases: In phase 1 the dataset is given to the stacked ensemble techniques, and in phase 2 feature optimization through the GWO algorithm is applied, and the resulting streamlined set of features is utilized by the stacked ensemble models.The code uses a UCI dataset, which is a common source of publicly available datasets for machine learning research.The dataset contains features (f1, f2, . . ., fn) representing various attributes related to heart disease.The dataset is divided into a training set (X) for model development and a test set (Y) for final validation.Feature Selection using GWO to identify the most relevant features for predicting heart disease, improving model accuracy and interpretability.GWO population (Xi) representing different feature combinations is created.Parameters a, A, and C, which control GWO's search behaviour, are initialized.Each feature combination's fitness (its ability to predict heart disease) is calculated.GWO's exploration and exploitation mechanisms are used to update feature combinations over multiple iterations.The best three feature combinations (Xα, Xβ, Xδ) are tracked.The best feature combination (Xα) is returned after the iterations.
Stacked Ensemble Model Training and Testing: For each model in the ensemble (Ti), a subset of features (D1) is selected from the optimal set identified by GWO.Each model (Ti) is trained and tested on each fold of the data using the corresponding feature subset (D1).The final output is a summary of performance scores for each model in the ensemble, providing insights into their strengths and the overall ensemble's effectiveness.The step-by-step pseudocode is explained in Algorithm 1.This two-step approach aimed to combine the power of feature selection with the advantages of ensemble learning.

Performance measures
Data mining is evaluated through performance metrics.Once the classification is completed, the performance metrics are evaluated by determining the confusion matrix and the ROC curve.The recall was used to assess the completeness of the model.If recall is higher, then fewer false negatives (FN) are produced.The exactness was measured using precision.While accuracy contributes to overall performance, the F1 score offers a more nuanced view by balancing precision and recall.This makes it the most reliable indicator of a model's ability to accurately predict both positive and negative cases.For comprehensive model evaluation, the F1 score surpasses simple accuracy by considering both how well the model identifies true positives and avoids false positives.This makes it the preferred metric for determining a model's effectiveness in real-world applications.
The ROC curve is a graph that explains the model's classification performance.The ROC curve was plotted with true-positive and false-positive values.Table 3 presents the performance metrics obtained using their formulas.The accuracy metric measures the percentage of predictions for which the model is correct.The precision metric measures the percentage of predictions classified as positive or positive by the model.The recall metric measures the percentage of positive cases correctly identified by the model.The F1 score is a weighted average of precision and recall.The Log_Loss called logarithmic loss or cross-entropy loss is a measure of how well the model predicts the actual values against the predicted probabilities.A lower Log_Loss indicates a better model, Wang et al. [25].The Mathew correlation coefficient (MCC) is also a statistical tool for model evaluation.It is an amount of the variation between actual and predicted values.This metric is more reliable and produces a high score in case of good results obtained during prediction in the four categories, namely TP, FN, TN, FP Chicco & Jurman [26].This value is equal to the chi-square statistics.

Experimental setup
The performance of the suggested model is assessed using ML models.The proposed models begin with the necessary data collection and proceed with preprocessing to accommodate missing values.The following step is to choose crucial attributes from the provided dataset.The performance of the ML model will also be examined using specific features.A variety of evaluation criteria are used to analyze performance.The last decision is used to conclude.The Anaconda Jupyter Notebook 6.4.8, which features built-in packages for ML models, and an Intel(R) Core (TM) i7-7600U CPU running at 2.80 and 2.90 GHz, is used to experiment.

Result analysis
ML algorithms were trained on a dataset.The algorithm's performance was assessed using the metrics listed in Table 3. Table 4 shows the detailed performance analysis of each algorithm.RF outperformed with 88.89% accuracy.This means that 88.89% of the predictions made by the RF algorithm were correct.Among all tested algorithms, Random Forest (RF) stood out with the lowest classification error rate at 9.84%.This translates to only a small fraction (less than 10%) of the model's predictions being inaccurate, as visualized in the chart below.

Result of stacked ML classifiers
Stacking works by training a secondary model, or "meta-learner," on top of several pre-trained ML models.This meta-learner learns how to optimally combine the predictions of the underlying models, resulting in more accuracy.The algorithms used for stacking are RF, multi-layer perceptron, KNN, support vector classifier, extra tree classifier, DT, extended gradient boosting, stochastic gradient descent, AdaBoost, and gradient boosting.The performance metrics are evaluated and tabulated in Table 5.
All the 13 features are passed to the stacked model.The stacked model achieved an accuracy of 86%, which is lower than the individual ML techniques.The precision, recall, sensitivity, specificity, Log_Loss, F1 score and Matthew correlation coefficient were also lower for the stacked model, and the results were also not as good as the individual ML techniques.To overcome this issue, GWO algorithm optimization is performed on the dataset.The optimized features are then applied to the ML techniques for training and stacking.GWO algorithm is a technique that can be used for performance improvement of ML models.It works by randomly generating a population of solutions, and then iteratively evaluating and improving the solutions until a satisfactory solution is found.In this case, the GWO algorithm is used to optimize the features of the dataset, which results in a better-performing ML model.

Results of optimized stacked ML classifiers
The limitations inherent to individual machine learning algorithms may not be overcome by a single approach.Combining multiple models can potentially improve overall prediction accuracy.While individual machine learning algorithms can achieve satisfactory performance on certain datasets, their inherent biases and limitations can be mitigated by ensemble learning techniques, which combine the predictions of multiple models to achieve greater accuracy.The drawbacks of stacked ML methods are overcome with the proposed model of GWO-optimized stacked ensemble techniques.To improve model performance, feature optimization was performed on the 13-dimensional dataset using the GWO algorithm.The features are reduced from 13 to 9.After optimization, the attributes selected are chest pain type, age, fasting blood sugar, resting blood pressure, ST slope, cholesterol, resting ECG, ca, and thal stress rate.The less important features are removed.The optimized features were then trained and passed to the stacked ensemble methods.The results achieved by the model proposed were much better than the methods and stacked methods.The performance evaluation for the proposed model is specified in Table 6.The model proposed achieved an accuracy of 93%, precision of 91%, sensitivity of 95%, specificity of 87%, F1 score of 93%, ROC of 91%, Log_Loss of 2.87, and Matthew correlation coefficient of 83%.The proposed model outperformed all other state-of-the-art methods in terms of specificity, precision, accuracy, sensitivity, F1 score, ROC, Log_Loss, and Matthew correlation coefficient.
The bar graph in Figure 4 shows the performance of different ML models for predicting a certain outcome.The bar graph indicates that the suggested model outperforms all other models.The model has an accuracy of 93% compared to other models, which is visualized in Figure 4.The other models shown in the bar graph are all state-of-the-art ML models.The proposed GWO-optimized stacked ensemble model combines multiple machine-learning models that learn from the strengths of each model.The bar graph shows that the model proposed has an important improvement   over traditional ML models for predicting the outcome, as they are more accurate, precise, and reliable.This means the proposed model is more likely to make correct predictions.By leveraging the power of ensemble learning, the proposed model exhibits remarkable adaptability.Figure 5 shows that incorporating more stacked models effectively reduces its Log_Loss, leading to superior heart disease prediction.The proposed model with 10 ensemble techniques has a Log_Loss of 2.87.This is a substantial enhancement over the Log_Loss of the traditional ML models, which ranged from 3.0 to 3.5.The proposed model with 17 models is also more accurate than the stacked ensemble model, which had a Log_Loss of 2.87.The bar graph in Figure 6 shows that the proposed model is more effective than the other stacked model and state-of-the-art ML methods without optimization.Focusing on heart disease prediction, Figures 4 and 5, and 6 reveal a substantial advantage for the proposed model compared to both traditional stateof-the-art ML models and stacked ensemble models.

Discussion
Table 6 reveals the proposed model's remarkable achievement of accuracy compared to every other model in Table 7.The proposed model of GWOoptimized stacked ensemble techniques is a significant improvement over traditional ML methods and stacked methods.By optimally combining and refining diverse ML models using the GWO algorithm, this model unlocks previously unattainable levels of performance and prediction accuracy.The proposed model is more accurate and reliable, with lower log loss.

Conclusion
Heart disease is a leading cause of death globally, and early prediction is crucial for improving patient outcomes.The study proposed a stacked ensemble model optimized by GWO for predicting heart disease.GWO helps select the most important features from the dataset, while stacked ensemble learning combines multiple machine learning models to improve accuracy.The proposed model achieves an accuracy of 93%, significantly higher than traditional methods like logistic regression 85.25% and support vector machines 70.49%.The model also shows high precision 91%, recall 95.3%, F1-score 92.9%, Matthew coefficient 0.83, and a low Log_Loss 2.87.This study demonstrates the potential of GWO-optimized stacked ensemble models for improving the accuracy of heart disease prediction.This could lead to earlier diagnosis, better treatment outcomes for patients, and a promising new approach for predicting heart disease with high accuracy.
Future scope: The study suggests exploring other ensemble techniques and different evaluation metrics, as well as analyzing feature importance to understand which features are most predictive of heart disease.They also recommend comparing the proposed model to various state-of-the-art methods for a more comprehensive evaluation.

Figure 1 .
Figure 1.Process Flow of proposed model.The model uses a dataset from the UCI repository and is preprocessed.The preprocessed model is passed to the GWO algorithm, and features are optimized.The optimized features are then used by ML techniques and performance is evaluated.

Figure 4 .
Figure 4. Accuracy for various models with the proposed model.

Figure 5 .
Figure 5. Log_Loss of various models with the proposed model.

Figure 6
compares the projected model to the state-ofthe-art methods and stacked ensemble ML techniques.The Y-axis of the graph displays the accuracy of each model, and the X-axis displays the different models being compared.The graph shows that the projected model beats other models on performance metrics.The proposed model has a higher accuracy, precision, recall, F1 score, Log_Loss, and Matthew correlation coefficient.The continual decrease of parameter space and

Figure 6 .
Figure 6.Performance metrics of the proposed model with stacked classifier.

Table 1 .
Existing study compared to this study.

Table 2 .
[4]t of attributes of the Heart dataset from UCI with feature information[4].

Table 4 .
Performance analysis before feature selection.

Table 5 .
Performance evaluation of the stacked model with other ML techniques.

Table 6 .
Performance evaluation of the proposed model with other ML techniques.

Table 7 .
Comparative Analysis of the proposed model with the models available.