BP neural network prediction method and device based on multi-strategy sparrow search algorithm
By introducing a multi-strategy sparrow search algorithm into the BP neural network, dynamically adjusting the discoverer proportion, adaptive t distribution and random walk strategy, the problem of BP neural network falling into local optimality is solved, and rapid convergence, high precision and volatility are achieved Great, improving predictive performance and applicability.
Patent Information
- Application Number
- CN202111518413.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-10
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2041-12-10
AI Technical Summary
Existing intelligent optimization algorithms are prone to falling into local optimization in BP neural networks, resulting in slow convergence and low learning efficiency, and cannot converge to the optimal accuracy when group diversity is reduced in the later stage.
The multi-strategy sparrow search algorithm is adopted to dynamically adjust the proportion of finders and introduce adaptive t distribution and random walk strategies to optimize the position update and search process of sparrow populations, improve the global and local search capabilities of the algorithm, and avoid local optimization.
The rapid convergence, high convergence accuracy and robustness of BP neural network are achieved, which proves the stronger robust optimization capabilities and broader applicability on different benchmark functions and data sets, and improves prediction performance.
Smart Images

Figure CN114511078B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of big data technology, and in particular to a BP neural network prediction method and device based on a multi-strategy sparrow search algorithm. Background Art
[0002] Back Propagation (BP) neural network is a basic model with a simple structure, which generally includes an input layer, a hidden layer and an output layer. In the three-layer structure, the BP neural network can simulate any complex nonlinear relationship through nonlinear elements. Because this method has good data processing and nonlinear mapping capabilities, it has been widely used for prediction. Although the BP neural network has many advantages, it is easy to fall into local optimality, has low learning efficiency and slow convergence.
[0003] Existing technologies have conducted a lot of research on improving the convergence speed of traditional BP neural networks and avoiding convergence to local optimality, and many optimization methods have been proposed. Among them, intelligent optimization algorithms abstracted by simulating the evolutionary process or foraging behavior of biological populations, such as Ant Colony Optimization (ACO) and Particle Swarm Optimization (PSO), are widely used to solve optimization problems due to their advantages of simple implementation and easy expansion. The use of intelligent optimization algorithms to optimize BP neural networks has become a research hotspot. The standard particle swarm algorithm has been applied to BP neural networks by researchers, effectively reducing learning time and improving calculation accuracy.
[0004] The inventors of the present application have discovered that the above-mentioned intelligent optimization algorithm is prone to fall into a local optimum and cannot converge to the optimal accuracy in the later stage of operation when the diversity of the group decreases. Summary of the invention
[0005] The present application provides a BP neural network prediction method and device based on a multi-strategy sparrow search algorithm to improve the accuracy of prediction.
[0006] In a first aspect, an embodiment of the present application provides a BP neural network prediction method based on a multi-strategy sparrow search algorithm, the method comprising:
[0007] Set initial parameters and initialize the population;
[0008] The fitness value f of each sparrow in the population is calculated by the fitness function i , then the adaptation value f i Sort and select the current optimal adaptation value f g and f g The corresponding position X b , and the current worst adaptation value fw and f w The corresponding position X w ;
[0009] Adjust the discoverer ratio PD value according to the number of iterations, determine the discoverer and follower, and update the positions of the discoverer and follower;
[0010] Update the optimal position X of each sparrow based on the updated positions of the discoverer and followers b and X b The adaptation value f g , and the worst position X w and X w The adaptation value f w ;
[0011] The optimal position X b and X b The adaptation value f g Assigned to BP neural network for training and learning.
[0012] Furthermore, after one iteration is completed, the method further includes:
[0013] Perform adaptive t-distribution mutation on the sparrows and recalculate the fitness value f of each sparrow i ;
[0014] If the sparrow's fitness value f i Compared with the sparrow's fitness value f before mutation i If it is low, the previous sparrow will be replaced by the mutated sparrow;
[0015] Otherwise, leave it unchanged.
[0016] Furthermore, the method further comprises:
[0017] The optimal sparrow is disturbed by random walk strategy;
[0018] If the adaptation value f of the sparrow after disturbance i Than the previous sparrow's adaptation value f i If it is low, replace the previous sparrow with the disturbed one and update f g ;
[0019] Otherwise, leave it unchanged.
[0020] Furthermore, the method further comprises:
[0021] Determine whether the algorithm has reached the maximum number of iterations;
[0022] If the conditions are met, the loop ends and the optimization results are output;
[0023] Otherwise, recalculate the fitness value f of each sparrow i , and the cycle continues.
[0024] Furthermore, the method determines the current PD value according to the following formula:
[0025]
[0026] Among them, PD start and PD end are the initial and final values of PD, respectively. The final number of discoverers is obtained by multiplying the number of sparrows by PD and rounding off.
[0027] Furthermore, the sparrow population also includes scouts, and the positions of the scouts are updated according to the following formula:
[0028]
[0029] Among them, β is a normally distributed random number with a mean of 0 and a variance of 1, representing the step size control parameter, K is a random number between [-1,1], and f i represents the fitness value of the i-th sparrow, f g and f w They represent the optimal and worst fitness values of the current sparrow population respectively, and γ is a constant.
[0030] Furthermore, the adaptive t distribution is used to change and update the position of the sparrow according to the following formula:
[0031]
[0032] in, is the position of the sparrow after mutation, x i is the position of the i-th sparrow individual, and t(r) is the t distribution with the current iteration number as the degree of freedom parameter.
[0033] Furthermore, the random walk process is expressed according to the following formula:
[0034] Y(t)=[0,cussum(2r(t1)-1),…cussum(2r(t) n )-1)]
[0035] Where Y(t) is the set of random walk steps, cussum is the calculated cumulative sum, t is the number of random walk steps, and r(t) is the random function.
[0036] Furthermore, when there is a boundary in the feasible region, normalization is performed according to the following formula:
[0037]
[0038] Among them, a m is the minimum random row of an m-dimensional variable; b m is the maximum random row of an m-dimensional variable; is the minimum value of the m-dimensional variable at the rth iteration; is the maximum value of the m-dimensional variable at the rth iteration.
[0039] In a second aspect, an embodiment of the present application provides a BP neural network prediction device based on a multi-strategy sparrow search algorithm for executing the above method.
[0040] The beneficial effects of this application are as follows:
[0041] (1) The MSSA provided in this application has the advantages of fast convergence, high convergence accuracy and robustness.
[0042] (2) This application tests different benchmark functions and proves that MSSA has stronger robust optimization capabilities than existing algorithms. The complex structure of MSSA can be applied to more scenarios and has more application value.
[0043] (3) This application compares the MSSA-BP model with the existing DPSO-BP, which has better prediction performance and wider applicability. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0045] Figure 1 It is a schematic diagram of the topological structure of a three-layer BP neural network model provided in an embodiment of the present application;
[0046] Figures 2a to 2i A convergence diagram of a benchmark function provided in an embodiment of the present application;
[0047] Figures 3a to 3b A fitness curve diagram provided for an embodiment of the present application;
[0048] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0049] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0050] The existing standard Sparrow Search Algorithm (SSA) simulates the behavior of sparrows in finding food and preventing predation. The roles of sparrows can be divided into three categories: finders, followers, and scouts. Finders are highly adaptable and can find food in a large area and guide followers to the direction of food. In order to increase the success rate of predation, followers will follow finders to find food, while some followers will look at finders, compete with them for food or forage around them. When the sparrow population is aware of danger, it will immediately enter an alert state and update its position.
[0051] Assume that there are N sparrows foraging in an M-dimensional search space, and the position of the i-th sparrow can be expressed as X i , where i=1,2,...,N.
[0052] First, the discoverer in the population updates its position using the following formula (1):
[0053]
[0054] Among them, r represents the current number of iterations, T represents the maximum number of iterations, is a normally distributed random number in the range of (0,1), Q is a normally distributed random number, L represents a 1-row and m-column matrix, all elements are 1. R2 represents the warning value, R2∈[0,1], ST represents the safety value, ST∈[0.5,1], Represents the position of the i-th sparrow in the m-th dimension at the r-th iteration.
[0055] Except for the discoverer, the remaining sparrows are followers, and their positions are updated as shown in formula (2).
[0056]
[0057] in represents the worst position of the sparrow in the current dimension at the rth iteration, It represents the optimal position of the sparrow in the current dimension at the r+1th iteration, and A represents a 1-row and m-column matrix with elements of 1 or -1.
[0058] In addition, the sparrow population will randomly generate scouts, generally accounting for 10% to 20% of the entire population, and their positions are updated as follows:
[0059]
[0060] Among them, β is a normally distributed random number with a mean of 0 and a variance of 1, representing the step size control parameter, K is a random number between [-1,1], and f i represents the fitness value of the i-th sparrow, f g , and f wRepresent the optimal and worst fitness values of the current sparrow population, respectively. γ is a very small constant to avoid f i =f g When the denominator is 0.
[0061] On the basis of the above-mentioned standard SSA algorithm, the present application provides a multiple-strategy sparrow search algorithm (Multiple-strategy Sparrow Search Algorithm, MSSA), which provides a dynamic PD value (i.e., discoverer ratio value) strategy, so that the PD value changes dynamically with the number of iterations, and introduces adaptive t-distribution changes to improve the algorithm's global search capability in the early stage and the local optimal search capability in the later stage. At the same time, after the sparrow search is completed, the present application uses a random walk strategy to perturb the sparrow population, and when the algorithm falls into a local optimum, it is forced to jump out, and based on the algorithm, the MSSA-BP (Multiple-strategy Sparrow Search Algorithm Back Propagation, the reverse neural network of the multi-strategy sparrow search algorithm) prediction model is designed. This application conducted simulation experiments on 9 benchmark functions to verify the search performance of the algorithm, and selected an offshore wind farm dataset in the western Gulf of Mexico and an air quality dataset in Beijing, China, to simulate the SSA-BP (Sparrow Search Algorithm Back Propagation), MSSA-BP model and DPSO-BP (Discrete Particle Swarm Optimization Back Propagation) model to verify the effectiveness of the model.
[0062] Specifically, the proportion of discoverers, PD value, will affect the search ability of the algorithm. Since the PD value in the standard SSA is a fixed value, it cannot adapt well to changes in iterations. Therefore, this application designs a dynamic PD strategy (i.e., dynamic PD value), such as formula (4), which can dynamically adjust the PD value according to the number of iterations. In the early stage of operation, the number of discoverers is large, which effectively enhances the global search ability of the algorithm in the early stage of operation. In the later stage of operation, the number of followers is large, which can enhance the local search ability of the algorithm.
[0063]
[0064] Among them, PD start and PD end are the initial and final values of PD, respectively. The final number of discoverers is obtained by multiplying the number of sparrows and PD and rounding off.
[0065] Adaptive t distribution strategy. The t distribution is also called the student distribution, and the shape of its curve is related to the size of the degree of freedom parameter n. When n=1, the t distribution is the Cauchy distribution, and when n→∞, the t distribution is the Gaussian distribution. The adaptive t distribution combines the characteristics of the Cauchy distribution and the Gaussian distribution, so the current number of iterations is assigned to its degree of freedom parameter n. In the initial stage of the algorithm, due to the small value of n, the t distribution is similar to the Cauchy variation; in the later stage of the algorithm, due to the large value of n, the t distribution is similar to the Gaussian distribution, which is conducive to improving the algorithm's optimization ability.
[0066] In this application, adaptive t distribution is used to change the position of the sparrow and update formula (5), as follows:
[0067]
[0068] in is the position of the sparrow after mutation, x i is the position of the i-th sparrow individual, and t(r) is the t distribution with the current iteration number as the degree of freedom parameter.
[0069] Random walk strategy. In SSA, the position of the sparrow is updated by updating the formula based on the position of the previous generation, which makes the algorithm easy to fall into the local optimum during the iteration process. In order to prevent this situation, the application introduces a random walk strategy. When the algorithm falls into the local optimum, the random walk is used to disturb the optimal sparrow, forcing it to jump out of the limitation and continue searching. At the beginning of the iteration, the boundary of the random walk is more obvious, which improves the global searchability. After multiple iterations, the wandering boundary becomes smaller to improve the local searchability.
[0070] The random walk process can be mathematically expressed as formula (6):
[0071] Y(t)=[0,cussum(2r(t1)-1),…cussum(2r(t) n )-1)] (6)
[0072] Where Y(t) is the set of random walk steps, cussum is the cumulative sum of the calculation, t is the number of random walk steps (the maximum number of iterations is taken in this application), and r(t) is a random function defined as (7):
[0073]
[0074] Where rand is a random number in the range [0,1].
[0075] Since there are boundaries in the feasible region, formula (6) cannot be used directly to update the position of the sparrow. According to formula (8), normalization is required to ensure that the random walk is within the feasible range.
[0076]
[0077] Among them, a m is the minimum random row of an m-dimensional variable; b m is the maximum random row of an m-dimensional variable; is the minimum value of the m-dimensional variable at the rth iteration; is the maximum value of the m-dimensional variable at the rth iteration.
[0078] like Figure 1 As shown, the present application also provides an optimized BP neural network prediction method based on the above multi-strategy sparrow search algorithm.
[0079] First, the BP neural network of the present application has a three-layer structure, and the number of input layer neurons and output layer neurons is determined according to the number of inputs and outputs. Secondly, the range of the number of hidden layer neurons is determined according to the empirical formula (9). By comparing the mean square error (MSE) of the predicted value and the actual value of the training set corresponding to different numbers of neurons in the hidden layer, the optimal number of neurons in the hidden layer is finally determined.
[0080]
[0081] The MSE generated by each network training set is used as an approximate fitness function to calculate the fitness value, that is, formula (10).
[0082]
[0083] In formula (10), Y i and Y′ i are the target value and the predicted value respectively. The smaller the MSE, the more accurate the model.
[0084] The following is the specific process of the BP neural network prediction method based on the multi-strategy sparrow search algorithm provided by the present invention:
[0085] Step S101: Set initial parameters: population size, maximum number of iterations T, warning value ST, proportion of scouts, etc.
[0086] Step S102: Initialize the population.
[0087] Step S103: Calculate the fitness value f of each sparrow in the population through the fitness function i , and then the adaptation value f i Sort and select the current optimal adaptation value f gand its corresponding position X b , and the current worst adaptation value f w and its corresponding position X w .
[0088] Step S104: Determine the current PD value according to formula (4), select the sparrows with strong adaptability as the discoverers, and the rest as followers, and update the positions of the discoverers and followers according to formula (1) and formula (2). Randomly select a part of the sparrows from the sparrow group for reconnaissance and early warning, and update their positions according to formula (3).
[0089] Step S105: After one iteration is completed, the sparrows are adaptively mutated according to formula (4) and the adaptation value f of each sparrow is recalculated. i Among them, if the adaptation value f of the sparrow i Compared with the sparrow's fitness value f before mutation i If the value is low, the previous sparrow will be replaced by the mutated sparrow. Otherwise, it will remain unchanged.
[0090] Step S106: Update the optimal position X of each sparrow according to the updated positions of the discoverer and the follower. b and X b The adaptation value f g , and the worst position X w and X w The adaptation value f w .
[0091] Step S107: The optimal sparrow is disturbed by random walk strategy. If the adaptation value f of the disturbed sparrow i Than the previous sparrow's adaptation value f i If it is low, replace the previous sparrow with the disturbed one and update f g . Otherwise, remain unchanged.
[0092] Step S108: Determine whether 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 S104.
[0093] Step S109: The best position X b and X b The adaptation value f g Assigned to BP neural network for training and learning.
[0094] In order to verify the performance of the MSSA algorithm of this application, 9 benchmark functions were selected for testing, as shown in Table 1, where F1~F3 are high-dimensional unimodal functions, F4~F6 are high-dimensional multimodal functions, and F7~F9 are low-dimensional functions. The optimization ability of MSSA is thoroughly examined through different types of benchmark functions.
[0095] Table 1
[0096]
[0097]
[0098] This application tested the MSSA, SSA and GWO algorithms in the Intel(R) Core(TM) i5-8500 CPU@3.00GHz, 8.00GB memory, Windows 10 and Matlab R2018b environment. The parameter settings of each algorithm are shown in Table 2. The population size N of each algorithm is 30, and the maximum number of iterations T=100.
[0099] Table 2
[0100]
[0101] In order to avoid contingency and test the performance of the algorithm more accurately, each group of experiments was run independently 10 times, and the optimal value, average value and standard deviation were used as evaluation indicators. The optimal value and average value reflect the algorithm's optimization ability and accuracy, and the standard deviation reflects the robustness of the algorithm. The experimental results are shown in Table 3, and the convergence of the algorithm is shown in Figure 3.
[0102] Table 3
[0103]
[0104]
[0105] According to the results in Figure 3 and Table 3, for high-dimensional unimodal functions F1, F2, and F3, MSSA found the optimal value, with multiple orders of magnitude improvement in mean and standard deviation compared to other algorithms. The convergence speed of MSSA is also significantly better than other algorithms, which shows that MSSA has better speed, accuracy, and robustness in finding the optimal value. For high-dimensional multimodal functions F4, F5, and F6, both SSA and MSSA can converge to the best accuracy, however, MSSA can obtain the optimal solution within 20 iterations, effectively avoiding falling into the local optimum, and outperforming other algorithms. For low-dimensional functions F7, F8, and F9, MSSA slightly improves the optimization accuracy, but the robustness of the algorithm is significantly improved compared to GWO, and the standard deviation is also slightly improved compared to SSA.
[0106] In summary, MSSA outperforms other intelligent algorithms in the search performance of high-dimensional unimodal functions, high-dimensional multimodal functions and low-dimensional functions, especially in solving high-dimensional functions. The dynamic PD strategy, adaptive t distribution and random walk strategy effectively improve the global and local optimization capabilities, and to a certain extent avoid the algorithm from falling into the local optimum during operation, making MSSA outstanding in terms of optimization speed, accuracy and robustness.
[0107] This application uses two data sets to compare the three models of SSA-BP, MSSA-BP and DPSO-BP: an offshore wind farm data set located in the western Gulf of Mexico and an air quality data set in Beijing, China. In the wind farm data set, considering that wind power generation is affected by wind and has little dependence on factors such as humidity and temperature, this application selects wind direction and wind speed as the input variables of the model and uses power generation (MW) as the prediction target. This application continuously extracts 1009 data samples from December 25 to December 31, 2012, with an interval of 10 minutes between each sample. 709 data are randomly selected for training, and the remaining 300 data are used for testing. In the air quality data set, six input variables are selected, including 24-hour average fine particulate matter (PM2.5), inhalable particulate matter (PM10), ozone (O3), nitrogen dioxide, carbon monoxide and sulfur dioxide [22-26], and the air quality index (AQI) is used as the prediction target. At the same time, an air quality data set for Beijing from 2018 to 2019 was collected. After eliminating invalid data, there were 685 data in total, of which 485 data were randomly selected for training, and the remaining 200 data were used for testing.
[0108] In order to evaluate the prediction performance of the model, this application selected three error indicators to analyze and evaluate the model. In order to avoid contingency and verify the performance of the model more accurately, each group of experiments was run independently 10 times, and the average value was taken as the experimental data. The experimental results are shown in Figure 3a and Figure 3b As shown, Figure 3a is the fitness curve of the wind farm dataset, Figure 3bis the fitness curve of the air quality dataset. The MSSA-BP model has the best initial fitness, and is basically ahead of SSA-BP and DPSO-BP in terms of convergence speed and accuracy throughout the whole process, and the average optimal fitness achieved at the end is still better than SSA-BP and DPSO-BP. As shown in Table 4, the average MAE and RMSE of MSSA-BP are lower than those of SSA-BP and DPSO-BP. In the wind farm dataset, the average MAPE of MSSA-BP is 0.72% lower than that of SSA-BP and 0.61% lower than that of DPSO-BP; in the air quality dataset, the average MAPE of MSSA-BP is 0.72% lower than that of SSA-BP. Compared with DPSO-BP, MSSA-BP is reduced by 1.30% and DPSO-BP is reduced by 0.82%.
[0109] Table 4
[0110]
[0111] In summary, this application proposes a BP neural network prediction method based on a multi-strategy improved sparrow search algorithm. On the basis of the standard SSA, a dynamic PD strategy is designed, an adaptive t distribution is used to mutate the sparrow, and a random walk strategy is used to perturb the sparrow, thereby improving the performance of the algorithm. At the same time, an MSSA-BP prediction model is designed based on the MSSA algorithm to improve the prediction performance. The optimization ability of MSSA is demonstrated by testing nine different types of benchmark functions. The simulation experimental results of the two sets of data 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 beneficial effects of this application are as follows:
[0112] (1) The MSSA provided in this application has the advantages of fast convergence, high convergence accuracy and robustness.
[0113] (2) This application tests different benchmark functions and proves that MSSA has stronger robust optimization capabilities than existing algorithms. The complex structure of MSSA can be applied to more scenarios and has more application value.
[0114] (3) This application compares the MSSA-BP model with the existing DPSO-BP, which has better prediction performance and wider applicability.
[0115] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 4 As shown, the electronic device 500 is, for example, the BP neural network prediction device based on the multi-strategy sparrow search algorithm, and the electronic device 500 includes:
[0116] Processor 51 and memory 52;
[0117] The memory 52 stores computer instructions;
[0118] The processor 51 executes the computer instructions stored in the memory 52, so that the processor 51 executes the BP neural network prediction method based on the multi-strategy sparrow search algorithm as above; or, the processor 51 executes the BP neural network prediction method based on the multi-strategy sparrow search algorithm as above.
[0119] The specific implementation process of the processor 51 can be found in the above method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not be repeated here.
[0120] Optionally, the electronic device 500 further includes a communication component 53 , wherein the processor 51 , the memory 52 and the communication component 53 may be connected via a bus 54 .
[0121] An embodiment of the present application also provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed by a processor, they are used to implement the BP neural network prediction method based on the multi-strategy sparrow search algorithm as described above.
[0122] An embodiment of the present application also provides a computer program product, which includes a computer program. When the computer program is executed by a processor, it implements the BP neural network prediction method based on the multi-strategy sparrow search algorithm as described above.
[0123] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0124] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A BP neural network prediction method based on multi-strategy sparrow search algorithm, It is characterized in that Applied to an electronic device, the electronic device stores computer instructions, the method comprising: Executing the computer instructions to set initial parameters and initialize the population; The fitness value f of each sparrow in the population is calculated by the fitness function i , then the adaptation value f i Sort and select the current optimal adaptation value f g and f g The corresponding position X b , and the current worst adaptation value f w and f w The corresponding position X w ; Adjust the discoverer ratio PD value according to the number of iterations, determine the discoverer and follower, and update the positions of the discoverer and follower; Update the optimal position X of each sparrow based on the updated positions of the discoverer and followers b and X b The adaptation value f g , and the worst position X w and X w The adaptation value f w ; The optimal position X b and X b The adaptation value f g Assigned to BP neural network for training and learning; Input the wind direction data and wind power data of the wind farm into the BP neural network so that the BP neural network can predict the power generation of the wind farm; In the BP neural network training process, after one iteration is completed, the sparrows are subjected to adaptive t distribution mutation, and the adaptation value f of each sparrow is recalculated. i ; If the sparrow's adaptation value f i Compared with the sparrow's fitness value f before mutation i If the value is low, the previous sparrow will be replaced by the mutated sparrow; otherwise, it will remain unchanged; During the BP neural network training process, the optimal sparrow is disturbed by a random walk strategy; If the adaptation value f of the sparrow after disturbance i Than the previous sparrow's adaptation value f i If it is low, replace the previous sparrow with the disturbed one and update f g ; Otherwise, remain unchanged; Determine the current PD value according to the following formula: Among them, PD start and PD end are the initial and final values of PD, respectively. The final number of discoverers is obtained by multiplying the number of sparrows by PD and rounding off.
2. The method according to claim 1, It is characterized in that Also includes: Determine whether the algorithm has reached the maximum number of iterations; If the conditions are met, the loop ends and the optimization results are output; Otherwise, recalculate the fitness value f of each sparrow i , and the cycle continues.
3. The method according to claim 1, It is characterized in that The sparrow population also includes scouts, and the scout positions are updated according to the following formula: Among them, β is a normally distributed random number with a mean of 0 and a variance of 1, representing the step size control parameter, K is a random number between [-1,1], and f i represents the fitness value of the i-th sparrow, f g and f w They represent the optimal and worst fitness values of the current sparrow population respectively, and γ is a constant.
4. The method according to claim 1, It is characterized in that The adaptive t distribution is used to change and update the position of the sparrow according to the following formula: in, is the position of the sparrow after mutation, x i is the position of the i-th sparrow individual, and t(r) is the t distribution with the current iteration number as the degree of freedom parameter.
5. The method according to claim 1, It is characterized in that The random walk process is expressed according to the following formula: Y(t)=[0,cussum(2r(t 1 )-1),…cussum(2r(t n )-1)] Where Y(t) is the set of random walk steps, cussum is the calculated cumulative sum, t is the number of random walk steps, and r(t) is the random function.
6. The method according to claim 1, It is characterized in that When there is a boundary in the feasible region, it is normalized according to the following formula: Among them, a m is the minimum random row of an m-dimensional variable; b m is the maximum random row of an m-dimensional variable; is the minimum value of the m-dimensional variable at the rth iteration; is the maximum value of the m-dimensional variable at the rth iteration.
7. A BP neural network prediction device based on a multi-strategy mahjong search algorithm, comprising a processor and a memory storing computer instructions, It is characterized in that When the processor executes the computer instructions, it is used to perform the method according to any one of claims 1 to 6.
