Egg price prediction method based on combined model
Through seasonal decomposition of time series and multi-model combination, it solves the problem that a single model is difficult to capture the seasonal and non-stationary components of egg price series, achieves accurate prediction of egg prices, improves prediction accuracy, and provides support for industrial decision-making.
Patent Information
- Application Number
- CN202410938480.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-13
- Publication Date
- 2024-10-18
AI Technical Summary
It is difficult for the existing single price prediction model to simultaneously capture the seasonal components and non-stationary components in the egg price series, resulting in inaccurate egg price predictions.
The time series seasonal decomposition algorithm STL is used to decompose the original sequence into trend components, seasonal components and residual components, and three models of support vector machine regression SVR, seasonal autoregressive differential moving average SARIMA and long short-term memory network LSTM are constructed to analyze each component. Make predictions and finally generate predictions for egg prices through the combined model.
By decomposing and combining models, we can accurately capture the fluctuation patterns of egg prices, improve the accuracy of price predictions, provide farmers and wholesalers with better decision-making support, and promote the sustainable development and supply-demand balance of the egg industry.
Smart Images

Figure CN118798959A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data mining and machine learning, and in particular to an egg price prediction method based on a combination model. Background Art
[0002] Eggs are rich in nutritional value and contain essential nutrients and trace elements such as protein, fat, cholesterol, etc., which are an important source of protein intake for the human body. Since egg prices fluctuate frequently and widely, and are affected by many factors, including seasonal demand changes, aquaculture production levels, feed costs, market supply chains, etc., it is of great significance for farmers, wholesalers, retailers and consumers to accurately predict the trend of egg prices. According to the existing public price data, the national egg market price reached its highest price of 12.48 yuan / kg in October 2019 and its lowest price of 4.66 yuan / kg, with a fluctuation range of up to 168%. The frequent price fluctuations of eggs not only lead to unstable income for farmers, but also affect industry decision-making and investment, and affect the quality of life of consumers and social and economic stability. Therefore, it is of great significance to conduct in-depth research on the development of my country's laying hen industry market, timely and accurately control the future trend of national egg prices, predict specific prices, and provide decision-making support for production managers and the market.
[0003] In recent years, with the rapid development of deep learning technology, price prediction has been introduced as a research topic for many agricultural product price issues. Many researchers have proposed different prediction methods for agricultural product price prediction. The methods for predicting agricultural product price series are mainly divided into the following two categories: the first category is the traditional time series model, which mainly includes the moving average method, the autoregressive moving average method, the exponential smoothing method, etc.; the second category is the neural network model, which mainly includes the convolutional neural network (CNN), the recurrent neural network (RNN) and the long short-term memory network (LSTM). However, since the price of eggs is affected by seasonal factors, holidays and emergencies, it will produce large price fluctuations. The above two types of single price prediction model technologies cannot simultaneously capture the seasonal components and non-stationary components in the egg price series, that is, it is difficult to accurately capture the fluctuation law of egg prices. Therefore, designing an accurate and effective egg price prediction method based on a combined model can provide important technical support for the intelligent production and sales of the breeding industry. Summary of the invention
[0004] 1. Technical issues to be resolved
[0005] In view of the deficiencies in the prior art, the present invention provides an egg price prediction method based on a combination model, which can solve the above technical problems.
[0006] (II) Technical solution
[0007] In order to solve the above technical problems, the present invention provides the following technical solutions: an egg price prediction method based on a combination model, comprising the following steps:
[0008] S1: Collect egg price data to form the original sequence of egg prices;
[0009] S2: Use the time series seasonal decomposition algorithm STL to decompose the original sequence into trend component, seasonal component and residual component;
[0010] S3: construct a combined model for egg price prediction, which includes three different prediction models: a first prediction model, a second prediction model, and a third prediction model;
[0011] S4: inputting the trend component into the first prediction model to obtain a trend prediction value, inputting the season component into the second prediction model to obtain a season prediction value, and inputting the remaining component into the third prediction model to obtain a remaining series prediction value;
[0012] S5: Add the trend forecast value, season forecast value and residual sequence forecast value to get the final forecast value of egg price.
[0013] Preferably, the first prediction model is a support vector machine regression SVR model.
[0014] Preferably, the second prediction model is a seasonal autoregressive differential moving average SARIMA model.
[0015] Preferably, the third prediction model is a long short-term memory network LSTM model.
[0016] Preferably, after step S2, the method further includes step S2a: normalizing the trend component, the seasonal component and the residual component.
[0017] Preferably, after step S2a, the method further includes step S2b: constructing a data set.
[0018] Preferably, after step S5, the method further includes step S6: evaluating the combined model.
[0019] Preferably, in step S6, the root mean square error and the mean absolute percentage error are specifically selected as evaluation indicators to evaluate the combined model.
[0020] Preferably, in step S1, monthly price data of national egg markets collected by China Animal Husbandry Information Network and the National Agricultural Products Business Information Public Service Platform are specifically selected.
[0021] Preferably, step S1 also includes performing data analysis on the original sequence.
[0022] (III) Beneficial effects
[0023] Compared with the prior art, the present invention provides an egg price prediction method based on a combination model, which has the following beneficial effects: the present invention uses STL to decompose the original sequence of egg prices into three components: a trend component, a seasonal component and a residual component, and further uses three different prediction models to predict the three components respectively. Through seasonal decomposition and a combination model, the present invention can improve the defect that the existing single prediction model cannot simultaneously capture the seasonal component and the non-stationary component in the egg price sequence, that is, accurately capture the fluctuation law of egg prices, so that the present invention can achieve accurate prediction of future short-term egg prices, thereby better providing decision support and market insights for farmers and wholesalers, so as to promote the sustainable development and supply and demand balance of the egg industry. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 It is the original series line chart of egg prices;
[0025] Figure 2 The trend component result diagram obtained by decomposing the original sequence of egg prices in the present invention;
[0026] Figure 3 The seasonal component result diagram obtained by decomposing the original sequence of egg prices in the present invention;
[0027] Figure 4 The residual component result diagram obtained by decomposing the original sequence of egg prices in the present invention;
[0028] Figure 5 The first flow chart of the egg price prediction method based on the combined model of the present invention;
[0029] Figure 6 A second flow chart of an egg price prediction method based on a combination model of the present invention;
[0030] Figure 7 A comparison chart of egg price prediction results of the combined model of the present invention and a single model;
[0031] Figure 8 The comparison chart of egg price prediction results of the combination model of the present invention and other combination models. In the figure: eggPrice-egg price, Price-price, Date-date, Actual-actual price, STL-SARIMA-SVR-LSTM: the combination model of the present invention, Transformer-existing neural network model. DETAILED DESCRIPTION
[0032] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0033] The present invention provides an egg price prediction method based on a combination model, comprising the following steps:
[0034] S1: Collect egg price data to form the original sequence of egg prices: that is, collect historical egg price data in chronological order. Specifically, the monthly price data of the national egg market collected by the China Animal Husbandry Information Network and the National Agricultural Products Business Information Public Service Platform can be selected. The collected data range is, for example, from January 2000 to April 2024, with a data sample number of 292, and the price unit is yuan / kg.
[0035] Furthermore, step S1 also includes data analysis of the original sequence: Figure 1 As shown, a line graph can be drawn for the collected data, and the Augmented Dickey Fuller test (ADF test) is used to test whether the original sequence is stable. The result shows that the original data is a non-stationary sequence with obvious fluctuation patterns that change with the seasons: the price of eggs begins to decline from February to March almost every year, and drops to the lowest point of the year in April, May, and June. The price begins to gradually rise in July and August, and generally reaches the highest point of the year in September and October. It has shown seasonal fluctuation characteristics for many years and is not an accidental phenomenon. Therefore, according to the above seasonal characteristics of the original sequence, the original sequence is decomposed into three components, namely the following step S2.
[0036] S2: Use the time series seasonal decomposition algorithm STL to decompose the original sequence into three components (components): trend component (Trend), seasonal component (Seasonal) and residual component (Remainder), such as Figure 2-Figure 4 shown.
[0037] STL (Seasonal and Trend decomposition using Loess), the STL algorithm uses the characteristics of the LOESS (Locally Weighted Scatterplot Smoothing) method to decompose the seasonal trend of time series. In the STL decomposition process, a cyclic process is first used to estimate and remove the seasonal component, and then the LOESS method is applied to estimate the trend component. Finally, the trend component and seasonal component are subtracted from the original data to obtain the residual component.
[0038] The above trend component is the trend component of the long-term change of data, which reflects the basic trend of the data over time; the seasonal component represents the periodic repetitive pattern of the data, such as regular fluctuations on a daily, weekly, monthly or annual basis; and the residual component is the random fluctuation after removing the trend and season, which is usually regarded as "irregular" or "abnormal". The present invention captures the long-term trend law in the egg price series through the trend component, captures the seasonal component in the egg price series through the seasonal component, and captures the non-stationary component and sudden component in the egg price series through the residual component, thereby realizing the comprehensive and multi-faceted capture of the fluctuation law of egg prices.
[0039] In addition, preferably, after step S2, step S2a may be further included: normalizing the trend component, the seasonal component and the residual component: in order to eliminate the dimensional differences between the features and prevent the influence of outliers on the model, the range of the data set such as the trend component is scaled between 0 and 1; the normalization is implemented as follows: Where Z max and Z min They represent the maximum and minimum values of the samples respectively, Z is the original value, and Z′ is the normalized value. After normalization, the numerical features are still retained on the same scale, which can effectively improve the training effect and generalization performance of the model.
[0040] Furthermore, after step S2a, step S2b is also included: constructing a data set: the range of the data collected above is, for example, from January 2000 to April 2024, and the number of data samples is 292. The samples for 276 consecutive months from January 2000 to December 2022 are used as training samples to train the model, and the samples for 16 months from January 2023 to April 2024 are used as test samples to verify the prediction effect.
[0041] S3: Construct a combined model for egg price prediction, which includes three different prediction models: a first prediction model, a second prediction model and a third prediction model.
[0042] S4: Input the trend component into the first prediction model to obtain the trend prediction value, input the season component into the second prediction model to obtain the season prediction value, and input the remaining component into the third prediction model to obtain the remaining sequence prediction value.
[0043] Preferably, the first prediction model is a support vector machine regression SVR model, the second prediction model is a seasonal autoregressive difference moving average SARIMA model, and the third prediction model is a long short-term memory network LSTM model; that is: the SVR model is used to predict the trend component in the original egg price series after STL decomposition, the SARIMA model is used to predict the seasonal component, and the LSTM model is used to predict the remaining component.
[0044] SVR model: SVR (Support Vector Regression) maps the data in the original space to a higher-dimensional feature space, so that the data is linearly separable in the feature space, and finds an optimal hyperplane in the high-dimensional feature space so that the distance between the hyperplane and the training data is the smallest. The mathematical description of SVR in the price prediction problem is as follows: Let x1, x2, x3..., x n is time series data, input x of order P t =(x t-1 , x t-2 , ..., x t-p ); then the prediction function is: Where φ is the model operator, ω and b are coefficients; the optimization problem is: Where C is the penalty factor and ∈ is the insensitive loss parameter, from which the prediction output can be obtained to generate the SVR prediction model. The optimal hyperparameter combination of the SVR model is selected by the grid search method. The hyperparameters that need to be set include the kernel function, the penalty parameter (C) and ∈.
[0045] SARIMA model: SARIMA (Seasonal Autoregressive Integrated Moving Average) model adds four seasonal parameters to the ARIMA (Autoregressive Integrated Moving Average) model, expressed as SARIMA (p, d, q) (P, D, Q, s), where p represents the number of observations using past time steps; d represents the number of differences, which is used to deal with the non-stationarity of the data; q represents the number of error terms using past time steps in the model; P represents the number of observations using past seasonal time steps in the model; D represents the number of seasonal differences; Q represents the number of error terms using past seasonal time steps in the model; s represents the length of the seasonal cycle of the data. The appropriate values of p, P, q and Q can be determined by the autocorrelation function and partial autocorrelation function of the difference sequence; then the model parameters are determined to be SARIMA (12, 1, 12) (2, 1, 1, 12).
[0046] LSTM model: LSTM (Long Short-Term Memory) includes three basic modules: input layer, hidden layer and output layer. The input layer performs preliminary processing on the residual sequence (residual component) of egg prices to meet the requirements of model input; the hidden layer constructs an LSTM cell link to form a network; and the output layer outputs the prediction results. The input variable is the residual component of egg prices, the number of output variables is a single variable for the next month, and 2 hidden layers are selected, with 8 neurons set in each layer. When the number of training times is 100, the loss of the model basically no longer decreases. The loss function selected by the LSTM model is the commonly used mean square error function (mse); the optimization function selects the Adam function.
[0047] S5: Add the trend forecast value, season forecast value and residual sequence forecast value to get the final forecast value of egg price.
[0048] In addition, after step S5, step S6 may be included: evaluating the above-mentioned combined model to evaluate the error of the final predicted value of the egg price. Preferably, in step S6, the root mean square error (RMSE) and the mean absolute percentage error (MAPE) are specifically selected as evaluation indicators to evaluate the combined model, and the calculation formulas of RMSE and MAPE are respectively as follows:
[0049]
[0050] like Figure 7-8 As shown, the egg price prediction results obtained by the combined model of the present invention are closer to the actual egg prices compared with the existing single models or other combined models, which proves that the egg price prediction method based on the combined model of the present invention can improve the prediction accuracy of egg prices.
[0051] Compared with the prior art, the present invention provides an egg price prediction method based on a combination model, which has the following beneficial effects: the present invention uses STL to decompose the original sequence of egg prices into three components: a trend component, a seasonal component and a residual component, and further uses three different prediction models to predict the three components respectively. Through seasonal decomposition and a combination model, the present invention can improve the defect that the existing single prediction model cannot simultaneously capture the seasonal component and the non-stationary component in the egg price sequence, that is, accurately capture the fluctuation law of egg prices, so that the present invention can achieve accurate prediction of future short-term egg prices, thereby better providing decision support and market insights for farmers and wholesalers, so as to promote the sustainable development and supply and demand balance of the egg industry.
[0052] It should be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0053] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. An egg price prediction method based on a combined model, It is characterized in that The following steps are involved: S1: Collect egg price data to form the original sequence of egg prices; S2: Decomposing the original sequence into a trend component, a seasonal component and a residual component using a time series seasonal decomposition algorithm STL; S3: constructing a combined model for egg price prediction, wherein the combined model includes three different prediction models: a first prediction model, a second prediction model, and a third prediction model; S4: inputting the trend component into the first prediction model to obtain a trend prediction value, inputting the season component into the second prediction model to obtain a season prediction value, and inputting the remaining component into the third prediction model to obtain a remaining sequence prediction value; S5: Add the trend prediction value, the season prediction value and the remaining sequence prediction value to obtain a final prediction value of the egg price.
2. The egg price prediction method based on the combined model according to claim 1, Features: The first prediction model is a support vector machine regression (SVR) model.
3. The egg price prediction method based on the combined model according to claim 1, Features: The second prediction model is a seasonal autoregressive difference moving average SARIMA model.
4. The egg price prediction method based on the combined model according to claim 1, Features: The third prediction model is a long short-term memory network LSTM model.
5. The egg price prediction method based on the combined model according to claim 1, Features: The method further includes step S2a after step S2: normalizing the trend component, the seasonal component and the residual component.
6. The egg price prediction method based on the combined model according to claim 5, Features: After step S2a, the method further includes step S2b: constructing a data set.
7. The egg price prediction method based on the combined model according to claim 1, Features: The method further includes step S6 after step S5: evaluating the combined model.
8. The egg price prediction method based on the combined model according to claim 7, Features: In the step S6, the root mean square error and the mean absolute percentage error are specifically selected as evaluation indicators to evaluate the combined model.
9. The egg price prediction method based on the combined model according to claim 1, Features: In the step S1, the monthly price data of the national egg market collected by the China Animal Husbandry Information Network and the National Agricultural Products Business Information Public Service Platform are specifically selected.
10. The egg price prediction method based on the combined model according to claim 1, Features: The step S1 also includes performing data analysis on the original sequence.
