Research Article

Wind Speed Forecast Based on the LSTM Neural Network Optimized by the Firework Algorithm

Algorithm 1

FWA-LSTM wind speed prediction algorithm.
(1)Wind speed data preparation and preprocessing;
(2)Normalize the raw data;
(3)Divide training set and test set;
(4)Construct LSTM wind speed prediction model. Set partial parameters and fix the number n of optimized parameter;
(5)FWA parameter initialization (fireworks population size P, solving space dimension d, maximum number of iterations iter_max, explosion amplitude range control parameter , the maximum number of sparks m, the number of variation sparks , the parameters a and b that limit the number of sparks produced by the explosion, the minimum normal value ε that tends to zero, the solution space boundaries Bu and Bi);
(6)Initialize the values of n-dimensional parameter combinations of P groups randomly in the solution space;
(7)Initialize the global optimal parameter combination gbest_parameters, the partial optimal parameter combination pbest_parameters, and the best fitness function value Pg;
(8)While the end condition is false:
(9) Apply the n-dimensional parameter combinations of P groups, respectively, to the LSTM network flow prediction model for training, and calculate the current fitness function value;
(10) Get the current best fitness value Pi and the corresponding parameter combination pbest_parameters;
(11) if Fi < 
(12)   = Fi;
(13)  gbest_parameters = pbest_parameters;
(14) end if
(15) for each parameter combination
(16)  Calculate the search direction and position of the new parameter combination according to formulas (8) and (9);
(17)  Fix the updated parameter in the selected values;
(18) end for
(19) The number of iterations+1;
(20)end while
(21)Return the gbest_parameters;
(22)gbest_parameters is introduced into LSTM wind speed prediction model to predict test data and calculate prediction error.