CN117521511A - Granary temperature prediction method based on improved wolf algorithm for optimizing LSTM - Google Patents
Granary temperature prediction method based on improved wolf algorithm for optimizing LSTM Download PDFInfo
- Publication number
- CN117521511A CN117521511A CN202311549671.9A CN202311549671A CN117521511A CN 117521511 A CN117521511 A CN 117521511A CN 202311549671 A CN202311549671 A CN 202311549671A CN 117521511 A CN117521511 A CN 117521511A
- Authority
- CN
- China
- Prior art keywords
- wolf
- algorithm
- lstm
- temperature
- improved
- 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
- 241000282461 Canis lupus Species 0.000 title claims abstract description 97
- 238000004422 calculation algorithm Methods 0.000 title claims abstract description 56
- 238000000034 method Methods 0.000 title claims abstract description 39
- 238000005457 optimization Methods 0.000 claims abstract description 41
- 238000012549 training Methods 0.000 claims abstract description 22
- 230000002441 reversible effect Effects 0.000 claims abstract description 13
- 238000007781 pre-processing Methods 0.000 claims abstract description 12
- 238000012360 testing method Methods 0.000 claims abstract description 11
- 238000012795 verification Methods 0.000 claims abstract description 10
- 239000013307 optical fiber Substances 0.000 claims abstract description 9
- 239000003795 chemical substances by application Substances 0.000 claims description 13
- 239000013598 vector Substances 0.000 claims description 13
- 238000004364 calculation method Methods 0.000 claims description 9
- 230000015654 memory Effects 0.000 claims description 7
- 241000282421 Canidae Species 0.000 claims description 6
- 230000008569 process Effects 0.000 claims description 6
- 238000012545 processing Methods 0.000 claims description 6
- 238000013528 artificial neural network Methods 0.000 claims description 5
- 238000011156 evaluation Methods 0.000 claims description 5
- 238000010606 normalization Methods 0.000 claims description 4
- 238000009826 distribution Methods 0.000 claims description 3
- 210000002569 neuron Anatomy 0.000 claims description 3
- 238000005295 random walk Methods 0.000 claims description 3
- ORILYTVJVMAKLC-UHFFFAOYSA-N Adamantane Natural products C1C(C2)CC3CC1CC2C3 ORILYTVJVMAKLC-UHFFFAOYSA-N 0.000 claims description 2
- 238000009529 body temperature measurement Methods 0.000 abstract description 4
- 230000006870 function Effects 0.000 description 5
- 238000012544 monitoring process Methods 0.000 description 5
- 230000004913 activation Effects 0.000 description 3
- 210000004027 cell Anatomy 0.000 description 3
- 238000013135 deep learning Methods 0.000 description 3
- 238000003860 storage Methods 0.000 description 3
- 230000009286 beneficial effect Effects 0.000 description 2
- 230000008901 benefit Effects 0.000 description 2
- 238000004140 cleaning Methods 0.000 description 2
- 238000013136 deep learning model Methods 0.000 description 2
- 230000007547 defect Effects 0.000 description 2
- 238000013461 design Methods 0.000 description 2
- 239000000463 material Substances 0.000 description 2
- 238000013178 mathematical model Methods 0.000 description 2
- 239000000203 mixture Substances 0.000 description 2
- 238000003062 neural network model Methods 0.000 description 2
- 208000000044 Amnesia Diseases 0.000 description 1
- 208000031091 Amnestic disease Diseases 0.000 description 1
- CIWBSHSKHKDKBQ-JLAZNSOCSA-N Ascorbic acid Chemical compound OC[C@H](O)[C@H]1OC(=O)C(O)=C1O CIWBSHSKHKDKBQ-JLAZNSOCSA-N 0.000 description 1
- 230000002159 abnormal effect Effects 0.000 description 1
- 230000001133 acceleration Effects 0.000 description 1
- 230000006986 amnesia Effects 0.000 description 1
- 238000013459 approach Methods 0.000 description 1
- 238000013473 artificial intelligence Methods 0.000 description 1
- 230000006399 behavior Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 125000004122 cyclic group Chemical group 0.000 description 1
- 230000007423 decrease Effects 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 230000008034 disappearance Effects 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 230000008030 elimination Effects 0.000 description 1
- 238000003379 elimination reaction Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000004880 explosion Methods 0.000 description 1
- 238000009472 formulation Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 210000002364 input neuron Anatomy 0.000 description 1
- 238000010801 machine learning Methods 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000003058 natural language processing Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 210000004205 output neuron Anatomy 0.000 description 1
- 230000002028 premature Effects 0.000 description 1
- 230000000306 recurrent effect Effects 0.000 description 1
- 230000006403 short-term memory Effects 0.000 description 1
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
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/10—Pre-processing; Data cleansing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/21—Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
- G06F18/214—Generating training patterns; Bootstrap methods, e.g. bagging or boosting
-
- 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/04—Architecture, e.g. interconnection topology
- G06N3/044—Recurrent networks, e.g. Hopfield networks
- G06N3/0442—Recurrent networks, e.g. Hopfield networks characterised by memory or gating, e.g. long short-term memory [LSTM] or gated recurrent units [GRU]
-
- 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
- G06N3/084—Backpropagation, e.g. using gradient descent
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2119/00—Details relating to the type or aim of the analysis or the optimisation
- G06F2119/08—Thermal analysis or thermal optimisation
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Evolutionary Computation (AREA)
- General Physics & Mathematics (AREA)
- Artificial Intelligence (AREA)
- Data Mining & Analysis (AREA)
- General Engineering & Computer Science (AREA)
- Life Sciences & Earth Sciences (AREA)
- Software Systems (AREA)
- Health & Medical Sciences (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Mathematical Physics (AREA)
- Computing Systems (AREA)
- Biomedical Technology (AREA)
- Biophysics (AREA)
- Computational Linguistics (AREA)
- Molecular Biology (AREA)
- General Health & Medical Sciences (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Bioinformatics & Computational Biology (AREA)
- Evolutionary Biology (AREA)
- Geometry (AREA)
- Medical Informatics (AREA)
- Computer Hardware Design (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
The invention relates to a granary temperature prediction method for optimizing LSTM based on an improved gray wolf algorithm, which comprises the following steps: collecting grain temperature data by using a distributed optical fiber temperature measurement system, and preprocessing the data and dividing the data; introducing a reverse learning strategy and a nonlinear convergence factor to improve the gray-wolf optimization algorithm to obtain an improved gray-wolf optimization algorithm; carrying out iterative solution on the super parameters of the LSTM by utilizing an improved gray wolf optimization algorithm, outputting an optimal solution of the super parameters, and storing a generated optimal prediction model; and inputting the training set into an optimal prediction model for training, obtaining a temperature prediction result after training, and evaluating the optimal prediction model by using the test set and the verification set. The invention improves the gray wolf algorithm by using a reverse learning strategy and a nonlinear convergence factor, not only improves the population richness, but also improves the optimizing speed, and simultaneously optimizes the LSTM by adopting the improved gray wolf optimizing algorithm, thereby improving the prediction precision of the LSTM.
Description
Technical Field
The invention relates to the technical field of granary supervision and artificial intelligence, in particular to a granary temperature prediction method for optimizing LSTM based on an improved gray wolf algorithm.
Background
With the great development of agricultural technology in China, the method is an important work for storing agricultural products. Grain is an important strategic material for the relationship of national and folk life and is also a basic guarantee for the life of people. While increasing grain yield, reasonable grain reserve management needs to be maintained. The grain temperature in the granary is an important index in monitoring work, and has important significance for detection and prediction of grain storage temperature.
At present, most grain temperature prediction models are traditional machine learning algorithms and neural network models used for predicting grain temperature, and deep learning models are rarely used for predicting grain temperature. Meanwhile, most optimization algorithms for optimizing the deep learning are traditional intelligent optimization algorithms, but the optimization algorithms are easy to fall into local optimum, the convergence speed is relatively slow, and the optimization of the deep learning prediction model needs to be improved. The improved optimization algorithm is used for predicting the deep learning model, so that the accuracy of granary temperature prediction is higher, and the method provides better help for subsequent grain monitoring work.
Disclosure of Invention
In order to solve the problems that the existing granary temperature prediction model is easy to sink into local optimum and has relatively low convergence speed, so that the working efficiency and the prediction accuracy of storage monitoring are reduced, the invention provides a granary temperature prediction method for optimizing LSTM based on an improved gray wolf algorithm.
In order to solve the problems, the invention adopts the following technical scheme:
a grain bin temperature prediction method based on an improved wolf algorithm for optimizing LSTM, the method comprising the steps of:
step 1: the grain temperature in the granary is acquired by using a distributed optical fiber temperature measuring system, the acquired temperature data is subjected to data preprocessing, and the preprocessed data is divided into a training set, a testing set and a verification set;
step 2: the method comprises the steps of introducing a reverse learning strategy and a nonlinear convergence factor to improve a wolf optimization algorithm to obtain an improved wolf optimization algorithm, wherein the improved wolf optimization algorithm comprises the following steps:
let p be uv ' random initialization population, reverse individuals p uv ”,p uv "calculated from equation (10):
wherein lb v For the lower boundary of the v th parameter to be optimized, ub v The upper boundary of the V-th parameter to be optimized is set, U is the total number of the population, and V is the total number of the parameters to be optimized;
among 2U search agents of the initial population and the direction population, taking the search agent with the highest adaptability in U as the final initial population, and marking as P; after the initial population is found, the position of each search agent is updated, and the positions of the lead wolves alpha, beta and delta are updated by using a random walk method, wherein the position updating formula is as follows:
p e (t+1)=p e (t)+a rm (t)·cd(t)(e=α,β,δ) (11)
in p e (t) is the position of the e search agent in the t-th iteration, cd (t) is the random number generated by the cauchy distribution, a rm (t) is a control factor, t max The maximum iteration number;
when the position of the leading wolf is updated each time, the fitness of the leading wolf is recalculated, the position of the leading wolf is finally determined according to a greedy algorithm, and the position of the omega wolf is calculated according to the following formula:
A uv (t)=2a(t)·rand 1 -a(t) (13)
C uv (t)=2·rand 2 (14)
wherein A is uv (t) and C uv (t) are search coefficient vectors, each of which includesAnd the positions of alpha, beta, delta wolf in the v dimension of the t-th iteration are respectively +.>Is the position vector, rand of a certain omega wolf towards alpha, beta and delta wolf 1 And rand 2 Is [0,1]Random number between a (t) is convergence factor, p uv (t) is the current position of the wolf population, p uv (t+1) is the final position of the wolf population;
by nonlinear convergence factor a nl (t) replacing the convergence factor a (t), nonlinear convergence factor a in equation (13) nl The calculation formula of (t) is as follows:
t is in pre Representing the current iteration number, and maxiter representing the maximum iteration number;
step 3: carrying out iterative solution on super parameters of the long-short-time memory neural network by utilizing the improved gray wolf optimization algorithm, outputting an optimal solution of the super parameters, and storing a generated optimal prediction model, wherein the super parameters comprise the number of hidden layers and the number of iterations;
step 4: and inputting the training set into the optimal prediction model for training, obtaining a temperature prediction result after training, and then respectively inputting the test set and the verification set into the optimal prediction model for evaluating the optimal prediction model.
The invention has the main beneficial effects as follows:
(1) The invention collects real grain temperature data by using a distributed optical fiber temperature measurement system, and realizes more accurate prediction of future temperature data based on the regularity of grain temperature change and the design of a neural network model with multi-index input and multi-index output;
(2) According to the invention, an improved gray wolf optimization algorithm (Improve gray wolf optimization, IGWO) is adopted to carry out iterative solution on super parameters of a long short-term memory (LSTM), so that the prediction accuracy of the LSTM is improved, and the optimization capacity of the optimization algorithm is improved; IGWO uses a reverse learning strategy and adds a nonlinear convergence factor, so that the population richness is improved, and the optimizing speed is also improved; the IGWO-LSTM model has higher prediction precision, and meanwhile, the model has simple structure, small error rate and good performance in the aspect of granary temperature prediction.
Drawings
FIG. 1 is a flow chart of a method for predicting granary temperature according to an embodiment of the present invention;
FIG. 2 is a LSTM model diagram;
FIG. 3 is a flow chart of data preprocessing and input and output of an optimal prediction model.
Detailed Description
The technical scheme of the present invention will be described in detail with reference to the accompanying drawings and preferred embodiments.
In one embodiment, as shown in fig. 1, the present embodiment provides a grain bin temperature prediction method based on improved wolf algorithm for LSTM optimization, and the method specifically includes the following steps 1 to 4.
Step 1: the temperature data acquisition is carried out on the grain temperature in the granary by using the distributed optical fiber temperature measurement system, the time of the temperature data can be adjusted according to actual needs, for example, the temperature data acquisition is carried out for three months or more than three months, and the like; and then, carrying out data preprocessing on the acquired temperature data, wherein the data preprocessing comprises the steps of filling in the defect value of the whole data, namely, data cleaning and carrying out data normalization processing on the filled data.
Data cleaning: according to the embodiment, the existing distributed optical fiber temperature measuring system is used for monitoring the temperature of grains, and because the temperature measuring material used by the distributed optical fiber temperature measuring system is a temperature measuring optical cable, the temperature detecting optical fiber is easy to bend or break in a granary with a complex environment, so that the acquired temperature data has a missing part, and therefore, in the data preprocessing process, the missing data is required to be supplemented by using a linear interpolation method, and the linear interpolation has the following calculation formula:
x i =x j +(x r -x j )(i-j)/(r-j) (1)
where i is the sequence number of the missing value, j is the sequence number of the last known data preceding the missing data, r is the sequence number of the following known data, x i Is a incomplete value; x is x j Is x i The former values; x is x r Is x i The latter values.
And (3) data normalization processing: and (3) scaling the data after the filling in by a certain proportion, so that the gradient descent speed and the model training speed are increased, the interference of bad factors on the model is reduced, and the model precision is improved. The normalized calculation formula is shown in (2):
wherein x is w For normalized values, x is the value to be normalized, x min 、x max Is the minimum and maximum of the input data.
After the preprocessing of the temperature data is completed, the preprocessed data, namely the normalized data, is divided into a training set, a testing set and a verification set according to the proportion of 6:2:2.
Step 2: and (3) introducing a reverse learning strategy and a nonlinear convergence factor to improve the gray-wolf optimization algorithm, so as to obtain an improved gray-wolf optimization algorithm.
In the embodiment, an improved wolf optimization algorithm is provided, and is improved by introducing a reverse learning strategy and a nonlinear convergence factor, so that the richness of the population is enriched, the optimizing rate is increased, the problem of premature sinking into local optimum is solved, and the prediction accuracy of the whole model is improved. The specific steps of the traditional gray wolf optimization algorithm are as follows:
social classification: in the process of establishing a model of a wolf optimization algorithm, constructing a social grade mathematical model of the wolf group, dividing the wolf group into four grades according to the fitness of each individual, and marking the individuals with alpha, beta and delta as the best fitness in sequence, wherein the rest individuals are omega;
surrounding the prey: the wolf gradually approaches and surrounds the prey when searching for it, and the mathematical model of this behavior is shown in the following formula:
D=|C·X p (t)-X(t)| (3)
X(t+1)=X p (t)-A·D (4)
A=2a·r 1 -a (5)
C=2·r 2 (6)
the position vector of the current prey is X p (t) wolf)The position vector is X (t), t is the iteration number, and X (t+1) is the position vector of the next iteration of the wolf; d is the distance between the wolf and the prey; the convergence factor is denoted as a, which decreases linearly from 2 to 0 with increasing iteration number; wherein the random number r 1 、r 2 At [0,1]On the interval;
hunting: the gray wolf optimization algorithm has the capability of identifying the potential optimal solution position, and the whole searching process is completed by the command of alpha wolf, beta wolf and delta wolf which are classified by the social level in the first step; after the wolf recognizes the position of the prey, the alpha wolf guides the beta wolf and the delta wolf to attack the prey, the first three optimal solutions are selected, and the rest wolves update the position according to the alpha wolf, the beta wolf and the delta wolf, wherein the specific calculation formula is shown as the following formula:
wherein D is * The distances between the wolves and the other wolves (where x represents α, β and δ); x is X * (t) is the position vector at the current iteration number (where x is α, β, and δ); x is X 1 A vector which is a movement of a certain gray wolf in the wolf group to alpha wolf; x is X 2 A vector which is a movement of a certain gray wolf in the wolf group to beta wolf; x is X 3 Is a vector that a certain wolf in the wolf group moves to delta wolf. Equations (7), (8) define the forward progression length and direction of progression of the remaining wolf ω, while equation (9) defines the final position of the ω wolf.
In this embodiment, a reverse learning strategy is introduced to enrich the population richness of the wolf optimization algorithm, and the probability of searching the optimal solution is uncontrollable because the traditional method for initializing the population by the wolf optimization algorithm is random initialization. If the opposite individuals of each individual are considered, the probability of both approaching the optimal individual is 50%. The search agent closer to the optimal individual is taken as the initial population, then each individual is further from the "prey". The improved gray wolf optimization algorithm in this embodiment includes the following steps:
assuming p' is a randomly initialized population, the inverted individual is p ", p" is calculated from equation (10):
wherein lb v For the lower boundary of the V-th parameter to be optimized, ub v The upper boundary of the V-th parameter to be optimized is set, U is the total number of the population, and V is the total number of the parameters to be optimized;
among the 2U search agents of the initial population and the directional population, the search agent with the highest fitness in U is denoted as P as the final initial population. After the initial population P is found, the location of each search agent is updated and the location of the lead wolves α, β, δ is updated using a random walk method. The formula for the location update is as follows:
p e (t+1)=p e (t)+a rm (t)·cd(t)(e=α,β,δ) (11)
in p e (t) is the position of the e search agent in the t-th iteration, cd (t) is the random number generated by the cauchy distribution, a rm (t) is a control factor, t max Is the maximum number of iterations.
The lead wolf will recalculate its fitness each time it updates its position. The position of the lead wolf is finally determined according to a greedy algorithm. Whereas the position of ωwolf is calculated according to the following formula:
A uv (t)=2a(t)·rand 1 -a(t) (13)
C uv (t)=2·rand 2 (14)
wherein A is uv (t) and C uv (t) are search coefficient vectors, each of which includesAnd the positions of alpha, beta, delta wolf in the v dimension of the t-th iteration are respectively +.>Is the position vector, rand of a certain omega wolf towards alpha, beta and delta wolf 1 And rand 2 Is [0,1]Random number between a (t) is convergence factor, p uv (t) is the current position of the wolf population, p uv (t+1) is defined as the final position of the wolf population, and the specific flow of the reverse learning improvement wolf optimization algorithm is shown in fig. 3.
In standard GWO, due to A uv (t) has the function of adjusting global optimization and local acceleration, and a (t) is known to be a composition A according to a formula (13) uv The key convergence factor of (t), but since the convergence factor a in the standard GWO is linearly reduced from 2 to 0, the search for hunting will be incomplete, the convergence speed of hunting will be slow, and the nonlinear convergence factor a is introduced in this embodiment nl (t) to solve the above problem instead of a (t) in the formula (13). Nonlinear convergence factor a nl The calculation formula of (t) is:
t is in pre Representing the current iteration number, and maxiter representing the maximum iteration number.
Step 3: and then, optimizing the long-time and short-time memory neural network by using an improved gray-wolf optimization algorithm, namely, carrying out iterative solution on two super parameters, namely the number of hidden layers and the iteration number of the LSTM, by using the improved gray-wolf optimization algorithm, so as to obtain an optimal solution of the super parameters, and storing the generated optimal prediction model.
The LSTM network model is a very classical deep learning network model, solves the defects of gradient elimination and gradient explosion of RNN (cyclic neural network) to a certain extent, is a common technical means for the existing time sequence prediction method, has the advantage of learning long-distance time sequence dependence, and therefore refers to the LSTM to predict the granary temperature.
According to the formulation of the LSTM network of fig. 2, LSTM incorporates memory cells, abbreviated as cells, that store historical data information along with hidden states.
First, the values of the input gate, the forget gate and the output gate are introduced. As can be seen from fig. 2, the input of the current time step and the hidden state of the previous time step are fed into the gates of LSTM, whose input, forget and output gates are processed by the full connection layer of the sigmoid activation function to calculate the value of the input output gate. Therefore, the values output by the three gates are all in the range of (0, 1).
The mathematical expression is to set the hidden unit number, the batch size and the input number as h, n and d. So input isThe hidden state of the previous time step gate is +.>Similarly, the time step gate is defined as follows: input door->Amnesia door->Output door->The calculation formula is as follows:
I t =σ(X t W xi +H t-1 W hi +b i ) (18)
F t =σ(X t W xf +H t-1 W hf +b f ) (19)
O t =σ(X t W xo +H t-1 W ho +b o ) (20)
wherein the method comprises the steps ofAnd->For weight parameter, ++>For the paranoid parameter, σ is the sigmoid activation function.
Second, in LSTM there is a mechanism to control input and forget (or skip), this function is done by two gates: input gate I t Control ofThe amount of data transferred, while forgetting the gate F t To control how many memory cells C t-1 Is a content of (3). Using per-element multiplication to yield:
when the values of the forgetting gate and the input gate are always 1 and 1 respectively0, then the past memory cell C t-1 Will be saved over time and passed to the current time step. The design well relieves the problem of gradient disappearance which often occurs in a Recurrent Neural Network (RNN) and better captures long-range dependencies in the sequence.
Finally, hidden stateTo define the computational requirements of (1), here fully functioning as an output gate. The calculation formula is as follows:
H t =O t ⊙tanh(C t ) (22)
in the formula, tanh is an activation function, so that nonlinear factors of the model are ensured, the expression of the model is increased, and H is always maintained t Within the interval (-1, 1).
The generated optimal prediction model is a multi-index input and multi-index output time sequence prediction model, wherein the input is acquired temperature data, and the output is predicted temperature data of a plurality of days.
Step 4: training the optimal prediction model by taking the divided training set in the step 1 as model input, obtaining a temperature prediction result after training, and inputting the divided test set in the step 1 into the optimal prediction model for model evaluation, wherein the adopted evaluation indexes comprise: mean Absolute Error (MAE), mean percent absolute error (MAPE), and Root Mean Square Error (RMSE). The calculation formulas of the method are respectively as follows:
of the three statistical indexes, phi is the number of test set data,representing predicted values->Representing a true value.
And (3) inputting the verification set divided in the step (1) into an optimal prediction model, and evaluating the generalization capability of the output result of the optimal prediction model by using the verification set.
An example of applying the granary temperature prediction method of the present invention to a grain storage facility is given below, with the following steps:
step one: and collecting and preprocessing data, namely collecting the temperature data of 2023, 6 months and 2023, 9 months of a certain granary, and collecting 12960 time point data. And filling the blank data by adopting a linear interpolation method to the original data in the preprocessing stage, and replacing the abnormal value to obtain the data after the filling.
And (3) data normalization processing: and (3) scaling the data after the filling in by a certain proportion, so that the gradient descent speed and the model training speed are increased, the interference of bad factors on the model is reduced, and the model precision is improved.
Data dividing processing: dividing the normalized data into a training set, a testing set and a verification set in a ratio of 6:2:2.
Step two: and (3) introducing a reverse learning strategy and a nonlinear convergence factor to improve the gray-wolf optimization algorithm, so as to obtain an improved gray-wolf optimization algorithm. The specific flow of the improved gray wolf optimization algorithm can be seen from the content of the step 2, and will not be repeated here.
Step three: and optimizing the iteration times of the LSTM and the number of hidden layers by using an improved gray wolf optimization algorithm, and outputting an optimal solution of the super parameters, thereby obtaining an optimized optimal prediction model. The process of solving the super parameter can be referred to the content in the foregoing step 3, which is not described herein.
LSTM is often widely used in the field of time series prediction and natural language processing, and exhibits excellent prediction effects. Compared to other predicted sequences, LSTM can save and utilize historical data information, which is an absolute advantage when processing time series data. Thus, the use of LSTM for granary temperature prediction is more advantageous.
Inputs and outputs of LSTM prediction model: the model is a time sequence prediction model with multi-index input and multi-index output, wherein the input is three months of temperature data collected by the distributed optical fiber temperature measurement system, and the output is predicted temperature data of fifteen days in the future. And on the training set, optimizing LSTM parameters by using IGWO to obtain super parameters and an optimal prediction model. The data preprocessing and the input and output flow of the optimal prediction model are shown in fig. 3.
Step four: the training set is input into an optimal prediction model for training, predicted temperature data of fifteen days in the future are output, the optimal prediction model is evaluated by using a divided test set and a verification set, errors between predicted values and actual values are calculated, adjustment evaluation of the model is made, and an evaluation index adopts Mean Absolute Error (MAE), mean percentage absolute error (MAPE) and Root Mean Square Error (RMSE) to evaluate the model.
The granary temperature prediction based on the improved gray wolf optimization algorithm and the LSTM is a multi-aspect modeling process, and in consideration of various aspects, the learning rate of the LSTM is adaptively adjusted by using an Adam optimizer when an optimal prediction model is trained, and multi-scale gradients can be effectively processed.
The basic parameters and super parameters of the optimal prediction model are selected as shown in table 1:
table 1 parameter selection
Input neuron number | 5 |
Number of output neurons | 2 |
Hidden layer neuron number | (54,60) |
Full link layer neuron count | 70 |
Learning rate | 0.0001 |
Number of iterations | 50 |
Time step | 10 |
Comparing the temperature prediction result of the LSTM network with the related index of the long-short time memory network model optimized by the improved gray wolf optimization algorithm, namely the optimal prediction model, wherein the comparison result is shown in the following table:
table 2 correlation index contrast of LSTM network and optimal predictive model of the invention
MAPE | RMSE | MAE | |
LSTM network | 10.47% | 0.3869 | 0.1641 |
Optimal prediction model | 8.91% | 0.1924 | 0.0982 |
As can be seen from comparison of Table 2, the granary temperature prediction method based on the improved Liuwolf algorithm for optimizing the LSTM provided by the invention utilizes a reverse learning strategy and a nonlinear convergence factor to improve the traditional Liuwolf optimization algorithm, improves the population richness, improves the convergence speed and optimizes the super-parameters of the LSTM, so that the method is more beneficial to accurately predicting the LSTM. The model can improve the accuracy of granary temperature prediction and provide more reliable data support for the monitoring work of the subsequent granary temperature.
The technical features of the above-described embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above-described embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples illustrate only a few embodiments of the invention, which are described in detail and are not to be construed as limiting the scope of the invention. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the invention, which are all within the scope of the invention. Accordingly, the scope of protection of the present invention is to be determined by the appended claims.
Claims (6)
1. The granary temperature prediction method for optimizing LSTM based on the improved wolf algorithm is characterized by comprising the following steps:
step 1: the grain temperature in the granary is acquired by using a distributed optical fiber temperature measuring system, the acquired temperature data is subjected to data preprocessing, and the preprocessed data is divided into a training set, a testing set and a verification set;
step 2: the method comprises the steps of introducing a reverse learning strategy and a nonlinear convergence factor to improve a wolf optimization algorithm to obtain an improved wolf optimization algorithm, wherein the improved wolf optimization algorithm comprises the following steps:
let p be uv ' random initialization population, reverse individuals p uv ”,p uv "calculated from equation (10):
p″ uv =lb v +ub v -p′ uv ,u=1,2,...,U,v=1,2,...,V (10)
wherein lb v For the lower boundary of the v th parameter to be optimized, ub v The upper boundary of the V-th parameter to be optimized is set, U is the total number of the population, and V is the total number of the parameters to be optimized;
among 2U search agents of the initial population and the direction population, taking the search agent with the highest adaptability in U as the final initial population, and marking as P; after the initial population is found, the position of each search agent is updated, and the positions of the lead wolves alpha, beta and delta are updated by using a random walk method, wherein the position updating formula is as follows:
p e (t+1)=p e (t)+a rm (t)·cd(t),e=α,β,δ (11)
in p e (t) is the position of the e search agent in the t-th iteration, cd (t) is the random number generated by the cauchy distribution, a rm (t) is a control factor, t max The maximum iteration number;
when the position of the leading wolf is updated each time, the fitness of the leading wolf is recalculated, the position of the leading wolf is finally determined according to a greedy algorithm, and the position of the omega wolf is calculated according to the following formula:
A uv (t)=2a(t)·rand 1 -a(t) (13)
C uv (t)=2·rand 2 (14)
wherein A is uv (t) and C uv (t) are search coefficient vectors, each of which includesAndthe positions of alpha, beta, delta wolf in the v dimension of the t-th iteration are respectively +.>Is the position vector, rand of a certain omega wolf towards alpha, beta and delta wolf 1 And rand 2 Is [0,1]Random number between a (t) is convergence factor, p uv (t) is the current position of the wolf population, p uv (t+1) is the final position of the wolf population;
by nonlinear convergence factor a nl (t) replacing the convergence factor a (t), nonlinear convergence factor a in equation (13) nl The calculation formula of (t) is as follows:
t is in pre Representing the current iteration number, and maxiter representing the maximum iteration number;
step 3: carrying out iterative solution on super parameters of the long-short-time memory neural network by utilizing the improved gray wolf optimization algorithm, outputting an optimal solution of the super parameters, and storing a generated optimal prediction model, wherein the super parameters comprise the number of hidden layers and the number of iterations;
step 4: and inputting the training set into the optimal prediction model for training, obtaining a temperature prediction result after training, and then respectively inputting the test set and the verification set into the optimal prediction model for evaluating the optimal prediction model.
2. The granary temperature prediction method based on the improved wolf algorithm for optimizing LSTM according to claim 1, wherein the optimal solution of the super parameter obtained by solving in the step 3 is: the hidden layer neuron number is (54, 60) and the number of iterations is 50.
3. The improved gray wolf algorithm-based LSTM grain bin temperature prediction method as recited in claim 1, wherein the data preprocessing process in step 1 comprises the steps of:
filling incomplete values in the temperature data by using a linear interpolation method;
and carrying out normalization processing on the temperature data after the compensation.
4. The improved gray wolf algorithm-based LSTM grain bin temperature prediction method as claimed in claim 1, wherein the evaluation indexes adopted when evaluating the optimal prediction model by using the test set include goodness of fit, average absolute error and root mean square error.
5. The improved gray wolf algorithm-based grain bin temperature prediction method for optimizing LSTM according to claim 1, wherein the learning rate of LSTM is adaptively adjusted by using an Adam optimizer when training the optimal prediction model.
6. The improved sirius algorithm-based grain bin temperature prediction method for optimizing LSTM according to claim 1, wherein the temperature data collected in step 1 is at least three months of most recent temperature data.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311549671.9A CN117521511A (en) | 2023-11-20 | 2023-11-20 | Granary temperature prediction method based on improved wolf algorithm for optimizing LSTM |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311549671.9A CN117521511A (en) | 2023-11-20 | 2023-11-20 | Granary temperature prediction method based on improved wolf algorithm for optimizing LSTM |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117521511A true CN117521511A (en) | 2024-02-06 |
Family
ID=89745169
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311549671.9A Pending CN117521511A (en) | 2023-11-20 | 2023-11-20 | Granary temperature prediction method based on improved wolf algorithm for optimizing LSTM |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117521511A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117808034A (en) * | 2024-02-29 | 2024-04-02 | 济南农智信息科技有限公司 | Crop yield prediction optimization method based on wolf bird optimization algorithm |
-
2023
- 2023-11-20 CN CN202311549671.9A patent/CN117521511A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
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 |
---|---|---|
CN109993270B (en) | Lithium ion battery residual life prediction method based on gray wolf group optimization LSTM network | |
CN113962364B (en) | Multi-factor power load prediction method based on deep learning | |
CN110245801A (en) | A kind of Methods of electric load forecasting and system based on combination mining model | |
CN111563706A (en) | Multivariable logistics freight volume prediction method based on LSTM network | |
CN108764539B (en) | Upstream and downstream water level prediction method for cascade power station | |
CN111401599B (en) | Water level prediction method based on similarity search and LSTM neural network | |
CN111027772A (en) | Multi-factor short-term load prediction method based on PCA-DBILSTM | |
CN113642225A (en) | CNN-LSTM short-term wind power prediction method based on attention mechanism | |
CN111626785A (en) | CNN-LSTM network fund price prediction method based on attention combination | |
CN113095550A (en) | Air quality prediction method based on variational recursive network and self-attention mechanism | |
CN117521511A (en) | Granary temperature prediction method based on improved wolf algorithm for optimizing LSTM | |
CN111861013A (en) | Power load prediction method and device | |
CN116596044B (en) | Power generation load prediction model training method and device based on multi-source data | |
CN114548591B (en) | Sequential data prediction method and system based on mixed deep learning model and Stacking | |
CN113158572A (en) | Short-term load prediction method and device | |
CN112329990A (en) | User power load prediction method based on LSTM-BP neural network | |
CN115860177A (en) | Photovoltaic power generation power prediction method based on combined machine learning model and application thereof | |
CN112330005A (en) | Water quality prediction method based on sequence-to-sequence deep learning mechanism | |
CN116187835A (en) | Data-driven-based method and system for estimating theoretical line loss interval of transformer area | |
CN113627070A (en) | Short-term photovoltaic power prediction method | |
CN116720620A (en) | Grain storage ventilation temperature prediction method based on IPSO algorithm optimization CNN-BiGRU-Attention network model | |
CN112036598A (en) | Charging pile use information prediction method based on multi-information coupling | |
CN114817571A (en) | Method, medium, and apparatus for predicting achievement quoted amount based on dynamic knowledge graph | |
CN114819395A (en) | Industry medium and long term load prediction method based on long and short term memory neural network and support vector regression combination model | |
CN117439053A (en) | Method, device and storage medium for predicting electric quantity of Stacking integrated model |
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 |