Research Article Optimized Multivariate Adaptive Regression Splines for Predicting Crude Oil Demand in Saudi Arabia Eman H. Alkhammash , 1 Abdelmonaim Fakhry Kamel , 2 Saud M. Al-Fattah , 3 and Ahmed M. Elshewey 4 1 Department of Computer Science, College of Computers and Information Technology, Taif University, P.O. Box 11099, Taif 21944, Saudi Arabia 2 Faculty of Graduate Environmental Studies, Ain Shams University, Cairo, Egypt 3 Saudi Aramco, Dhahran, Saudi Arabia 4 Faculty of Computers and Information, Computer Science Department, Suez University, Suez, Egypt Correspondence should be addressed to Eman H. Alkhammash; hms_1406@hotmail.com and Ahmed M. Elshewey; elshewy86@ gmail.com Received 4 November 2021; Revised 16 December 2021; Accepted 24 December 2021; Published 10 January 2022 Academic Editor: Jorge E. Macias-Diaz Copyright © 2022 Eman H. Alkhammash et al. is is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited. is paper presents optimized linear regression with multivariate adaptive regression splines (LR-MARS) for predicting crude oil demand in Saudi Arabia based on social spider optimization (SSO) algorithm. e SSO algorithm is applied to optimize LR-MARS performance by fine-tuning its hyperparameters. e proposed prediction model was trained and tested using historical oil data gathered from different sources. e results suggest that the demand for crude oil in Saudi Arabia will continue to increase during the forecast period (1980–2015). A number of predicting accuracy metrics including Mean Absolute Error (MAE), Median Absolute Error (MedAE), Mean Square Error (MSE), Root Mean Square Error (RMSE), and coefficient of determination (R 2 ) were used to examine and verify the predicting performance for various models. Analysis of variance (ANOVA) was also applied to reveal the predicting result of the crude oil demand in Saudi Arabia and also to compare the actual test data and predict results between different predicting models. e experimental results show that optimized LR-MARS model performs better than other models in predicting the crude oil demand. 1. Introduction e development of prediction techniques and machine learning models is a critical task for crude oil demand [1]. e prediction techniques can predict different features in oil [2] including oil price, oil demand, oil viscosity, etc. Prediction models and techniques can present many ad- vantages in energy sector such as energy planning, strategy formulation, and energy advancement. e design of pre- diction models and techniques is a complex task which has huge impacts for the economic trajectories of countries, energy companies, and other industrial sectors [3]. According to the International Energy Agency (IEA), the global demand for crude oil accounted for about 41% of the total fuel share in 2016. According to the Organization of the Petroleum Exporting Countries (OPEC), Saudi Arabia is one of the world’s largest oil consumers, ranking fifth after Russia with a 3.4% share of global oil consumption in 2016. ere are numerous models that support the crude oil demand prediction, including autoregressive conditional heteroscedasticity (ARCH) model [4], other time series models, artificial neural networks [5], and fuzzy theory predictions [6, 7]. Machine learning models play an important role in the evaluation and prediction tasks. e features included in the dataset can be used to perform predictions. Machine learning models can also perform future predictions based on the available in the dataset [8]. Regression analysis is a Hindawi Discrete Dynamics in Nature and Society Volume 2022, Article ID 8412895, 9 pages https://doi.org/10.1155/2022/8412895