
EJERS, European Journal of Engineering Research and Science Vol. 5, No. 2, February 2020 Machine Learning Algorithmic Study of the Naira Exchange Rate Ledisi G. Kabari, Marcus B. Chigoziri, and Eneotu Joseph obtained from the Central Bank of Nigeria [5]. Fig. 1 Abstract—In this study, we discuss various machine learning represents a plot of the yearly average exchange rates of the algorithms and architectures suitable for the Nigerian Naira US Dollar (USD), British Pounds (GBP) and Euro (EUR) to exchange rate forecast. Our analyses were focused on the the Nigerian Naira (NGN). exchange rates of the British Pounds, US Dollars and the Euro The remaining parts of this paper are structured as against the Naira. The exchange rate data was sourced from the Central Bank of Nigeria. The performances of the follows: The related works are in Section II, Section III algorithms were evaluated using Mean Squared Error, Root presents the different machine learning algorithms used, the Mean Squared Error, Mean Absolute Error and the coefficient methodology is presented in Section IV, results and of determination (R-Squared score). Finally, we compared the discussions are in Section V and finally, the conclusion is in performances of these algorithms in forecasting the exchange Section VI. rates. Index Terms—Exchange Rate, Machine Learning, Recurrent Neural Network, Time Series Forecast. II. RELATED WORKS Reference [6] carried out a research on predicting the exchange rates of the US Dollar, British Pounds, Japanese I. INTRODUCTION YEN and other currencies, to the Nigerian Naira. They used The importance of exchange rate forecast cannot be Multiple Linear Regression and MATLAB to perform the overemphasized. It is believed that exchange rate volatility analysis. Reference [7] applied Seasonal Arima Model in hampers the growth of international trade [1]. The effects of forecasting the exchange of the naira. In the context the exchange rate variability [2] have been a subject of discuss Nigerian naira, these references never applied machine in international economics [3], [4]. Exchange rate forecast learning algorithms to analyze and compare their findings. help businesses to evaluate risks and make proactive Our primary focus on this is to apply different machine decisions in order to maximize returns. In the 1970’s, the learning algorithms, including the state-of-the-art Deep introduction of floating exchange rates led to a dynamic Neural Network (DNN) in foretelling the exchange rate of change in the international financial market. Since then, foreign currencies against the Nigerian naira. Existing exchange rates have been determined largely by private literature shows the use of Auto-Regressive conditional market forces within the floating exchange rate system. In a Heteroskedasticity (ARCH) [8] and Generalized Auto- densely populated country like Nigeria, which is a high Regressive conditional Heteroskedasticity (GARCH) [9] target for international investments, import and even export models for forecasting stock prices and other time series of goods, it is imperative to study foreign currency exchange data predictions. In these days of cryptocurrencies rates. (particularly bit- coin) that is disrupting the financing In this paper, we obtained, observed and analyze the institutions, reference [10] points out that Long-Short Term history of major foreign currencies exchange rates in the Memory (a type of Recurrent Neural Network) is more world against the naira in simple time series plots. We used successful in making prediction on bitcoin time series data. various machine learning algorithms such as the support References [11],[12],[13] and others have used recurrent vector machines, linear and polynomial regressions and neural network in predicting the price of bitcoin. However, recurrent neural network to train the historic data and our work and interest lies in predicting the exchange rates of forecast the next future exchange rates. We implemented the foreign currencies to the NGN. algorithms in Python programming language using the TensorFlow and Scikit-Learn (sklearn) frameworks, and MATLAB. We also used NumPy and Pandas libraries for III. MATH data preprocessing. The simulation was done using the daily In this section, the machine learning algorithms used in historic exchange rate data of a period of over 18 years, this paper are presented. A. Polynomial Regression Published on February 17, 2020. L. G. Kabari is with Computer Science Department, Ken Saro-Wiwa In the context of machine learning, polynomial regression Polytechnic, Bori, Nigeria (e-mail: [email protected]). can be transformed into linear regression. The general M. B. Chigoziri is a Post Graduate Student of Computer Science th Department, Ignatius Ajuru University of Education, Port Harcourt, Nigeria mathematical equation for a polynomial of n degree is: (e-mail: [email protected]). J. Eneotu is a Post Graduate Student of Computer Science Department, 2 푛 Ignatius Ajuru University of Education, Port Harcourt, Nigeria 푦(푤, 푥) = 푤0 + 푤1푥 + 푤2푥 +. +푤푛푥 (1) ([email protected]). DOI: http://dx.doi.org/10.24018/ejers.2020.5.2.1739 183 EJERS, European Journal of Engineering Research and Science Vol. 5, No. 2, February 2020 Where 푥 = 푥1 + 푥2+. +푥푛 C. Neural Networks and 푤 = 푤1 + 푤2+. +푤푛 A Neural Network (NN) is a set of computational A second-order (quadratic) polynomial can be written as: algorithms inspired by the neurons in the brain. A simple [14] NN also known as the single-layer perceptron, can be described as a function f which maps input data x to an 2 푦(푤, 푥) = 푤2푥 + 푤1푥 + 푤0 ( 2) output vector y as shown in equation 8. Which can be reformulated as: 푦 = 푓(푤 ⋅ 푥 + 푏) ( 8) 2 2 푦(푤, 푥) = 푤5푥2 + 푤4푥1 + 푤3푥1푥2 + 푤2푥2 + 푤1푥1 + 푤0(3) where w is the weight, and b is the bias. In this section, we shall be considering a popularly used NN algorithms. 2 2 Let say 푧 = [푥2 , 푥1 , 푥1푥2, 푥1, 푥2] = [푧5, 푧4, 푧3, 푧2, 푧1] D. Recurrent Neural Networks Therefore, A Recurrent Neural Net- work (RNN) is a type of NN that is designed to learn from sequence of data. The basic 푦(푤, 푥) = 푤5푧5 + 푤4푧4 + 푤3푧3 + 푤2푧2 + 푤1푧1 + 푤0 (4) problem of RNN is the vanishing gradient problem, however, this is solved by the Long-Short Term Memory This shows that the polynomial equation (2) has been (LSTM) architecture, a type of RNN introduced by transformed into a linear equation (4) in w. In this way, a Hochreiter et al [17]. In this paper we implemented the polynomial regression problem can be remodeled as a linear Gated Recurrent Unit (GRU), which is another variant of the one. In other words, polynomial curves can be used as a sort RNN, and also a combined implementation of GRU and of replacement for transformations of linear functions. LSTM. Though they tend to be more useful in situations where residual variation is small, they have occasional uses. IV. METHODOLOGY Moreover, they provide a simple setting for considering the variable selection problem. To apply a polynomial in A. Data multiple linear regression model, one merely constructs a set The data for this research was obtained from the Central of variables which are powers of the desired base variable. Bank of Nigeria (CBN). The data contain the exchange rates For the purpose of this research, the sklearn polynomial of 9 foreign currencies which include USD, GBP, feature api [15] and the polyval/polyfit tools in MATLAB KRONER, YEN, EUR and other currencies, from December were used and the results were compared. 2001 to September 2019. Our research is based on the B. Support Vector Machines exchange rates of British Pounds Sterling, United States Dollar and the Euro against the Nigerian Naira (NGN). Support Vector Machines (SVMs), also known as Support However, for training the machine learning algorithms, we Vector Networks are a machine learning algorithm for used the USD. The data contains 7 columns with buying, classification and regression problems [16]. SVM is an selling and central (average) exchange rates, and 41583 algorithm that maps input data into a high-dimensional rows of samples. Fig. 1 represents a plot of the data space and it uses the concept of hyper-plane to maximally resampled to yearly average exchange rates. separate training data. Given the constraint, 푦(wx + 푏) ≥ 1 (5) where 푖 = 1, … 푙 For higher generalization of the learning architecture, the optimal hyper-plane, given by: w0 ⋅ x + 푏0 = 0 (6) is used. The optimal hyper-plane passes through the maximum margin between the support vectors of the classes in the dataset. [16]. The support vectors xi are obtained from the equation: Fig. 1. Yearly Average Exchange Rates of USD/NGN, GBP/NGN and 푦 (푤 ⋅ 푥 + 푏) = 1 (7) EUR/NGN Support Vector Classification (SVC) is used for B. Data Preprocessing and Normalization classification problems whereas Support Vector Regression The most important aspect of using data for training any (SVR) is used for regression and for this paper, we will use machine learning algorithm is data preprocessing. Here we SVR. In this work, we used the sklearn library to implement preprocessed the data using NumPy and Pandas libraries. the SVR with rbf, linear and polynomial kernels. We called different functions on Pandas Dataframe of the data to check and remove missing and none numeric values DOI: http://dx.doi.org/10.24018/ejers.2020.5.2.1739 184 EJERS, European Journal of Engineering Research and Science Vol. 5, No. 2, February 2020 before converting the data into NumPy array. The data was algorithm. Using the degree argument of the polynomial normalized using sklearn MinMaxScaler function and train- features of 2 (degree=2), we obtained the validation test-split function to split the data into 80% train set and performance of the polynomial regression algorithm as: 20% for validation before inputting into the learning MSE = 0.0017, RMSE = 0.0407, MAE = 0.0050 and R- algorithms.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages4 Page
-
File Size-