An attention-enhanced TimesNet time series model for predicting the commodity price

Xiaorong Cai · Alexandria Engineering Journal · 2025

Commodity price prediction is a critical task in economic management, financial investment, and market regulation. Traditional prediction models, such as ARIMA and GARCH, often encounter limitations in capturing the complex nonlinear dynamics and time-dependent nature of price fluctuations. In this study, we present an enhanced TimesNet model that integrates self-attention mechanisms with two-dimensional time–frequency transformations. This combination improves the model’s ability to effectively capture both long-term trends and short-term cyclical fluctuations in commodity prices. The model was evaluated using data from a wide range of agricultural commodities, including potatoes, cucumbers, soybeans, corn, wheat, rapeseed, eggs, bananas, apples, oil, and watermelons. Experimental results demonstrate that the improved model significantly outperforms existing models. Specifically, with a sequence length of 512, the model achieves an average absolute error (MAE) of 0.129, compared to 0.134 for the original TimesNet model. These results confirm the enhanced model’s superior capacity for capturing long-term dependencies and cyclical fluctuations. The proposed TimesNet model, by combining self-attention and 2D time–frequency transformations, offers a robust, accurate, and computationally efficient solution for commodity price prediction, making it highly applicable to real-world agricultural markets.

Read the paper · More papers on PaperTik