1. Introduction
Forecasting plays a vital role in macroeconomic planning. It is a critical analysis tool for countries’ financial and monetary strategies. Predicting key variables such as gross domestic product (GDP), inflation, interest rates, exchange rates, and taxes are essential for making economic decisions for fiscal authorities and state banks. Policymakers usually make decisions in real time based on incomplete knowledge about the current situation of an economy [
1]. The ability to predict macroeconomic factors is essential for designing and implementing timely policy responses. Exchange rate forecasting is important for financial institutions and companies with foreign currency exposure. Companies with such risk must hedge their foreign currency cash flows to predict their benefits from changes in exchange rates. Financial forecasting, especially exchange rate forecasting, is becoming a crucial topic in the field of economics. The literature shows that the macroeconomic model is one of the earliest forecasting models used to predict exchange rates. However, the low performance of traditional econometric models is forcing the research community to investigate efficient methods to identify exchange rate fluctuations. Although artificial intelligence has been a subject for decades, it is now finally beginning to have an impact on business operations as well as the daily lives of individuals and different studies have been conducted on the application of artificial intelligence in the financial sector [
2]. In the past few years, ML techniques have attracted increasing interest in forecasting different variables. Many traditional methods were proposed for predicting macroeconomic variables, but there are still some challenges. Machine learning methods have received extensive attention from the research community due to their high predictive accuracy. These methods include many powerful models that have made significant achievements in finance and other fields. These soft computing machine learning models often prove very successful in financial and monetary forecasts, which involve forecasting GDP, interest rate inflation, unemployment rate stock indices, currencies, creditworthiness, or bankruptcy prediction. They are not only restricted to financial and money forecasting. However, these methods of ML are applied by a research institute to resolve different kinds of real-world problems such as pattern classification, statistic forecasting, optimizations, use in medical treatment, and signal processing.
Nevertheless, the concept of artificial intelligence is not fully applicable in under-developed countries, especially in Pakistan where the progression of AI not only has been slow but is applied in just a few sectors [
3]. Over the last few decades, the technology’s capacity to crunch data and then derive useful knowledge from billions of inputs in milliseconds has improved exponentially, but this is not adopted in non-financial sectors of Pakistan. Likewise, in Pakistan, the risk was predicted by the researcher with the use of traditional techniques such as VaR, CVaR, standard deviation, and beta, but no work has been conducted on the financial and non-financial sectors using artificial intelligence techniques. This study analyzed the influence of various AI techniques based on ML algorithms and their impact on the automation of risk. Moreover, it determined accurate risk prediction by using supervised artificial intelligence techniques and presented the best-fit AI technique with the highest accuracy offering the lowest error values for non-financial firms in Pakistan. Within the economic community, the interest in the forecast of exchange rates is based on predicting future trends and better achieving financial advantages or certain hedge risks [
4]. For instance, large multinational companies that view the foreign exchange rate as an essential aspect of their business can benefit significantly from accurate forecasts [
5]. However, this interest in the foreign exchange market is not limited to large multinational companies. Exchange rate forecasting is now important for all types of companies, regardless of their size, geographic distribution, or business. This is because, regardless of whether or not a company is concerned with international business through export, imports, and FDI, it can require foreign currency to pay for imported goods or services. As a result, the costs of imported or exported products and services may vary with the exchange rate, which creates a particular exchange rate risk.
The economy of Pakistan is mainly based on the import of commodities. Exchange rate fluctuations are affected by the dynamics of commodity prices, and the randomness in the exchange rates makes it difficult to predict. Therefore, nonlinear parametric and non-parametric models perform poorly on exchange rate forecasting. The second complication associated with the forecasting of exchange rates is the noise and the chaotic and unsteady nature of the data [
6]. Statistical methods assume that the data are linear and correlated, but in practice, the time-series data, mainly the exchange rates, do not conform to this type of assumption; therefore, the forecast of the exchange rate by the various statistical methods is not satisfactory [
7]. This paper aims to propose a forecasting model that is ready to forecast inflation rate and exchange rate movements accurately, especially in the context of Pakistan. Special focus is on the machine learning forecasting techniques such as k-nearest neighbor (KNN), polynomial regression (PR), artificial neural networks (ANNs), and support vector machine (SVM). This paper focuses on the answering following questions:
How to determine the best ML technique (KNN, PR, ANN, and SVM) to forecast the macroeconomic indicators (exchange rate and inflation rate)?
What is the best ML technique (KNN, PR, ANN, and SVM) with the minimum error for predicting the macroeconomic indicators (exchange rate and inflation rate)?
What are the impacts of the hidden layers and the number of neurons per layer of the ANN technique on the errorless prediction of exchange rates?
Do the hidden layers and the number of neurons per layer of the ANN technique have any impact on the error-less prediction of inflation rates?
Keeping the above questions in mind, the study was conducted based on the following objectives that provided the ultimate solution to the question raised, and thus, problems were solved. The research question is based on the following objective:
To examine the best ML technique (KNN, PR, ANN, and SVM) to forecast the macroeconomic indicators (exchange rate and inflation rate);
To determine the best ML technique (KNN, PR, ANN, and SVM) with the minimum error for predicting the macroeconomic indicators (exchange rate and inflation rate);
To find out the impacts of the hidden layers and the number of neurons per layer of the ANN technique on errorless prediction of exchange rates;
Observing the hidden layers and the number of neurons per layer of the ANN technique have any impact on error-less prediction of inflation rates.
The remainder of the paper is organized as follows:
Section 2 presents an overview of the literature.
Section 3 presents the material and methods.
Section 4 presents experimental results. Finally, the conclusion is presented in
Section 5.
2. Literature Review
Predicting macroeconomic data such as GDP, inflation, and unemployment exchange rate is a challenging task. In order to make predictions, considerable data are required, and the relationships between different independent variables and dependent variables need to be established. The traditional economic predicting models require suitable predefined predictor variables and are usually based on theory-driven approaches, whereas ML algorithms aim to improve forecasting capabilities, especially when the actual model is unknown and complex and past experiences in the form of data are available.
In recent years, ML has achieved remarkable progress, especially in a recognition task, not only spinning from visualization to speech, but also in predicting problem and the ability to effectively process large amounts of data, as well as processing algorithms in a reasonable time frame, and the cost is relatively low [
8]. Data management, workflow automation, predictive decision automation, and smart visualizations are only a few of AI building blocks that can be used to digitalize a company’s risk features. Commercial implementations of Al technologies are increasingly accessible on online platforms from accounting firms, management compliance and risk management consultants, governance and organization management consultants, and others, relying on process automation to assist risk management more appropriately as compared to risk governance. Advanced analytics allowed by AI explain the evolution of digitalized risk of technology into cognitive insight, allowing for appropriate and precise analytics than before. As a result, decisions are being automated, aided by smart visualizations and the application of augmented reality in the risk role of an organization, which are still emerging technologies [
9]. ML algorithms are recently used to predict GDP from data [
10], as ML algorithms are more flexible than traditional predicting models and can make predictions without assumptions or predefined judgments but based on previous experiences [
11]. Forecasting inflation and exchange rates is significant for financial planning. Various studies used different forecasting techniques to examine inflation and exchange rate forecasting. A comparative analysis of ML algorithms and factor models to predict Japan’s macroeconomic time series has been presented [
12]. Moreover, Ülke et al. [
13] compared ML techniques for inflation forecasting in the USA from 1984 to 2014. Moreover, it is also reported [
11] that the random forest model and gradient boosting model are more accurate than the autoregressive benchmark for macroeconomic forecasting. In a study reported [
14], ML approaches are found better than dynamic factor models and autoregressive techniques for forecasting Pakistan’s GDP. It is shown that predicting gains through nonlinear methods is associated with high macroeconomic uncertainty, financial pressure, and housing bubble bursts [
15]. According to Gogas et al. [
16], the SVM method has been widely used to forecast the real GDP in different parts of the world for making quick decisions regarding the economy. The results of the study showed very accurate forecasting. AI is being used to constructively track and prevent misrepresentation, fraudulent tax evasion, incompetence, and the detection of potential risks. Companies, for example, use individual data and attitudes to identify patterns and detect suspicious transactions. Master cards have been working to integrate AI technology in the “identification” of individual frauds as part of their monetary service networks. Similar methods have been used to determine trade misconduct [
2]. Therefore, AI techniques and machine learning algorithms that make up AI’s foundation are revolutionizing and will continue to revolutionize how we handle financial risk. The progress of artificial intelligence-based outcomes helps to detect the amount banks can lend to a customer and determines the ways that can provide alarming signs to the traders of the financial market regarding role danger, assists in detecting insider and customer fraud and provides means to improve enforcement and reduce the model risk [
17].
According to Heaton et al. (2017), neural networks and deep learning algorithms are considered to be at the cutting edge of techniques of machine learning, and they are mostly classified and chosen separately from the other ML techniques. Deep learning, depending on the reason for which it is used, can be both supervised and unsupervised. Moreover, it is also reported by Medeiros et al. [
18] whether we can use random forest and LASSO for forecasting. Moreover, the focus of this research is inflation and exchange rate prediction. The inflation rate plays an essential role in financial economics. Inflation is a global problem that has received much attention. The inflation rate not only is an economic variable, but is also related to people’s lives and social stability. Inflation rate prediction helps in policymaking. High inflation can cause an economic recession in a country. Hence, inflation needs to be controlled. One of the government’s measures to control inflation is to use the consumer price index (CPI) to calculate and forecast inflation every month. The CPI is one of the most usually used indicators to calculate the inflation rate. It affects the decisions of the government, families, policymakers, and investors. A high inflation rate will worsen an economy’s economic growth, reduce wages and increase the cost of production. Similarly, a low-inflation environment is seen as a negative economic indicator related to the decline in economic demand. Therefore, it is crucial to predict the inflation rate in different time frames.
In both business and science, big data has now become a hot subject. Technological innovation in finance has dramatically changed over the last 10 years, in a large part due to some big increase and progress arising from advances in information technology and financial practice, in the shape of big data, artificial intelligence (AI), machine learning, and blockchain technologies. In this regard, the rapid development of technologies such as big data, cloud computing, blockchain, and artificial intelligence and financial technology is now spreading worldwide. Likewise, in today’s world, artificial intelligence (AI) and big data (BD) have risen very rapidly, which is playing an important role in the latest era techniques of financial institutions. In addition, this new era of digital technologies brought the evolving concept of financial technology (FinTech). Simply Fintech can be defined as “a systematic technology that will enable financial innovation for bringing the latest business models, the application of these models with a built-in sense of the process that will affect that performance of the financial institution. Thus, FinTech will provide a very helpful base to the prevailed situation in the financial markets for establishing a link between financial service and performance. FinTech innovations, which are emerging in many aspects of finance, such as retail finance, wholesale payments, investment management, insurance, credit provision, and equity capital raising, are not only competing with traditional financial services, but also promoting their innovations and transformation. Despite the emergence of financial innovations in the financial industry, the effects of FinTech on the financial system are less understood. The methods are used to mine the correlation of various variables among huge and massive data, such as interbank liquidity and global capital flow including the relation between financial markets and web contracts [
19]. Big data analyses’ key goal is to combine disparate financial data and gain more insight to perceive and distinguish systemic risk [
20]. As a result, big data analysis is similar to other application fields that include heterogeneous data knowledge fusion and traditional data mining algorithms such as classification methods [
21].
Similarly, the researcher researched to study the impact of artificial intelligence in minimizing systematic risk [
22]. According to this study, the use of AI engines in the financial sector will help risk managers in forecasting and minimizing risk by increasing efficiency and by cost-saving [
23]. In the literature, it is also concluded that the use of AI and machine learning in financial and macroeconomic indicators will predict the minimization of risk [
24]. In this study, they also discussed the challenges and future of AI in risk management. The availability of appropriate data is the most significant of these challenges. While Python and R machine learning packages can read data of all types from Excel to SQL, as well as performing natural language processing and image processing, the rate at which machine learning applications have been proposed has not kept up with companies’ ability to organize the internal data they have appropriate access to. Data are often held in various silos around departments, on different systems, and often with internal political constraints.
Considering the above literature, we conducted research in which we studied the role of artificial intelligence in the automation of financial, operational, strategic, and reputational risk. We also identified which technique of AI is the best fit for risk prediction by examining which offers the highest accuracy rate. The GDP growth, inflation, exchange rate, and interest rate are the most critical indicators of macroeconomic factors. However, predicting macroeconomic variables requires complicated calculations, and sometimes official data are frequently available after at least one quarter [
11]. Because of this delay, sometimes policymakers apply policies without considering the actual conditions of an economy. Macroeconomic variables are difficult to predict, because many other variables may affect them. In the past, forecasting based on statistical modelling has been used. The most common statistical model used to predict time series is the autoregressive (AR) model, which assumes that future observations are mainly based on current observations (Hall 2018). However, AR models are regarded as a benchmark for predicting macroeconomic variables in many studies. Although different econometric methods are widely used, they have some obvious disadvantages. First, they assume serial correlation, and second, such techniques are not applicable when we have a large number of different kinds of data to be considered with an aim to generate forecasts in actual time. The ineffectiveness of traditional methods and the noisy and random nature of the data encourage researchers to use machine learning methods. With the advancement of computing power, the use of machine learning methods as an alternative to time series regression models are getting attention day by day. ML allows computer systems to mimic human intelligence. The development and deployment of ML in macroeconomic forecasting have increased dramatically. ML can manage complex economic systems efficiently with large amounts of data [
25]. When it comes to macroeconomic forecasting, machine learning algorithms have recently received much attention in economic analysis. In line with the above, this paper contributes in two different ways. Firstly, it compares the performances of machine learning models for forecasting inflation which have not yet been thoroughly analyzed and covered before. This paper pays special attention to ANNs, KNN, polynomial regression, and SVM, because these models have received extensive attention in many prediction problems due to their excellent performance. Second, it introduces a machine learning-based approach to achieve more accurate forecasting of exchange rates and inflation in Pakistan than the forecasting made by different econometric methods. To the best of our knowledge, there have been no studies that compare these methods.
Theoretical Support of the Research
As theory is an integral part of the research, we used computational learning theory as an underpinning theory for this research. Computational learning theory refers to a formal mathematical framework that aims to quantify learning tasks and algorithms. It is also called “statistical learning theory”. The basic purpose of computational learning theory is to learn the machine learning algorithm and determine what is understandable. It will help us to know the required data sufficient for the training of a specific algorithm. This theory is related to the design and analysis of machine learning algorithms (association with computational learning). It is a branch of theoretical computing that discusses the main designs of a computer program and its ability to identify computing limitations. This theory helps to raise questions on the performance of learning algorithms. In particular, such algorithms aim to make accurate predictions or representations based on observations. The availability of a large amount of data has enhanced the role of this theory for the accurate prediction of the stock market.