A Novel Method in Two-Step-Ahead Weight Adjustment of Recurrent Neural Networks : Application in Market Forecasting

Gold price prediction is a very complex nonlinear problem which is severely difficult. Real-time price prediction, as a principle of many economic models, is one of the most challenging tasks for economists since the context of the financial agents are often dynamic. Since in financial time series, direction prediction is important, in this work, an innovative Recurrent Neural Network (RNN) is utilized to obtain accurate Two-StepAhead (2SA) prediction results and ameliorate forecasting performances of gold market. The training method of the proposed network has been combined with an adaptive learning rate algorithm and a linear combination of Directional Symmetry (DS) is utilized in the training phase. The proposed method has been developed for online and offline applications. Simulations and experiments on the daily Gold market data and the benchmark time series of Lorenz and Rossler shows the high efficiency of proposed method which could forecast future gold price precisely. Keywords—Recurrent Neural Network; Two Step Ahead Prediction; Reinforcement Learning; Directional Statistics; Gold Market


A. Motivation
Customers have to arrange their lifetime work and consumption orientation, while organizations choose on how to develop up upcoming manufacturing abilities based on their expectations of future events.Thus, an accurate forecast is crucial in decision making.In either situation, the providers want to know how the uncertain upcoming market may open up.Lately, predicting the gold price is becoming progressively essential.For a long time, gold has been exchanged definitely on worldwide marketplaces.Many types of gold trading are also exchanged, such as gold futures trading, gold options and gold forward contracts[1], [2].Moreover, since the cost of gold differs within a restricted range, it is able to decrease the effect of rising prices, control the increase of cost and help carry out a constrictive financial plan.Gold performs a crucial part in international markets and traders give more attention to it.Gold offers a way of secured risk and it can also be saved without devaluation.Besides, investors could save more money with an accurate forecast of the gold price.

B. Contribution
Forecasting a sequence of values in a time series is named multi-step ahead prediction.Applying a predictive model stepby-step and using the expected value of the moment phase to determine its value in the next time step is a common approach, known as multi-level forecast.Since small prediction error at the beginning may propagate into the future, the widely used recursive applications of one-step-ahead predictions have been demonstrated to have disadvantages in real life programs [3].In this paper a new approach based on the two step ahead prediction of the gold market is proposed.This model shows high convergence rate, low prediction error and efficiency in gold market forecasting.The proposed method could be widely applied to similar management and decision making problems which depends on expectations of future events.

C. Related Works
The evolution of financial markets is a complicated phenomenon that is at the top in terms of difficulty of the modeling and prediction.One reason for this difficulty is the complex nonlinearity that is inherent at work.A reliable forecast of future events possesses great value.The basic idea for forecasts is usually the case that additional information from antecedent observed values and/or model outputs will be beneficial to forecasts.Then the forecast results tend to be closer to the true values as the forecast model iteratively adjusted through model performance with error reduction.The findings of recent literature confirm that stock markets are predictable from past outputs and other macroeconomics and financial variables.The predictability of stock market led the researchers to investigate the sources of this predictability [4].On the other hand, prediction of the stock price is a highly complicated and very difficult task because there are too many factors such as political events, economic conditions, traders expectations and other environmental factors that may influence stock prices.In addition, stock price series are generally quite noisy, dynamic, nonlinear, complicated, nonparametric, and chaotic by nature [5].The main goal of this study is to explore the predictability of the gold market.Predicting the gold market is important and of great interest because www.ijacsa.thesai.orgsuccessful prediction of gold prices may promise attractive benefits.It usually affects a financial traders decision to buy or sell gold.These tasks are highly complicated and very difficult because there are too many factors that may influence gold price.Soft computing techniques have been successfully applied to solve the problems of stock markets including gold market.Soft computing techniques are commonly used methods for stock problems.While stock markets and catching their non-linear actions are based on the noisy environment, Soft computing techniques offer useful tools in predicting stock market [6].Neural networks, fuzzy systems and genetic algorithms are the intelligent systems that have been widely used for predicting of financial systems.In order to deal with varying environments, neural networks recognize patterns; the primary objective of this work is an accurate estimation of the gold market pattern using historical information about the gold price.Many companies, economic experts, individual traders and other inventory stock traders believe that they can estimate stock market trend and make profits.Thus, many models have been proposed to predict the stock market trend.[10], [11].However, many experiments contradict the RE hypothesis [12].Technical analysis that completely disregards the EMH, is based on the fact that history will repeat itself.Prediction occurs by taking advantage of effects that are hidden in the past trading activities, and by examining patterns shown in price series [13], [14], [15].Outstanding property of Artificial Neural Networks (ANNs) is their ability in the estimation of nonlinear features, which make them useful tools for various issues [16], [17], [18], [19], [20].Although, static neural networks may not be successful in setting up efficient nonlinear models for dynamical systems.Many static neural networks were developed to fix different issues, such as rainfall and stream flow forecasting [21], [22], reservoir flood control [23] and financial predictions [24], [25].But they are not able to well retain the time variation characteristics of time series and can identify the short-term memory components.Besides, the performance of dynamic neural networks is better than of static neural networks and dynamic networks can effectively extract the dynamic characteristics of systems [26].Lately, RNNs have drawn much attention for getting dynamic features of systems [27], [28], [29], [30].Because of their powerful characteristics, RNNs have been efficiently used for a wide range of problems such as time series predicting [31], [32], [33].RNNs are also capable of enhancing prediction precision [34].However, the training of an RNN is challenging and could take a lot of time [35].The Real Time Recurrent Learning (RTRL) algorithm is an efficient and effective algorithm for training repeated systems suggested by Williams and Zipser, uses internal feedback loops to improve the performance [36].In accordance with the one-step-ahead RTRL criteria, 2SA RTRL criteria was developed.Basically a more than one-step-ahead forecast is more difficult to achieve satisfactorily due to the lack of measurements in the forecast.Many  forecasting problems, however, require styles for providing multistep-ahead forecasts [37].

II. IMPROVED 2SA R-RTRL
In this paper the Reinforced-RTRL (R-RTRL) algorithm for RNNs is applied for 2SA gold price forecast.Reinforced Recurrent Neural Network(R-RNN) proposed by Chang is shown in figure 1 and it is consists of two layers and has M external inputs and K outputs [26].As shown in figure 1, x(t) denotes the M × 1 discrete time varying input vector and y(t + 1) is the N × 1 output of the corresponding processing layer.Network input is formed by two vectors x(t) and y(t) as illustrated in 1 (1) On the other hand, y(t + 1) is the input of the second layer and z(t + 2) denotes the corresponding k1 output.The output of neuron j in the processing layer is given by 2 where f (.) is a nonlinear activation function of a neuron.In output layer, the net output of neuron k in the output layer at time t + 2 and is computed by 3 Where , w lji (t) is network weight in 2 and 3. We now could define the kth element of time-varying K × 1 error vector e k (t + 2) in 4 where d k (t + 2) denote the target value of neuron k at time t + 2.
The instantaneous total network error is defined as 5 The learning rate of a particular weight w lmn can be proposed by 6 ) ) ∂w lmin (7) Finally, the updating process is given by 8 where, w lmn denotes the weight matrix for processing layer in case of l = 1 and for output layer in case of l = 2, w new lmn is weight adjustment of IR-RTRL algorithm, ∆w lmn is weight change and ∆w lmn is reinforced weight change.

A. Improved Reinforced Method
The proposed reinforced function in 7, has very effective results for forecasting reservoir inflow during a typhoon.Even though minimizing the prediction error and making an accurate forecast is very important, predicting the direction of movement of financial time series has higher importance.Moreover, as discussed before, customers have to arrange their decision of trading which affect their benefits and total wealth.Furthermore, correct forecasting directions or turning points between the actual and predicted values could lead them toward improved decisions of trading.Thus, based on the fact that prediction of direction plays an essential role in efficiency of market forecasting methods, an improved method of learning is presented in which an improved punishment function is proposed in 9 which include a linear coefficient depending on the DS that is tend to be used as an evaluation criterion of direction prediction thus far [38], [39].The DS is a statistical measure of a model's performance in predicting the direction of change, positive or negative, of a time series from one time period to the next.
where α and β are constant coefficient and DS is directional symmetry which is defined in 10.
where, M is the length of input signal and parameter a(t) is defined by 11.
In other words, DS is introduced to measure the performance of a model in predicting the direction of changes and DS=100 percent indicates the fact that the change of the direction has been perfectly predicted for time series from one period to the next.

B. Adaptive Learning Rate
The fixed learning rate may speed up the convergence of the error which could cause divergence from data trend.On the other hand, the convergence rate could not be adjusted by the fixed learning rate.In this section, to overcome shortcomings of fixed learning rate, an online adaptive learning rate η(t) is proposed for updating weights, which improves the learning speed and performance effectiveness.The online adaptive learning rate, η(t), updates via meta learning rate through time [38].The adaptive updating of network weights is proposed in 12 and the learning rate updates through 13.

III. MODEL TEST AND VERIFICATION
We apply the proposed learning algorithm to a RNN and compare it with R-RTRL and Back Propagation Neural Network(BPNN) learning algorithms for the same network.Chaotic behavior is commonly observed in economic systems [40] and many studies validate chaotic behavior of economic systems [41], [42].The forecast ability of the IR-RTRL networks is become manifest by making a comparison between two chaotic benchmark time series of Lorenz and Rossler, which number of researchers widely used and reported while comparing the learning ability of different neural networks and they both display chaotic behavior like financial time series.In order to compare the results, the Mean Square Error (MSE) and the Normalized Mean Square Error (NMSE) criterions given by 14 and 15 are employed.
where, M is the length of input signal and d is the average of the observed values.The Rossler system is a system of three non-linear ordinary differential equations.These differential equations define a continuous-time dynamical system that exhibits chaotic dynamics associated with the fractal properties of the attractor.The Rossler time series is given by 16.The Lorenz series is also a system of three non-linear ordinary differential equations given by 17.
where x,y and z are the system state, t is time, and σ,b are the system parameters.As depicted in figure 3, training accuracy improves as the number of processing cycle increases.On the other hand, as the number of iteration increases during neural network training, the validation test error becomes higher and the network appears to become over trained when the number of iterations reaches a specific numbers.
Over training occurs when training data, which are already well modeled by the algorithm, continues to be iterated through the model and the number of epochs continues to increase.
Over training is caused by the network memorizing the inputoutput pairs and becoming less able to recognize similar unknown input-output patterns which could be used as a validation tool of a neural network.The accuracy of predictions decreases when unknown test data are presented to the over trained network [43].Additionally, the figure 3 is shown so as to make the fact that after special number of epochs, the network gets over trained.Figure 4 and figure 5    method by comparing the performance of it with R-RTRL network and BPNN.Number of neurons in the processing layer for all three neural networks is taken equal to have a better comparison.Thus, 2SA forecasting is performed based on nominated methods for gold price.As depicted in table III, results demonstrate that the proposed algorithm has smaller NMSE and MSE.According to the table, MSE of online R-RTRL learning is larger than twice the MSE of online IR-RTRL learning and for offline learning process, the priority of proposed method is more evident.Considering the results and comparing them, the proposed method has decreased 2SA prediction errors and it can forecast 2SA gold price values  well.
According to figure 7, training accuracy improves as the number of processing cycle increases and yet, after the number of iterations reaches a specific numbers, the network appears to become over trained.The figure is shown as to make the overtraining edge and the intention of this analysis is to avoid over training of the proposed network.Figure figure 8 depicts the offline forecast errors of the Gold market based on the proposed IR-RTRL, R-RTRL and BPNN.Furthermore, figure 9 depicts the online forecast errors of Gold market based on the proposed IR-RTRL, R-RTRL and BPNN.Clearly, the forecast error of the proposed IR-RTRL is significantly smaller than the forecast error of R-RTRL and BPNN and one could draw the conclusion that the proposed learning algorithm is more efficient for online and offline learning.As a conclusion, the IR-RTRL network performs an efficient and precise prediction of future gold price for both online and offline forecasting issues.An efficient and precise prediction of future price can be very valuable.The RTRL systems can successfully design powerful and complicated model with high precision for 2SA predictions.In this paper, the IR-RTRL is proposed to train a new neural network model for 2SA gold price forecasting.Empirical results obtained demonstrate the ability of effective learning and precise predicting of the model and reveal that the prediction using IR-RTRL model is better than results obtained through other models presented in this study.The extended model could be used for multi-step ahead prediction which may cause a lower prediction error and higher efficiency for predicting gold price.Moreover, the result of this prediction www.ijacsa.thesai.org

Fig. 3 .
Fig.3.Effect of increasing the number of epochs on total system error of 3(a) Rossler system and 3(b) Lorenz system respectively.

TABLE I
and also tables I and table II demonstrate the fact that the BPNN has the worst performance in training and testing phase and the proposed IR-RTRL has the best testing and training performance in both Rossler and Lorenz time series which reveals the fact that the proposed method could appropriately adjust weights that leads to a reliable and accurate 2SA forecast.IV.APPLICATION Daily gold price data from the database of Bloomberg, which is the open access database including historical data of gold market is used to perform simulations.In this work, spanning data from 21 December 2012 to 12 July 2013 a total of 792 data are used for training and spanning data from 14 July 2013 to 15 August 2014 a total of 339 data for evaluating the model.Besides, all spanning data from 21 December 2012

TABLE III :
Model performance of 2SA forecast of gold market price for online and offline learning