# Adaptive Leakage Protection for Low-Voltage Distribution Systems Based on SSA-BP Neural Network
## 3 Normal Leakage Current Prediction Model
### Sparrow Algorithm Optimizes BP Neural Network Prediction  
As the most typical deep learning method, the BP neural network [27; 28; 29] is widely used by many scholars to predict temperature, current, passenger flow, and so on. Therefore, this paper uses the BP neural network to construct a normal leakage current prediction model, taking the feature vector at the current moment as the input, and the prediction as the output. Figure 5 is a schematic diagram of the structure of the three-layer BP neural network model, where \(x_{i}^{n}\) represents the \(i\) (\(i=1,2,\ldots,j\)) input of the \(n\)-th group of samples in the input layer, \(y^{n}\) represents the predicted value corresponding to the \(n\)-th group of samples in the output layer, \(m^{n}\) represents the actual measured value, \(e^{n}\) is the error between the predicted value and the actual value, \(w_{ip}\) is the weight coefficient between the input layer and the hidden layer, and \(w_{p}\) is the weight coefficient between the hidden layer and the output layer. The unipolar S function is selected as the activation function of the neural network. For the prediction model, the characteristic phasors \(\{I_{t},T_{t},H_{t},I_{At},I_{Bt},I_{Cl}\}\) are used as input, which represent the measured leakage current, temperature, humidity, and 3-phase load current at time \(t\), respectively. The prediction of leakage current should be accurate and real-time. Thus, this method uses recursive prediction to input the characteristic quantity at time t and output the predicted leakage current at time \(t+1\), so as to obtain the prediction of leakage current. Figure 4: Flow chart of adaptive action threshold adjustment. Figure 5: Structure of BP neural network model. The number of nodes in the hidden layer of the neural network will affect the accuracy of the prediction. By comparing different numbers of nodes, it is found that the prediction effect is the best when the number of nodes in the hidden layer is 12. Therefore, the structure of the BP neural network is determined to be 6-12-1, while setting the learning rate to 0.2. Since the neural network optimizes the weight and threshold according to the negative gradient direction of the error function, convergence is slow, and it is easy to fall into the local optimum, which affects the performance of the BP neural network. In order to improve the prediction accuracy, SSA [30; 31] is used to iteratively update the weight and threshold of the BP network. The fitness function of SSA is the minimum error value of the neural network. The optimal weight and threshold are obtained through SSA optimization, and the weight and threshold are assigned to the BP neural network. After several iterations, the nonlinear dynamic mapping ability of the BP network is improved. The sparrow search algorithm is a bionic intelligent algorithm proposed based on the influence of two different behaviors of sparrows in the process of finding food. It has the characteristics of strong optimization ability, fast convergence, and high stability. Sparrows are separated into two groups when looking for food: the finders and the followers. The finder's behavioral strategy is to find food for the whole sparrow population by providing the foraging area and direction of the population, and the follower's behavioral strategy is to obtain food by observing and following the finder. All sparrows in the population can complete the search for food by performing both strategies. Moreover, sparrows in peripheral locations are vulnerable to attack and need to constantly update their locations to obtain optimal locations. In a sparrow population, once a sparrow finds a predator, a warning message is sent, and the group immediately flies away from the danger area. Supposing there are \(M\) sparrows in \(N\)-dimensional space; each sparrow's position is \(P_{i}=[p_{i1},\,P_{i2},\,\ldots,\,p_{N}]\) (\(i=1,\,2,\,\ldots,\,M\)) and the fitness value is \(F=f\,[P_{1},\,P_{2},\,\ldots,\,P_{M}]\).