Facility environment multi-step prediction method based on pooling attention
Through a neural network based on pooled attention, the error problem of long-term prediction in facility environments was solved, high-precision multi-step prediction of the environment in livestock and poultry houses was achieved, and the economic benefits of facility agriculture were improved.
Patent Information
- Application Number
- CN202310550634.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-16
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2043-05-16
AI Technical Summary
Existing facility environment prediction models have large errors in medium- and long-term predictions, making it difficult to achieve high-precision multi-step predictions, especially accurate predictions of environmental changes in livestock and poultry houses.
A two-stage attention encoder-decoder neural network based on pooled attention is adopted. The encoder extracts stable features, and the decoder extracts unstable jump features. Combined with the mapping prediction strategy, high-precision multi-step prediction of facility environment is achieved.
It improves the accuracy of medium- and long-term forecasts, simplifies the calculation process, reduces the complexity of the model, and is suitable for improving the economic benefits of facility agriculture.
Smart Images

Figure CN116578862B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of facility environment prediction, and more specifically, relates to a multi-step prediction method and model for facility environment changes based on a pooled attention neural network. Background Art
[0002] A suitable facility environment is essential for efficient facility agriculture production. Predicting various environmental parameters within a facility (such as temperature and humidity) and generating control plans based on the predicted results can address the errors that can easily occur in traditional facility agriculture control, effectively reducing control losses and improving the economic benefits of facility agriculture planting and breeding.
[0003] Currently, approaches to facility environment prediction can be divided into two categories: one is mechanism models, which primarily model the greenhouse facility environment from a physical perspective. These models require extensive testing to refine the models, resulting in high modeling costs. Furthermore, these models are significantly affected by factors such as greenhouse structure and facilities, resulting in poor universality and difficulty in widespread application. The second category is data-driven system identification models, which are characterized by mining connections between data, establishing a correspondence between various influencing factors and prediction targets, and enabling reasoning from historical data to future data. System identification models include statistical models and machine learning models. Compared to statistical models, machine learning models, such as artificial neural networks, are simple to use and have a wide range of applicable scenarios, showing great potential in poultry house environment prediction.
[0004] Currently, research by scholars both domestically and internationally demonstrates the feasibility of artificial neural networks for facility environmental forecasting. However, most existing forecasting models only perform well for single-step or short-term predictions. When applied to medium- and long-term predictions, or multi-step predictions, errors rapidly increase, and the predicted values exhibit significant anomalies. Achieving high-precision medium- and long-term facility forecasting is a major challenge in this field. Summary of the Invention
[0005] This paper addresses the problem of predicting the internal environment of livestock and poultry houses by proposing a multi-step prediction method for facility environments based on pooled attention. This method uses a two-stage attention codec neural network to mine trend features and current states. The mined features are then used to achieve high-precision single-step predictions of environmental changes within livestock and poultry houses. Multi-step predictions are then accomplished using a mapping-based prediction strategy.
[0006] The technical solution of the present invention is:
[0007] A multi-step prediction method for facility environment based on pooled attention is proposed. The method is based on the environmental influencing factor data and historical data of the environmental parameters in the livestock and poultry house for training, and a prediction model based on pooled attention is established. The prediction model encodes several pieces of environmental influencing factor data and the environmental parameters in the house from the start time T1 to the end time T2 to obtain a latent state vector. The pooled attention module is used to extract the non-stable jump features in the environmental parameters in the house to obtain an attention matrix. The attention matrix and the latent state vector are feature fused and decoded, and the decoded output is mapped to the environmental parameters in the house to be predicted.
[0008] Furthermore, the method specifically includes an encoding step, a decoding step, and a mapping step:
[0009] The encoding step is to encode the environmental impact factor data X from the start time T1 to the end time T2. t and the indoor environmental parameters Y t As the input sequence, t represents the time, and the stacked time series decomposition unit is used for encoding to obtain multi-level stable features, which are then concatenated to obtain the hidden state vector H of the input sequence;
[0010] In the decoding step, the pooling attention module is used to analyze the internal environment parameter Y t Extract the unstable jump features in , obtain the attention matrix C and perform multi-head attention processing;
[0011] The attention matrix C after multi-head attention processing is fused with the encoded hidden state vector H, and the fused data is normalized using the MLP module and the LN module to obtain the decoding output D;
[0012] In the mapping step, a fully connected layer is used to parse the decoded output D to obtain the prediction result.
[0013] Furthermore, the stacked time series decomposition unit adopts an m-layer stacked fully connected network module FCNN, and the hidden state vector H is obtained using the following formula:
[0014] H={h0,h1,…,h n-1 =FCNN m (X t ,Y t )
[0015] Where: H represents the hidden state vector, h0,h1,…,h n-1 Represents the hidden state vector value after being processed by the encoder, including the stable characteristics of the sequence, n represents the length of the hidden state vector; FCNN represents the encoding operation, m represents the number of layers of the fully connected network module, and t represents the time. represents the environmental influencing factor data at time t, k1 represents the number of environmental influencing factors, represents the indoor environmental data at time t, and k2 represents the number of indoor environmental parameters, including future temperature and relative humidity data at multiple points.
[0016] Furthermore, in the decoding step, the unstable jump characteristics of the sequence come from the state changes of the environmental control equipment in the poultry house and the climate changes in the outside world. When these changes occur, they will affect the target sequence and cause the sequence to deviate from the stable state.
[0017] Furthermore, the decoding step uses the following formula:
[0018]
[0019] Among them, MaxPoolAttn() represents the maximum pooling processing Max-Pooling Attention, MaxPoolAttn, MutilHeadAttn() represents the multi-head attention processing Mutil-Head Attention, MutilHeadAttn, MLP() represents the MLP module processing, and LN() represents the LN module processing block.
[0020] Furthermore, the mapping step uses the fully connected layer FC to parse the decoded output D, realize the mapping from the decoded output to the predicted result, and obtain the predicted result
[0021]
[0022] Among them, t∈(T2,T2+τ), FC() represents the mapping process of the fully connected layer, and τ represents the step size of the future time that needs to be predicted.
[0023] Furthermore, factors affecting the environment in livestock and poultry houses include outdoor environmental factors and the operating status of equipment in the house; the outdoor environmental factors include weather forecasts, and the operating status of equipment in the house includes the switch status of the equipment.
[0024] Furthermore, the training steps of the prediction model based on pooled attention for historical data are the same as the prediction steps. During the training process, the ADAM optimizer is used to learn parameters and iteratively update the parameters of the prediction model.
[0025] Furthermore, the learning rate of the model is 0.0001, and it is updated in a linear manner, with the learning rate decreasing by 10% every 100 times; the loss of the model is expressed as the root mean square error (RMSE).
[0026] Beneficial effects of the present invention:
[0027] The method of the present invention makes full use of the information of the facility environment multivariate time series data to build a model, and performs mapping prediction based on the characteristics of different dimensions of the sequence:
[0028] First, facility environmental data exhibits significant seasonal and cyclical characteristics, which are relatively stable and provide a benchmark for predictive data during the task. In the encoder, a stacked time series decomposition module is designed to extract these long-term stability features. The input sequence passes through multiple fully connected modules with a stacked structure, decomposing and filtering the sequence layer by layer to extract long-term stability features.
[0029] Secondly, because the facility environment is affected by environmental controls and climate change, poultry house environmental sequences contain unstable transition information, which can affect the prediction of points and segments in the sequence. In the decoder, a pooled attention module is designed to filter out more active attention components, optimizing traditional dot-product attention. This reduces model complexity while improving the model's ability to perceive and extract sequence transition information.
[0030] The method of the present invention can realize the prediction of a sequence of specified time steps in the future. Compared with other multi-step prediction methods, it has a certain improvement in accuracy and is simple and effective in medium- and long-term prediction tasks.
[0031] The decoding part of the present invention designs a pooled attention module to screen the attention state, simplify the calculation process, and reduce the model calculation time.
[0032] Other features and advantages of the present invention will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] The above and other objects, features and advantages of the present invention will become more apparent through a more detailed description of exemplary embodiments of the present invention with reference to the accompanying drawings, wherein like reference numerals generally represent like components throughout the exemplary embodiments of the present invention.
[0034] Figure 1 The structure diagram of the facility environment multi-step prediction system based on pooled attention of the present invention is shown.
[0035] Among them: encoder Encoder, decoder Decoder, mapping layer FC Layer. DETAILED DESCRIPTION
[0036] The preferred embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although the preferred embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited to the embodiments set forth herein.
[0037] The present invention provides a multi-step prediction method for facility environment based on pooled attention. The method is trained based on environmental influencing factor data and historical data of environmental parameters in livestock and poultry houses to establish a prediction model based on pooled attention; a plurality of environmental influencing factor data and environmental parameters in the house acquired from a start time T1 to an end time T2 are encoded by the prediction model to obtain a latent state vector; a pooled attention module is used to extract unstable transition features in the environmental parameters in the house to obtain an attention matrix; feature fusion decoding is performed on the attention matrix and the latent state vector, and the decoded output is mapped to the environmental parameters to be predicted in the house. The method specifically includes an encoding step, a decoding step, and a mapping step:
[0038] The encoding step is to encode the environmental impact factor data X from the start time T1 to the end time T2. t and the indoor environmental parameters Y t As the input sequence, t represents the time, and the stacked time series decomposition unit is used to encode and obtain multi-level stable features. After splicing, the hidden state vector H of the input sequence is obtained; the stacked time series decomposition unit uses an m-layer stacked fully connected network module FCNN, and the hidden state vector H is obtained using the following formula:
[0039] H={h0,h1,…,h n-1 =FCNN m (X t ,Y t )
[0040] Where: H represents the hidden state vector, h0,h1,…,h n-1 Represents the hidden state vector value after being processed by the encoder, including the stable characteristics of the sequence, n represents the length of the hidden state vector; FCNN represents the encoding operation, m represents the number of layers of the fully connected network module, and t represents the time. represents the environmental influencing factor data at time t, k1 represents the number of environmental influencing factors, represents the indoor environmental data at time t, and k2 represents the number of indoor environmental parameters, including future temperature and relative humidity data at multiple points.
[0041] In the decoding step, the pooling attention module is used to analyze the internal environment parameter Y t Extract the unstable jump features in the sequence, obtain the attention matrix C and perform multi-head attention processing; the unstable jump features of the sequence come from the state changes of the environmental control equipment in the poultry house and the climate changes in the outside world. When these changes occur, they affect the target sequence and cause the target sequence to deviate from the stable state;
[0042] The attention matrix C after multi-head attention processing is fused with the encoded hidden state vector H, and the fused data is normalized using the MLP module and the LN module to obtain the decoding output D;
[0043]
[0044] Among them, MaxPoolAttn() represents the maximum pooling processing Max-Pooling Attention, MaxPoolAttn, MutilHeadAttn() represents the multi-head attention processing Mutil-Head Attention, MutilHeadAttn, MLP() represents the MLP module processing, and LN() represents the LN module processing block.
[0045] In the mapping step, the fully connected layer FC is used to parse the decoded output D, and the mapping from the decoded output to the predicted result is realized to obtain the predicted result.
[0046]
[0047] Among them, t∈(T2,T2+τ), FC() represents the mapping process of the fully connected layer, and τ represents the step size of the future time that needs to be predicted.
[0048] The prediction model of the present invention is generally designed as a codec structure, consisting of an encoder and a decoder:
[0049] The encoder part is a time series decomposition module with a stacked structure. This module extracts the long-term stability trend features of the input sequence by stacking multiple fully connected modules. Through the encoder, such features are converted into a latent state space and represented by the latent state vector H.
[0050] The decoder consists of a pooling attention module, a multi-head attention module, an MLP, and a LN module. First, the pooling attention module is used to capture sequence transition features, generating the attention matrix C. Next, a multi-head attention module is used to perform feature fusion. The MLP and LN modules normalize the previous operations, resulting in the decoder output D.
[0051] After the decoder output, a fully connected layer is used to map the encoder output to the prediction result.
[0052] The model uses the ADAM optimizer to learn parameters. The learning rate is set to 0.0001, and the model is iterated 1000 times. The learning rate is updated using a linear method, decreasing by 10% every 100 iterations. The RMSE loss function is used.
[0053] The model of the application is suitable for facility environment multi-step time series prediction tasks. By collecting, processing and preprocessing the environmental parameters (such as temperature, humidity, etc.) in the poultry house, after time alignment of the records, the facility environment multi-step prediction model based on pooling attention of the application is input. The model extracts the long-term stability features of the data through the time series decomposition encoder with a stacked structure, further designs and uses the pooling attention module in the decoder to extract the short-term jump features of the data, and finally realizes the mapping of the specified step prediction results through the full connection module.
[0054] In specific implementation:
[0055] The data of the poultry house in Lishui District, Nanjing City, is collected for experiment, the facility environment multi-step prediction method (Pool-Attention Forecasting) based on the pooling attention of the application is used, and the existing technologies of LSTM, DA-RNN and Informer are used to predict the future 24, 36 and 60 time steps of environmental changes, and the results are as shown in the following table,
[0056]
[0057] The method can realize the prediction of the future specified time step sequence. Among them, the RMSE in 24-step prediction can reach 0.772, the RMSE in 36-step prediction can reach 0.898, and the RMSE in 60-step prediction can reach 1.176, which has certain improvement in accuracy compared with other multi-step prediction methods. Especially in the medium and long-term time series prediction task, the accuracy is significantly improved. It can be shown that the model is simple and effective in medium and long-term prediction tasks, and provides a basis for formulating a reasonable microclimate regulation scheme.
[0058] The above has described the embodiments of the application, the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments.
Claims
1. A multi-step prediction method for facility environment based on pooled attention, characterized by: The method is based on training data on environmental factors and historical data on environmental parameters in livestock and poultry houses, and establishes a prediction model based on pooled attention. The prediction model encodes several pieces of environmental factors and environmental parameters obtained from the start time T1 to the end time T2 to obtain a latent state vector. The pooled attention module is used to extract the unstable transition features in the environmental parameters to obtain an attention matrix. The attention matrix and latent state vector are subjected to feature fusion decoding, and the decoded output is mapped to the environmental parameters to be predicted. The method specifically includes an encoding step, a decoding step, and a mapping step: The encoding step is to encode the environmental impact factor data X from the start time T1 to the end time T2. t and the indoor environmental parameters Y t As the input sequence, t represents the time, and the stacked time series decomposition unit is used for encoding to obtain multi-level stable features, which are then concatenated to obtain the hidden state vector H of the input sequence; In the decoding step, the pooling attention module is used to analyze the internal environment parameter Y t Extract the unstable jump features in , obtain the attention matrix C and perform multi-head attention processing; The attention matrix C after multi-head attention processing is fused with the encoded hidden state vector H, and the fused data is normalized using the MLP module and the LN module to obtain the decoding output D; In the mapping step, a fully connected layer is used to parse the decoded output D to obtain the prediction result.
2. The multi-step facility environment prediction method based on pooled attention according to claim 1, characterized in that: The stacked time series decomposition unit uses an m-layer stacked fully connected network module FCNN, and the hidden state vector H is obtained using the following formula: H={h0,h1,…,h n-1 }=FCNN m (X t ,Y t ) Where: H represents the hidden state vector, h0,h1,…,h n-1 represents the hidden state vector value after being processed by the encoder, which contains the stable characteristics of the sequence, n represents the length of the hidden state vector; FCNN represents the encoding operation, m represents the number of layers of the fully connected network module, t represents the time, X t = represents the environmental influencing factor data at time t, k1 represents the number of environmental influencing factors, represents the indoor environmental data at time t, and k2 represents the number of indoor environmental parameters, including future temperature and relative humidity data at multiple points.
3. The multi-step facility environment prediction method based on pooled attention according to claim 1, characterized in that: In the decoding step, the non-stable jump characteristics of the sequence come from the state changes of the environmental control equipment in the poultry house and the climate changes in the outside world.
4. The multi-step prediction method for facility environment based on pooled attention according to claim 1 is characterized in that The decoding step uses the following formula: Among them, MaxPoolAttn() represents the maximum pooling processing Max-Pooling Attention, MaxPoolAttn, MutilHeadAttn() represents the multi-head attention processing Mutil-Head Attention, MutilHeadAttn, MLP() represents the MLP module processing, and LN() represents the LN module processing block.
5. The multi-step prediction method for facility environment based on pooled attention according to claim 1 is characterized in that The mapping step uses the fully connected layer FC to parse the decoded output D, realize the mapping from the decoded output to the predicted result, and obtain the predicted result Among them, t∈(T2,T2+τ), FC() represents the mapping process of the fully connected layer, and τ represents the step size of the future time that needs to be predicted.
6. The multi-step facility environment prediction method based on pooled attention according to claim 1, characterized in that: Environmental factors affecting livestock and poultry houses include outdoor environmental factors and the operating status of equipment in the house; The outdoor environmental factors include weather forecasts, and the operating status of the equipment in the house includes the switch status of the equipment.
7. The multi-step facility environment prediction method based on pooled attention according to claim 1, characterized in that: The training steps of the prediction model based on pooled attention for historical data are the same as the prediction steps. During the training process, the ADAM optimizer is used to learn the parameters and iteratively update the parameters of the prediction model.
8. The multi-step facility environment prediction method based on pooled attention according to claim 1, characterized in that: The learning rate of the model is 0.0001, and it is updated in a linear manner, with the learning rate decreasing by 10% every 100 times; the loss of the model is expressed in root mean square error (RMSE).
Citation Information
Patent Citations
Short-term wind power prediction method based on end-to-end memory network
CN111160620A
Time series data prediction method and device
CN113360848A