Forecasting Malaysia Gold’s Price by using Neural Networks

Gold and all kinds of gold alloys are commonly used in the manufacture of jewelry, coins and in exchange for trade in many countries. In addition, gold can conduct electricity efficiently and withstand corrosion. This has made gold becomes an important industrial metal in the late 20th century. It is also important for the investors and public to know the trend of changes on gold’s price in order to assist them in making a good decision on their business. This research is done to forecast the Malaysia gold’s price by using artificial Neural Network (NN). The forecasting models are implemented by using Alyuda Neurointelligence software. A monthly gold’s price data from January 2013 until March 2018 is used and applied to the models and comparing their error measures. The results show that the Conjugate Gradient Algorithm (CGA) is chosen as the best neural network algorithm to forecast gold price since it has a higher value of correlation and R square with the best architecture design [2-5-1]. Then, the future price of gold starting from April 2018 until December 2018 is forecasted by using the best model.


INTRODUCTION
Gold is a chemical element which is physically soft, heavy and yellow in color.For many years, it has been used by people for decoration, jewelry and as money.Other than that, gold is also used to repair and replace teeth and for electronic equipments such as computers.Gold's proportion is measured in Carat (K) which is divided into 24K, 21K, 18K, 14K and 10K.It measures the fineness and purity of the gold.The fineness and purity of gold represent the weight of gold which is in proportion to the total weight and any impurities mix in it.For example, by adding alloy metals will increase the hardness and durability of coins and jewelry.Generally, the higher of the Carat (K) value, the higher of the price.There are several factors which led to the volatility of gold price.One of the factors is the inflation (Sindhu, 2013).For example, when there is a high level of inflation in a country, the currency of the country will lose its value and the price of goods and services will increase.Thus, the price of gold will also increase.Aside from this, there are other factors that influenced the gold price to undergo changes such as the currency exchange, investment, oil price, silver price, production and demand.It is important for the investors and public to know the trend and the causes of the changes in the price of gold in order to assist them to conduct their business.Thus, this study was proposed to forecast the future value of gold by using the most appropriate method.The main objective of this study is to forecast the future price of gold in Malaysia using Artificial Neural Networks (ANN).

127
The data was taken from the Index Mundi Portal (IndexMundi-Malaysia-Country Profile, 2018).The data consists of the monthly gold's price at Malaysia from January 2013 until March 2018 per ounce.Hence, this study aims to determine the appropriate forecasting model and to predict the future gold price.

Artificial Neural Networks (ANN)
ANN is one of the common models that can be applied in many areas mostly in forecasting.The function of ANN imitates human brains' biological operations which are to receive input, to combine the input and to produce an output.The structure of ANN comprises of input layer, hidden layer, and output layer (Alptekin et al., 2017).Each layer of ANN structure consists of neurons which are connected to each other by edges.Each type of ANN has different learning algorithms such as Conjugate Gradient, Limited Memory Quasi-Newton, Batch Back Propagation, Levenberg-Marquardt, Quick Propagation, Quasi-Newton and Online Back Propagation that is suitable for a certain problem.Figure 1 shows the architecture of a simple ANN.(2018) has proved the efficiency of LMA in financial time series prediction.For its fast processing and 128 wide usage in literature, these algorithms were used for training neural networks on forecasting Malaysia gold's price.CGA was applied along the conjugate directions which lead to faster convergence than following the steepest descent direction (Mira, 2001).An optimal distance to move along the current search direction was determined by performing a line search after determining the step size.The previous search direction needs to be combined with the new steepest descent direction in order to determine the new search direction.LMA is also known as the damped least-squares (DLS) method which is often used to solve the nonlinear least squares problems (Zhao, 2014).This is because it is a fast and stable convergence and suitable for training small and medium sized problems.Before applying the data with LMA, we must set the key parameter of the network.First, we need to set the architecture of the network such as number of layers and number of neurons in each network.Next, we need to find the activation function that shows a nonlinear activation of the data.

RESEARCH METHODOLOGY
A quantitative secondary data collection method was used in this research.The data of Malaysia daily gold's price in Ringgit Malaysia (RM) was taken from the Index Mundi portal.By taking the monthly price of gold per troy ounce from January 2013 until March 2018, the data was forecasted for April until December 2018.The forecasting techniques were implemented on Alyuda Neuro Intelligence software that is the neural network software.This study will only focus on two ANN algorithms which are Conjugate Gradient Algorithm (CGA) and Levenberg-Marquardt Algorithm (LMA).There were five steps involved in developing ANN by using Alyuda Neuro Intelligence software (Lan et al., 2015).Figure 2 shows the general five steps to develop the model.The steps as illustrated in Figure 2 include analyzing data, data pre-processing, design the network architecture, training and testing the networks.Based on all of algorithms, this study will compare the algorithms performance with the smallest means squared error (MSE).
Step 1: Analysis Firstly, the monthly historical data of Malaysia gold's price from January 2013 until March 2018 were imported into the software Alyuda Neuro Intelligence.Then, the time series mode was chosen and the value of the step-ahead is nine since this study will forecast the gold's price for the next nine months as shown in Figure 3.  Step 2: Pre-processing In this stage, the input data will be normalized into the scale between -1 to 1 by using hyperbolic tangent and the output is between 0 to 1 using sigmoid function.The result is shown in the Figure 5. Step 3: Design Using the "Search Architecture" command will produce the best network architecture that is [2-5-1].The number of nodes in input layer is 2 and the number of nodes in hidden layer is 5. Figure 6 shows the design of ANN and their number of hidden nodes.Step 4: Training By using "Train" command, the network was trained for the desired algorithms which are CGA and LMA as shown in the Figure 7. Step 5: Testing

Pre-processing Design Training Testing
In the last stage, the data was tested to forecast the future price of gold.This process was automatically performed by the software Alyuda Neuro Intelligence.Figure 8 shows the overall testing results for gold price by using CGA and the summary of the correlation and R-squared. 132

RESULT AND DISCUSSION
Table 2 shows the testing results of forecasting gold's price in Alyuda Neurointelligence software.After comparing two algorithms; CGA and LMA, this study selected the CGA since it has lower Mean Average Error, higher correlation and R-squared value than LMA.The correlation r of gold price was 0.959221 which is more than 0.7 and closer to 1.This indicates that there is a strong positive relationship between the target and the output.The value of correlation of determination R 2 was 0.910572.This means that the percentage of variation in output that was explained by the model is 91.06% while the other 8.94% was caused by random errors.The comparison between output values and target values of gold's price is shown in Figure 9.It shows that the pattern of output values follows the target values.When the target value increases, the value of output also increases and vice versa.In conclusion, the target values are directly proportional to output values.
133 Since the CGA seems to be a suitable method to forecast, then we were trying to forecast the future value of Malaysia gold's price.Table 3 shows the results of forecast values for April 2018 until December 2018.Figure 10 illustrates trends of forecasting gold's price in Malaysia which is predicted to constantly increase from the previous month.It also shows that the importance of gold buying in the future is still active and is in the public interest.

Figure 1 :
Figure 1: Architecture of a simple ANN

Figure 2 :
Figure 2: Steps in developing model using Alyuda Neuro Intelligence

Figure 3 :
Figure 3: Time series option Next, the data will be partitioned into three sets of values.From 62 values that have been accepted for neural network training, 44 values (70.97%) composed the training set, 9 values (14.52%) composed the validation set and 9 values (14.52%) composed the test set.Figure 4 shows the imported data and the data partition for the training.

Figure 4 :
Figure 4: Data partition into three different sets

Figure 6 :
Figure 6: Design of ANNBased on the result of network architecture as shown in Table1, it can be observed that the best accuracy for the network architecture with the best correlation for gold's price is [2-5-1].This architecture gives the lowest number of train error, test error and has the highest value of fitness and correlation.

Figure 8 :
Figure 8: Testing result for gold price using CGA

Figure 9 :
Figure 9: Comparison between output and target values of the network by using CGA

Table 1 ,
it can be observed that the best accuracy for the network architecture with the best correlation for gold's price is [2-5-1].This architecture gives the lowest number of train error, test error and has the highest value of fitness and correlation.