CN115034126A - Method and system for optimizing LSTM neural network model through wolf algorithm - Google Patents
Method and system for optimizing LSTM neural network model through wolf algorithm Download PDFInfo
- Publication number
- CN115034126A CN115034126A CN202210402353.9A CN202210402353A CN115034126A CN 115034126 A CN115034126 A CN 115034126A CN 202210402353 A CN202210402353 A CN 202210402353A CN 115034126 A CN115034126 A CN 115034126A
- Authority
- CN
- China
- Prior art keywords
- wolf
- neural network
- network model
- lstm neural
- value
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F30/00—Computer-aided design [CAD]
- G06F30/20—Design optimisation, verification or simulation
- G06F30/27—Design optimisation, verification or simulation using machine learning, e.g. artificial intelligence, neural networks, support vector machines [SVM] or training a model
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/004—Artificial life, i.e. computing arrangements simulating life
- G06N3/006—Artificial life, i.e. computing arrangements simulating life based on simulated virtual individual or collective life forms, e.g. social simulations or particle swarm optimisation [PSO]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2111/00—Details relating to CAD techniques
- G06F2111/10—Numerical modelling
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Evolutionary Computation (AREA)
- General Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Artificial Intelligence (AREA)
- Life Sciences & Earth Sciences (AREA)
- Biophysics (AREA)
- Mathematical Physics (AREA)
- Computing Systems (AREA)
- Health & Medical Sciences (AREA)
- Molecular Biology (AREA)
- Biomedical Technology (AREA)
- General Health & Medical Sciences (AREA)
- Computational Linguistics (AREA)
- Data Mining & Analysis (AREA)
- Geometry (AREA)
- Medical Informatics (AREA)
- Computer Hardware Design (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
The invention discloses a method and a system for optimizing an LSTM neural network model by a gray wolf algorithm, which relate to the field of the LSTM neural network model, and are characterized in that a hyper-parameter is mapped into a gray wolf individual position, a difference value between a result value obtained by training an LSTM neural network model corresponding to the gray wolf individual position through a data set and an actual air is taken as a fitness objective function value, an alpha wolf is divided by the fitness objective function value, meanwhile, in order to avoid misleading of a beta wolf and a delta wolf to the gray wolf individual position in the traditional gray wolf algorithm, only the alpha wolf is adopted to guide a population position, a Levy flight strategy is adopted to guide an alpha wolf quality value to carry out global search, and the position of the gray wolf is iteratively updated by the improved gray wolf algorithm; after the iteration times are met, the LSTM neural network model is trained through the individual position of the alpha wolf, namely the optimal hyper-parameter and data set, so that the air quality value is predicted through the trained model, and the convergence speed of the network and the accuracy of model prediction are greatly improved.
Description
Technical Field
The invention relates to the field of LSTM neural network models, in particular to a method and a system for optimizing an LSTM neural network model through a wolf algorithm.
Background
In recent years, along with the continuous development and improvement of the economy of China, the process of urbanization is accelerated continuously, and cities in various regions are expanded continuously. The problem of increasing energy consumption and environmental pollution follows with it, so in order to deal with the air pollution condition that may appear in the future, it is extremely important to take monitoring measures to the air exhaust gas, and grasp the pollutant discharge condition at any time.
In the early development stage of the air quality prediction technology, the change rule of the air quality is mainly researched through a statistical theory and method, so that the air quality prediction technology based on statistics is provided; some researchers combine the multivariate linear and classification regression trees and apply the combined results to air quality prediction, and certain results are obtained. In recent years, with the development of machine learning, a large number of scholars propose an air quality prediction technology based on deep learning, and the most extensive application is to construct an air quality prediction model of a neural network, input multi-channel data into the network for training, mine the rule of nonlinear data, and improve prediction accuracy and generalization capability.
The most popular neural network in the air quality prediction field at the present stage is a long-time and long-time memory neural network (LSTM), because the LSTM neural network can solve the problem of long-time sequence memory loss, and the LSTM neural network has higher air quality prediction accuracy for precise interval time than the traditional neural network, and in addition, each sequence output of the LSTM neural network can correspond to an air quality prediction result of a time point; however, due to the existence of a plurality of sequences, the LSTM neural network has the problems of time-consuming calculation and delayed convergence speed, thereby causing the reduction of model prediction accuracy. Therefore, the optimization of the topological structure of the LSTM network is particularly important, most of the current selection research on parameters of the LSTM neural network prediction model adopts a grid search algorithm, control variables are finely adjusted, the essential is that optimal parameters are violently searched, the calculation mode is time-consuming and labor-consuming, and an optimal solution cannot be obtained all the time.
Disclosure of Invention
In order to solve the technical problems and improve the prediction precision of the LSTM neural network model, the invention provides a method for optimizing the LSTM neural network model through a wolf algorithm, which optimizes the LSTM neural network model through the improved wolf algorithm to predict the air quality value, and the method comprises the following steps:
s1: acquiring concentration values and air quality values of various types of pollution gases at each moment t in a preset area in a preset time period, and constructing a data set;
s2: initializing input parameters of a gray wolf algorithm, including initializing a, A and C parameters, setting the number of gray wolfs in a wolf cluster, the maximum iteration times, the individual dimension of the gray wolfs, namely the over-parameter and the over-parameter value range of an LSTM neural network model, and randomly initializing a wolf cluster position according to the over-parameter value range, wherein the individual position of the gray wolfs in the wolf cluster position is the over-parameter;
s3: acquiring a fitness objective function value corresponding to the position of each gray wolf, wherein the fitness objective function value is a difference value between a result value obtained by training the individual position of the gray wolf, namely an LSTM neural network model corresponding to a hyper-parameter, and an actual air quality value through a data set;
s4: initializing iteration times and starting counting the iteration times;
s5: acquiring the minimum value in the fitness objective function value, and taking the wolf of which the minimum value corresponds to the individual position of the wolf as an alpha wolf;
s6: updating the individual position of the alpha wolf through the Laevir flight guidance;
s7: updating the values of the parameters a, A and C, and updating the wolf group position according to the individual position of the alpha wolf;
s8: adding 1 to the iteration times, judging whether the iteration times are larger than or equal to the maximum iteration times, if not, returning to the step S5, and if so, outputting the position of the alpha wolf, namely the hyper-parameter;
and S9, training an LSTM neural network model through the data set and the hyperparameters acquired in the step S8, and predicting the air quality value through the trained LSTM neural network model.
Further, the hyper-parameters are specifically the hidden layer neuron number and the time step of the LSTM neural network model.
Further, the data set includes a plurality of items of data, the items of data include concentration values and air quality values of various types of pollutant gases corresponding to time t, and one value corresponds to one item, and step S1 further includes preprocessing the data set, specifically including:
s11, acquiring the number of missing items of data in the item data, judging whether the number of items is more than or equal to the preset number of over-missing items, and if so, deleting the item data; if not, acquiring a data mean value of the missing item within a preset time length at the upper and lower moments corresponding to the t moment, and filling the missing item through the mean value;
s12: and performing correlation analysis on the concentration values and the air quality values of the various types of pollution gases in the data set processed in the step S11 to obtain the pollution gas types corresponding to the previous preset correlations in the arrangement sequence from large to small in correlation, and performing smoothing and normalization processing on the concentration values corresponding to the pollution gas types to obtain a final data set.
Further, in the step S6, the individual positions are updated by the levey flight guidance α wolf, which is expressed by the formula:
in the formulaU and v are expressed to fit normal distribution respectively, wherein, sigma v =1,In the formula, beta is a preset constant;
t represents the time, a is the random number of the individual position of the wolf,for point-to-point multiplication symbols, Levy (β) is a random search path, X worst Representing the worst grey wolf individual position, X, of the wolf group positions a (t) is the individual position of the wolf at time t, X a (t)' indicates the individual position of the alpha wolf after guidance by the Levis flight.
Further, the formula expression for updating the wolf group position according to the individual position of the α wolf in the step S7 is:
D a =|C 1 ·X a (t)-X(t)|;
X(t+1)=X a (t)′-A·D a ;
wherein A is a control convergence factor, C 1 As a coefficient of synergy, X a (t) is the individual position of the alpha wolf at time t, X (t) is the individual position of the gray wolf at time t, D a Is the distance between the alpha wolf and the other gray wolfs, X a (t)' indicates the individual position of the alpha wolf after the guidance of the Laevi flight, and X (t +1) is the updated individual position of the grey wolf at the time t + 1.
The present invention also provides a system for optimizing an LSTM neural network model via a grayish wolf algorithm that optimizes the LSTM neural network model via an improved grayish wolf algorithm to predict an air quality value, comprising:
the data set construction module is used for acquiring concentration values and air quality values of various types of pollution gases at each moment t in a preset area in a preset time period and constructing a data set;
the initialization module is used for initializing input parameters of a gray wolf algorithm, and comprises initialization parameters a, A and C, setting the number of gray wolfs in a wolf cluster, the maximum iteration times, the individual dimensionality of the gray wolfs, namely the super-parameter and the value range of the super-parameter of an LSTM neural network model, and randomly initializing a wolf cluster position according to the value range of the super-parameter, wherein the individual position of the gray wolfs in the wolf cluster position is the super-parameter;
the fitness objective function module is used for acquiring a fitness objective function value corresponding to the position of each wolf, wherein the fitness objective function value is a difference value between a result value obtained by training the individual position of the wolf, namely an LSTM neural network model corresponding to a hyper-parameter, and an actual air quality value through a data set;
the iteration module is used for initializing the iteration times and starting counting the iteration times;
the head wolf acquisition module is used for acquiring the minimum value in the fitness objective function value and taking a wolf of which the minimum value corresponds to the individual position of the gray wolf as an alpha wolf;
the Levy guiding module is used for updating the individual position of the Aleper through Levy flight guidance;
the updating module is used for updating the values of the parameters a, A and C and updating the wolf group position according to the individual position of the alpha wolf;
the judging module is used for adding 1 to the iteration times and outputting the position of the alpha wolf, namely the hyper-parameter, when the iteration times is more than or equal to the maximum iteration times; when the iteration times are smaller than the maximum iteration times, the iteration is re-entered through the wolf head acquisition module;
and the prediction module is used for training the LSTM neural network model through the data set and the hyperparameter acquired in the step S8, and predicting the air quality value through the trained LSTM neural network model.
Further, the hyper-parameters are specifically the number of hidden layer neurons and the time step of the LSTM neural network model.
Further, the data set includes a plurality of items of data, the items of data include concentration values and air quality values of various types of pollutant gases corresponding to time t, one value corresponds to one item, and the data set constructing module further preprocesses the data set, specifically including:
the mean value filling unit is used for acquiring the number of missing items of data in the item data and deleting the item data when the number of items is greater than or equal to the preset number of super-missing items; when the number of items is less than the preset number of over-missing items, acquiring a data mean value of the missing items within a preset time length from top to bottom at the corresponding t moment, and filling the missing items through the mean value;
and the correlation analysis unit is used for carrying out correlation analysis on the concentration values and the air quality values of various types of pollution gases in the data set processed by the mean value filling unit so as to obtain the pollution gas types corresponding to the previous preset correlations in the arrangement sequence of the correlations from large to small, and carrying out smoothing and normalization processing on the concentration values corresponding to the pollution gas types so as to obtain the final data set.
Compared with the prior art, the invention at least has the following beneficial effects:
(1) the method comprises the steps of mapping an ultra-parameter to an individual position of the grey wolf, taking a difference value between a result value obtained by training the individual position of the grey wolf, namely an LSTM neural network model corresponding to the ultra-parameter, and an actual air quality value through a data set as a fitness objective function value, and dividing an alpha wolf through the fitness objective function value, and meanwhile, in order to avoid misleading of a beta wolf and a delta wolf (a second optimal position and a third optimal position) to the individual position of the grey wolf in the traditional grey wolf algorithm, canceling the guiding function of the beta wolf and the delta wolf, only guiding a population position by adopting the alpha wolf (the optimal position), and guiding the alpha wolf to carry out global search by adopting a Lewy flight strategy, and iteratively updating the position of the grey wolf by adopting an improved grey wolf algorithm; after the iteration times are met, an LSTM neural network model is trained through the individual position of the alpha wolf, namely the optimal hyper-parameter and data set, so that the air quality value is predicted through the trained model, and the convergence speed of the network and the accuracy of model prediction are greatly improved;
(2) the optimal hyper-parameter of the LSTM neural network model is obtained through an improved wolf algorithm, and the problems of low convergence speed of the LSTM on long-term sequences and low model prediction accuracy are solved;
(3) the alpha wolf is guided to search for a better position through a Levy flight (Levy) strategy, so that a wolf group can be prevented from being trapped into local optimization, global search in an optimization process is realized, and the problem of poor robustness of a standard wolf algorithm is effectively solved, so that the prediction accuracy of an LSTM neural network is further improved;
(4) according to the method, a large number of data items of missing data are deleted in the step S11, a small number of data items of missing data are subjected to mean filling, the correlation analysis is performed on the concentration values of various types of pollution gases and the air quality value in the step S12, so that the types of the pollution gases highly correlated with the air quality value are screened out (the situation that useless data influence the performance of an LSTM neural network model is avoided), the screened data are subjected to smoothing and normalization processing, a final data set is obtained, and the prediction accuracy of the model is greatly improved.
Drawings
FIG. 1 is a flow chart of a method for optimizing an LSTM neural network model by the Grey wolf algorithm;
FIG. 2 is a block diagram of a system for optimizing an LSTM neural network model using the Grey wolf algorithm;
FIG. 3 is a gray wolf level diagram of a conventional gray wolf algorithm.
Detailed Description
The following are specific embodiments of the present invention and are further described with reference to the drawings, but the present invention is not limited to these embodiments.
Example one
In order to solve the problem that the prediction accuracy of the model is reduced due to the fact that calculation of the LSTM neural network is time-consuming and the convergence rate is delayed, as shown in figure 1, the invention provides a method for optimizing the LSTM neural network model through a wolf algorithm, and the LSTM neural network model is optimized through the improved wolf algorithm to predict the air quality value, and the method comprises the following steps:
s1: acquiring concentration values and air quality values of various pollutant gases at each moment t in a preset area in a preset time period, and constructing a data set;
the data set includes a plurality of items of data, the items of data include concentration values and air quality values of various types of pollutant gases corresponding to time t, one value corresponds to one item, and step S1 further includes preprocessing the data set, which specifically includes:
s11, acquiring the number of missing data items in the item data, judging whether the number of items is more than or equal to a preset number of over-missing items (representing a large amount of missing data), and if so, deleting the item data; if not (representing a small amount of missing data), acquiring a data mean value of the missing item within a preset time length from top to bottom at the moment t corresponding to the missing item, and filling the missing item through the mean value (namely a mean value filling method);
in this embodiment, the data mean value of the missing item within the upper and lower 10 hours of the time t is specifically obtained.
S12: the concentration values and the air quality values of the various types of pollution gases in the data set processed in step S11 are subjected to correlation analysis to obtain the pollution gas types corresponding to the previous preset correlations (i.e., the highly correlated pollution gas types) in the arrangement sequence from large to small in correlation, and the concentration values corresponding to the pollution gas types are subjected to smoothing and normalization processing to obtain the final data set.
According to the method, a large number of data items of missing data are deleted through the step S11, a small number of data items of missing data are filled in a mean value mode, correlation analysis is conducted on concentration values of various types of pollution gases and air quality values through the step S12, pollution gas types highly related to the air quality values are screened out (so that useless data are prevented from affecting the performance of an LSTM neural network model), smoothing and normalization processing are conducted on the screened data, a final data set is obtained, and the prediction accuracy of the model is greatly improved.
In this embodiment, the formula for performing normalization processing on the concentration value corresponding to the type of the polluted gas is as follows:
wherein X is the concentration of the pollutant gas, X min The minimum concentration value of the polluted gas in the screened data after correlation analysis is carried out; x max The maximum concentration value of the polluted gas in the screened data after correlation analysis is carried out; x is the normalized concentration value of the polluted gas output, and the data range of the normalized concentration value of the polluted gas is [0, 1 ]]。
As shown in fig. 3, for the conventional grayish wolf algorithm GWO, it should be noted that:
the sirius is a canine, considered a top predator, who is at the top of the biosphere food chain. The gray wolf is most like the group, and generally, 5-12 wolfs are averagely contained in each group. Of particular interest are those having a very strict hierarchy of social levels, as shown in fig. 3. The first level of the pyramid is the leader in the population, called α. In the wolf pack, α is an individual with management ability, and is mainly responsible for matters related to various decisions in the hunting, sleeping time and place, food distribution, and the like. The second level of the pyramid is the brain team of α, called β, which is primarily responsible for assisting α in making decisions. When alpha of the whole wolf group is vacant, beta will take over the position of alpha. The dominance of beta in the wolf group is next to alpha, and the wolf group gives the command of alpha to other members and feeds back the execution conditions of the other members to alpha to play the role of a bridge. The third layer of the pyramid is delta, which follows decision commands of alpha and beta and is mainly responsible for investigation, sentry, nursing and other matters. Poorly adapted α and β will also be reduced to δ. The bottom layer of the pyramid is omega, which is mainly responsible for the balance of the internal relations of the population.
S2: initializing input parameters of a gray wolf algorithm, including initializing a, A and C parameters, setting the number of gray wolfs in a wolf cluster, the maximum iteration times, the individual dimension of the gray wolfs, namely the over-parameter and the over-parameter value range of an LSTM neural network model, and randomly initializing a wolf cluster position according to the over-parameter value range, wherein the individual position of the gray wolfs in the wolf cluster position is the over-parameter; the hyper-parameters are the number of hidden layer neurons and the time step of the LSTM neural network model.
In this embodiment, the number of gray wolves is set to 15, and the maximum number of iterations is set to 200.
Wherein A is 2a r 1 -a;C=2·r 2 (ii) a Where a is a constant that decays from 2 to 0 as the number of iterations increases, a is a control convergence factor, C is a synergistic coefficient, and r1 and r2 are random numbers of (0, 1).
S3: acquiring a fitness objective function value corresponding to the position of each gray wolf, wherein the fitness objective function value is a difference value between a result value obtained by training the individual position of the gray wolf, namely an LSTM neural network model corresponding to a hyper-parameter, and an actual air quality value through a data set;
s4: initializing iteration times and starting counting the iteration times;
s5: acquiring the minimum value in the fitness objective function value, and taking the wolf of which the minimum value corresponds to the individual position of the wolf as an alpha wolf;
s6: updating the individual position of the alpha wolf through the Laevir flight guidance;
in the grey wolf algorithm position updating process, grey wolf individuals approach to the individual positions (optimal positions) of the alpha wolfs, population loss diversity is caused, local convergence is caused, the defect of premature and early convergence is caused, and therefore Laevi flight (Levy) is adopted to guide the alpha wolfs to carry out global search, and the search range is expanded.
In the step S6, the individual position is updated by the levey flight guidance α wolf, and the formula expression is:
in the formulaU and v are expressed to fit normal distribution respectively, wherein, sigma v =1,In the formula, beta is a preset constant;
t represents the time, a is the random number of the individual position of the wolf,for point-to-point multiplication symbols, Levy (β) is a random search path, X worst Representing the worst individual positions of Grey wolf, X, of the wolf cluster positions a (t) is the individual position of the wolf at time t, X a (t)' indicates the individual position of the alpha wolf after guidance by the Levis flight.
S7: updating the values of the parameters a, A and C, and updating the wolf group position according to the individual position of the alpha wolf;
in step s7, α wolf (best position) is used to guide the grey wolf individual position update, and the command effect of β wolf and δ wolf (second and third best positions) on the population position update is cancelled, because β wolf and δ wolf can mislead individual grey wolf to be far away from the best solution position when commanding the wolf population individual update, and the accumulated error can cause the optimization to fall into local convergence.
In step S7, the formula expression for updating the wolf group position according to the individual position of the α wolf is:
D a =|C 1 ·X a (t)-X(t)|;
X(t+1)=X a (t)′-A·D a ;
wherein A is a control convergence factor, C 1 (i.e. C) is a coefficient of synergy, X a (t) is the individual position of the alpha wolf at time t, X (t) is the individual position of the gray wolf at time t, D a Is the distance between the alpha wolf and the other gray wolfs, X a (t)' indicates the individual position of the alpha wolf after the guidance of the Laevi flight, and X (t +1) is the updated individual position of the grey wolf at the time t + 1.
S8: adding 1 to the iteration times, judging whether the iteration times are larger than or equal to the maximum iteration times, if not, returning to the step S5, and if so, outputting the position of the alpha wolf, namely the over-parameter;
and S9, training an LSTM neural network model through the data set and the hyperparameters acquired in the step S8, and predicting the air quality value through the trained LSTM neural network model.
The method comprises the steps of mapping an over-parameter into a grey wolf individual position, taking a difference value between a result value obtained by training the grey wolf individual position, namely an LSTM neural network model corresponding to the over-parameter, and an actual air quality value through a data set as a fitness objective function value, dividing an alpha wolf through the fitness objective function value, simultaneously, in order to avoid misleading of beta wolfs and delta wolfs (second and third optimal positions) to the grey wolf individual position in the traditional grey wolf algorithm, canceling the guiding effect of the beta wolfs and the delta wolfs, only guiding the population position by adopting the alpha wolfs (optimal positions), and guiding the alpha wolfs to carry out global search by adopting a Levy flight strategy, and carrying out iterative update on the grey wolf position through the improved grey wolf algorithm; after the iteration times are met, the LSTM neural network model is trained through the individual position of the alpha wolf, namely the optimal hyper-parameter and data set, so that the air quality value is predicted through the trained model, and the convergence speed of the network and the accuracy of model prediction are greatly improved.
Example two
In this embodiment, the prediction effects of different networks are shown by specific experimental data, and Root Mean Square Error (RMSE), mean square error (MAPE), and ACCURACY (accuray) can be used as the evaluation indexes of the network model performance. See table below:
as can be seen from the data in the table, the results of the air quality predictions of the four different prediction models were compared. Although the BP neural network can track the prediction trend, the LSTM neural network with long-time sequence memory has better prediction effect on the air quality; according to the invention, Levy is used for improving GWO, the optimized hyper-parameter of the LSTM neural network is obtained through improved GWO, the accuracy of the model can be obviously improved, the predicted value is basically consistent with the actual value, and the experimental result shows that the method for optimizing the LSTM neural network model through the Huilu algorithm has feasibility, can effectively improve the prediction capability of the network, has advantages in the aspects of model prediction accuracy and model prediction stability compared with the traditional mode, and provides a more effective method and way for air quality prediction.
EXAMPLE III
As shown in FIG. 2, the present invention also proposes a system for optimizing an LSTM neural network model by a gray wolf algorithm, which optimizes the LSTM neural network model by an improved gray wolf algorithm to predict an air quality value, comprising:
the data set building module is used for obtaining concentration values and air mass values of various pollution gases at each moment t in a preset area in a preset time period and building a data set;
the data set comprises a plurality of items of data, the items of data comprise concentration values and air quality values of various types of pollution gases corresponding to t time, one value corresponds to one item, and the data set construction module also comprises a data set preprocessing module, which specifically comprises the following steps:
the mean value filling unit is used for acquiring the number of missing items of data in the item data and deleting the item data when the number of items is greater than or equal to the preset number of super-missing items; when the number of items is less than the preset number of over-missing items, acquiring a data mean value of the missing items within a preset time length from top to bottom at the corresponding t moment, and filling the missing items through the mean value;
and the correlation analysis unit is used for carrying out correlation analysis on the concentration values and the air quality values of various types of pollution gases in the data set processed by the mean value filling unit so as to obtain the pollution gas types corresponding to the previous preset correlations in the arrangement sequence of the correlations from large to small, and carrying out smoothing and normalization processing on the concentration values corresponding to the pollution gas types so as to obtain the final data set.
The initialization module is used for initializing input parameters of a gray wolf algorithm, and comprises initialization parameters a, A and C, setting the number of gray wolfs in a wolf cluster, the maximum iteration times, the individual dimensionality of the gray wolfs, namely the super-parameter and the value range of the super-parameter of an LSTM neural network model, and randomly initializing a wolf cluster position according to the value range of the super-parameter, wherein the individual position of the gray wolfs in the wolf cluster position is the super-parameter;
the fitness objective function module is used for acquiring a fitness objective function value corresponding to the position of each wolf, wherein the fitness objective function value is a difference value between a result value obtained by training the individual position of the wolf, namely an LSTM neural network model corresponding to a hyper-parameter, and an actual air quality value through a data set;
the iteration module is used for initializing the iteration times and starting counting the iteration times;
the head wolf acquisition module is used for acquiring the minimum value in the fitness objective function value and taking a wolf of which the minimum value corresponds to the individual position of the gray wolf as an alpha wolf;
the Levy guiding module is used for updating the individual position of the Aleper through Levy flight guidance;
the updating module is used for updating the values of the parameters a, A and C and updating the wolf group position according to the individual position of the alpha wolf;
the judging module is used for adding 1 to the iteration times and outputting the position of the alpha wolf, namely the hyper-parameter, when the iteration times is more than or equal to the maximum iteration times; when the iteration times are smaller than the maximum iteration times, the iteration is re-entered through the wolf head acquisition module;
and the prediction module is used for training the LSTM neural network model through the data set and the hyperparameter acquired in the step S8, and predicting the air quality value through the trained LSTM neural network model.
The hyper-parameters are the number of hidden layer neurons and the time step of the LSTM neural network model.
The alpha wolf is guided to search for a better position through a Levy flight (Levy) strategy, so that a wolf group can be prevented from being trapped in local optimization, global search in an optimization process is realized, and the problem of poor robustness of a standard wolf algorithm is effectively solved, so that the prediction accuracy of the LSTM neural network is further improved.
It should be noted that all directional indicators (such as upper, lower, left, right, front and rear … …) in the embodiment of the present invention are only used to explain the relative position relationship between the components, the movement situation, etc. in a specific posture (as shown in the drawing), and if the specific posture is changed, the directional indicator is changed accordingly.
Moreover, descriptions of the present invention as relating to "first," "second," "a," etc. are for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicit ly indicating a number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In the description of the present invention, "a plurality" means at least two, e.g., two, three, etc., unless explicitly specified otherwise.
In the present invention, unless otherwise expressly stated or limited, the terms "connected," "secured," and the like are to be construed broadly, and for example, "secured" may be a fixed connection, a removable connection, or an integral part; can be mechanically or electrically connected; they may be directly connected or indirectly connected through intervening media, or they may be connected internally or in any other suitable relationship, unless expressly stated otherwise. The specific meanings of the above terms in the present invention can be understood by those skilled in the art according to specific situations.
In addition, the technical solutions in the embodiments of the present invention may be combined with each other, but it must be based on the realization of those skilled in the art, and when the technical solutions are contradictory or cannot be realized, such a combination of technical solutions should not be considered to exist, and is not within the protection scope of the present invention.
Claims (8)
1. A method for optimizing an LSTM neural network model using a grayish wolf algorithm, the method being characterized in that the LSTM neural network model is optimized using an improved grayish wolf algorithm to predict an air quality value, comprising the steps of:
s1: acquiring concentration values and air quality values of various types of pollution gases at each moment t in a preset area in a preset time period, and constructing a data set;
s2: initializing input parameters of a gray wolf algorithm, including initializing a, A and C parameters, setting the number of gray wolfs in a wolf cluster, the maximum iteration times, the individual dimension of the gray wolfs, namely the over-parameter and the over-parameter value range of an LSTM neural network model, and randomly initializing a wolf cluster position according to the over-parameter value range, wherein the individual position of the gray wolfs in the wolf cluster position is the over-parameter;
s3: acquiring a fitness objective function value corresponding to the position of each gray wolf, wherein the fitness objective function value is a difference value between a result value obtained by training the individual position of the gray wolf, namely an LSTM neural network model corresponding to a hyper-parameter, and an actual air quality value through a data set;
s4: initializing iteration times and starting counting the iteration times;
s5: acquiring the minimum value in the fitness objective function value, and taking the wolf of which the minimum value corresponds to the individual position of the wolf as an alpha wolf;
s6: updating the individual position of the alpha wolf through the Laevir flight guidance;
s7: updating the values of the parameters a, A and C, and updating the wolf group position according to the individual position of the alpha wolf;
s8: adding 1 to the iteration times, judging whether the iteration times are larger than or equal to the maximum iteration times, if not, returning to the step S5, and if so, outputting the position of the alpha wolf, namely the over-parameter;
and S9, training an LSTM neural network model through the data set and the hyperparameters acquired in the step S8, and predicting the air quality value through the trained LSTM neural network model.
2. The method for optimizing the LSTM neural network model according to claim 1, wherein the hyper-parameters are the number of hidden layer neurons and the time step size of the LSTM neural network model.
3. The method of claim 1, wherein the data set includes a plurality of items, the items include concentration values and air quality values of various types of pollutant gases corresponding to time t, and one item corresponds to each of the items, and the step S1 further includes preprocessing the data set, specifically including:
s11, acquiring the number of items with missing data in the item data, judging whether the number of items is more than or equal to the preset number of over-missing items, and if so, deleting the item data; if not, acquiring a data mean value of the missing item within a preset time length from top to bottom at the time t corresponding to the missing item, and filling the missing item through the mean value;
s12: and performing correlation analysis on the concentration values and the air quality values of the various types of pollution gases in the data set processed in the step S11 to obtain the pollution gas types corresponding to the previous preset correlations in the arrangement sequence from large to small in correlation, and performing smoothing and normalization processing on the concentration values corresponding to the pollution gas types to obtain a final data set.
4. The method of claim 2, wherein the step S6 is implemented by updating the individual positions of the LSTM neural network model through the lewy flight guidance α wolf, and the formula is as follows:
in the formulaU and v are expressed to fit normal distribution respectively, wherein, sigma v =1,In the formula, beta is a preset constant;
t represents the time, a is the random number of the individual position of the wolf,for point-to-point multiplication symbols, Levy (β) is a random search path, X worst Representing the worst individual positions of Grey wolf, X, of the wolf cluster positions a (t) is the individual position of the wolf at time t, X a (t)' indicates the individual position of the alpha wolf after guidance by the Levis flight.
5. The method for optimizing the LSTM neural network model according to the gray wolf algorithm of claim 4, wherein the formula for updating the wolf group location according to the individual location of the α wolf in the step S7 is as follows:
D a =|C 1 ·X a (t)-X(t)|;
X(t+1)=X a (t)′-A·D a ;
wherein A is a control convergence factor, C 1 As a coefficient of synergy, X a (t) is the individual position of the alpha wolf at time t, X (t) is the individual position of the gray wolf at time t, D a Is the distance between the alpha wolf and the other gray wolfs, X a (t)' indicates the individual position of the alpha wolf after the guidance of the Laevir flight, and X (t +1) is the updated individual position of the grey wolf at the time of t + 1.
6. A system for optimizing an LSTM neural network model via a grayling algorithm that optimizes the LSTM neural network model via an improved grayling algorithm to predict an air quality value, comprising:
the data set construction module is used for acquiring concentration values and air quality values of various types of pollution gases at each moment t in a preset area in a preset time period and constructing a data set;
the initialization module is used for initializing input parameters of a gray wolf algorithm, and comprises initialization parameters a, A and C, setting the number of gray wolfs in a wolf cluster, the maximum iteration times, the individual dimensionality of the gray wolfs, namely the super-parameter and the value range of the super-parameter of an LSTM neural network model, and randomly initializing a wolf cluster position according to the value range of the super-parameter, wherein the individual position of the gray wolfs in the wolf cluster position is the super-parameter;
the fitness objective function module is used for acquiring a fitness objective function value corresponding to the position of each wolf, wherein the fitness objective function value is a difference value between a result value obtained by training the individual position of the wolf, namely an LSTM neural network model corresponding to a hyper-parameter, and an actual air quality value through a data set;
the iteration module is used for initializing the iteration times and starting counting the iteration times;
the head wolf acquisition module is used for acquiring the minimum value in the fitness objective function value and taking a wolf of which the minimum value corresponds to the individual position of the gray wolf as an alpha wolf;
the Levy guiding module is used for updating the individual position of the Aleper through Levy flight guidance;
the updating module is used for updating the values of the parameters a, A and C and updating the wolf group position according to the individual position of the alpha wolf;
the judging module is used for adding 1 to the iteration times and outputting the position of the alpha wolf, namely the hyper-parameter, when the iteration times is more than or equal to the maximum iteration times; when the iteration times are smaller than the maximum iteration times, the iteration is re-entered through the wolf head acquisition module;
and the prediction module is used for training the LSTM neural network model through the data set and the hyperparameter acquired in the step S8, and predicting the air quality value through the trained LSTM neural network model.
7. The system for optimizing the LSTM neural network model using the wolf's algorithm as claimed in claim 6, wherein the hyper-parameters are the number of hidden layer neurons and the time step size of the LSTM neural network model.
8. The method of claim 6, wherein the data set includes a plurality of items of data, the items of data include concentration values and air quality values of various types of pollutant gases corresponding to time t, and one value corresponds to one item, and the data set constructing module further pre-processes the data set, specifically including:
the mean value filling unit is used for acquiring the number of data missing items in the item data and deleting the item data when the number of items is greater than or equal to the preset number of super-missing items; when the number of items is less than the preset number of super-missing items, acquiring a data mean value of the missing items within a preset time length from top to bottom at the time t, and filling the missing items through the mean value;
and the correlation analysis unit is used for carrying out correlation analysis on the concentration values and the air quality values of various types of pollution gases in the data set processed by the mean value filling unit so as to obtain the pollution gas types corresponding to the previous preset correlations in the arrangement sequence of the correlations from large to small, and carrying out smoothing and normalization processing on the concentration values corresponding to the pollution gas types so as to obtain the final data set.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210402353.9A CN115034126A (en) | 2022-04-18 | 2022-04-18 | Method and system for optimizing LSTM neural network model through wolf algorithm |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210402353.9A CN115034126A (en) | 2022-04-18 | 2022-04-18 | Method and system for optimizing LSTM neural network model through wolf algorithm |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115034126A true CN115034126A (en) | 2022-09-09 |
Family
ID=83119296
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210402353.9A Pending CN115034126A (en) | 2022-04-18 | 2022-04-18 | Method and system for optimizing LSTM neural network model through wolf algorithm |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115034126A (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116562824A (en) * | 2023-05-25 | 2023-08-08 | 闽通数智安全顾问(杭州)有限公司 | Highway engineering full life cycle project management method and system |
CN116933114A (en) * | 2023-06-12 | 2023-10-24 | 浙江大学 | CNN-LSTM-based direct-current micro-grid detection method and device |
CN117252115A (en) * | 2023-11-20 | 2023-12-19 | 安徽建筑大学 | Soft measurement method, equipment and medium for secondary water supply and demand based on neural network |
CN117452828A (en) * | 2023-12-22 | 2024-01-26 | 中电行唐生物质能热电有限公司 | Method and system for controlling emission of harmful gas in boiler based on neural network |
CN117808034A (en) * | 2024-02-29 | 2024-04-02 | 济南农智信息科技有限公司 | Crop yield prediction optimization method based on wolf bird optimization algorithm |
-
2022
- 2022-04-18 CN CN202210402353.9A patent/CN115034126A/en active Pending
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116562824A (en) * | 2023-05-25 | 2023-08-08 | 闽通数智安全顾问(杭州)有限公司 | Highway engineering full life cycle project management method and system |
CN116562824B (en) * | 2023-05-25 | 2023-11-24 | 闽通数智安全顾问(杭州)有限公司 | Highway engineering full life cycle project management method and system |
CN116933114A (en) * | 2023-06-12 | 2023-10-24 | 浙江大学 | CNN-LSTM-based direct-current micro-grid detection method and device |
CN117252115A (en) * | 2023-11-20 | 2023-12-19 | 安徽建筑大学 | Soft measurement method, equipment and medium for secondary water supply and demand based on neural network |
CN117252115B (en) * | 2023-11-20 | 2024-02-09 | 安徽建筑大学 | Soft measurement method, equipment and medium for secondary water supply and demand based on neural network |
CN117452828A (en) * | 2023-12-22 | 2024-01-26 | 中电行唐生物质能热电有限公司 | Method and system for controlling emission of harmful gas in boiler based on neural network |
CN117452828B (en) * | 2023-12-22 | 2024-03-01 | 中电行唐生物质能热电有限公司 | Method and system for controlling emission of harmful gas in boiler based on neural network |
CN117808034A (en) * | 2024-02-29 | 2024-04-02 | 济南农智信息科技有限公司 | Crop yield prediction optimization method based on wolf bird optimization algorithm |
CN117808034B (en) * | 2024-02-29 | 2024-05-10 | 济南农智信息科技有限公司 | Crop yield prediction optimization method based on wolf bird optimization algorithm |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN115034126A (en) | Method and system for optimizing LSTM neural network model through wolf algorithm | |
Huan et al. | Prediction of dissolved oxygen in aquaculture based on gradient boosting decision tree and long short-term memory network: A study of Chang Zhou fishery demonstration base, China | |
CN108416366B (en) | Power system short-term load prediction method based on meteorological index weighted LS-SVM | |
CN110782093B (en) | PM fusing SSAE deep feature learning and LSTM2.5Hourly concentration prediction method and system | |
CN111882033B (en) | Keras-based regional civil aviation main passive carbon emission prediction method | |
CN112418498B (en) | Temperature prediction method and system for intelligent greenhouse | |
CN109308544B (en) | Blue algae bloom prediction method based on contrast divergence-long and short term memory network | |
CN108507700A (en) | A kind of pig house multi-point temperature prediction technique and system | |
CN114861533A (en) | Wind power ultra-short-term prediction method based on time convolution network | |
CN114519451B (en) | Intelligent island type park vehicle carbon emission prediction method and system | |
CN108399470A (en) | A kind of indoor PM2.5 prediction techniques based on more example genetic neural networks | |
CN111915097B (en) | Water quality prediction method for optimizing LSTM neural network based on improved genetic algorithm | |
CN115602337A (en) | Cryptocaryon irritans disease early warning method and system based on machine learning | |
CN115564114A (en) | Short-term prediction method and system for airspace carbon emission based on graph neural network | |
Han et al. | Mixed chaotic FOA with GRNN to construction of a mutual fund forecasting model | |
CN113962819A (en) | Method for predicting dissolved oxygen in industrial aquaculture based on extreme learning machine | |
Yang et al. | A multi-factor forecasting model for carbon emissions based on decomposition and swarm intelligence optimization | |
CN114548350A (en) | Power load prediction method based on goblet sea squirt group and BP neural network | |
CN107038450A (en) | Unmanned plane policing system based on deep learning | |
CN115759346B (en) | Carbon emission prediction method, device and equipment based on AO algorithm | |
CN111126827A (en) | Input-output accounting model construction method based on BP artificial neural network | |
CN116341929A (en) | Prediction method based on clustering and adaptive gradient lifting decision tree | |
Tan et al. | Time Series Prediction using Backpropagation Network Optimized by Hybrid K-means-Greedy Algorithm. | |
CN114707684A (en) | Improved LSTM-based raw tobacco stack internal temperature prediction algorithm | |
Arifianto et al. | Malaria incidence forecasting from incidence record and weather pattern using polynomial neural network |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |