Wheat future price prediction method based on CMACS-ARO-LSTM-attention
By optimizing wheat futures price forecasting using an improved CMACS-ARO-LSTM-attention model, the accuracy problem of traditional models under complex market fluctuations and sudden events is solved, achieving high-precision and stable price forecasting, thereby enhancing the decision-making ability of market participants and the scientific nature of government policymaking.
Patent Information
- Application Number
- CN202411519429.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-29
- Publication Date
- 2026-05-01
AI Technical Summary
Traditional price forecasting models are ineffective at capturing complex market fluctuations, especially the long-term and short-term dependencies in time series data. Furthermore, deep learning models show a significant decrease in accuracy when dealing with sudden events or abnormal data. The hyperparameter optimization process is time-consuming and difficult to reach the global optimum, which limits the accuracy and robustness of wheat futures price forecasts.
We adopted a CMACS-ARO-LSTM-attention model, improved the global and local search capabilities of the ARO algorithm, optimized the hyperparameters of the wheat futures price prediction model, including the number of neurons, batch size, and number of training rounds, and combined LSTM and attention mechanisms to improve prediction accuracy and stability.
It significantly improves the accuracy and robustness of wheat futures price forecasts, effectively captures short-term and long-term market dependencies, responds to emergencies and abnormal market fluctuations, and provides reliable decision-making support for risk management and market regulation.
Smart Images

Figure CN121961623A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to wheat futures price prediction technology, and in particular to a wheat futures price prediction method based on the CMACS-ARO-LSTM-attention model. Background Technology
[0002] As the global agricultural market becomes increasingly complex, accurate forecasting of commodity futures prices has become ever more crucial. Wheat futures prices, in particular, are not only related to global food security but also influence national economic and policy-making. Accurate price forecasts can help market participants effectively manage risk and provide decision-making support for governments, thereby ensuring the stability and efficient operation of the market. Therefore, improving the accuracy of wheat futures price forecasting has become a key research focus.
[0003] Traditional price forecasting models often perform poorly in capturing complex market fluctuations, especially long-term and short-term dependencies in time series data. While classic methods like ARIMA perform well in handling seasonal trends or short-term volatility, their accuracy drops significantly when dealing with sudden events or anomalous data. In recent years, machine learning and deep learning methods have been increasingly applied to the forecasting of commodity futures prices, especially Long Short-Term Memory (LSTM) networks. LSTM networks, in particular, excel in modeling complex time series data due to their ability to simultaneously handle long-term and short-term dependencies, significantly improving forecast accuracy and robustness.
[0004] However, deep learning models still have some shortcomings when dealing with complex fluctuations in the agricultural product market. For example, a single LSTM model may lead to unstable prediction results when handling sudden market fluctuations and outliers. Furthermore, the hyperparameter optimization process of deep learning models is often time-consuming and difficult to reach the global optimum, further limiting their application in price forecasting. Therefore, improving the robustness and optimization efficiency of LSTM models has become a key research challenge.
[0005] To address these issues, this invention proposes a joint model combining the Artificial Rabbit Optimization (ARO) algorithm improved with Cauchy mutation and adaptive crossover strategy (CMACS) with LSTM-attention. This model first improves the ARO algorithm through CMACS, thereby enhancing its global search capability and local search efficiency in finding the optimal hyperparameters of the LSTM-attention model for wheat futures price prediction. Then, the improved CMACS-ARO optimizes the parameters of the LSTM-attention model for wheat futures price prediction, including the number of neurons, batch size, and number of training epochs. Finally, the optimized LSTM-attention model is used for wheat futures price prediction. The improved CMACS-ARO-LSTM-Attention model can better capture key features in time-series data, improve adaptability to market fluctuations, and thus enhance the accuracy and stability of wheat futures price prediction. Summary of the Invention
[0006] The technical problem to be solved by this invention is to provide a wheat futures price prediction method based on the CMACS-ARO-LSTM-attention model, so as to achieve both accuracy and stability in wheat futures price prediction.
[0007] This invention is implemented as follows: a wheat futures price prediction method based on CMACS-ARO-LSTM-attention, comprising the following steps: Step S1: Using wheat, a major agricultural product in China, as the research object, construct a wheat price dataset and preprocess the wheat data. Based on the wheat price dataset, generate a training set, a test set, and a validation set in a 6:2:2 ratio. Step S2: Improve the Artificial Rabbit Optimization Algorithm (ARO) using Cauchy Mutation and Adaptive Crossover Strategy (CMACS); Step S3: Construct a wheat futures price prediction model using a classic Long Short-Term Memory (LSTM) network and an attention mechanism; Step S4: Use the improved ARO algorithm to find the optimal parameters of the wheat futures price prediction model LSTM-attention, including the number of neurons, batch size, and number of training rounds; Step S5: The improved LSTM-attention model is trained, tested, and validated using the wheat price training set. The classic time series regression evaluation indicators, root mean square error (RMSE), mean absolute error (MAE), and coefficient of determination (R²), are used as evaluation criteria to measure the predictive ability of the wheat futures price prediction model.
[0008] Furthermore, step S1 specifically includes: We collected wheat spot prices, wheat futures prices, the national average wheat price, and futures prices for corn, bran, and wheat middlings from 12 representative regions. We preprocessed the wheat price data using classic normalization methods. We then used autocorrelation analysis to examine the influence of past wheat futures prices on future prices. Using a Windows sliding window, we divided the wheat price data into groups of five days, using the target values of the previous five days as feature values, along with other features, to predict the target value for the next day. Finally, we divided the wheat price dataset into training, testing, and validation sets in a 6:2:2 ratio.
[0009] Furthermore, in step S2, the improvement of the Artificial Rabbit Optimization Algorithm (ARO) through Cauchy mutation and adaptive crossover strategy (CMACS) specifically involves: (1) Use Cauchy mutation to improve the global search capability of ARO: First, a population of hyperparameters and related parameters for a wheat futures price prediction model is randomly initialized. Then, based on the energy factor, a foraging and random hiding strategy is implemented to calculate the fitness of each individual, update the individual's position and the global optimal solution of the current wheat futures price prediction model hyperparameters. Next, the Cauchy mutation function is called to extract random numbers from the Cauchy distribution and generate mutation values corresponding to the position vector. f\left ( {x;{x}_{0},\gamma} \right )=\frac {1} {\pi \gamma \left [ {1+\left ( {\frac {x-{x}_{0}} {\gamma}} \right )^{2}} \right ]} ; in, It is a position parameter. It is a scale parameter; The generated Cauchy random number is multiplied by the global optimal solution of the hyperparameters of the current wheat futures price prediction model and added to the original position vector. Cauchy mutation is then performed on each element. mutated\_ position\left [ {i} \right ]=position\left [ {i} \right ]+cauch\, y\_ random\left [ {i} \right ]*position\left [ {i} \right ] ; Where, position\left [ {i} \right ] It is the first in the original position vector 1 element, cauch, y_ random [ {i} \right ] The first one generated from the Cauchy distribution A random number; Finally, the updated wheat futures price prediction model incorporates the global optimal solution of hyperparameters after Cauchy mutation, improving the global search capability of ARO and avoiding getting trapped in local optima; (2) Use an adaptive crossover strategy to improve the local search capability of ARO: First, the crossover rate is adjusted based on individual fitness. Individuals with higher fitness have a higher crossover rate, while those with lower fitness have a lower crossover rate. This ensures the diversity and convergence speed of the hyperparameter population in the wheat futures price prediction model. ; in, It is the basic crossover rate; It is a scaling factor; It is the fitness value of the individual with the highest fitness in the hyperparameter population of the wheat futures price prediction model; It is the fitness value of the individual with the lowest fitness in the hyperparameter population of the wheat futures price prediction model; Then, during the evolution process, the execution probability of the crossover operation is dynamically adjusted, and the decision to perform the crossover operation is based on the current crossover rate. If the crossover operation is performed, two individuals in the hyperparameter population of the wheat futures price prediction model are selected as parents, and offspring are generated and added to the hyperparameter population of the wheat futures price prediction model. Finally, the individual position and fitness are updated, and the local search efficiency is optimized through the adaptive crossover strategy to accelerate the convergence of the algorithm.
[0010] Furthermore, in step S3, the classic LSTM-attention wheat futures price prediction model includes an input layer, an LSTM layer, an attention mechanism layer, and an output layer, which are connected sequentially. The input layer takes into account historical data features of wheat futures prices; the LSTM layer extracts and learns time-series dependency features; the attention mechanism layer assigns weights and highlights key features of wheat price fluctuations to improve the accuracy of wheat futures price prediction; and the output layer provides the wheat futures price prediction result.
[0011] Furthermore, in step S4, the improved ARO algorithm is used to find the optimal parameters of the wheat futures price prediction model LSTM-attention, specifically as follows: Define the objective function of ARO, take the parameters of the LSTM model as input, including the number of neurons, batch size, and number of training epochs, and return the loss function; use the improved ARO algorithm to optimize the objective function, find the optimal number of neurons, batch size, and number of training epochs, and find the optimal hyperparameters for the wheat futures price prediction model.
[0012] The advantages of this invention are: This invention optimizes the LSTM-attention model for wheat futures price prediction using an improved ARO algorithm based on CMACS, achieving accurate predictions of wheat futures prices. The CMACS strategy enhances the global search capability by increasing the randomness and perturbation of the ARO algorithm and introduces a more flexible search mechanism, effectively addressing the complexity of the problem and ensuring the algorithm can explore a wider search space, avoiding getting trapped in local optima. Optimizing the hyperparameters (such as the number of neurons, batch size, and number of training epochs) of the LSTM-attention model using the improved ARO algorithm effectively reduces the impact of inappropriate parameters on the model's performance, thereby improving prediction accuracy and computational efficiency, especially demonstrating significant advantages when dealing with complex fluctuations in the wheat sales market. Using the prediction method of this invention for wheat futures price prediction not only captures short-term and long-term market dependencies but also effectively responds to sudden events and abnormal market fluctuations, significantly improving the robustness and stability of the prediction. This provides market participants with a more reliable basis for decision-making, facilitates better risk management and market regulation, and provides scientific support for government policy-making and food security maintenance. Attached Figure Description
[0013] Figure 1 This is a flowchart illustrating a wheat futures price prediction method based on CMACS-ARO-LSTM-attention according to an exemplary embodiment. Detailed Implementation
[0014] The overall idea of the technical solution in this application embodiment is as follows: Wheat futures prices are predicted using a wheat price data processing module, an ARO improvement module, a wheat futures price prediction model LSTM-Attention construction module, and an improved ARO-based LSTM-Attention model parameter optimization module. The wheat price data processing module is used to preprocess wheat price data and divide it into training and test sets. The ARO improvement module uses Cauchy mutation and adaptive crossover strategy (CMACS) to improve the Artificial Rabbit Optimization Algorithm (ARO) to enhance its search capability. The wheat futures price prediction model LSTM-Attention construction module includes an input layer and an LSTM layer. The model consists of an attention mechanism layer and an output layer. The input layer is used to input historical data features of wheat futures prices. The LSTM layer is used to extract and learn time-series dependency features from the historical wheat futures price data. The attention mechanism layer is used to assign weights and highlight features that are critical to changes in wheat futures prices to improve the model's prediction accuracy. The output layer is used to output the prediction results of wheat futures prices. The improved ARO module optimizes the parameters of the LSTM-Attention model by finding the optimal hyperparameters of the wheat futures price prediction model LSTM-Attention, including the number of neurons, batch size, and number of training rounds. This reduces the impact of manual parameter tuning and improves the accuracy and stability of wheat futures price prediction.
[0015] Please refer to Figure 1 As shown, a preferred embodiment of the wheat futures price prediction method based on the CMACS-ARO-LSTM-attention model of the present invention includes the following steps: Step S1: Obtain a large amount of basic data related to wheat prices in different regions. After preprocessing the wheat price data of each region, construct a wheat price dataset. Based on the wheat price dataset, divide it into a training set, a test set, and a validation set in a 6:2:2 ratio. In specific implementation, wheat, a Chinese grain crop, can be selected as the experimental object. Use 12 representative wheat spot prices, wheat futures prices, the national average wheat price, and corn, bran, and wheat middlings futures prices as the wheat price dataset.
[0016] Step S2: Improve the Artificial Rabbit Optimization Algorithm (ARO) using Cauchy Mutation and Adaptive Crossover Strategy (CMACS); that is, in order to solve the problems of ARO in dealing with unimodal problems with complex shapes and multiple local extrema, as well as the lack of diverse search strategies, this invention improves the Artificial Rabbit Optimization Algorithm (ARO) using Cauchy Mutation and Adaptive Crossover Strategy (CMACS), increases its randomness and perturbation, and introduces a more flexible search mechanism to more comprehensively cover the search space, so as to improve ARO's ability to find the optimal parameters of the wheat futures price prediction model LSTM-attention.
[0017] Step S3: Construct a wheat futures price prediction model using a classic Long Short-Term Memory (LSTM) network and an attention mechanism; Step S4: Use the improved ARO algorithm to find the optimal parameters for the wheat futures price prediction model LSTM-attention; Step S5: Train, test, and validate the improved wheat futures price prediction model LSTM-attention using the wheat price training set. Use the classic time series regression evaluation indicators, root mean square error (RMSE), mean absolute error (MAE), and coefficient of determination (R²), as evaluation criteria to assess the prediction performance of the wheat futures price prediction model LSTM-attention.
[0018] Step S1 specifically involves: A large amount of basic data related to wheat prices in different regions was obtained, and the wheat price data of each region was normalized. The autocorrelation function (ACF) and partial autocorrelation function (PACF) were used to detect the autocorrelation and partial autocorrelation in the time series, respectively, to determine the degree of influence of past wheat futures prices on current wheat futures prices. Using a Windows window, the wheat price data was divided into groups of five days, and the wheat futures prices of the previous five days were also used as feature values, along with other features, to predict the wheat futures price of the next day. Based on the preprocessed wheat price data of each region, a wheat price dataset was constructed and divided into training set, test set, and validation set in a 6:2:2 ratio.
[0019] In step S2, the improvement of the Artificial Rabbit Optimization Algorithm (ARO) through Cauchy mutation and adaptive crossover strategy (CMACS) specifically involves: (1) Use Cauchy mutation to improve the global search capability of ARO: First, a population of hyperparameters and related parameters for a wheat futures price prediction model is randomly initialized. Then, based on the energy factor, a foraging and random hiding strategy is implemented to calculate the fitness of each individual, update the individual's position and the global optimal solution of the current wheat futures price prediction model hyperparameters. Next, the Cauchy mutation function is called to extract random numbers from the Cauchy distribution and generate mutation values corresponding to the position vector. f\left ( {x;{x}_{0},\gamma} \right )=\frac {1} {\pi \gamma \left [ {1+\left ( {\frac {x-{x}_{0}} {\gamma}} \right )^{2}} \right ]} ; in, It is a position parameter. It is a scale parameter; The generated Cauchy random number is multiplied by the global optimal solution of the hyperparameters of the current wheat futures price prediction model and added to the original position vector. Cauchy mutation is then performed on each element. mutated\_ position\left [ {i} \right ]=position\left [ {i} \right ]+cauch\, y\_ random\left [ {i} \right ]*position\left [ {i} \right ] ; Where, position\left [ {i} \right ] It is the first in the original position vector 1 element, cauch, y_ random [ {i} \right ] The first one generated from the Cauchy distribution A random number; Finally, the updated wheat futures price prediction model was updated by introducing the global optimal solution of hyperparameters after Cauchy mutation, which improves the global search capability of ARO and avoids getting trapped in local optima. (2) Use an adaptive crossover strategy to improve the local search capability of ARO: First, the crossover rate is adjusted based on individual fitness. Individuals with higher fitness have a higher crossover rate, while those with lower fitness have a lower crossover rate. This ensures the diversity and convergence speed of the hyperparameter population in the wheat futures price prediction model. ; in, It is the basic crossover rate; It is a scaling factor; It is the fitness value of the individual with the highest fitness in the hyperparameter population of the wheat futures price prediction model; It is the fitness value of the individual with the lowest fitness in the hyperparameter population of the wheat futures price prediction model; Then, during the evolution process, the execution probability of the crossover operation is dynamically adjusted, and the decision to perform the crossover operation is based on the current crossover rate. If the crossover operation is performed, two individuals in the hyperparameter population of the wheat futures price prediction model are selected as parents, and offspring are generated and added to the hyperparameter population of the wheat futures price prediction model. Finally, the individual position and fitness are updated, and the local search efficiency is optimized through the adaptive crossover strategy to accelerate the convergence of the algorithm.
[0020] The construction process of the wheat futures price prediction model using the classic Long Short-Term Memory (LSTM) network and attention mechanism in step S3 includes: This paper uses the Keras library to create an LSTM layer and an attention mechanism layer for a wheat futures price prediction model. The input layer shape, the number of LSTM neurons, and the activation function are set. A Lambda layer is added for dimensionality reduction, and a fully connected layer is added to the attention mechanism to calculate the attention weights. The LSTM output is multiplied by the attention weights to obtain the weighted output, and the target value is predicted through the fully connected layer.
[0021] In step S4, the improved ARO algorithm is used to find the optimal parameters of the LSTM-attention model for wheat futures price prediction. Specifically: Define the objective function of ARO, take the parameters of the LSTM model as input, including the number of neurons, batch size, and number of training epochs, and return the loss function. Optimize this objective function using an improved ARO algorithm to find the optimal number of neurons, batch size, and number of training epochs, thus finding the optimal hyperparameters for the wheat futures price prediction model. Key strategies for using the ARO optimization algorithm to find the optimal hyperparameters for the LSTM-attention model in wheat futures price prediction include: (1) Detour foraging strategy: This strategy improves the efficiency of ARO in searching for the optimal hyperparameters of the wheat futures price prediction model by having each individual update its position to another randomly selected individual in the hyperparameter population of the wheat futures price prediction model, while introducing perturbations to avoid local extrema. , ; in, It is the first During the nth iteration The candidate position for a rabbit It is the first During the nth iteration The rabbit's current location. It is the number of hyperparameters in the wheat futures price prediction model population. A random number in (0,1) To generate random numbers that conform to a quasi-normal distribution; (2) Random hiding strategy: In each iteration of the optimal hyperparameter search for the wheat futures price prediction model, each individual creates multiple "caves" in different dimensions of the search space and randomly selects one to hide in, in order to reduce the risk of capturing local extrema: , ; in, Indicates a randomly selected cave; (3) Energy factor mechanism: The ARO algorithm dynamically switches between detour foraging and random hiding strategies using an energy factor, exploring and developing the optimal hyperparameters for wheat futures price prediction models. ; in, It is a random number in (0, 1).
[0022] In summary, the advantages of this invention are: This invention optimizes the LSTM-attention model for wheat futures price prediction using an improved ARO algorithm based on CMACS, achieving accurate predictions of wheat futures prices. The CMACS strategy enhances the global search capability by increasing the randomness and perturbation of the ARO algorithm and introduces a more flexible search mechanism, effectively addressing the complexity of the problem and ensuring the algorithm can explore a wider search space, avoiding getting trapped in local optima. Optimizing the hyperparameters (such as the number of neurons, batch size, and number of training epochs) of the LSTM-attention model using the improved ARO algorithm effectively reduces the impact of inappropriate parameters on the model's performance, thereby improving prediction accuracy and computational efficiency, especially demonstrating significant advantages when dealing with complex fluctuations in the wheat sales market. Using the prediction method of this invention for wheat futures price prediction not only captures short-term and long-term market dependencies but also effectively responds to sudden events and abnormal market fluctuations, significantly improving the robustness and stability of the prediction. This provides market participants with a more reliable basis for decision-making, facilitates better risk management and market regulation, and provides scientific support for government policy-making and food security maintenance.
Claims
1. A wheat futures price prediction algorithm based on CMACS-ARO-LSTM-attention, characterized in that, Includes the following steps: Step S1: Using "wheat" as the research object among China's major agricultural products, construct a wheat price dataset and preprocess the wheat data. Based on the wheat price dataset, generate a training set, a test set, and a validation set in a 6:2:2 ratio. Step S2: Improve the Artificial Rabbit Optimization Algorithm (ARO) using Cauchy Mutation and Adaptive Crossover Strategy (CMACS); Step S3: Construct a wheat futures price prediction model using a classic Long Short-Term Memory (LSTM) network and an attention mechanism; Step S4: Use the improved ARO algorithm to find the optimal parameters of the wheat futures price prediction model LSTM-attention, including the number of neurons, batch size, and number of training rounds; Step S5: The improved LSTM-attention model is trained, tested, and validated using the wheat price training set. The classic time series regression evaluation indicators, root mean square error (RMSE), mean absolute error (MAE), and coefficient of determination (R²), are used as evaluation criteria to measure the predictive ability of the wheat futures price prediction model.
2. The wheat futures price prediction method based on CMACS-ARO-LSTM-attention as described in claim 1, characterized in that, Step S1 specifically involves: We collected data on wheat spot prices, wheat futures prices, the national average wheat price, and futures prices for corn, bran, and wheat middlings from 12 representative regions. We preprocessed the wheat price data using the classic normalization method and tested the degree of influence of past wheat futures prices on future prices through autocorrelation analysis. Using a Windows sliding window, wheat price data is divided into groups of five days. The target values of the previous five days are also used as feature values, and are used together with other features to predict the target value for the next day. The wheat price dataset is divided into training set, test set and validation set in a ratio of 6:2:
2.
3. The wheat futures price prediction method based on CMACS-ARO-LSTM-attention as described in claim 1, characterized in that, In step S2, the improvement of the Artificial Rabbit Optimization Algorithm (ARO) through Cauchy mutation and adaptive crossover strategy (CMACS) specifically involves: (1) Use Cauchy mutation to improve the global search capability of ARO: First, a population of hyperparameters and related parameters for a wheat futures price prediction model is randomly initialized. Then, based on the energy factor, a foraging and random hiding strategy is implemented to calculate the fitness of each individual, update the individual's position and the global optimal solution of the current wheat futures price prediction model hyperparameters. Next, the Cauchy mutation function is called to extract random numbers from the Cauchy distribution and generate mutation values corresponding to the position vector. ; in, It is a position parameter. It is a scale parameter; The generated Cauchy random number is multiplied by the global optimal solution of the hyperparameters of the current wheat futures price prediction model and added to the original position vector. Cauchy mutation is then performed on each element. ; in, It is the first in the original position vector One element, The first one generated from the Cauchy distribution A random number; Finally, the updated wheat futures price prediction model was updated by introducing the global optimal solution of hyperparameters after Cauchy mutation, which improves the global search capability of ARO and avoids getting trapped in local optima. (2) Use an adaptive crossover strategy to improve the local search capability of ARO: First, the crossover rate is adjusted based on individual fitness. Individuals with higher fitness have a higher crossover rate, while those with lower fitness have a lower crossover rate. This ensures the diversity and convergence speed of the hyperparameter population in the wheat futures price prediction model. ; in, It is the basic crossover rate; It is a scaling factor; It is the fitness value of the individual with the highest fitness in the hyperparameter population of the wheat futures price prediction model; It is the fitness value of the individual with the lowest fitness in the hyperparameter population of the wheat futures price prediction model; Then, during the evolution process, the execution probability of the crossover operation is dynamically adjusted, and the decision to perform the crossover operation is based on the current crossover rate. If the crossover operation is performed, two individuals in the hyperparameter population of the wheat futures price prediction model are selected as parents, and offspring are generated and added to the hyperparameter population of the wheat futures price prediction model. Finally, the individual position and fitness are updated, and the local search efficiency is optimized through the adaptive crossover strategy to accelerate the convergence of the algorithm.
4. The wheat futures price prediction method based on CMACS-ARO-LSTM-attention as described in claim 1, characterized in that, In step S4, the improved ARO algorithm is used to find the optimal parameters of the wheat futures price prediction model LSTM-attention, specifically as follows: Define the objective function of ARO, take the parameters of the LSTM model as input, including the number of neurons, batch size, and number of training epochs, and return the loss function; use the improved ARO algorithm to optimize the objective function, find the optimal number of neurons, batch size, and number of training epochs, and find the optimal hyperparameters for the wheat futures price prediction model.