arXiv:2609.04300cs.AISep 2026

Manuscript Offprint

arXiv:2609.04300

Data-Optimized Contingency Screening: A Machine Learning Approach to Power System Security

Joshua Salako, Folajimi Osikomaiya, Olakorede Olamiju

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Joshua Salako

dept. of Electrical and Electronics

Engineering

Federal University of Agriculture

Abeokuta, Nigeria

0009-0005-1044-2616

Folajimi Osikomaiya

dept. of Electrical and Electronics

Engineering

Federal University of Agriculture

Abeokuta, Nigeria

0009-0000-2998-3256

Olakorede Olamiju

dept. of Electrical and Electronics

Engineering

Federal University of Agriculture

Abeokuta, Nigeria

0009-0009-1913-8265

Abstract—Ensuring the security of the power system is essential for stability and reliability, especially in the event of disruption. Effective classification of contingency in power systems enables proactive decision-making and mitigates large-scale breakdowns and failures. This study explores the use of machine learning algorithms to classify security levels of contingencies in power systems into safe, moderate or severe classes. For this approach, Newton-Raphson load flow method extracts system data from contingency scenarios, using Overall Performance Index (OPI) as safety measure. For data pre-processing, Synthetic Minority Over-Sampling Technique (SMOTE) and Principal Component Analysis (PCA) is used to address class imbalance and reduce dimensionality, respectively. K-Nearest Neighbours (KNN), Random Forest (RF) and Support Vector Machines (SVM) is trained and evaluated on datasets generated through N-k contingency scenarios for k equal 1, 2, and 3 on IEEE-14 and IEEE-30 bus systems using four hybrid pre-processing configurations: normalized, SMOTE-balanced, PCA-transformed, and a combined SMOTE PCA-transformed. Performance is assessed by precision, recall and F1 score, with priority given to the severe contingency classes. The RF achieved the highest F1 scores of 0.97 in IEEE-30 and 0.86 in IEEE-14, SVM benefits significantly from PCA and improves the accuracy of the classification, while KNN is best suited for SMOTE and PCA conversion. The findings show that PCA contributes more than SMOTE to the overall performance of the model. However, SMOTE improves recall but can introduce false positives and is therefore a compromise of accuracy. This study highlights machine learning as a scalable and powerful alternative to traditional contingency analysis, which improves the assessment of security in real time.

Keywords—Power system, contingency analysis, machine learning, load flow, SMOTE, PCA

I. INTRODUCTION

A stable and reliable supply of electricity is of the utmost importance in modern society, as it plays a crucial role in facilitating the activities of the various sectors, including residential, commercial, industrial and infrastructure [1]. The primary objective of the energy system is to maintain a stable and adequate supply of electricity to customers, while respecting the fixed limits of frequency and voltage. Power systems, which consist of interconnected generation, transmission and distribution networks, ensure uninterrupted supply while respecting the limits of frequency and voltage [2]. However, the challenges are posed by energy system contingencies which pose significant obstacles to the smooth and reliable functioning of these systems [3]. The safety of the energy system is paramount, referring to the ability of the system to maintain stability and functionality during credible risks. The contingencies may be caused by a variety of factors such as equipment failure, unexpected faults, natural disasters, human error or deliberate attacks on infrastructure. Therefore, there is an urgent need for a robust detection process to determine whether a system is operating safely or whether it is in an emergency situation at any given time [4][20].

Contingencies have the potential to disrupt the normal operation of the energy system, leading to blackouts, voltage instability, cascading failures and consequent social and economic consequences [29]. The impact extends to sectors such as health, transport, communication, finance and general public security and welfare. Therefore, accurate identification, classification and understanding of energy system contingencies and their immediate response is essential for efficient contingency management, timely decision making and implementation of measures to restore system stability and minimise the impact on end-users [5]. Traditional energy system contingency classification is highly dependent on manual analysis and expertise [6]. This manual approach, carried out by experienced energy system experts, entails challenges such as time-consuming procedures, especially in large systems with many interconnected components and growing data. The increasing complexity of modern energy systems makes it difficult for professionals to analyse and classify in real time the contingencies in a comprehensive way, and introduces the risk of inconsistencies and bias. This underlines the need for automated and intelligent methods to help classify emergencies and provide accurate and timely assessments for efficient decision-making and response strategies.

Machine learning has emerged as a powerful tool in modern engineering and decision-making processes, offering data-driven solutions to complex problems in a wide range of areas[21]. Machine learning algorithms allow automatic pattern recognition, classification and prediction by analysing large datasets. These techniques have shown significant improvements in accuracy and efficiency in areas ranging from health care to finance and industrial automation [16]. One of the key applications of machine learning is in the security of power systems, where ensuring the stability and reliability of the electricity supply is of particular importance [29]. Power systems operate under dynamic conditions, which make them vulnerable to disturbances such as breakdowns of transmission lines, power failures and cascading failures. In order to mitigate these risks, contingency analysis is carried out to assess the resilience of the system in the event of a disruption. Traditional methods, such as deterministic safety assessments, are computationally intensive and often struggle to provide insights in real time [17].

The K-nearest neighbors (KNN) algorithm, a non-parametric machine learning technique, has garnered significant attention for its capability to classify contingency scenarios based on historical system data [30]. By analyzing

XXX-X-XXXX-XXXX-X/XX/$XX.00 ©20XX IEEE patterns from past contingency cases, KNN can effectively predict event severity, enabling grid operators to implement preventive measures. Research indicates that machine learning methods substantially improve contingency screening and classification accuracy while reducing computational complexity without compromising reliability [18][19]. In addition to KNN, Random Forests (RF) and Support Vector Machines (SVM) have also proven effective in contingency classification for power systems. RF, an ensemble learning approach, constructs multiple decision trees during training and determines the class prediction through majority voting [31]. This methodology enhances classification robustness by mitigating overfitting and improving generalization, making it particularly suitable for high-dimensional power system datasets. RF has been widely employed in power system security assessment due to its ability to manage intricate variable interactions while delivering interpretable results for contingency ranking and classification.

Conversely, SVM, a powerful supervised learning algorithm, seeks to identify an optimal hyperplane that maximizes the margin between different classes in a high-dimensional space [32]. Particularly effective in both binary and multi-class classification tasks, SVM is a strong candidate for contingency classification. By leveraging kernel functions, SVM can transform non-linearly separable data into a higher-dimensional space, thereby enhancing classification performance in complex contingency scenarios [33]. The integration of machine learning-driven classification models enables power system operators to strengthen decision-making, optimize grid stability, and mitigate the risks associated with unforeseen contingencies. The increasing adoption of these approaches represents a paradigm shift in power system security, fostering more adaptive and intelligent decision-making frameworks [22].

Three machine learning algorithms—RF, SVM, and KNN—are investigated and assessed in this study for power system contingency classification in an effort to overcome the drawbacks of manual methods. The remainder of the work is organized as follows: Section II covers related works, and Section III displays the methodology, modeling, and data generation and preprocessing of the machine learning classification algorithms. Section IV concludes with a thorough discussion of the outcomes and conclusions drawn from the assessment of the research methodology.

References (32)