UPM Institutional Repository

Computationally efficient single layer transformer convolutional encoder for accurate price prediction of agriculture commodities


Citation

Bundak, Caceja Elyca and Abd Rahman, Mohd Amiruddin and Mohd Haniff, Nurin Syazwina and Afrizal, Nur Syaiful and Yusof, Khairul Adib and Abdul Karim, Muhammad Khalis and Mamat, Md Shuhazlly and Rahmat, Romi Fadillah (2025) Computationally efficient single layer transformer convolutional encoder for accurate price prediction of agriculture commodities. IEEE Access, 13. pp. 82144-82159. ISSN 2169-3536

Abstract

Predicting the accurate future price of the agricultural crops is important to avoid overproduction or shortages in the food supply chain. To obtain accurate predictions, the process usually involves large and complex datasets, which would add to computational costs for developing a model with good performance. Therefore, this study introduces the single-layer Transformer Convolutional Encoder algorithm (STCE), an improved version of the traditional transformer encoder. STCE is computationally efficient and does not compromise the accuracy of the prediction. In STCE, the fully connected Convolutional Neural Network (CNN) layer is used in the transformer to get the first temporal features and record long-range dependencies with Multi-Head Attention. To minimize complexity while maintaining performance, a single dense layer is used for the output instead of the Multi-Layer Perceptron (MLP) and omit positional encoding, which leverages the natural sequence order of the time series data. Additionally, since time-series price data normally comes with missing values, this study introduce a sequence nearest neighbor imputation algorithm for anchoring that data to complement the STCE method. This study focuses on various vegetable prices, such as tomatoes, long beans, and cucumbers, with empirical validation across various prediction prices, specifically 30-day, 60-day, and 90-day predictions. Predictions made with Root Mean Squared Error (RMSE), Mean Absolute Error (MAE), and Mean Absolute Percentage Error (MAPE) show that the STCE algorithm is better than other deep learning algorithms, even the traditional transformer encoder. STCE algorithm not only has better performance, but it also reduces the computational time in the training with 12% fewer seconds compared to the transformer encoder and 22% fewer seconds for LSTM. This study not only provides valuable insights for farmers and planners in the agriculture market but also highlights the robust potential of transformer encoder in predicting commodity markets.


Download File

[img] Text
121535.pdf - Published Version
Available under License Creative Commons Attribution.

Download (3MB)
Official URL or Download Paper: https://ieeexplore.ieee.org/document/10990219/

Additional Metadata

Item Type: Article
Divisions: Faculty of Science
DOI Number: https://doi.org/10.1109/ACCESS.2025.3567903
Publisher: Institute of Electrical and Electronics Engineers
Keywords: CNN; Commodity price prediction; Deep learning; Encoder; Transformer
Depositing User: MS. HADIZAH NORDIN
Date Deposited: 05 Nov 2025 06:50
Last Modified: 05 Nov 2025 06:50
Altmetrics: http://www.altmetric.com/details.php?domain=psasir.upm.edu.my&doi=10.1109/ACCESS.2025.3567903
URI: http://psasir.upm.edu.my/id/eprint/121535
Statistic Details: View Download Statistic

Actions (login required)

View Item View Item