Exchange rate prediction through A based on Kernel Regression
Xian Hua, Defu Zhang Department of Computer Science,
Xiamen University, Xiamen, 361005, China E-mail:[email protected]
Stephen C.H. Leung Department of Management Sciences,
City University of Hong Kong, Hong Kong, China E-mail: [email protected]
Abstract—This paper represents a fusion model of functional link artificial neural network (FLA) based on Kernel Regression (KR) for modeling and prediction of exchange rate time series. To predict the exchange rate, we process the exchange rate datasets with KR to smooth the noise. And then the smoothed datasets are nonlinearly expanded using the sine and cosine expansions before inputting to the FLA model.
Using exchange rates between US to British Pound, Indian Rupees and Japanese Yen, we conducted several experiments on exchange rate prediction. We compare the performance to the FLA model without KR and to the adaptive exponential smoothing method (AES), and it is observed that the FLA- KR model outperforms the two other methods.
Keyword: Financial prediction; Exchange rate prediction;
Artificial neural network; Kernel regression; Adaptive exponential smoothing method
I. INTRODUCTION
The common financial time series that need predicting are stock prices, interest rates, price indices and currency exchange rates. These time series are known to be complex, difficult for econometric modeling, non-stationary, very noisy and badly fitted by linear models [1]. Lots of factors interact in financial market, such as equity, interest rate, economic or political policies, etc. Therefore, it is hard to build a general applicable forecasting model.
The financial prediction is one of the most popular areas at present, not only for the researcher but also for the businessman. Owing to its importance, many methods have been applied to it, e.g. fuzzy logic [2], artificial neural network (ANN) [3], genetic algorithm (GA) [4], hidden markov model (HMM) [5], support vector machine (SVM) [6]. But it is not convincing and viable for a single model to capture the dynamics of the entire financial time series [7].
In order to improve the accuracy rate, we propose a hybrid model combining FLANN and KR to archive a better performance in exchange rate prediction. In our model, KR is used to smooth the actual exchange time series and the FLANN is used to predict for the three different exchange rates, one, three, and twelve months ahead. To evaluate the prediction ability of our FLANN-KR model, we compare its
performance with AES model and the FLANN model without KR.
The remainder of the paper is organized as follows:
Section II describes the details of the data process, including the KR and nonlinearly expression. Section III presents the procedure of using FLANN-KR in exchange rate prediction and in Section IV the experimental results and analysis have been carried out. Finally the conclusion of the paper is covered in Section V.
II. DATA PROCESS A. The onlinear Expansion
In this paper, we consider three input date features, the normalized rate on the first day of a month, the mean and variance values computed for this month. To obtain the mean and variance values, we take the previous eleven months’ rates and the present rate as a set. Then, we expand the three inputs using (1).
In (1) Krepresents number of sine or cosine expansions,
represents number of training patterns, M represents number of feature elements. And hereM =3,
K = 3
, so after the nonlinear expansion, T=(2K+1)M elements are used as the input to the FLANN.K k
M m
n
m n v k
k n s
m n v k
k n s
n v k
m n s
, , 1 , 0
, , 1 , 0
1 , , 1 , 0
]]
. [
* ) 1 2 cos[(
) 2 , (
)]
, (
* ) 1 2 sin[(
)) 1 2 ( , (
) 0 , ( )) 1 2 ( , (
K K K
=
=
−
=
−
=
−
=
−
= +
π π
(1)
B. Kernel Regression
Kernel Regression is one method of smoothing estimators and categorized as a non-parametric technique.
The idea of kernel regression is to put a set of identical weighted functions called kernels local to each observational data point. The kernel will assign weight to each location based on distance from the data point. Kernel regression allows you to base the prediction of a value on past 2010 Third International Conference on Business Intelligence and Financial Engineering
observations, and to weight the impact of past observations depending on how similar they are compared with the current values of the explanatory variables [9].
We use the following formulas to filter noise.
∑
∑
∑
=
=
= −
−
=
= T
t
t h T
t
t t h t
T
t h t h
X x K
Y X x K Y
x T w
x m
1 1 1
, '
) (
) ( )
1 ( )
( (2)
2 2
2
2 ) 1
( h
x
h e
x h
K = −
π
(3)
In (2) h is the kernel bandwidth and works as smoothing parameter, {Y } is a time series, t X works as a center, t x presents neighboring location, mh'(x)is the smooth value of {Yt} at time x. Equation (3) is one kind of the kernel basis functions, Gaussian function is adopted by this paper.
In the experiment, we usually set h=2.6, T =50to get a better performance.
III. EXCHANGE RATE PREDICTION A. AES Model
The adaptive exponential method was developed initially by Trigg and Leach [8] and it is used to predict a time series according to:
t t t t
t x F
F+1=α +(1−α ) (4)
Where, xtand F represent the real and predicted values t at time t, and Ft+1represents the predicted value at time t+1.
The parameter α is updated according to the prediction. t Formula (4) states the predicted value at time t+1 is not only based on the real value at time t but also affected by the predicted value at time t.
B. FLA Model
The FLANN has only one single layer and one single neuron at the output [3]. Compared to the multilayer artificial neural network (MLANN), the FLANN is much simpler and less computational. It is also reported that for some applications the FLANN outperforms the MLANN.
Fig. 1 depicts the schematic diagram of the FLANN. The weights w(n,0),w(n,1)L,w(n,T−1) are firstly randomly initialized. The output y(n)is then passed through a sigmoid function to generate the estimated rate.
The learning algorithm is as below:
∑
=
+
=
T
t
n wb t n w t n s n y
0
) ( ) , ( ) , ( )
( (5)
) (
) (
1 )) 1 ( ( )
( yn
n y
e n e
y sig n
d +
= −
=
∧ (6)
∑
y(n) d∧(n)wb )
0 , (n S
) 1 , (n S
) 2 , (nT− S
) 1 , (nT− S
0) (n, w
1) (n, w
1) (,
T− wn
2) (n,T− w
Figure 1. Schematic diagram of the FLANN
The error e(n)is the difference between the actual rate and the estimated rate. The reflected error is given by (8), where sig'(y(n)) means the derivative of the sigmoid function.
) ( ) ( )
(n d n d n e
∧
−
= (7)
)) ( ( ) ( ) ( ) ( )
(n =e n ⋅d' n =e n ⋅sig' y n
∧
δ (8)
The corresponding changes of weights are calculated through (9), which are also affected by the input patterns.
And the Bias weight is only connected to the reflected error.
) ( ) , ( ) ,
(n t s nt n
w =η ⋅δ
∆ (9) )
( )
(n n
wb =ηδ
∆ (10) When we finish one experiment cycle, which means we have finished computing the training patterns, then we update the weight using average change for a special
t
.∑
=
∆
=
∆
n
t n
w t w
0
) , 1 (
)
( (11)
∑
=
∆
=
∆
n
n
wb wb
0
)
1 ( (12)
When the training process is over, the weights and bias weight are frozen as the final values. And we used the well- established model for future prediction of exchange rate.
C. FLA-KR Model
In this part the proposed hybrid model is described. The following is exactly how our FLANN-KR model works and the block diagram of the hybrid model is shown in Fig.2.
a. Process the training and test datasets respectively using KR, and then calculate the three input features, the rate, mean and variance values of this month, normalizing those inputs during the calculation.
b. Use nonlinear expansion to expand the three input features to obtain the input patterns of FLANN.
c. Recursively train the recurrent FLANN with the training data until the terminal criterion is met.
d. Apply the test data to the developed FLANN model and un-normalize the results to get the real prediction rates.
IV. EXPERIMENTAL RESULTS
All data are monthly and obtained from www.forecasts.org, the same as in Majhi and Panda [3]. We have chosen exchange rates between U.S. dollar and Japanese yen, the British pound and the India Rupees. Table I shows the detail of the training data and the test data.
The convergence characteristics of the FLANN-KR model (the blue lines) and the FLANN model (the red lines) for prediction of conversion rate of Rupees, Pound and Yen of various future months ahead are shown in Fig 3-5.
Three different models are applied to the test data and the corresponding performances of simulation for one month ahead for the prediction of exchange rates are show in Table II and it should be noted that we only show the last 15 comparison results of the seventeen test datasets. We can see that, the AES model is not available when the adjacent value is very different; the FLANN model has hysteresis which is the same as most ANN models; and our FLANN-KR model which deals with the smooth datasets is more stable.
To evaluate the ability of our FLANN-KR model, we also compare its performance with FLANN without KR in terms of mean absolute percentage error (MAPE). The mean absolute percentage error is used to measure the accuracy of a prediction and is calculated from the following formula:
TABLE I. TRAINING AND TESTING DATASETS
Currency conversion
Data range
o.
of data
o. of patterns generated
o. of patterns
for training
o. of patterns
for testing US to JY 73-01-01
05-10-01 394 382 366 17
US to BP 71-01-01
05-10-01 418 407 390 17
US to IR 71-01-01
05-10-01 418 407 390 17
Figure 2. Block diagram of FLANN-KR model
Figure 3. Convergence characteristic of FLANN-KR model and FLANN model for prediction of conversion rate of Rupees in different months
Figure 4. Convergence characteristic of FLANN-KR model and FLANN model for prediction of conversion rate of Pound in different months
Figure 5. Convergence characteristic of FLANN-KR model and FLANN model for prediction of conversion rate of Yen in different months
% 100
* )) ( (
1
r y
p y abs MAPE
r
i i
i
∑
i=
−
= (13)
Where,
r
is the total number of test data sequences, yiis the actual rate on dayi, andp is the forecast rate on dayi i.As shown in Table III, the FLANN-KR model has better performance when compared to the FLANN, especially when predicting three and twelve months ahead’s exchange rate. We can see that only in Japanese Yen for one month ahead prediction the FLANN-KR model works a little worse then the FLANN model. Fig.6-8 are bat chats to compare the MAPEs of the two models.
TABLE II. ONE MONTH AHEAD PREDICTION OF EXCHANGE RATES
USING TEST DATA AND THREE DIFFERENT MODELS
Conversation rate Actual AES FLA FLA-KR 46.32 45.4019 46.007 45.5086 46.05 45.9618 46.0791 45.4655 45.74 46.3115 46.0121 45.3989 45.03 46.0519 45.9338 45.3055 43.85 45.9156 45.7269 45.1886 43.62 45.1244 45.3344 45.0596 43.58 43.8609 45.2296 44.9345 43.59 43.6203 45.1894 44.8272 43.64 43.58 45.1706 44.7444 43.41 43.59 45.1842 44.6864 43.52 43.6147 45.0723 44.6499 43.43 43.4516 45.0737 44.6082 43.55 43.5134 44.9856 44.58 43.85 43.4915 44.9651 44.5644 Indian rupees
44.76 43.5344 45.0205 44.5609 0.54936 0.547394 0.550682 0.550204 0.557507 0.543886 0.557244 0.54972 0.553189 0.548774 0.564365 0.548386 0.537432 0.553847 0.560293 0.546209 0.518511 0.553227 0.54465 0.543509 0.532 0.545868 0.52378 0.540934 0.529914 0.51983 0.53979 0.539296 0.525127 0.531937 0.537578 0.539265 0.527398 0.531265 0.53249 0.541121 0.538822 0.530392 0.535459 0.544633 0.550146 0.527799 0.548096 0.549138 0.5712 0.538339 0.55946 0.553749 0.557289 0.548421 0.578291 0.557813 0.553587 0.570641 0.566149 0.560961 British pound
0.56654 0.557325 0.562734 0.563155 110.23 109.433 109.808 109.013 110.09 109.46 110.305 108.569 108.78 109.737 110.123 108.044 104.7 110.009 108.997 107.481 103.81 108.877 105.531 106.954 103.34 105.346 104.778 106.545 104.94 103.824 104.384 106.322 105.25 103.342 105.728 106.309 107.19 104.937 105.972 106.504 106.6 105.182 107.61 106.88 108.75 106.958 107.043 107.393 111.95 106.603 108.861 107.983 110.61 106.786 111.649 108.613 111.24 111.628 110.497 109.24 Japanese yen
114.87 110.615 111.057 109.834
TABLE III. EXCHANGE RATES PREDICTION USING FLANN AND
FLANN-KR
MAPE Months ahead
FLA## FLA##-KR
Indian rupees
1 2.69155 2.12648
3 3.85982 2.59763
12 6.49357 5.15656
British pound
1 1.874 1.59716
3 2.84748 2.21147
12 2.78109 1.14892
Japanese yen
1 1.4193 1.86353
3 2.49678 2.4597
12 2.61506 1.37354
Figure 6. Comparison of FLANN and FLANN-KR on MAPE of Rupees in different months
Figure 7. Comparison of FLANN and FLANN-KR on MAPE of Pound in different months
Figure 8. Comparison of FLANN and FLANN-KR on MAPE of Yen in different months
V. CONCLUSION
Since many models are presented to improve the prediction capability of exchange rates, we find that a better way to improve the accuracy is to use the aggregation strategies that combine the collection of individual models rather than building a single model.
In this work we predict the exchange rates between US to British Pound, Indian Rupees and Japanese Yen through functional link artificial neural network based on kernel regression and also by only using functional link artificial neural network and adaptive exponential smoothing method.
To show the accuracy of the proposed model, we compared it with the two other models. And the experimental results showed that the FLANN-KR model outperformed the AES and FLANN in different aspects.
ACKNOWLEDGMENT
The authors would like to thank Michael Williams, Department of Computer Science, Xiamen University, China and Liang Shi, Department of Computer Science and Technology, University of Science and Technology of China, China for their suggestions that helped improve this paper.
REFERENCES
[1] Bodyanshiy, Y., & Popov, S., “Neural network approach to forecasting of quasiperiodic financial time series,” European Journal of Operational Research, 173(3), pp. 1357-1366,2006.
[2] Yungho Leu, Chien-Pang Lee, Yie-Zu Jou, “A distance-based fuzzy time series model for exchange rates forecasting,” Expert Systems with Applications. 36, pp. 8107-8114,2009.
[3] Ritanjali Majhi, G. Panda,G. Sahoo, “Efficient prediction of exchange rates with low complexity artificial network models,”
Expert Systems with Application. 36, pp. 181-189, 2009.
[4] Bhattacharya, S., & Meheta, K, “Staged learning of trading rules using genetic algorithm,” In Proceeding of 3rd INFORMS conference on info, sys. And tech Montreal, pp. 62-66, April 1998.
[5] Md. Rafiul Hassan, Baikunth Nath, “Stock market forecasting using hidden markov model: a new approach,” Proceeding of the 2005 5th international conference on intelligent systems design and applications 2005.
[6] Wei Huang, Yoshiteru Nakamori, Shou-Yang Wang, ”Forecasting stock market movement direction with support vector machine,”
Computers & Operations Research 32, pp. 2513-2522, 2005.
[7] He Ni, Hujun Yin, “Exhange rate prediction using hybird neural networks and trading indicators,” Neurocomputing 72 pp.2815- 2823, 2009.
[8] Trigg, D.W, & Leach, A.G., “Exponential smoothing with an adaptive response rate ,” Operation Research Quartely,1963.
[9] Teknomo Kardi, Kernel Regression,
http://people.revoledu.com/kardi/tutorial/Regression/KernelRegressi on/index.html