International Journal of Electrical and Computer Engineering (IJECE) Vol. 13, No. 5, October 2023, pp. 5265~5272 ISSN: 2088-8708, DOI: 10.11591/ijece.v13i5.pp5265-5272 5265 Journal homepage: http://ijece.iaescore.com Random forest model for forecasting vegetable prices: a case study in Nakhon Si Thammarat Province, Thailand Sopee Kaewchada 1 , Somporn Ruang-On 1 , Uthai Kuhapong 2 , Kritaphat Songsri-in 3 1 Creative Innovation in Science and Technology Program, Faculty of Science and Technology, Nakhon Si Thammarat Rajabhat University, Nakhon Si Thammarat, Thailand 2 School of Science, Walailak University, Nakhon Si Thammarat, Thailand 3 Computer Science Program, Faculty of Science and Technology, Nakhon Si Thammarat Rajabhat University, Nakhon Si Thammarat, Thailand Article Info ABSTRACT Article history: Received Oct 20, 2022 Revised Jan 12, 2023 Accepted Feb 4, 2023 The objectives of this research were developing a model for forecasting vegetable prices in Nakhon Si Thammarat Province using random forest and comparing the forecast results of different crops. The information used in this paper were monthly climate data and average monthly vegetable prices collected between 2011 – 2020 from Nakhon Si Thammarat meteorological station and Nakhon Si Thammarat Provincial Commercial Office, respectively. We evaluated model performance based on mean absolute percentage error (MAPE), root mean squared error (RMSE), and mean absolute error (MAE). The experimental results showed that the random forest model was able to predict the prices of vegetables, including pumpkin, eggplant, and lentils with high accuracy with MAPE values of 0.09, 0.07, and 0.15, with RMSE values of 1.82, 1.46, and 2.33, and with MAE values of 3.32, 2.15, and 5.42, respectively. The forecast model derived from this research can be beneficial for vegetable planting planning in the Pak Phanang River Basin of Nakhon Si Thammarat Province, Thailand. Keywords: Dataset Forecasting Machine learning Random forest model Vegetable price This is an open access article under the CC BY-SA license. Corresponding Author: Somporn Ruang-On Creative Innovation in Science and Technology Program, Faculty of Science and Technology, Nakhon Si Thammarat Rajabhat University Tha Ngio Subdistrict, Muang District, Nakhon Si Thammarat 80280, Thailand Email: somporn_rua@nstru.ac.th 1. INTRODUCTION Nakhon Si Thammarat is a province in the south of Thailand, where most of the population is engaged in agriculture. The main problems found in vegetable cultivation in the province are droughts. According to the statistics, Nakhon Si Thammarat experienced a total of 5 droughts during 2013 to 2019. In 2016, there were 12 districts with the highest drought level, and the agriculture was damaged by 883.54 square kilometres [1]. Besides the unfavourable climate, farmers face the problem of plant disease, pest infestation, and low consumer prices as farmers cannot set desired prices [2]. Although the price of vegetables has a large impact on the population, it is volatile and changes quickly. This makes it more difficult to predict future prices consistently. Nonetheless, vegetable price prediction is necessary for the general public to recognize the price of vegetables in advance [3]. There is currently a lot of research focusing on improving forecasting models to be more accurate by using modern statistical and computing methods such as machine learning (ML) and artificial intelligence (AI) depending on the goals and nature of the problem [4]. ML is a subdomain of AI [5]. It is a science of training computers to act without giving any command to it [6]. In AI, we make computers artificially more intelligent