# A Predictive Model Using Long Short-Time Memory (LSTM) Technique for Power System Voltage Stability
## 2 The Proposed System Methodology
Missing values were removed to ensure dataset execution, and a thorough search was conducted to identify artifacts like outliers, duplicates, or atypical patterns that could affect the analysis. The data were divided into different testing and training sets with a 30:70 ratio. We constructed a system model which evaluates the effectiveness of the training and testing data. Assigning 70% of the dataset for training and reserving 30% for testing helped to prevent overfitting of the model to the training data improved its capacity to generalize to new unseen data. In the ML technique, it is critical to select the appropriate number of layers, type of layers, and activation functions. The setting limitations and parameters of these techniques will be discussed in further detail to understand their impact on model effectiveness. LSTM-Based Power System Voltage Stability Assessment Model  
The LSTM concepts and the suggested LSTM algorithm for predicting voltage stability are explained in the next sections. \[ai=\alpha(Xa\,.[hi-1,\,xi\,]+ja\,) \tag{11}\]  
\[bi=\alpha\ (Xb\,.[hi-1,\,xi\,]+jb) \tag{12}\]  
\[ci=\alpha(Xc\,.[hi-1,\,xi\,]+jc) \tag{13}\]  
An LSTM cell comprises an input layer, forget gate, and output gate. The memory cell in an LSTM can determine how information is added to or removed from the cell  
Figure 4: Structure of the evaluation and labeling process (IEEE bus system). state at each time step. The following is a breakdown of the components: _ai_ is the forget gate; _bi_ is the input gate and _ci_ is the output gate; _Xa_, _Xb_, _Xc_, _Xe_ and _ja_, _jb_, _jc_, _je_ are the associated bias vectors and weight matrices, respectively; _x_() is the sigmoid function. In summary, the LSTM system learns how to effectively manage and update the cell state through these gates and their associated biases and weights. The sigmoid function is integral in controlling the amount of information retained or discarded, which is a crucial part of the learning process. The whole change procedure of the cell position is expressed as a check on:  
\[Ei=tanh(Xc\left[hi-1;\ xi\right]+je) \tag{14}\]  
\[Ei=\left[(ft\.\ Ei-1\ )+(ki\times Ei)\ \right] \tag{15}\]  
where * denotes the outcome in component order, _Ei_ is the candidate cell, and _Ei_ - 1, respectively, denotes the position of the cell in time steps \(i\) and \(i\) - 1. The hidden state _hi_ is evaluated as follows:  
\[hi=\left[ci\times tanh(Et)\right] \tag{16}\]  
The non-linear activation function is represented by the function _tanh_. The extended time domain correlation feature extraction in the LSTM network is made possible by its special architecture, which substitutes memory cells for hidden layer nodes. The dynamics of the post-contingency system serve as the input in this evaluation model. The VS of the IEEE 33-bus was predicted employing the LSTM algorithm. The network used the resolved linear unit (ReLU) activation function from the first to fifth layers, improving its ability to represent non-linear relationships and capture intrinsic patterns. Figure 4.0  
where _ht_, the hidden feature, _Xs_, _js_ are the weight and biases that are used to tune the training data throughout procedure. The final outcome of our structure \(V_{x}^{\prime}\) is to find the voltage stability position of the electrical power system. The sigmoid activation function in the last layer allows the network to produce an output within a limited range, usually between 0 and 1. This output was good for predicting voltage stability, as shown in Figure 4.1 The initial layer of the LSTM model was constructed using an LSTM architecture with 32 units, employing the ReLU activation function, a return sequence parameter set to true, and an input shape of (13, 1). The subsequent stratum incorporated an additional LSTM layer with 24 units, using the ReLU function, and a true setting for the return sequence parameter. The third LSTM layer consisted of 16 units, including the ReLU activation function. The fourth layer with 24 units was densely connected, and used the ReLU activation function.