Gold Price Forecasting Using Machine Learning Models with Hyperparameter Optimization for Inflation Hedging
Downloads
Gold serves as a hedge against inflation, particularly in emerging markets such as Malaysia, where macroeconomic volatility is pronounced. This study evaluates the predictive performance of six machine learning models; comprising ensemble models (Random Forest, XGBoost, Gradient Boosting Machine, and LightGBM) and deep learning models (Long Short-Term Memory and Gated Recurrent Units) in forecasting Malaysia's gold prices using monthly macroeconomic data from 2009 to 2024. Key indicators include inflation rates, interest rates, exchange rates, oil prices, and stock indices. Hyperparameter tuning is performed using the Optuna framework by comparing three optimization strategies: Tree-structured Parzen Estimator (TPE), Grid Search, and Covariance Matrix Adaptation Evolution Strategy (CMA-ES). Experimental results show that Gradient Boosting, optimized via CMA-ES, achieves the best performance (RMSE = 101.26, R² = 0.9972) using the complete feature set. While deep learning models demonstrate improvements following optimization, ensemble models consistently outperform them due to better alignment with the static, cross-sectional nature of the dataset. Feature importance analysis identifies GP_Low, GP_High, and both domestic and international inflation and interest rates as the most significant predictors. This study contributes by benchmarking ensemble and deep learning models, evaluating multiple hyperparameter optimization strategies, and identifying key macroeconomic indicators relevant to gold price forecasting. The findings provide valuable insights for investors, financial analysts, and policymakers in economies sensitive to inflation.
Downloads
[1] Baur, D. G., & Lucey, B. M. (2010). Is gold a hedge or a safe haven? An analysis of stocks, bonds and gold. Financial Review, 45(2), 217–229. doi:10.1111/j.1540-6288.2010.00244.x.
[2] World Gold Council. (2024). Gold Demand Trends: Full Year 2024. World Gold Council, London, United Kingdom.
[3] Bildirici, M. E., & Sonustun, F. O. (2018). The effects of oil and gold prices on oil-exporting countries. Energy Strategy Reviews, 22, 290–302. doi:10.1016/j.esr.2018.10.004.
[4] Ibrahim, M. H. (2012). Financial market risk and gold investment in an emerging market: the case of Malaysia. International Journal of Islamic and Middle Eastern Finance and Management, 5(1), 25–34. doi:10.1108/17538391211216802.
[5] Bin Sukri, M. K. A., & Mohd Zain, N. H. (2015). The relationship between selected macroeconomic factors and gold price in Malaysia. International Journal of Business, Economics and Law, 8(1), 182-193.
[6] Rady, E. H. A., Fawzy, H., & Fattah, A. M. A. (2021). Time series forecasting using tree based methods. Journal of Statistics Applications & Probability, 10(1), 229–244. doi:10.18576/JSAP/100121.
[7] Siami-Namini, S., Tavakoli, N., & Siami Namin, A. (2018). A Comparison of ARIMA and LSTM in Forecasting Time Series. 2018 17th IEEE International Conference on Machine Learning and Applications (ICMLA), 1394–1401. doi:10.1109/ICMLA.2018.00227.
[8] Anbananthen, S. K., Sainarayanan, G., Chekima, A., & Teo, J. (2006). Data Mining using Pruned Artificial Neural Network Tree (ANNT). 2nd International Conference on Information and Communication Technologies ICTTA 2006, 1350–1356. doi:10.1109/ictta.2006.1684577.
[9] Manjula, K. A., & Karthikeyan, P. (2019). Gold Price Prediction using Ensemble based Machine Learning Techniques. 2019 3rd International Conference on Trends in Electronics and Informatics (ICOEI), 1360–1364. doi:10.1109/icoei.2019.8862557.
[10] Jabeur, S. Ben, Mefteh-Wali, S., & Viviani, J. L. (2024). Forecasting gold price with the XGBoost algorithm and SHAP interaction values. Annals of Operations Research, 334(1–3), 679–699. doi:10.1007/s10479-021-04187-w.
[11] Mohtasham Khani, M., Vahidnia, S., & Abbasi, A. (2021). A Deep Learning-Based Method for Forecasting Gold Price with Respect to Pandemics. SN Computer Science, 2(4), 335. doi:10.1007/s42979-021-00724-3.
[12] Primananda, S. B., & Isa, S. M. (2021). Forecasting Gold Price in Rupiah using Multivariate Analysis with LSTM and GRU Neural Networks. Advances in Science, Technology and Engineering Systems Journal, 6(2), 245–253. doi:10.25046/aj060227.
[13] He, Z., Zhou, J., Dai, H.-N., & Wang, H. (2019). Gold Price Forecast Based on LSTM-CNN Model. 2019 IEEE Intl Conf on Dependable, Autonomic and Secure Computing, Intl Conf on Pervasive Intelligence and Computing, Intl Conf on Cloud and Big Data Computing, Intl Conf on Cyber Science and Technology Congress (DASC/PiCom/CBDCom/CyberSciTech), 1046–1053. doi:10.1109/DASC/PiCom/CBDCom/CyberSciTech.2019.00188.
[14] Liang, Y., Lin, Y., & Lu, Q. (2022). Forecasting gold price using a novel hybrid model with ICEEMDAN and LSTM-CNN-CBAM. Expert Systems with Applications, 206, 117847. doi:10.1016/j.eswa.2022.117847.
[15] Taneva-Angelova, G., Raychev, S., & Ilieva, G. (2025). A Framework for Gold Price Prediction Combining Classical and Intelligent Methods with Financial, Economic, and Sentiment Data Fusion. International Journal of Financial Studies, 13(2), 102. doi:10.3390/ijfs13020102.
[16] Anbananthen, K. S. M., & Elyasir, A. M. H. (2013). Evolution of opinion mining. Australian Journal of Basic and Applied Sciences, 7(6), 359-370.
[17] Hajek, P., & Novotny, J. (2022). Fuzzy Rule-Based Prediction of Gold Prices using News Affect. Expert Systems with Applications, 193, 116487. doi:10.1016/j.eswa.2021.116487.
[18] Kostyrin, E., & Drynkin, S. (2025). Innovative Approach to the Optimal Distribution of Citizens’ Pension Savings to Non-State Pension Funds. Emerging Science Journal, 9(1), 504–523. doi:10.28991/ESJ-2025-09-01-028.
[19] Hutter, F., Kotthoff, L., & Vanschoren, J. (2019). Automated machine learning: methods, systems, challenges. Springer, Cham, Switzerland. doi:10.1007/978-3-030-05318-5.
[20] Akiba, T., Sano, S., Yanase, T., Ohta, T., & Koyama, M. (2019). Optuna: A Next-generation Hyperparameter Optimization Framework. Proceedings of the ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, 2623–2631. doi:10.1145/3292500.3330701.
[21] Hashim, S. L., Ramlan, H., Razali, N. H., & Nordin, N. Z. (2017). Macroeconomic variables affecting the volatility of gold price. Journal of Global Business and Social Entrepreneurship (GBSE), 3(5), 97-106.
[22] Md Hashim, S. L. (2022). Analysis on Factors Influence the Price of Gold in Malaysia. Advanced International Journal of Business, Entrepreneurship and SMEs, 4(11), 16–22. doi:10.35631/aijbes.411002.
[23] Mohd Nasir, F. Z., Wan Zakaria, W. M. F., Musa, M. H., Burhanuddin, M. A., & Azman Ong, M. H. (2018). Economic forces on gold price in Malaysia. e-Academia Journal, 7(2), 54-65.
[24] Mainal, S. A., Mohd Selamat, A. H., Abd Majid, N. D. S., & Noorzee, K. N. I. (2023). Factors Influencing the Price of Gold in Malaysia. Information Management and Business Review, 15(3(I)), 195–205. doi:10.22610/imbr.v15i3(i).3529.
[25] Sailaja, V. N., Kumar, A., & VS, P. K. (2022). A study on macro-economic variables and their impact on gold price in India. Academy of Marketing Studies Journal, 26(5), 1-16.
[26] Cohen, G., & Aiche, A. (2023). Forecasting gold price using machine learning methodologies. Chaos, Solitons & Fractals, 175, 114079. doi:10.1016/j.chaos.2023.114079.
[27] Cologni, A., & Manera, M. (2008). Oil prices, inflation and interest rates in a structural cointegrated VAR model for the G-7 countries. Energy Economics, 30(3), 856–888. doi:10.1016/j.eneco.2006.11.001.
[28] Guo, C., Luo, Y., Qin, B., & Ge, X. (2025). Enhancing Gold Price Forecasting through Decomposition Algorithms and Deep Learning: A Comprehensive Comparative Analysis and Hybrid Model Matching Approach. Proceedings of 2025 4th International Conference on Cyber Security, Artificial Intelligence and the Digital Economy, CSAIDE 2025, 355–361. doi:10.1145/3729706.3729762.
[29] Das, S., Sahu, T. P., & Janghel, R. R. (2022). Oil and gold price prediction using optimized fuzzy inference system based extreme learning machine. Resources Policy, 79, 103109. doi:10.1016/j.resourpol.2022.103109.
[30] Liu, Y., Zhang, Y., & Peng, X. (2024). Textual analysis and gold futures price forecasting: Evidence from the Chinese market. Finance Research Letters, 69, 106116. doi:10.1016/j.frl.2024.106116.
[31] Salim, M., & Djunaidy, A. (2024). Development of a CNN-LSTM Approach with Images as Time-Series Data Representation for Predicting Gold Prices. Procedia Computer Science, 234, 333–340. doi:10.1016/j.procs.2024.03.007.
[32] Anbananthen, K. S. M., Busst, M. B. M. A., Kannan, R., & Kannan, S. (2023). A Comparative Performance Analysis of Hybrid and Classical Machine Learning Method in Predicting Diabetes. Emerging Science Journal, 7(1), 102–115. doi:10.28991/ESJ-2023-07-01-08.
[33] Makala, D., & Li, Z. (2021). Prediction of gold price with ARIMA and SVM. Journal of Physics: Conference Series, 1767(1), 012022. doi:10.1088/1742-6596/1767/1/012022.
[34] Narendran, S. (2024). Exploring the Efficacy of Various Machine Learning Approaches for Gold Price Forecasting: Insights and Analysis. 2024 7th International Conference on Circuit Power and Computing Technologies (ICCPCT), 1319–1324. doi:10.1109/ICCPCT61902.2024.10673291.
[35] Zangana, H. M., & Obeyd, S. R. (2024). Deep Learning-based Gold Price Prediction: A Novel Approach using Time Series Analysis. Sistemasi, 13(6), 2581. doi:10.32520/stmsi.v13i6.4651.
[36] Dewi, N. P. J. R., Ginantra, N. L. W. S. R., Darma, I. W. A. S., & Indrawan, I. G. A. (2023). Application of Long Short-Term Memory (LSTM) and Gated Recurrent Unit (GRU) Algorithm in Gold Price Prediction. 2023 11th International Conference on Cyber and IT Service Management, CITSM 2023, 1–6. doi:10.1109/CITSM60085.2023.10455749.
[37] Bergstra, J., Bardenet, R., Bengio, Y., & Kégl, B. (2011). Algorithms for hyper-parameter optimization. Advances in Neural Information Processing Systems (NIPS 2011), 24.
[38] Kee, T., & Ho, W. K. O. (2025). Optimizing Machine Learning Models for Urban Sciences: A Comparative Analysis of Hyperparameter Tuning Methods. Urban Science, 9(9), 348. doi:10.3390/urbansci9090348.
[39] Kausar, R., Iqbal, F., Raziq, A., Sheikh, N., & Rehman, A. (2024). Enhanced Foreign Exchange Volatility Forecasting using CEEMDAN with Optuna-Optimized Ensemble Deep Learning Model. Sains Malaysiana, 53(9), 3229–3239. doi:10.17576/jsm-2024-5309-25.
[40] Lai, L. H., Lin, Y. L., Liu, Y. H., Lai, J. P., Yang, W. C., Hou, H. P., & Pai, P. F. (2024). The Use of Machine Learning Models with Optuna in Disease Prediction. Electronics (Switzerland), 13(23), 4775. doi:10.3390/electronics13234775.
[41] Pokhrel, P., & Lazar, A. (2023). A Comparison of AutoML Hyperparameter Optimization Tools for Tabular Data. The International FLAIRS Conference Proceedings, 36. doi:10.32473/flairs.36.133357.
[42] Shekhar, S., Bansode, A., & Salim, A. (2021). A Comparative study of Hyper-Parameter Optimization Tools. 2021 IEEE Asia-Pacific Conference on Computer Science and Data Engineering (CSDE), 1–6. doi:10.1109/CSDE53843.2021.9718485.
[43] Lindauer, M., Eggensperger, K., Feurer, M., Biedenkapp, A., Deng, D., Benjamins, C., Ruhkopf, T., Sass, R., & Hutter, F. (2022). SMAC3: A Versatile Bayesian Optimization Package for Hyperparameter Optimization. Journal of Machine Learning Research, 23(54), 1–9.
[44] Breiman, L. (2001). Random forests. Machine Learning, 45(1), 5–32. doi:10.1023/A:1010933404324.
[45] Hochreiter, S., & Schmidhuber, J. (1997). Long short-term memory. Neural Computation, 9(8), 1735-1780. doi:10.1162/neco.1997.8.8.1735.
[46] Chung, J., Gulcehre, C., Cho, K., & Bengio, Y. (2014). Empirical evaluation of gated recurrent neural networks on sequence modeling. arXiv Preprint, arXiv:1412.3555. doi:10.48550/arXiv:1412.3555.
[47] Mahmud Sujon, K., Binti Hassan, R., Tusnia Towshi, Z., Othman, M. A., Abdus Samad, M., & Choi, K. (2024). When to Use Standardization and Normalization: Empirical Evidence from Machine Learning Models and XAI. IEEE Access, 12, 135300–135314. doi:10.1109/ACCESS.2024.3462434.
[48] Potoski, M. (2013). Predicting gold prices. CS 229: Machine Learning Final Projects, Stanford University, Stanford, United States.
[49] Kumar, R., Moolchandani, J., Shukla, A., Sahu, S., Thada, V., & Chole, V. (2024). Machine Learning-Based Prediction of Gold Prices Using Economic Indicators. 2024 13th International Conference on System Modeling & Advancement in Research Trends (SMART), 520–524. doi:10.1109/SMART63812.2024.10882507.
[50] Kohavi, R. (1995). A study of cross-validation and bootstrap for accuracy estimation and model selection. International Joint Conference on Artificial Intelligence (IJCAI), 14(2), 1137–1145.
[51] Brownlee, J. (2017). Long short-term memory networks with python: develop sequence prediction models with deep learning. Machine Learning Mastery, Vermont, Australia.
[52] Bailly, A., Blanc, C., Francis, É., Guillotin, T., Jamal, F., Wakim, B., & Roy, P. (2022). Effects of dataset size and interactions on the prediction performance of logistic regression and deep learning models. Computer Methods and Programs in Biomedicine, 213, 106504. doi:10.1016/j.cmpb.2021.106504.
[53] Greff, K., Srivastava, R. K., Koutnik, J., Steunebrink, B. R., & Schmidhuber, J. (2017). LSTM: A Search Space Odyssey. IEEE Transactions on Neural Networks and Learning Systems, 28(10), 2222–2232. doi:10.1109/TNNLS.2016.2582924.
[54] Ahmed, S., Akinci, O., & Queralto, A. (2024). U.S. Monetary Spillovers to Emerging Markets: Both Policy Drivers and Vulnerabilities Matter. doi:10.2139/ssrn.4973935.
[55] Hanifi, S., Cammarono, A., & Zare-Behtash, H. (2024). Advanced hyperparameter optimization of deep learning models for wind power prediction. Renewable Energy, 221, 119700. doi:10.1016/j.renene.2023.119700.
[56] Ahmed, S., Akinci, O., & Queralto, A. (2024). US Monetary Policy Spillovers to Emerging Markets: Both Shocks and Vulnerabilities Matter. FRB of New York Staff Report, 1321. doi:10.17016/IFDP.2021.1321r1.
[57] Leng, C. T., Yi, L. J., Woh, L. K., & Cheong, S. (2020). Asymmetric volatility spillover between oil market, gold market and Malaysian stock market. Bachelor of Finance, Universiti Tunku Abdul Rahman, Petaling Jaya, Malaysia.
[58] Shiva, A., & Sethi, M. (2015). Understanding Dynamic Relationship among Gold Price, Exchange Rate and Stock Markets: Evidence in Indian Context. Global Business Review, 16(5_SUPPL), 93–111. doi:10.1177/0972150915601257.
- This work (including HTML and PDF Files) is licensed under a Creative Commons Attribution 4.0 International License.



















