| This study explores the use of supervised learning techniques in machine learning methods to identify cyberattacks in smart grid infrastructure. As smart grids become more dependent on interconnected technologies, they also become more vulnerable to cybersecurity threats. In response to this threat, the research compares an array of machine learning algorithms with the aim of finding effective models for classifying malicious activities within the grid context. A comparison of literature offers a basis for choosing applicable models and their uses in cybersecurity. The algorithms reviewed are Extra Trees, XGBoost, Random Forest, Bagging Classifier, Logistic Regression, Decision Tree, and K-Nearest Neighbors (KNN). Also, deep learning models such as Multi-Layer Perceptron (MLP) and Long Short-Term Memory (LSTM) networks are used because of their ability to identify intricate patterns in data and temporal relationships. Model performance is measured by usual metrics: accuracy, precision, recall, F1 score, and confusion matrix. Among all the models, the Extra Trees Classifier showed the best performance, with 98% accuracy, 0.98 precision, 0.99 recall, and an F1 score of 0.99. The Random Forest had a close run with 97% accuracy. XGBoost and Bagging Classifier both got 96% accuracy with negligible variations in other measures. Logistic Regression performed worse overall, with 78% accuracy while having a very high recall of 0.94. Decision Tree and KNN had accuracies of 93% and 92%, respectively, but resulted in more misclassifications than ensemble algorithms. Deep learning methods improved consistently with training epochs; the optimal MLP model reached a precision and recall of 91.88%, and LSTM reached 93.83%. Yet, none outperformed the best performing tree-based classifiers. These results underscore the potency of ensemble learning approaches in smart grid cyber defense and point toward prioritizing future investigation of real-time detection strategies, including an examination of the applicability of federated learning for privacy-concerned decentralized solutions. |