Data prediction can improve the science of decision-making by making predictions about what happens in daily life based on natural law trends. Back propagation (BP) neural network is a widely used prediction method. To reduce its probability of falling into local optimum and improve the prediction accuracy, we propose an improved BP neural network prediction method based on a multi-strategy sparrow search algorithm (MSSA). The weights and thresholds of the BP neural network are optimized using the sparrow search algorithm (SSA). Three strategies are designed to improve the SSA to enhance its optimization-seeking ability, leading to the MSSA-BP prediction model. The MSSA algorithm was tested with nine different types of benchmark functions to verify the optimization performance of the algorithm. Two different datasets were selected for comparison experiments on three groups of models. Under the same conditions, the mean absolute error (MAE), root mean square error (RMSE), and mean absolute percentage error (MAPE) of the prediction results of MSSA-BP were significantly reduced, and the convergence speed was significantly improved. MSSA-BP can effectively improve the prediction accuracy and has certain application value.

In the era of big data, the field of artificial intelligence is making a splash, [

In recent years, much research has been conducted on improving the convergence speed of traditional BP neural networks and avoiding convergence to local optimum. Many optimization methods have been proposed. Among them, intelligent optimization algorithms abstracted by simulating the evolutionary process or foraging behavior of biological populations, [

However, these standard intelligent optimization algorithms decline in species diversity in the late iterations and tend to fall into local optima, which may fail to search for optimal weights and thresholds when guiding BP neural networks to adjust network parameters, thus failing to achieve the best prediction.

In 2020, a novel sparrow search algorithm (SSA) was proposed by Xue et al. [

The sparrow search algorithm simulates the behavior of sparrows to find food and resist being predated. The roles of sparrows can be divided into three categories: discoverers, followers, and scouts. Finders are adaptable, able to search for food in a large area and guide the food direction for followers. To increase the success of predation, followers will follow the discoverers to forage, while some followers will watch the discoverers and compete with them for food or forage around them. When the sparrow population recognizes the danger, it immediately goes on alert and updates its position.

Assuming a population of

First, the discoverers in the population update the position by

where

Except the discoverers, all the sparrows are followers, and their positions are updated by

where

In addition, the sparrow population will randomly generate scouts, generally accounting for 10% to 20% of the entire population, and their locations are updated by

where

From the algorithmic process of SSA, it can be seen that each update of sparrow position is based on the position of the last sparrow, which will lead to the algorithm may fall into local optimum when the population size decreases in the late iteration, and the optimal weights and thresholds cannot be searched when guiding the BP neural network to adjust the network parameters, thus affecting the prediction accuracy of the model.

In this section, we design a dynamic discoverers strategy, adopt an adaptive t-distribution policy and a random wandering policy to improve the performance of SSA, and the framework of multi-strategy sparrow search algorithm (MSSA) is Algorithm 1.

The proportion of discoverers affects the search capability of the algorithm. Since the proportion of discoverers in the standard SSA is a fixed value, it does not adapt well to the changes in the iterative process. Therefore, as shown in

where

The t-distribution is also called the student distribution, [

In this paper, the adaptive t-distribution is used to vary the sparrow position and update it by

In SSA, sparrows are based on the position of the previous generation and update the position by updating the equation, which makes the algorithm easily fall into the local optimum during the iteration. We introduce the random wandering strategy to improve the searchability of the sparrow population by using random wandering to perturb the sparrow population after the sparrow search is completed, [

The process of the random walk can be expressed mathematically as

Among them,

Based on the proposed algorithm, this paper designs the MSSA-BP model. In this part, we conduct simulation experiments on nine benchmark functions to verify the algorithm’s search performance and select the offshore wind farm dataset in the western Gulf of Mexico and the air quality dataset in Beijing, China, for the SSA-BP, MSSA-BP model, and DPSO-BP model to verify the effectiveness of the models.

Firstly, we determine the three-layer structure of the BP neural network, as shown in

The MSE generated by each network training set is used as an approximate fitness function to calculate the fitness value, and the MSE is as in

In

Step 1: Set initial parameters: population size, the maximum number of iterations, warning value ST, the proportion of scouts

Step 2: Initialize the population.

Step 3: The fitness

Step 4: Determine the current

Step 5: After one iteration is completed, the fitness value

Step 6: According to the current state of the sparrow population, update the optimal position

Step 7: Perturbation of the optimal sparrow employing a random wandering strategy. If the scrambled sparrow is better than the previous one, replace the previous sparrow with the scrambled one and update

Step 8: Determine if the algorithm has reached the maximum number of iterations. If the condition is met, the loop ends, and the optimization result is output; otherwise, return to step 5.

Step 9: The obtained optimal weights and thresholds are assigned to the BP neural network for training and learning.

In order to verify the performance of the MSSA algorithm, we selected nine benchmark functions for testing, as shown in

30 | 0 | ||

30 | 0 | ||

30 | 0 | ||

30 | 0 | ||

30 | 0 | ||

30 | 0 | ||

4 | 0.000307 | ||

3 | -3.86 | ||

4 | -10.5363 |

We tested the MSSA, SSA, and GWO algorithms under Intel(R) Core(TM) i5–8500 CPU @3.00 GHz, 8.00 GB of RAM, Windows 10 and Matlab R2018b environment, and the parameters of each algorithm were set in

Algorithm | Parameter |
---|---|

GWO | |

SSA | |

MSSA |

In order to avoid chance and test the performance of the algorithm more accurately, we run each group of experiments independently ten times, and finally, take the optimal value, the average value, and the standard deviation as the evaluation index, where the optimal value and the average value reflect the algorithm’s ability to find the best and accuracy, and the standard deviation reflects the robustness of the algorithm. The experimental results are shown in

Function | GWO | SSA | MSSA | |
---|---|---|---|---|

F1 | Best | 2.88E−03 | 0.00E+00 | 0.00E+00 |

Avg | 1.03E−02 | 2.70E−56 | 4.52E−236 | |

Std | 8.03E−03 | 5.40E−56 | 0.00E+00 | |

F2 | Best | 1.58E−02 | 7.89E−127 | 3.19E−254 |

Avg | 2.12E−02 | 1.92E−20 | 9.98E−160 | |

Std | 4.08E−03 | 3.84E−20 | 0.00E+00 | |

F3 | Best | 7.90E+01 | 3.24E−84 | 0.00E+00 |

Avg | 2.52E+02 | 1.91E−34 | 4.95E−249 | |

Std | 1.94E+02 | 3.81E−34 | 0.00E+00 | |

F4 | Best | 2.66E+01 | 0.00E+00 | 0.00E+00 |

Avg | 4.33E+01 | 0.00E+00 | 0.00E+00 | |

Std | 1.33E+01 | 0.00E+00 | 0.00E+00 | |

F5 | Best | 2.19E−02 | 8.88E−16 | 8.88E−16 |

Avg | 3.22E−02 | 8.88E−16 | 8.88E−16 | |

Std | 1.01E−02 | 0.00E+00 | 0.00E+00 | |

F6 | Best | 1.02E−02 | 0.00E+00 | 0.00E+00 |

Avg | 1.09E−01 | 0.00E+00 | 0.00E+00 | |

Std | 8.77E−02 | 0.00E+00 | 0.00E+00 | |

F7 | Best | 4.97E−04 | 3.10E−04 | 3.08E−04 |

Avg | 8.54E−03 | 3.52E−04 | 3.13E−04 | |

Std | 9.65E−03 | 4.21E−05 | 7.25E−06 | |

F8 | Best | −3.86E+00 | −3.86E+00 | −3.86E+00 |

Avg | −3.86E+00 | −3.86E+00 | −3.86E+00 | |

Std | 2.30E−03 | 5.83E−03 | 9.23E−07 | |

F9 | Best | −1.05E+01 | −5.13E+00 | −1.05E+01 |

Avg | −8.96E+00 | −5.13E+00 | −1.05E+01 | |

Std | 3.05E+00 | 4.85E−10 | 5.38E−10 |

According to the results in

In summary, MSSA outperforms other intelligent algorithms in the search performance on high-dimensional single-peaked functions, high-dimensional multi-peaked functions, and low-dimensional functions, especially in solving high-dimensional functions with a considerable improvement. The dynamic discoverers strategy, adaptive t-distribution, and random wandering strategy effectively enhance the global and local optimization-seeking ability, and to a certain extent, prevent the algorithm from falling into local optimum during operation, which makes MSSA have excellent performance in the speed, accuracy, and robustness of optimization-seeking.

This study uses two datasets to compare the three models, SSA-BP, MSSA-BP, and DPSO-BP: an offshore wind farm dataset located in the western Gulf of Mexico and an air quality dataset from Beijing, China. In the wind farm dataset, considering that wind power generation is influenced by wind and has little dependence on factors such as humidity and temperature, wind direction and wind speed are chosen as input variables for the model, and power generation (MW) is used as the prediction target. We took 1009 consecutive data samples from Dec. 25−Dec. 31, 2012, with 10-min intervals for each sample, 709 data were randomly selected for training, with the remaining 300 data used for testing. In the air quality dataset, we selected six input variables, including 24-h average delicate particulate matter (PM2.5), inhalable particulate matter (PM10), ozone (O3), NO2, CO, and SO2 [

In order to evaluate the prediction performance of the model, three error metrics were chosen to analyze and evaluate the model in this study: RMSE, MAE, and MAPE. To avoid chance and verify the performance of the model more accurately, we ran each group of experiments ten times independently and finally took the average value as the experimental data.

For both datasets,

Dataset | Index | SSA-BP | DPSO-BP | MSSA-BP |
---|---|---|---|---|

Wind farm dataset | MAE | 0.0487 | 0.0382 | 0.0326 |

RMSE | 0.0665 | 0.049 | 0.0426 | |

MAPE | 1.76% | 1.65% | 1.04% | |

Air quality dataset | MAE | 5.063 | 4.582 | 4.106 |

RMSE | 9.326 | 7.914 | 7.529 | |

MAPE | 6.74% | 6.26% | 5.44% |

In summary, we conclude the following:

The performance of MSSA is significantly improved compared with SSA, and the dynamic discoverers strategy, adaptive t-distribution, and random wandering strategy are effective in improving the performance of SSA.

We propose to use MSSA to optimize the weights and thresholds of BP neural networks, and the designed MSSA-BP model can effectively improve the prediction performance.

Through benchmark function testing and model validation, MSSA remains stable during the iterative process, proving that MSSA has strong robustness.

This research proposes a BP neural network prediction method based on a multi-strategy improved sparrow search algorithm. Based on the standard SSA, we design a dynamic discoverers strategy, which uses adaptive t-distribution to mutate the sparrow, and uses a random walk strategy to sparrow perturbs and improve the algorithm’s performance. The MSSA-BP prediction model was also designed to improve the prediction performance based on the MSSA algorithm. The superiority-seeking ability of MSSA is demonstrated by testing nine different types of benchmark functions. The results of simulation experiments with two data sets show that the average MAE, average RMSE, and average MAPE of MSSA-BP are better than the comparison model, proving that MSSA-BP has better prediction accuracy and robustness. The contributions of our research to engineering practice are as follows:

The MSSA proposed in this paper has the advantages of fast convergence speed, high convergence accuracy and good stability.

In this paper, we tested different benchmark functions and proved that MSSA has strong optimization ability and can be applied to more scenarios with special application value.

The comparative experiments of the two data sets demonstrate that the model proposed in this paper has better prediction performance and wider applicability.

Of course, MSSA-BP still has some shortcomings, and its more complex structure leads to slower running time than SSA-BP, which is an area for improvement. Meanwhile, the intelligent algorithm inevitably encounters the optimal localization problem due to NP theory, which remains a challenge. Our future research may incorporate engineering practice problems.