Fish feed feeding amount prediction optimization method and related device
By combining SARIMAX and LSTM models, the seasonal and nonlinear characteristics in the time series data of fish feed feeding volume are solved, and the accuracy of the existing prediction model in complex environments is achieved, and higher prediction accuracy and model performance are achieved.
Patent Information
- Application Number
- CN202411738557.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-28
- Publication Date
- 2025-04-01
AI Technical Summary
The existing fish feed feeding prediction model lacks prediction accuracy in complex and variable environments, especially in dealing with complex nonlinear relationships and small sample data.
Fish feed feed volume prediction was performed using a method combining SARIMAX and LSTM models. The SARIMAX model is used to process seasonal and trending characteristics in time series data, while the LSTM model is used to capture nonlinear relationships in the data. The prediction results are combined by residual method and weighted summing method, and the performance is evaluated using the scoring model to determine the optimal prediction model.
In a complex and changeable environment, the accuracy of fish feed feed volume prediction is significantly improved, the overall performance of the prediction model is improved, and the interpretability of the model is improved by introducing attention mechanisms.
Smart Images

Figure CN119740201A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the technical field of automated breeding, and in particular to a method for predicting and optimizing the feeding amount of fish feed and a related device. Background Art
[0002] With the rapid development of the global aquaculture industry, how to manage fish feeding efficiently and accurately has become one of the key issues in improving aquaculture benefits. Traditional feeding methods mainly rely on manual experience, often lack scientific basis, and easily lead to feed waste or fish malnutrition, thus affecting aquaculture production and economic benefits. In order to meet these challenges, in recent years, intelligent feeding models based on mathematical models have gradually attracted attention. These models use environmental data and fish behavior data to predict the appropriate feeding amount and implement feeding through automated equipment.
[0003] Most of the existing feeding models rely on machine learning and statistical methods, such as random forest regression, generalized linear models and neural networks, but they still have some shortcomings. For example, the model based on random forest regression is not effective when dealing with complex nonlinear relationships and small sample data, and the prediction accuracy may be limited when facing sudden changes. Based on this, how to improve the prediction accuracy of fish feed feeding amount in a complex and changing environment has become a technical problem that needs to be solved urgently. Summary of the invention
[0004] The embodiment of the present invention provides a method and related device for predicting and optimizing the feeding amount of fish feed, which can improve the prediction accuracy of the feeding amount of fish feed and enhance the overall performance of the prediction model in a complex and changeable environment.
[0005] In a first aspect, an embodiment of the present invention provides a method for predicting and optimizing the feeding amount of fish feed, comprising:
[0006] Acquiring time series data, the time series data including water temperature, dissolved oxygen level in water, light intensity, turbidity and average weight of fish under different feeding environments and times;
[0007] The time series data are respectively input into a pre-built SARIMAX model and an LSTM model based on an attention mechanism to predict the feeding amount of fish feed, wherein the SARIMAX model is used to process seasonal characteristics and trend characteristics in the time series data, and the LSTM model based on the attention mechanism is used to capture the nonlinear relationship in the time series data. Then, the SARIMAX model and the LSTM model based on the attention mechanism are inserted into the residual method and the weighted sum method to calculate the first prediction result and the second prediction result, wherein the first prediction result is calculated based on the residual method, and the second prediction result is calculated based on the weighted sum method;
[0008] Use the scoring model to evaluate the performance of the residual method and the weighted sum method, and obtain the corresponding scoring results;
[0009] An optimal target prediction model is determined according to the scoring result, and the target prediction model is used to predict the feeding amount of fish feed.
[0010] In some embodiments, after acquiring the time series data, the method further includes:
[0011] Performing a white noise test and a stationarity test on the time series data to obtain a test result;
[0012] When the test result shows that the time series data is not white noise and the time series data sequence is stable, the SARIMAX model is constructed.
[0013] In some embodiments, the method further comprises:
[0014] When the test result shows that the time series data is not white noise and the time series data sequence is not stable, the time series data is differentially processed until the time series data sequence is stable, and then the SARIMAX model is constructed.
[0015] In some embodiments, the method for constructing the SARIMAX model includes:
[0016] Analyze the autocorrelation function graph and partial autocorrelation function graph of the time series data to determine the autoregressive order, the difference order and the sliding average order;
[0017] Determining a model structure of a SARIMAX model according to the autoregressive order, the difference order, and the moving average order;
[0018] Using test data to predict the SARIMAX model to obtain an error index, wherein the test data includes a training set and a test set, the training set is used for model training, and the test set is used for model testing;
[0019] Determining optimal SARI MAX model parameters according to the error index and grid search method;
[0020] The SARIMAX model is constructed based on the SARIMAX model parameters.
[0021] In some embodiments, the method for constructing the LSTM model based on the attention mechanism includes:
[0022] Designing a long short-term memory neural network model including three LSTM layers, wherein the LSTM layers are used to extract sequence features from the time series data;
[0023] Adding a fully connected layer after the three LSTM layers, wherein the fully connected layer is used to map the sequence features into a single value for predicting the feeding amount;
[0024] Calculate the attention weight of each time step through the fully connected layer;
[0025] Normalize the attention weights to a probability distribution using a Softmax activation function;
[0026] The output of the LSTM layer is weighted and summed using the normalized attention weights to generate a weighted context vector;
[0027] The weighted context vector is combined with the output of the LSTM layer to further extract features to obtain the final prediction result;
[0028] The long short-term memory neural network model is trained using the training data. During the training process, the mean square error is used as the loss function, and the Adam optimizer is selected. The initial learning rate is set to a preset value, and the hyperparameters are adjusted using a grid search or a random search until the optimal LSTM model parameters are obtained;
[0029] The LSTM model based on the attention mechanism is constructed based on the LSTM model parameters.
[0030] In some embodiments, the first prediction result is calculated based on a residual method, including:
[0031] Calculating the residual sequence of the SARIMAX model according to the prediction result and the actual value of the SARIMAX model;
[0032] Processing the nonlinear part of the residual sequence through the LSTM model based on the attention mechanism to predict the correction value of the nonlinear part;
[0033] Adding the prediction result of the SARIMAX model and the correction value of the nonlinear part to obtain the first prediction result;
[0034] The second prediction result is calculated based on a weighted summation method, including:
[0035] The model weights of the SARIMAX model and the LSTM model based on the attention mechanism are calculated using the inverse error method;
[0036] The predicted value of the SARIMAX model and the predicted value of the LSTM model based on the attention mechanism are respectively multiplied by the model weight to obtain the second prediction result.
[0037] In some embodiments, the method further comprises:
[0038] Construct a scoring model based on preset evaluation indicators;
[0039] Scoring the first prediction result and the second prediction result according to the scoring model;
[0040] A prediction value with a higher score is selected from the first prediction result and the second prediction result as the final fish feed feeding amount prediction value.
[0041] In a second aspect, an embodiment of the present invention further provides a device for predicting and optimizing the amount of fish feed fed, the device comprising:
[0042] An acquisition module is used to acquire time series data, wherein the time series data includes water temperature, dissolved oxygen level in water, light intensity, turbidity and average weight of fish under different feeding environments and times;
[0043] A prediction module, used for inputting the time series data into a pre-built SARIMAX model and an LSTM model based on an attention mechanism respectively to predict the feeding amount of fish feed, wherein the SARIMAX model is used to process the seasonal characteristics and trend characteristics in the time series data, and the LSTM model based on the attention mechanism is used to capture the nonlinear relationship in the time series data, and then the SARIMAX model and the LSTM model based on the attention mechanism are inserted into the residual method and the weighted sum method to calculate the first prediction result and the second prediction result, wherein the first prediction result is calculated based on the residual method, and the second prediction result is calculated based on the weighted sum method;
[0044] An evaluation module is used to evaluate the performance of the residual method and the weighted sum method using a scoring model and obtain corresponding scoring results;
[0045] The optimization module is used to determine the optimal target prediction model according to the scoring result, and the target prediction model is used to predict the feeding amount of fish feed.
[0046] In a third aspect, an embodiment of the present invention further provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method for predicting and optimizing the feeding amount of fish feed as described in the first aspect is implemented.
[0047] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are used to execute the method for predicting and optimizing the feeding amount of fish feed as described in the first aspect.
[0048] According to the fish feed feeding amount prediction optimization method and related device provided by the embodiment of the present invention, the fish feed feeding amount prediction optimization method includes: obtaining time series data, the time series data includes water temperature, dissolved oxygen level in water, light intensity, turbidity and average weight of fish under different feeding environments and times; inputting the time series data into a pre-built SARIMAX model and an LSTM model based on an attention mechanism to predict the fish feed feeding amount, and obtaining a first prediction result and a second prediction result, wherein the SARIMAX model is used to process seasonal characteristics and trend characteristics in the time series data, and the LSTM model based on the attention mechanism is used to capture the nonlinear relationship in the time series data; then, the SARIMAX model and the LSTM model based on the attention mechanism are inserted into the residual method and the weighted summation method to calculate the first prediction result and the second prediction result, the first prediction result is calculated based on the residual method, and the second prediction result is calculated based on the weighted summation method; using a scoring model to evaluate the performance of the residual method and the weighted summation method, and obtaining corresponding scoring results; determining the optimal target prediction model according to the scoring results, and the target prediction model is used to predict the fish feed feeding amount. First, the SARIMAX model can effectively process the seasonal and trend components in time series data and optimize the prediction ability of the model. For data with seasonal characteristics such as feed feeding amount, SARIMAX can accurately capture periodic changes and provide reliable baseline predictions. Secondly, the LSTM neural network can deeply explore the complex nonlinear relationships in the data through its unique structure, especially when processing long time series data, which can significantly improve the prediction accuracy. Compared with the existing random forest regression model, LSTM can better adapt to nonlinear patterns and improve the overall performance of the model. The present invention also introduces an attention mechanism, which can automatically identify the features that have the greatest impact on the prediction results, thereby improving the interpretability of the model. This not only solves the transparency problem of the traditional black box model, but also makes the decision-making process of the model more understandable. In summary, the present invention combines the advantages of SARIMAX and LSTM models, uses SARIMAX to process trend and seasonal components, LSTM captures complex nonlinear patterns, and introduces an attention mechanism to automatically identify the most important input features for the prediction results, thereby further improving the accuracy and interpretability of the prediction. The cross-validation evaluation method is adopted, which not only reduces the risk of overfitting, but also ensures the stability and reliability of the model on different data subsets. Based on this, the embodiments of the present invention can improve the prediction accuracy of fish feed feeding amount in a complex and changeable environment and enhance the overall performance of the prediction model. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Figure 1 is a flow chart of a method for predicting and optimizing the amount of fish feed provided by one embodiment of the present invention;
[0050] Figure 2 is a SARIMAX model establishment and prediction implementation flow chart provided by an embodiment of the present invention;
[0051] Figure 3 It is a flowchart of establishing and predicting an LSTM model based on an attention mechanism provided by an embodiment of the present invention;
[0052] Figure 4 is a flow chart of a residual method provided by an embodiment of the present invention;
[0053] Figure 5 is a flow chart of a weighted summation method provided by an embodiment of the present invention;
[0054] Figure 6 is an overall flow chart provided by an embodiment of the present invention;
[0055] Figure 7 is a schematic diagram of a device for predicting and optimizing the amount of fish feed provided by one embodiment of the present invention;
[0056] Figure 8 is a schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0057] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0058] It should be noted that, although the functional modules are divided in the device schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first", "second", etc. in the specification and claims and the following drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0059] In the embodiments of the present invention, the words "further", "exemplarily" or "optionally" are used to indicate examples, illustrations or descriptions, and should not be interpreted as being more preferred or more advantageous than other embodiments or designs. The use of the words "further", "exemplarily" or "optionally" is intended to present related concepts in a specific way.
[0060] First, several terms involved in the present invention are analyzed:
[0061] SARIMAX model: A time series forecasting method that combines seasonality, exogenous variables and autoregressive moving average models, suitable for processing periodically changing data.
[0062] Exogenous variables: External factors that have an impact on the model's predictions.
[0063] Johansen cointegration test: used to test whether there is a long-term stable relationship between multiple time series and to help determine the cointegration vector.
[0064] Ljung-Box test: used to detect whether the time series residual is white noise and check whether there is significant autocorrelation in the data.
[0065] LSTM model: A special type of recurrent neural network designed to process time series data with long-term dependencies.
[0066] Attention mechanism: By assigning different weights to the input sequence, it helps the model focus on the most important information for prediction.
[0067] Grid search: A method to find the best model configuration by traversing all hyperparameter combinations.
[0068] Residual method: First predict the SARIMAX linear part, then use LSTM to capture the nonlinear residual and combine them into the final prediction result.
[0069] Weighted summation method: By calculating the inverse of the model error, weights are assigned to different models and the prediction results are combined.
[0070] Scoring model: By evaluating the model's MSE, MAPE and other indicators, the comprehensive score is calculated and the best prediction model is selected.
[0071] Attent ion-LSTM: LSTM model based on attention mechanism.
[0072] In order to more conveniently describe the working principle of the embodiment of the present invention later, an introduction to related technical scenarios is first given below.
[0073] With the rapid development of the global aquaculture industry, how to manage fish feeding efficiently and accurately has become one of the key issues in improving aquaculture benefits. Traditional feeding methods mainly rely on manual experience, often lack scientific basis, and easily lead to feed waste or fish malnutrition, thus affecting aquaculture production and economic benefits. In order to meet these challenges, in recent years, intelligent feeding models based on mathematical models have gradually attracted attention. These models use environmental data and fish behavior data to predict the appropriate feeding amount and implement feeding through automated equipment.
[0074] Most of the existing feeding models rely on machine learning and statistical methods, such as random forest regression, generalized linear models and neural networks, but they still have some shortcomings. For example, the model based on random forest regression is not effective when dealing with complex nonlinear relationships and small sample data, and the prediction accuracy may be limited when facing sudden changes. Based on this, how to improve the prediction accuracy of fish feed feeding amount in a complex and changing environment has become a technical problem that needs to be solved urgently.
[0075] Based on this, the present invention provides a method and related device for predicting and optimizing the amount of fish feed. The method comprises: obtaining time series data, the time series data including water temperature, dissolved oxygen level in water, light intensity, turbidity and average weight of fish under different feeding environments and times; inputting the time series data into a pre-built SARIMAX model and an LSTM model based on an attention mechanism to predict the amount of fish feed, wherein the SARIMAX model is used to process seasonal characteristics and trend characteristics in the time series data, and the LSTM model based on the attention mechanism is used to capture the nonlinear relationship in the time series data; then, the SARIMAX model and the LSTM model based on the attention mechanism are inserted into the residual method and the weighted summation method to calculate the first prediction result and the second prediction result; the first prediction result is calculated based on the residual method, and the second prediction result is calculated based on the weighted summation method; using the scoring model to evaluate the performance of the residual method and the weighted summation method, and obtaining the corresponding scoring results; determining the optimal target prediction model according to the scoring results, and the target prediction model is used to predict the amount of fish feed. First, the SARIMAX model can effectively process the seasonal and trend components in time series data and optimize the prediction ability of the model. For data with seasonal characteristics such as feed feeding amount, SARIMAX can accurately capture periodic changes and provide reliable baseline predictions. Secondly, the LSTM neural network can deeply explore the complex nonlinear relationships in the data through its unique structure, especially when processing long time series data, which can significantly improve the prediction accuracy. Compared with the existing random forest regression model, LSTM can better adapt to nonlinear patterns and improve the overall performance of the model. The present invention also introduces an attention mechanism, which can automatically identify the features that have the greatest impact on the prediction results, thereby improving the interpretability of the model. This not only solves the transparency problem of the traditional black box model, but also makes the decision-making process of the model more understandable. In summary, the present invention combines the advantages of SARIMAX and LSTM models, uses SARIMAX to process trend and seasonal components, LSTM captures complex nonlinear patterns, and introduces an attention mechanism to automatically identify the most important input features for the prediction results, thereby further improving the accuracy and interpretability of the prediction. The cross-validation evaluation method is adopted, which not only reduces the risk of overfitting, but also ensures the stability and reliability of the model on different data subsets. Based on this, the embodiments of the present invention can improve the prediction accuracy of fish feed feeding amount in a complex and changeable environment and enhance the overall performance of the prediction model.
[0076] The embodiments of the present invention are further described below in conjunction with the accompanying drawings.
[0077] like Figure 1 As shown, Figure 11 is a flow chart of a method for predicting and optimizing fish feed feeding amount provided by an embodiment of the present invention. The method for predicting and optimizing fish feed feeding amount may include but is not limited to steps S101 to S104.
[0078] Step S101, acquiring time series data, the time series data including water temperature, dissolved oxygen level in water, light intensity, turbidity and average weight of fish under different feeding environments and times;
[0079] Step S102, inputting the time series data into a pre-built SARIMAX model and an LSTM model based on an attention mechanism respectively to predict the feeding amount of fish feed, wherein the SARIMAX model is used to process the seasonal characteristics and trend characteristics in the time series data, and the LSTM model based on the attention mechanism is used to capture the nonlinear relationship in the time series data. Then, the SARIMAX model and the LSTM model based on the attention mechanism are inserted into the residual method and the weighted sum method to calculate the first prediction result and the second prediction result, wherein the first prediction result is calculated based on the residual method, and the second prediction result is calculated based on the weighted sum method;
[0080] Step S103, using the scoring model to evaluate the performance of the residual method and the weighted sum method, and obtaining corresponding scoring results;
[0081] Step S104, determining the optimal target prediction model according to the scoring result, and the target prediction model is used to predict the feeding amount of fish feed.
[0082] It can be understood that the present invention proposes a combined prediction model of seasonal autoregressive integrated moving average (SARIMAX) and long short-term memory (LSTM) neural network based on attention mechanism, aiming to address the shortcomings of existing methods and give full play to the advantages of combining mathematical statistics with machine learning.
[0083] First, the SARIMAX model can effectively process the seasonal and trend components in time series data, optimizing the model's predictive ability. For data with seasonal characteristics such as feed feeding amount, SARIMAX can accurately capture periodic changes and provide reliable baseline predictions. Secondly, the LSTM neural network can deeply explore the complex nonlinear relationships in the data through its unique structure, especially when processing long time series data, which can significantly improve the prediction accuracy. Compared with traditional SVR and random forests, LSTM can better adapt to nonlinear patterns and improve the overall performance of the model. Another innovation of the present invention is the introduction of an attention mechanism, which can automatically identify the features that have the greatest impact on the prediction results, thereby improving the interpretability of the model. This not only solves the transparency problem of the traditional black box model, but also makes the decision-making process of the model more understandable.
[0084] The present invention combines the advantages of SARIMAX and LSTM models, using SARIMAX to process trend and seasonal components, LSTM to capture complex nonlinear patterns, and introduces an attention mechanism to automatically identify the most important input features for the prediction results, thereby further improving the accuracy and interpretability of the prediction. The cross-validation evaluation method not only reduces the risk of overfitting, but also ensures the stability and reliability of the model on different data subsets.
[0085] The following is a further description of the fish feed feeding amount prediction and optimization method of the present invention in conjunction with the accompanying drawings. The overall detailed implementation steps of the method are as follows:
[0086] First, you can use a computer vision system to obtain relevant data about fish schools. Since data such as water temperature, dissolved oxygen level in the water, light intensity, turbidity, and average weight of fish vary at different collection sites, times, and methods. In order to make these data comparable and better able to analyze and compare, they need to be normalized. So the specific steps are as follows:
[0087] Step (1): For the fuzzy values that affect the amount of fish fed (such as environmental factors) in the interval [a i ,b i ] Calculate the median c i for a i and b i The arithmetic mean is calculated as follows:
[0088]
[0089] Step (2): For the data c processed in step (1) i , calculate the maximum value v of this factor max and the minimum value v min The normalization process is as follows:
[0090]
[0091] Second, the SARIMAX model is used to make a preliminary prediction of the data. Then, the appropriate model parameters are found through grid search, including autoregressive terms, difference terms, and moving average terms. The specific implementation steps are as follows:
[0092] Step (1): Split the data into a training set and a test set, where 80% of the data is used for model training and 20% of the data is used for testing.
[0093] Step (2): Perform Ljung-Box test on the input sequence and the output sequence. The null hypothesis of the Ljung-Box test is that the sequence is white noise. If the p-value is less than the preset significance level of 0.05, the null hypothesis is rejected and it is considered that the sequence has significant autocorrelation.
[0094] Step (3): Perform a stationarity test on the data. If the sequence is stationary, the SARIMAX model can be directly constructed. If the sequence is not stationary, perform a Johansen cointegration test. If there is a cointegration relationship between the exogenous variables, they can be directly introduced into the model as exogenous variables. If the exogenous variables are not cointegrated, they are differentially processed before modeling.
[0095] Step (4): Establish the SARI MAX model. The expression of the SARI MAX model is as follows:
[0096]
[0097] Among them, Y t is the feeding amount, X t-k These include water temperature, dissolved oxygen levels in the water, light intensity, turbidity and average fish weight.
[0098] By analyzing the autocorrelation function (ACF) and partial autocorrelation function (PACF) diagrams of the data, parameters such as the autoregressive order (p), the difference order (d) and the moving average order (q) are determined.
[0099] Step (5): Then, the SARIMAX model is used for prediction. Based on the determined order, the SARIMAX model is used for fitting, and the model includes seasonal and exogenous variables such as water temperature and dissolved oxygen level. After the SARIMAX model is established, the model is predicted using the test data. Through the model prediction function, the future feeding amount can be predicted based on the existing data and the input of exogenous variables.
[0100] Step (6): Finally, in order to select the optimal SARIMAX model parameters, a grid search method was used. The autoregressive order (p), difference order (d) and moving average order (q) of the model, the seasonal autoregressive order (P), seasonal difference order (D) and seasonal moving average order (Q) ranged from 0 to 3, and the seasonal period (S) was fixed to 12. The MSE, MAPE and R of different parameter combinations were calculated. 2 Finally, the parameter configuration with the best performance on the test set is selected to obtain the best prediction result. The steps of establishing and implementing the above SARIMAX model are as follows: Figure 2 shown.
[0101] Third, build an LSTM model based on the attention mechanism.
[0102] Step (1): Split the data into a training set and a test set, where 80% of the data is used for model training and 20% of the data is used for testing.
[0103] Step (2): Build an LSTM model. In the input layer, water temperature, dissolved oxygen level in water, light intensity, turbidity, and average weight of fish are selected as input features. Subsequently, a model containing 3 layers of LSTM is designed to extract sequence features, and appropriate dropout and recurrent_dropout parameters are set in each layer to reduce the risk of overfitting. Finally, a fully connected layer is added after the LSTM layer to map the sequence features into a single value for predicting the feeding amount.
[0104] Step (3): Introduce the attention mechanism. The attention weights of each time step are calculated through a fully connected layer. Then, the weights are normalized to probability distribution using the Softmax activation function. Next, the output of the LSTM layer is weighted and summed using the normalized attention weights to generate a weighted context vector. Finally, the weighted context vector is combined with the LSTM output to further extract features to obtain the final prediction result.
[0105] Step (4): Select the optimizer and loss function. Use mean square error as the loss function. Select the Adam optimizer and set the initial learning rate to 0.001.
[0106] Step (5): Use the training set to train the model, and use the validation set to adjust the model hyperparameters. After each training, check the performance on the validation set, calculate the loss value and evaluation indicators (MSE, MAPE, etc.). If the model overfits during training, it can be prevented by introducing early stopping. If not, continue to the next step.
[0107] Step (6): Use grid search or random search to adjust hyperparameters, such as the number of units in the LSTM layer, learning rate, dropout rate, and batch size. Finally, the optimal parameters are obtained and imported into the model to obtain the optimal prediction value. The steps for establishing and implementing the prediction of the LSTM model based on the attention mechanism are as follows: Figure 3 shown.
[0108] Fourth, construct the residual method.
[0109] Step (1): The prediction result of the SARIMAX model is denoted as S t ,y t is the actual value, then the residual sequence ε of the SARIMAX model t
[0110] The calculation formula is as follows:
[0111] ε t =y t -S t (4)
[0112] Step (2): The LSTM model based on the attention mechanism can be used to fit the nonlinear part of the residual sequence. The LSTM model processes the residual sequence ε t , predict the correction value of the nonlinear part
[0113] Step (3): After obtaining the predicted values of the linear part and the nonlinear part, add the two parts to get the final predicted value. The calculation formula is as follows:
[0114]
[0115] The establishment and prediction implementation steps of the above residual method are as follows: Figure 4 shown.
[0116] Fifth, construct the weighted summation method.
[0117] Step (1): Use the inverse error method to calculate the weights of the SARIMAX model and the LSTM model based on the attention mechanism. The calculation formula is as follows:
[0118]
[0119] Among them, E i Represents the mean square error (MSE) of the ith model.
[0120] Step (2): After obtaining the weights, multiply the two model prediction values by the weights respectively to obtain the final prediction value.
[0121] The steps for establishing and predicting the weighted summation method are as follows: Figure 5 shown.
[0122] Sixth, establish a scoring model.
[0123] Step (1): Standardize the three indicators. For MSE and MAPE, smaller values represent better models, so reverse standardization is required. The standardization formula is as follows:
[0124]
[0125] Step (2): Standardize R 2 The calculation formula is as follows:
[0126]
[0127] Step (3): Define the weights as w MSE =0.5, w MAPE =0.3, Therefore, the comprehensive score is calculated as follows:
[0128]
[0129] Step (4): Compare the scores and take the prediction value with the highest score as the final prediction value.
[0130] To sum up, the overall detailed implementation steps of this method are as follows: Figure 6 shown.
[0131] It can be understood that the present invention combines the seasonal autoregressive integrated moving average (SARIMAX) with the long short-term memory (LSTM) neural network, uses the SARIMAX model to process the trend and seasonal components in the data, and captures complex nonlinear relationships through LSTM.
[0132] It can be understood that the present invention introduces an attention mechanism into the LSTM model, so that the model can automatically identify the most important features for the prediction results, thereby solving the problem that the traditional black box model is difficult to explain.
[0133] It is understood that the present invention evaluates the performance of different prediction models by establishing a comprehensive scoring model. The model evaluation indicators (such as MSE and MAPE) are processed by a standardized method, and the accuracy of the scoring system is improved by reverse standardization. Each indicator is weighted and summed according to the set weight, and the optimal prediction model is finally determined by comprehensive scoring.
[0134] In summary, the present invention optimizes the prediction results by combining the SARIMAX model and the LSTM model based on the attention mechanism using the residual method. This method organically combines the traditional time series model with the deep learning model, and can simultaneously process the linear and nonlinear parts of the data, thereby significantly improving the accuracy and stability of the prediction. In particular, after the introduction of the attention mechanism, LSTM can pay more attention to the key moments in the time series that have a greater impact on the prediction results, further improving the model's ability to capture complex data patterns. The present invention also innovatively proposes a scoring model based on the residual method and the weighted summation method, which can automatically select the optimal prediction model, thereby improving the robustness and accuracy of the prediction system. These innovations enable the present invention to show higher flexibility and accuracy when dealing with complex and changeable environmental data compared to the traditional single model method.
[0135] In addition, if Figure 7 As shown, one embodiment of the present invention further discloses a device for predicting and optimizing the amount of fish feed, the device comprising:
[0136] An acquisition module 110 is used to acquire time series data, the time series data including water temperature, dissolved oxygen level in water, light intensity, turbidity and average weight of fish under different feeding environments and times;
[0137] A prediction module 120 is used to input the time series data into a pre-built SARIMAX model and an LSTM model based on an attention mechanism to predict the feeding amount of fish feed, wherein the SARIMAX model is used to process the seasonal characteristics and trend characteristics in the time series data, and the LSTM model based on the attention mechanism is used to capture the nonlinear relationship in the time series data. Then, the SARIMAX model and the LSTM model based on the attention mechanism are put into the residual method and the weighted sum method to calculate the first prediction result and the second prediction result, wherein the first prediction result is calculated based on the residual method, and the second prediction result is calculated based on the weighted sum method;
[0138] An evaluation module 130, for evaluating the performance of the residual method and the weighted sum method using a scoring model, and obtaining corresponding scoring results;
[0139] The optimization module 140 is used to determine the optimal target prediction model according to the scoring results, and the target prediction model is used to predict the feeding amount of fish feed.
[0140] The lithium-ion battery capacity prediction device of the embodiment of the present invention is used to execute the fish feed feeding amount prediction and optimization method in the above embodiment. Its specific processing process is the same as the fish feed feeding amount prediction and optimization method in the above embodiment, and will not be repeated here.
[0141] In addition, if Figure 8 As shown, an embodiment of the present invention further discloses an electronic device, including: at least one processor 210; at least one memory 220, for storing at least one program; when the at least one program is executed by the at least one processor 210, the fish feed feeding amount prediction optimization method as in any of the previous embodiments is implemented.
[0142] In addition, an embodiment of the present invention further discloses a computer-readable storage medium, in which computer-executable instructions are stored. The computer-executable instructions are used to execute the fish feed feeding amount prediction and optimization method as described in any of the previous embodiments.
[0143] The system architecture and application scenarios described in the embodiments of the present invention are intended to more clearly illustrate the technical solutions of the embodiments of the present invention, and do not constitute a limitation on the technical solutions provided by the embodiments of the present invention. Those skilled in the art will appreciate that with the evolution of the system architecture and the emergence of new application scenarios, the technical solutions provided by the embodiments of the present invention are equally applicable to similar technical problems.
[0144] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.
[0145] In hardware implementation, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some physical components or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or temporary medium). As known to those of ordinary skill in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disk (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and can be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically embodies computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0146] The terms "component", "module", "system", etc. used in this specification are used to represent computer-related entities, hardware, firmware, a combination of hardware and software, software, or software in execution. For example, a component can be, but is not limited to, a process running on a processor, a processor, an object, an executable file, an execution thread, a program, or a computer. By way of illustration, both applications running on a computing device and a computing device can be components. One or more components may reside in a process or an execution thread, and a component may be located on a computer or distributed between two or more computers. In addition, these components may be executed from various computer-readable media having various data structures stored thereon. Components may communicate, for example, through local or remote processes based on signals having one or more data packets (e.g., data from two components interacting with another component between a local system, a distributed system, or a network, such as the Internet interacting with other systems through signals).
Claims
1. A method for predicting and optimizing the amount of fish feed fed, characterized in that: include: Acquiring time series data, the time series data including water temperature, dissolved oxygen level in water, light intensity, turbidity and average weight of fish under different feeding environments and times; The time series data are respectively input into a pre-built SARIMAX model and an LSTM model based on an attention mechanism to predict the feeding amount of fish feed, wherein the SARIMAX model is used to process seasonal characteristics and trend characteristics in the time series data, and the LSTM model based on the attention mechanism is used to capture the nonlinear relationship in the time series data. Then, the SARIMAX model and the LSTM model based on the attention mechanism are inserted into the residual method and the weighted sum method to calculate the first prediction result and the second prediction result, wherein the first prediction result is calculated based on the residual method, and the second prediction result is calculated based on the weighted sum method; Use the scoring model to evaluate the performance of the residual method and the weighted sum method, and obtain the corresponding scoring results; An optimal target prediction model is determined according to the scoring result, and the target prediction model is used to predict the feeding amount of fish feed.
2. The method for predicting and optimizing the amount of fish feed according to claim 1, characterized in that: After acquiring the time series data, it also includes: Performing a white noise test and a stationarity test on the time series data to obtain a test result; When the test result shows that the time series data is not white noise and the time series data sequence is stable, the SARIMAX model is constructed.
3. The method for predicting and optimizing the amount of fish feed according to claim 2, characterized in that: The method further comprises: When the test result shows that the time series data is not white noise and the time series data sequence is not stable, the time series data is differentially processed until the time series data sequence is stable, and then the SARIMAX model is constructed.
4. The method for predicting and optimizing the amount of fish feed according to claim 1, characterized in that: The method for constructing the SARIMAX model includes: Analyze the autocorrelation function graph and partial autocorrelation function graph of the time series data to determine the autoregressive order, the difference order and the sliding average order; Determining a model structure of a SARIMAX model according to the autoregressive order, the difference order, and the sliding average order; Using test data to predict the SARIMAX model to obtain an error index, wherein the test data includes a training set and a test set, the training set is used for model training, and the test set is used for model testing; Determining optimal SARIMAX model parameters according to the error index and grid search method; The SARIMAX model is constructed based on the SARIMAX model parameters.
5. The method for predicting and optimizing the amount of fish feed according to claim 1, characterized in that: The method for constructing the LSTM model based on the attention mechanism includes: Designing a long short-term memory neural network model including three LSTM layers, wherein the LSTM layers are used to extract sequence features from the time series data; Adding a fully connected layer after the three LSTM layers, wherein the fully connected layer is used to map the sequence features into a single value for predicting the feeding amount; Calculate the attention weight of each time step through the fully connected layer; The attention weights are normalized into a probability distribution using a Softmax activation function; The output of the LSTM layer is weighted summed using the normalized attention weights to generate a weighted context vector; The weighted context vector is combined with the output of the LSTM layer to further extract features to obtain the final prediction result; The long short-term memory neural network model is trained using the training data. During the training process, the mean square error is used as the loss function, and the Adam optimizer is selected. The initial learning rate is set to a preset value, and the hyperparameters are adjusted using a grid search or a random search until the optimal LSTM model parameters are obtained; The LSTM model based on the attention mechanism is constructed based on the LSTM model parameters.
6. The method for predicting and optimizing the amount of fish feed according to claim 1, characterized in that: The first prediction result is calculated based on the residual method, including: Calculating the residual sequence of the SARIMAX model according to the prediction result and the actual value of the SARIMAX model; Processing the nonlinear part of the residual sequence through the LSTM model based on the attention mechanism to predict the correction value of the nonlinear part; Adding the prediction result of the SARIMAX model and the correction value of the nonlinear part to obtain the first prediction result; The second prediction result is calculated based on a weighted summation method, including: The model weights of the SARIMAX model and the LSTM model based on the attention mechanism are calculated using the inverse error method; The predicted value of the SARIMAX model and the predicted value of the LSTM model based on the attention mechanism are respectively multiplied by the model weight to obtain the second prediction result.
7. The method for predicting and optimizing the amount of fish feed according to claim 1, characterized in that: The method further comprises: Construct a scoring model based on preset evaluation indicators; Scoring the first prediction result and the second prediction result according to the scoring model; A prediction value with a higher score is selected from the first prediction result and the second prediction result as the final fish feed feeding amount prediction value.
8. A device for predicting and optimizing the amount of fish feed, characterized in that: The device comprises: An acquisition module is used to acquire time series data, wherein the time series data includes water temperature, dissolved oxygen level in water, light intensity, turbidity and average weight of fish under different feeding environments and times; A prediction module, used for inputting the time series data into a pre-built SARIMAX model and an LSTM model based on an attention mechanism respectively to predict the feeding amount of fish feed, wherein the SARIMAX model is used to process the seasonal characteristics and trend characteristics in the time series data, and the LSTM model based on the attention mechanism is used to capture the nonlinear relationship in the time series data, and then the SARIMAX model and the LSTM model based on the attention mechanism are inserted into the residual method and the weighted sum method to calculate the first prediction result and the second prediction result, wherein the first prediction result is calculated based on the residual method, and the second prediction result is calculated based on the weighted sum method; An evaluation module is used to evaluate the performance of the residual method and the weighted sum method using a scoring model and obtain corresponding scoring results; The optimization module is used to determine the optimal target prediction model according to the scoring result, and the target prediction model is used to predict the feeding amount of fish feed.
9. An electronic device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method for predicting and optimizing the feeding amount of fish feed according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are used to execute the method for predicting and optimizing the feeding amount of fish feed according to any one of claims 1 to 7.