Improved typical laying hen disease early warning method based on time sequence prediction model

By combining the Seq2Seq model with the characteristics of laying hens’ inventory and temperature and humidity for multi-step prediction, the problem of error accumulation in multi-step predictions in traditional methods is solved, accurate long-term disease warning is achieved, and farmers are helped to reduce the risk of disease spread.

CN120654897APending Publication Date: 2025-09-16BEIJING WODEBOCHUANG INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510971284.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-15
Publication Date
2025-09-16

AI Technical Summary

Technical Problem

Existing disease warning methods suffer from serious error accumulation when faced with multi-step predictions, making it difficult to provide accurate long-term disease warnings and effectively capture the long-term trends of disease transmission and long-term dependencies in sequences. This makes it difficult for farmers to adjust environmental management and prevention and control measures in a timely manner, increasing the risk of disease spread.

Method used

A Seq2Seq model based on the encoding-decoding framework is used for multi-step prediction. Combined with auxiliary features such as laying hen inventory, temperature and humidity, the encoder and decoder are implemented through the LSTM neural network to reduce the error accumulation of multi-step iterative prediction and improve the prediction accuracy.

Benefits of technology

It has achieved multi-step accurate disease early warning, which can effectively capture the long-term trend of disease transmission, help farmers adjust environmental management and prevention and control measures in advance, reduce the risk of disease spread, and improve the accuracy of long-term predictions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120654897A_ABST
    Figure CN120654897A_ABST
Patent Text Reader

Abstract

The invention provides an improved typical laying hen disease early warning method based on a time sequence prediction model, and belongs to the technical field of breeding monitoring, and the typical laying hen disease early warning method comprises the steps: firstly collecting sample data, carrying out the normalization processing, summarizing the obtained normalized data into a time sequence, and obtaining the time sequence of different types of sample data; inputting time sequences of different types of sample data into the Seq2Seq model, and outputting disease prediction data by the Seq2Seq model; and performing inverse proportion conversion on the disease prediction data output by the Seq2Seq model to obtain the finally predicted disease incidence quantity in a certain time sequence in the future. According to the method, the multi-step accurate prediction capability is realized, and the problem of accumulation of multi-step prediction errors in a traditional method is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of breeding monitoring, in particular to an improved typical laying hen disease early warning method based on a time series prediction model. Background Art

[0002] At present, the management of typical laying hen diseases is mainly focused on the field of intelligent diagnosis. By real-time monitoring and diagnosis of the health status of laying hens, symptoms can be discovered and identified in a timely manner, and treatment measures can be taken. However, existing technologies pay little attention to the early warning of laying hen diseases. Early warning of laying hen diseases is also crucial for laying hen farming. By predicting the incidence of a certain type of typical laying hen disease in advance, farmers can understand the laying hen diseases that may occur in the area, and according to the early warning results, they can adjust the environmental conditions of the chicken house in advance, optimize feeding management, and take vaccination or drug intervention measures in time to improve the health level of the flock, thereby significantly reducing the risk of disease spread and reducing farming losses. At present, the prediction methods for diseases are mainly divided into the following three categories:

[0003] The first category involves time series models based on statistical methods, such as the Autoregressive Integrated Moving Average (ARIMA) model and the Grey System model. These methods are typically used for short-term forecasting and can capture the underlying trends in disease transmission. However, their drawbacks are that their accuracy decreases significantly when data updates are delayed or when epidemic data is complex. Furthermore, they can only provide single-step or short-term forecasts, making them inadequate for the long-term forecasting required for sudden disease outbreaks.

[0004] The second category is models based on machine learning methods, such as support vector machines (SVMs) and random forests. Compared to statistical methods, these methods are better able to capture complex nonlinear relationships and generally outperform traditional statistical methods in predicting outcomes. However, machine learning models focus on short-term, single-step forecasts, predicting the outcome of the next step (or several steps in the future) based on current and past input data. The predicted output depends on the input at each prediction moment and cannot effectively capture long-term trends in disease spread or long-term dependencies within a sequence.

[0005] The third category is deep learning-based models, such as long short-term memory (LSTM) neural networks. These methods have strong time series modeling capabilities and can effectively predict diseases over a long timeframe. However, a drawback is that when faced with multi-step predictions, the predicted values ​​from each single-step prediction are added to the existing sequence, and then a new single-step prediction is initiated using this new sequence. This process is repeated multiple times to obtain long-term prediction results. This can lead to cumulative prediction errors at each step, affecting the final prediction accuracy.

[0006] Therefore, it is necessary to develop a disease warning method that can reduce the error accumulation of multi-step iterative predictions in traditional methods, provide more accurate long-term disease warnings, help farmers adjust environmental management and prevention and control measures in a timely manner, and reduce the risk of disease spread. Summary of the Invention

[0007] To address the above problems, the present invention aims to provide a typical laying hen disease early warning method based on an improved time series prediction model. The algorithm first uses a sequence-to-sequence model (Seq2Seq) based on an encoding-decoding framework to perform multi-step prediction of laying hen disease time series. Then, in order to improve the prediction accuracy, auxiliary features such as laying hen inventory, temperature and humidity are added to perform multivariate disease time series prediction. The algorithm effectively reduces the error accumulation problem of multi-step iterative prediction in traditional methods, can provide more accurate long-term disease warnings, and help farmers adjust environmental management and prevention and control measures in a timely manner to reduce the risk of disease spread.

[0008] The technical solution adopted in the present invention is:

[0009] An improved early warning method for typical laying hen diseases based on a time series prediction model includes:

[0010] Step S1: first collect sample data and normalize the sample data;

[0011] Step S2: Aggregate the normalized data of the same type of sample data at different times into a time series to obtain the time series of sample data of different types; input the time series of sample data of different types into the Seq2Seq model, and the Seq2Seq model outputs disease prediction data;

[0012] Among them, the Seq2Seq model uses an LSTM neural network to implement the decoder and encoder: the laying hen disease time series Y is encoded into a hidden state through the encoder and passed forward by the LSTM unit of the encoder; then, the Seq2Seq model transforms the hidden state of each input time step of the time series Y into a context vector through a custom function q; in the encoder of the Seq2Seq model, the LSTM unit of each time step will output a hidden state to capture the context information of the time series Y at that time step; the decoder converts the context vector C, the hidden state S of the previous time step, and the hidden state S of the previous time step into the context vector C at each decoding time step. t and the output y' of the previous time step t-1 Transformed into the hidden state of the current time step; Finally, the hidden state S of the decoder at time step t t Output the final prediction value of time step t through the fully connected layer

[0013] Step S3: Perform an inverse proportional transformation on the disease prediction data output by the Seq2Seq model to obtain the final predicted number of disease incidences in a certain future time series.

[0014] Furthermore, the typical laying hen disease early warning method includes the following specific steps:

[0015] Step S1: collecting laying hen disease data as characteristic data closely related to laying hen disease occurrence, and performing normalization processing on the collected laying hen disease data;

[0016] Step S2: Aggregate the normalized data of laying hen disease data at different times into a time series to obtain a laying hen disease time series; input the laying hen disease time series into a Seq2Seq model, and the Seq2Seq model outputs disease prediction data;

[0017] Step S3: Perform an inverse proportional transformation on the disease prediction data output by the Seq2Seq model to obtain the final predicted number of disease incidences in a certain future time series.

[0018] Furthermore, the normalization process is to normalize the maximum and minimum values ​​of the collected sample data, and use the conversion function to normalize the sample data sequence x1, x2, ..., x n After mapping, the normalized data falls within the range [0,1], where the normalization formula is:

[0019]

[0020] Among them, y i is the normalized result, x i is the sample data, max is the maximum value of the original sample data sequence, and min is the minimum value of the original sample data sequence.

[0021] Furthermore, in step S1, the sample data collected include laying hen disease data, laying hen inventory data, temperature data of the corresponding area, and humidity data of the corresponding area.

[0022] Furthermore, the step S2 includes:

[0023] Step S21: normalizing the laying hen disease data, laying hen inventory data, temperature data of the corresponding region, and humidity data of the corresponding region to obtain laying hen disease time series, laying hen inventory time series, temperature time series, and humidity time series, respectively;

[0024] Step S22: The laying hen disease time series, laying hen inventory time series, temperature time series, and humidity time series are input into the Seq2Seq model, and the Seq2Seq model outputs disease prediction data.

[0025] Furthermore, in step S22, when the laying hen disease time series, laying hen inventory time series, temperature time series and humidity time series are input into the Seq2Seq model:

[0026] For any time step in each time series, the data of the corresponding time step in the laying hen disease time series, laying hen inventory time series, temperature time series and humidity time series are taken to obtain an input feature vector at the corresponding time step; the input feature vectors corresponding to all time steps in the time series are combined into an input sequence, which is used as the final input time series of the Seq2Seq model.

[0027] The beneficial effects of the typical laying hen disease early warning method based on the improved time series prediction model of the present invention are:

[0028] The present invention proposes a typical laying hen disease early warning method based on an improved time series prediction model, which can improve the long-term prediction accuracy of laying hen diseases through multivariate time series prediction. The algorithm adopts a Seq2Seq model based on an encoding-decoding framework, combined with auxiliary features such as regional laying hen inventory, temperature and humidity, and regional economic level, to achieve multi-step accurate prediction capabilities, overcoming the problem of cumulative multi-step prediction errors in traditional methods. Experimental verification shows that the Seq2Seq model of the present invention outperforms the traditional LSTM model in evaluation indicators in multi-step prediction, and the multivariate Seq2Seq model with the addition of auxiliary features such as laying hen inventory, temperature and humidity, and regional economic level has further improved prediction capabilities and faster convergence of the loss function. This enables farmers to reasonably regulate the chicken house environment, optimize feeding management, and promptly carry out vaccination or drug intervention based on accurate disease warnings, thereby reducing the risk of laying hen disease spread and reducing breeding losses.

[0029] The present invention uses a Seq2Seq model based on an encoding-decoding framework to perform multi-step prediction of laying hen disease time series. The model's encoder and decoder both use LSTM neural networks, fully considering the sequence dependencies of multiple time steps in the prediction sequence. Compared with the traditional LSTM model in multi-step prediction, the prediction results of each time step are independent of each other. It can better capture the long-term trend of disease spread and effectively improve the prediction accuracy. On the basis of the Seq2Seq model, auxiliary features such as regional laying hen inventory, regional temperature and humidity are added to perform multivariate disease time series prediction. These features are closely related to the occurrence of laying hen diseases, enabling the model to integrate more key factors for prediction, further improving the prediction ability. In addition, the loss function of the multivariate prediction model converges faster during training, and it can more efficiently learn multivariate time series features.

[0030] This invention can be applied to early warning of typical laying hen diseases, aiming to improve the long-term prediction accuracy of laying hen diseases. By combining a multi-step time series prediction model with factors such as laying hen inventory, temperature and humidity, it can provide farmers with accurate disease warning results, helping them understand potential diseases and take preventive measures. This technology can be applied to disease management and prevention in laying hen farms, assisting farmers in optimizing feeding and management, regulating the chicken house environment, and implementing vaccinations or drug interventions in advance, thereby significantly reducing the risk of disease spread and minimizing breeding losses. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] Figure 1 is the typical laying hen disease data of a domestic laying hen farm from January 2023 to December 2024 in Example 1 of the present invention;

[0032] Figure 2 is the laying hen inventory data of a domestic laying hen farm from January 2023 to December 2024 in Example 1 of the present invention;

[0033] Figure 3 The temperature and humidity data of a domestic laying hen farm in the region from January 2023 to December 2024 in Example 1 of the present invention;

[0034] Figure 4 It is the framework of the Seq2Seq prediction model of the encoding-decoding framework in Example 1 of the present invention;

[0035] Figure 5 This is the model prediction comparison result from January 2023 to December 2024 in Example 1 of the present invention. DETAILED DESCRIPTION

[0036] The technical solutions in the embodiments of the present invention are described clearly and completely below. Many specific details are set forth in the following description to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the scope of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.

[0037] The present invention provides an improved method for early warning of typical laying hen diseases based on a time series prediction model, comprising the following steps:

[0038] Step S1, data collection and preprocessing: collect sample data (including typical laying hen disease data and other characteristic data closely related to laying hen diseases), and perform normalization on the sample data. The normalization formula is as follows:

[0039]

[0040] Among them, y i is the normalized result, x i is the sample data, max is the maximum value of the original sample data sequence (i.e. the maximum value in the corresponding sample data), and min is the minimum value of the original sample data sequence (i.e. the minimum value in the corresponding sample data);

[0041] Step S2: Aggregate the normalized data of the same type of sample data at different times into a time series to obtain the time series of sample data of different types; input the time series of sample data of different types into the Seq2Seq model, and the Seq2Seq model outputs disease prediction data;

[0042] Step S3: Perform an inverse proportional transformation on the disease prediction data output by the Seq2Seq model to obtain the final predicted number of disease incidences in a certain future time series.

[0043] The present invention introduces a multivariate time series prediction model, uses the number of typical laying hen disease incidences, laying hen inventory, and temperature and humidity in historical months as characteristic variables for predicting future laying hen disease incidences, constructs a multidimensional vector, and sends a multidimensional time series input sequence composed of the multidimensional vector to the encoder end for multivariate time series prediction.

[0044] Example 1 A typical laying hen disease early warning method based on an improved time series prediction model

[0045] As described above, this embodiment is a specific process and result of a typical laying hen disease early warning method based on an improved time series prediction model. Disease prediction is performed based on a multivariate time series prediction model, specifically including the following steps:

[0046] Step S1: Data collection and preprocessing

[0047] Three types of sample data were collected, namely, typical laying hen disease data, laying hen inventory data, and temperature and humidity data of the corresponding regions, as follows:

[0048] The dataset used in this algorithm includes typical laying hen disease data (including the number and time of typical laying hen disease outbreaks), laying hen inventory data, and temperature and humidity data of the corresponding regions from 220 laying hen farmers / farms in China from January 2010 to January 2025. Among them, the laying hen farmer / farm disease data and laying hen inventory data are from the disease management platform established within the company for laying hen farms nationwide, and the data are collected regularly every month; the temperature and humidity data of the corresponding regions are from the National Meteorological Information Center. Among them, Figure 1 It shows the typical laying hen disease data of a domestic laying hen farm from January 2023 to December 2024. Figure 2It shows the laying hen inventory data of the laying hen farm from January 2023 to December 2024. Figure 3 The temperature and humidity data of the area where the farm is located for the corresponding time period are displayed.

[0049] Layer inventory data was selected as an auxiliary feature for predicting laying hen diseases because it directly reflects the scale of the farm. A larger inventory often indicates a higher risk of disease transmission, and therefore, inventory is closely related to disease occurrence. Temperature and humidity are key environmental factors that affect laying hen health and the survival of environmental pathogens. For example, high temperatures and high humidity can easily promote the reproduction and spread of pathogens (such as bacteria and viruses), while also potentially reducing the immunity of laying hens and increasing the risk of disease outbreaks. These three sets of data are all closely related to the occurrence of laying hen diseases, and therefore were selected as auxiliary features for predicting laying hen diseases.

[0050] Then the four sets of sample data collected are normalized to their maximum and minimum values, and the sample data sequences x1, x2, ..., x are normalized using the conversion function. n Perform the mapping operation, and the normalized data falls within the interval [0,1], where the conversion function is:

[0051]

[0052] Among them, y i is the normalized result, x i is the sample data, max is the maximum value of the original sequence (i.e., the maximum value in the corresponding sample data), and min is the minimum value of the original sequence (i.e., the minimum value in the corresponding sample data). After the sample data is normalized, it is used as the input of the prediction model for modeling.

[0053] The output of the Seq2Seq model is also normalized data, so the output of the Seq2Seq model needs to be inversely proportionally transformed to obtain the output value corresponding to the original data. The inverse function of the transformation function is used in the inverse transformation, and the formula is as follows:

[0054]

[0055] in, is the output of the prediction model, The output value corresponding to the original data is obtained by inversely converting the output result of the prediction model, that is, the final predicted value required.

[0056] In the present invention, by normalizing the four groups of sample data, the following purposes can be achieved: In machine learning modeling, the numerical ranges of different features may vary greatly (such as disease data between 100 and 400, and temperature between -12°C and 22°C). If normalization is not performed, the model may be biased towards features with larger values, resulting in unstable training or difficulty in convergence. The present invention can eliminate the dimensional effect through normalization (making all features at the same scale to avoid certain features dominating model training due to their large values) and accelerate the optimization process (optimization algorithms such as gradient descent converge faster on normalized data because the parameter update direction is more balanced); the present invention chooses Min-Max normalization for the laying hen disease prediction scenario for the following reasons:

[0057] Applicability: Min-Max assumes that the data has no obvious outliers and has clear boundaries (such as temperature and humidity have clear physical ranges). In this dataset:

[0058] Temperature range: -12℃~22℃ (fixed meteorological range).

[0059] Epidemic data: 175-447 (no extreme outliers).

[0060] Compared with other normalization methods, the normalization method of the present invention has the advantages of Z-Score normalization (more suitable for data with Gaussian distribution or outliers, and the present data has no obvious long-tail distribution) and Robust Scaling (suitable for data with outliers, but the present data does not require such robustness).

[0061] The data set is divided into:

[0062] After completing the normalization process on the four types of sample data, the present invention further performs a division operation on the data set.

[0063] Specifically, the normalized data is divided into a training set and a test set in chronological order, with a ratio of 7:3. This means that 70% of the sample data serves as the training set for building and fitting the model, while the remaining 30% serves as the test set for evaluating the model's generalization ability on unseen data. The training set is primarily used for optimizing model parameters and updating weights, while the test set is used to measure the model's performance on prediction tasks. This allows for effective model selection and early stopping strategies during training to prevent overfitting.

[0064] In the time series prediction task of this invention, considering the strong temporal dependence and non-stationarity of time series, the division of training and test sets strictly follows the chronological order rather than random sampling, ensuring that the model evaluation process truly simulates the actual scenario of future trend prediction. Specifically, the total sample data sequence length is set to T, of which the first 70% (i.e., the first 0.7T time steps) is used as the training sequence, and the remaining 30% (the last 0.3T time steps) is used as the test sequence. This ensures that the model can only "see" past data during training, and simulates "future data" for prediction evaluation during the testing phase.

[0065] The data set division in this step not only ensures the rigor of model training, but also provides a basis for model performance evaluation in subsequent steps (such as RMSE, MAE, R 2 It provides a standardized and repeatable evaluation basis, which helps to more objectively compare the actual effects of different models in laying hen disease prediction tasks.

[0066] S2. Aggregate the normalized data of the same type of sample data at different times into a time series to obtain the time series of sample data of different types; input the time series of sample data of different types into the Seq2Seq model, and the Seq2Seq model outputs disease prediction data;

[0067] Figure 4 This is a multi-step time series prediction model for laying hen diseases based on the Seq2Seq model of the present invention.

[0068] Take the time series of laying hen disease data as an example (hereinafter referred to as “laying hen disease time series”), Figure 4 As shown, based on the input laying hen disease time series Y = [y t-w ,...,y t-2 ,y t-1 ], the Seq2Seq model outputs the predicted k-step time series The Seq2Seq model uses an LSTM neural network to implement the decoder and encoder: the laying hen disease time series Y is encoded into a hidden state by the encoder and passed forward by the LSTM unit of the encoder.

[0069] For the first LSTM unit, its hidden state is generally set to an all-zero vector. The vector dimension is determined by the model parameter units and is consistent with the hidden state vector dimension of subsequent LSTM units.

[0070] The current hidden state h after the first LSTM unit t-1 The hidden state h of the previous LSTM unit t-2 and the current model input y t-1 Joint decision, i.e. h t-1 =LSTMencoder (h t-2 ,y t-1 ).

[0071] Afterwards, the Seq2Seq model transforms the hidden state of each input time step of the time series Y into a context vector through a custom function q. Specifically, the custom function q takes the last hidden state from the encoded w hidden state vectors h as the output context vector C. That is, the present invention directly uses the last hidden state of the encoder as the context vector C and uses it for the decoding operation, as shown in the following formula:

[0072] C=q(h t-w ,...,h t-2 ,h t-1 )=h t-1

[0073] In the encoder of the Seq2Seq model, the LSTM unit at each time step outputs a hidden state to capture the context information of the time series Y at that time step. t-w ,...,y t-2 ,y t-1 ] contains a total of w time steps, and the encoder will generate w hidden states in sequence: [h t-w ,...,h t-2 ,h t-1 ].

[0074] The decoder transforms the context vector C, the hidden state S of the previous time step into the context vector C at each decoding time step. t and the output y' of the previous time step t-1 Transformed into the hidden state of the current time step. In the decoding part, the updated state of the LSTM unit is as follows:

[0075] S t =LSTM decoder (S t-1 ,y' t-1 ,C)

[0076] The first hidden state S of the decoder t The hidden state S of the previous time step t-1 is the last hidden state h of the encoder t-1 Directly transmitted, that is, S t-1 =h t-1 .

[0077] Among them, S t-1 represents the hidden state of the decoder at the previous time step; y' t-1Represents the output of the previous time step; in order to avoid the cumulative error caused by the network not converging during training, the input y' of the previous time step t-1 corresponding to the first time step t of the decoder LSTM unit t-1 That is, the real input value y of the time series Y corresponding to the previous time step t-1 , that is, y' t-1 =y t-1 In the verification and testing phases, since the true value of the predicted value is unknown, the input (y' t ,……,y' t+k-2 ) The input table after is the predicted value of the previous time step like Figure 4 As shown, the input y' of the second time step t is the predicted value at the previous time step, i.e., time t-1 The input y' of the third time step t+1 is the predicted value at the previous time step, i.e. time t And so on.

[0078] Finally, the decoder's hidden state S at time step t is t Output the final prediction value of time step t through the fully connected layer That is, the Seq2Seq model outputs disease prediction data:

[0079]

[0080] Among them, W s is the weight matrix, b s is the bias term, and σ is the activation function.

[0081] Step S3: Perform an inverse proportional transformation on the disease prediction data output by the Seq2Seq model to obtain the final predicted number of disease incidences in a certain future time series.

[0082] The output of the Seq2Seq model is also normalized data, so the output of the prediction model needs to be inversely proportionally transformed to obtain the output value corresponding to the original data. The inverse function of the transformation function is used in the inverse transformation, and the formula is as follows:

[0083]

[0084] in, is the output of the prediction model, The output value corresponding to the original data is obtained by inversely converting the output result of the prediction model, that is, the final predicted value required.

[0085] In the present invention, when predicting disease data in step S2, either univariate time series prediction or multivariate time series prediction can be used.

[0086] First method: univariate time series forecasting

[0087] First, we take the time series of typical laying hen disease incidence in a certain area as the research object and conduct a one-dimensional typical laying hen disease time series prediction analysis. That is, without considering other characteristic variables of the above data set, we only use the normalized historical w-month laying hen disease incidence number Y = [y t-w ,...,y t-2 ,y t-1 ] T ∈R w Predict the number of laying hen diseases in the region in the next k months, and output It is also normalized disease prediction data (needs to be inversely proportionally transformed), and its mathematical expression is shown as follows:

[0088]

[0089] Here, "k" represents the prediction up to the kth month in the future, i.e., the prediction window is k; w represents the data covering w months of history, i.e., the observation window is w. F(·) represents the Seq2Seq prediction model used. During the prediction process, the input sequence is a normalized time series of laying hen disease data from the previous eight months, and the prediction of laying hen disease incidence data for the next six months is made. The structure and hyperparameter settings of the Seq2Seq multi-step prediction model based on the encoder-decoder architecture are shown in the following table:

[0090] Table 1 Seq2Seq model structure and hyperparameter settings

[0091]

[0092] Parameter selection based on:

[0093] 1) LSTM encoding layer:

[0094] The basis for setting units=100 is:

[0095] Empirical choice: In medium-scale time series prediction (input sequence length 8, output 6), 100 neurons can balance model complexity and computational cost.

[0096] Fewer (such as 50) may lead to underfitting and fail to fully learn the sequence patterns.

[0097] A larger number (such as 200) may lead to overfitting, especially when the amount of training data is limited.

[0098] 2) Parameter scale verification:

[0099] LSTM parameters in the encoding layer = 4 × (input_dim + units + bias) × units = 4 × (1 + 100) × 100 = 40,800 (same as in the table);

[0100] The number of LSTM parameters in the decoding layer = 4 × (input_dim + units + bias) × units = 4 × (100 + 100) × 100 = 80,400 (same as in the table).

[0101] Where input_dim is the input feature dimension. In the unary time series model, the input feature of the encoding layer is the epidemic data, with a dimension of 1. The input of the decoding layer is the output of the encoder, with a dimension of 100. units is the number of neurons, 100. bias is the bias term, with a parameter value of 1.

[0102] 2) RepeatVector layer (n=6)

[0103] This corresponds directly to the prediction window size (6 months into the future), ensuring that the decoder incrementally generates predictions for 6 time steps.

[0104] 3) TimeDistributed (Dense) layer

[0105] (1) Function

[0106] A fully connected layer is applied to each time-step output of the decoder LSTM, mapping it to the target dimension (1 output value / month).

[0107] (2) Selection basis

[0108] Time-step prediction: TimeDistributed ensures that each prediction time step is calculated independently to avoid information confusion.

[0109] 4) Loss function (MSE)

[0110] (1) Reasons for choosing MSE (mean square error)

[0111] Standard loss for regression tasks: MSE penalizes large errors more severely and is suitable for epidemic quantity prediction (extreme prediction bias needs to be avoided).

[0112] Compared with other loss functions:

[0113] MAE (mean absolute error) is more robust to outliers, but there are no significant outliers in this data.

[0114] Huber Loss combines MSE / MAE, but increases the complexity of hyperparameter tuning.

[0115] The output layer does not require an activation function (linear by default) because the MSE loss function is suitable for regression tasks.

[0116] 5) Batch size (batch_size=64)

[0117] (1) Selection basis

[0118] Training efficiency and stability trade-off:

[0119] Smaller batch size (e.g. 16): Gradient updates are more frequent, but the noise is greater and convergence is slower.

[0120] Larger batch size (e.g., 128): High memory usage and may lead to falling into local optimality.

[0121] Empirical choice: 64 is a common value in deep learning and is suitable for medium-sized datasets.

[0122] 6) Number of training steps (epochs = 150)

[0123] Early Stopping Verification:

[0124] If the test set loss does not decrease after 50 rounds, training can be terminated early.

[0125] 150 rounds is the safety limit to ensure adequate training.

[0126] Too few (such as 50) may lead to underfitting, and too many (such as 300) may lead to overfitting.

[0127] 7) Optimization function (Adam)

[0128] Adaptive learning rate: Combining the advantages of momentum and RMSProp, it is suitable for non-stationary targets (epidemic data may fluctuate suddenly).

[0129] Compared with other optimizers:

[0130] SGD: The learning rate needs to be adjusted manually and convergence is slow.

[0131] RMSProp: performs well on cyclic data, but is sensitive to hyperparameters.

[0132] In the model, the input sequence is first processed by the encoder, which compresses the entire sequence into a fixed-dimensional context vector. This context vector is then passed to the decoder, which gradually generates the output sequence based on this vector. Specifically:

[0133] LSTM Encoder Layer: The encoder layer uses an LSTM layer with 100 hidden units. It processes the input time series step by step and outputs a context vector that contains all the information about the input sequence. In this model, the encoder has 40,800 parameters, which represents the number of trainable parameters in this layer.

[0134] RepeatVector layer: The encoder's output is typically a fixed-length vector, while the decoder needs to generate multiple outputs step by step. Therefore, the encoder's output vector is repeated six times through the RepeatVector layer to ensure that there is input at each time step. Its function is to convert a fixed-dimensional vector into a format suitable for the number of decoder time steps.

[0135] LSTM Decoder Layer: The decoder is also an LSTM layer with 100 hidden units and 80,400 parameters. The decoder generates a new output at each time step based on the output of the previous time step and the context vector.

[0136] TimeDistributed layer: This is an encapsulation layer that processes the output of each time step at each time step. Here, it is used to apply a Dense layer to each time step of the decoder to generate the final output.

[0137] Loss function: The mean square error (MSE) is used as the loss function to measure the difference between the predicted results and the true labels.

[0138] Optimization function: The model is trained using the Adam optimizer, which is an efficient optimization algorithm that can adaptively adjust the learning rate and help accelerate convergence.

[0139] Training configuration: The model's batch size is 64, meaning that at each training iteration, the model uses 64 samples for parameter updates. The training process proceeds for 150 iterations, with each iteration updating the model's parameters to minimize the loss function.

[0140] Evaluation indicators: The following three model evaluation indicators were used to evaluate the prediction ability of the laying hen disease time series prediction model: root mean square error (RMSE), coefficient of determination (R 2 ) and mean absolute error (MAE).

[0141] By collecting sample data and performing data preprocessing, the processed data is divided into training set and test set in a ratio of 7:3. The model is trained and saved using the training set data, and the prediction effect is verified using the test set.

[0142] The present invention adopts an early stopping mechanism, that is, when the performance on the validation set no longer improves within a few rounds, the training is automatically stopped to prevent the model from continuing to overfit on the training set.

[0143] Among them, the univariate time series prediction model training is as follows:

[0144] Table 2. List of training of univariate time series prediction model

[0145]

[0146]

[0147] Among them, D batch Indicates that from the training set D train A small batch of samples divided by batch size (batch size = 64) is used for the forward propagation and back propagation update of the model parameters. If the total number of training samples is 10000 and the batch size is 64, then each iteration D batch For a subset of 64 X, Y pairs, a training parameter update is performed; after one epoch is completed, the model will complete the traversal of all 10,000 samples.

[0148] The second method: multivariate time series forecasting model

[0149] Based on the univariate time series prediction model, the present invention further introduces a multivariate time series prediction model, and adds laying hen inventory data and temperature and humidity data of the corresponding region to the Seq2Seq model as characteristic variables for predicting the future incidence of laying hen diseases. The mathematical expression is as follows:

[0150]

[0151] Among them, I=[i t-1 ,i t-2 ,...,i t-w ]∈R w represents the normalized time series of laying hen inventory data for the region in the historical w months (hereinafter referred to as “laying hen inventory time series”). represents the normalized time series of temperature data for the region over w months in history (hereinafter referred to as “temperature time series”). represents the normalized time series of humidity data for the region over the past w months (hereinafter referred to as the "humidity time series"). F(·) represents the Seq2Seq prediction model used. The prediction model used in this step is the same as that used in step S2 above. The only difference is that the input sequences used in the prediction are the time series of laying hen diseases, laying hen inventory, temperature, and humidity for the previous eight months, and the next six months of laying hen disease incidence data are predicted.

[0152] That is, the original input consists of only the laying hen disease time series Y = [y t-1 ,y t-2 ,...,y t-w ] is expanded into a vector sequence containing multiple features: For each time step tj (j = 1, ..., w), construct the input feature vector:

[0153]

[0154] This set of multidimensional vectors forms the input sequence:

[0155] Q=[q t-1 ,q t-2 ,...,q t-w ]∈R w×4

[0156] That is, the number of laying hen disease incidences and the four auxiliary vectors are spliced ​​into a multi-dimensional time series input and sent to the encoder end.

[0157] In order to effectively integrate multi-source features, the original Seq2Seq model has been expanded in terms of input structure. Specifically, the model originally received a univariate time series (i.e., each time step contains only one dimension, namely, the number of disease cases). After adding auxiliary features, the input structure is adjusted to a multivariate time series: multiple features of each time step (including the number of disease cases, livestock inventory, temperature, and humidity) are concatenated into a four-dimensional vector, forming a two-dimensional input matrix Q∈R w×4 The model does not need to modify the original encoder structure during training. It only needs to set the encoder input dimension to 4 to process the four-dimensional input vector at each time step.

[0158] The multivariate time series prediction model is also a Seq2Seq model, that is, the model is as follows Figure 4As shown, the experimental parameters are consistent with those for univariate time series prediction, with only the input variables differing. This means that both univariate and multivariate time series predictions use the Seq2Seq model, differing only in the feature dimensions of the input models. The Seq2Seq model uses an LSTM encoder, which supports variable-dimensional input. This means it can encode input features y of varying dimensions into hidden state features h of the same dimension. This is related solely to the model's parameter settings and not to the model structure.

[0159] Multivariate time series forecasting model training:

[0160] Table 3. List of multivariate time series prediction model training

[0161]

[0162]

[0163] To further evaluate the performance of various prediction models, we selected a traditional LSTM model for comparison. LSTM (Long Short-Term Memory) is a widely used model for time series prediction, effectively capturing long-term dependencies. Therefore, the LSTM model was used as a baseline model for comparison with the Seq2Seq model to verify the advantages of Seq2Seq in processing laying hen disease data with multivariate features and complex temporal dependencies.

[0164] In the experiment, the structure of the LSTM model is set as follows:

[0165] LSTM layer: Use 100 hidden units and add appropriate dropout layers to prevent overfitting.

[0166] Loss function: Same as the Seq2Seq model, using mean squared error (MSE).

[0167] Optimizer: Adam optimizer is used.

[0168] Training configuration: The batch size is set to 64 and the number of training steps is 150. The comparative experimental results are shown in Table 4 and Figure 5 As shown:

[0169] Table 4 Comparison of model prediction results

[0170]

[0171]

[0172] Among them, the root mean square error (RMSE), the coefficient of determination (R 2) and mean absolute error (MAE) do not have a standardized value. In the design of this algorithm, the evaluation indicators of the LSTM model are used as the benchmark comparison value. If the evaluation indicators of this algorithm are improved on the basis of the benchmark comparison value, it means that the performance of this algorithm is better.

[0173] MAE measures the average of the absolute differences between predicted and true values. Smaller values ​​indicate more accurate predictions. Seq2Seq's MAE is lower than LSTM's at all step sizes, and the gap widens as the prediction step size increases, indicating that Seq2Seq is more stable for long sequence predictions.

[0174] RMSE is the square root of the mean of the squared errors, focusing on predictions with large deviations. The improvement in RMSE is consistent with that in MAE, demonstrating that Seq2Seq is more robust in error control, particularly when predicting over long timeframes, where it can better avoid significant deviations.

[0175] R 2 A measure of model fit, the closer the value is to 1, the better. 2 The improvement is most obvious, especially for long prediction steps (3 to 6 weeks), indicating that it is more effective in modeling long-term dependencies and sequence structures.

[0176] Comparison results show that the Seq2Seq model's predictive performance metrics are significantly better than those of the LSTM model. This is because both the model's encoder and decoder utilize the LSTM network, which possesses "memory" capabilities, fully demonstrating its advantages in time series forecasting. To support multi-step forecasts of varying lengths, the LSTM forecasting model typically outputs an n-dimensional vector (i.e., the n time steps to be predicted) immediately after the LSTM network outputs its hidden state. Therefore, the prediction results for each time step in this n-dimensional vector are completely independent. The Seq2Seq model, through its encoder and decoder structures, fully considers the sequential dependencies between multiple time steps in the forecast sequence, resulting in superior prediction results for multi-step forecasts.

[0177] Table 4 compares the evaluation metrics of multivariate and univariate time series prediction models. "Mul-Seq2Seq" represents a multivariate Seq2Seq prediction model that uses historical laying hen disease data, laying hen inventory data, and temperature and humidity data for the region as input. "Seq2Seq" represents a univariate Seq2Seq prediction model that uses only the single-dimensional laying hen disease data as input. During model training, the multivariate prediction model that incorporates auxiliary features achieves faster loss function convergence and is able to learn sequence features more quickly. Comparing the prediction results of the two models, the prediction capabilities of both models are significantly improved when the prediction step length does not exceed six months.

[0178] Comparing the mean absolute error (MAE), Mul-Seq2Seq has a lower MAE than Seq2Seq in all aspects, indicating that it has a stable advantage in accuracy, especially in the period of 1 to 4 weeks, which means that it more effectively reduces the accumulation of gradual prediction errors.

[0179] Comparing the root mean square error (RMSE), Mul-Seq2Seq also outperforms Seq2Seq in controlling large errors. The RMSE reduction reaches more than 2.6% under all step sizes, showing stronger robustness.

[0180] Coefficient of determination (R 2 ), Mul-Seq2Seq significantly improves the model fitting ability, especially in long prediction steps (4 weeks and 6 weeks), indicating that it is better at capturing long-term dependencies.

[0181] Figure 5 The results of using two trained sequence prediction models (Seq2Seq and Multi-Seq2Seq) to predict the number of poultry diseases from January 2023 to December 2024 are shown. The blue curve represents the actual number of diseases, and the orange and gray curves represent the predicted values ​​of the Seq2Seq model and the Mul-Seq2Seq model, respectively. In the prediction process, the actual disease data of the previous 8 months are used as input each time to predict the number of epidemics for the next 6 consecutive months. This sliding window prediction method covers the entire period from 2023 to 2024, and is finally spliced ​​into a complete prediction sequence. From Figure 5 As can be seen from the figure, the overall trends of the two models are relatively close to the true values, with particularly strong performance in the second half of 2024. The Mul-Seq2Seq model (gray) is closer to the true values ​​at several peak points (such as March 2024, June 2024, and December 2024), consistent with its superior performance. The Seq2Seq model (orange) can better capture the seasonal variations in disease numbers, but it lags slightly or has larger deviations in some areas of significant fluctuation.

[0182] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention, and should all be included in the scope of protection of the present invention.

Claims

1. A typical laying hen disease early warning method based on an improved time series prediction model, characterized in that: include: Step S1: first collect sample data and normalize the sample data; Step S2: Aggregate the normalized data of the same type of sample data at different times into a time series to obtain the time series of sample data of different types; input the time series of sample data of different types into the Seq2Seq model, and the Seq2Seq model outputs disease prediction data; The Seq2Seq model uses an LSTM neural network to implement its decoder and encoder. The encoder encodes the laying hen disease time series Y into hidden states, which are passed forward by the encoder's LSTM unit. The Seq2Seq model then transforms the hidden states of each input time step of time series Y into context vectors using a custom function q. In the Seq2Seq model's encoder, the LSTM unit at each time step outputs a hidden state that captures the contextual information of time series Y at that time step. The decoder transforms the context vector C, the hidden state S of the previous time step into the context vector C at each decoding time step. t and the output y of the previous time step, t-1 Transformed into the hidden state of the current time step; Finally, the hidden state S of the decoder at time step t t Output the final prediction value of time step t through the fully connected layer Step S3: Perform an inverse proportional transformation on the disease prediction data output by the Seq2Seq model to obtain the final predicted number of disease incidences in a certain future time series.

2. The typical laying hen disease early warning method based on the improved time series prediction model according to claim 1 is characterized in that: The typical laying hen disease early warning method comprises the following specific steps: Step S1: collecting laying hen disease data as characteristic data closely related to laying hen disease occurrence, and normalizing the collected laying hen disease data; Step S2: Aggregate the normalized data of laying hen disease data at different times into a time series to obtain a laying hen disease time series; input the laying hen disease time series into a Seq2Seq model, and the Seq2Seq model outputs disease prediction data; Step S3: Perform an inverse proportional transformation on the disease prediction data output by the Seq2Seq model to obtain the final predicted number of disease incidences in a certain future time series.

3. The typical laying hen disease early warning method based on the improved time series prediction model according to claim 1 or 2, characterized in that: Normalization is to normalize the maximum and minimum values ​​of the collected sample data, and use the conversion function to normalize the sample data sequence x1, x2, ..., x n After mapping, the normalized data falls within the range [0,1], where the normalization formula is: Among them, y i is the normalized result, x i is the sample data, max is the maximum value of the original sample data sequence, and min is the minimum value of the original sample data sequence.

4. The typical laying hen disease early warning method based on the improved time series prediction model according to claim 1 or 2, characterized in that: In step S1, the sample data collected include laying hen disease data, laying hen inventory data, temperature data of the corresponding area, and humidity data of the corresponding area.

5. The typical laying hen disease early warning method based on the improved time series prediction model according to claim 1 or 2, characterized in that: The step S2 comprises: Step S21: normalizing the laying hen disease data, laying hen inventory data, temperature data of the corresponding region, and humidity data of the corresponding region to obtain laying hen disease time series, laying hen inventory time series, temperature time series, and humidity time series, respectively; Step S22: The laying hen disease time series, laying hen inventory time series, temperature time series, and humidity time series are input into the Seq2Seq model, and the Seq2Seq model outputs disease prediction data.

6. The typical laying hen disease early warning method based on the improved time series prediction model according to claim 5 is characterized in that: In step S22, when the laying hen disease time series, laying hen inventory time series, temperature time series and humidity time series are input into the Seq2Seq model: For any time step in each time series, the data of the corresponding time step in the laying hen disease time series, laying hen inventory time series, temperature time series and humidity time series are taken to obtain an input feature vector at the corresponding time step; the input feature vectors corresponding to all time steps in the time series are combined into an input sequence, which is used as the final input time series of the Seq2Seq model.