Abstract
As renewable energy sources and variable demand increase, maintaining the stability of smart grids (SGs) helps guarantee that electricity systems continue to operate effectively and uninterrupted. More intelligent solutions are required since traditional monitoring methods frequently examine the initial indications of instability. This study proposes a machine learning (ML) methodology for classification and prediction of SG stability to obtain effectiveness in system operations and increase reliability. Fourteen ML models are used in this study for classification and prediction tasks. These ML models are tested under eight evaluation metrics. This study uses the features of engineering and selection to improve the model's performance and accuracy and reduce the dimensionality. Different feature selection methods are used, such as filter, wrapper, and embedded methods. We used two hyperparameter optimization methods, such as Bayesian optimization (tree-structured Parzen estimator, TPE) and metaheuristic optimization (grey wolf optimizer, GWO), to improve ML performance. The results show that light gradient boosting machine achieves near-perfect predictive performance under both optimization strategies, with the TPE-based model reaching 99.95% accuracy and the GWO-based model reaching 99.90%. We use different explainable AI methods to ensure the model is trustworthy. This study improves SG resilience and supports energy efficiency.