[ieee proceedings of 2005 international conference on machine learning and cybernetics - guangzhou,...

5
Proceedings of the Fourth International Conference on Machine Learning and Cybernetics, Guangzhou, 18-21 August 2005 FORECASTING STOCK MARKET WITH FUZZY NEURAL NETWORKS RONG-JUN LI, ZHI-BIN XIONG College of Business Administration, South China University of Technology Guangzhou 510640 P.R.China E-MAIL: [email protected] Abstract: Neural networks have been widely used to forecast indices and prices of stock market due to the significant properties of treating non-linear data with self-learning capability. However, neural networks suffer from the difficulty to deal with qualitative information and the “black box” syndrome that more or less limited their applications in practice. To overcome the drawbacks of neural networks, in this study we proposed a fuzzy neural network that is a class of adaptive networks and functionally equivalent to a fuzzy inference system. The experiment results based on the comprehensive index of Shanghai stock market indicate that the suggested fuzzy neural network could be an efficient system to forecast financial time series. To make this clearer, an empirical analysis is given for illustration. Keywords: Neural Network; Fuzzy Logic; Stock Market 1. Introduction As is well known, stock market is a very complex non- linear time series system. It is assumed that behaviors of stock market to be shown in the future could be predicted with previous information given in the history. Therefore, there exists a function f such that ) ; , , ; , , ; , , ( ) 1 ( t m t t l t t k t y y x x p p f t P = + where P is an index or a price to be predicted and x, y, etc. are influence factors from outside. If we consider only the interior relation existed in time series of p t ’s, then function f can be rewritten as ) , , ( ) 1 ( t k t p p f t P = + The traditional methods used to forecast indices and prices of stock market, such as auto regressive model, moving averages model, exponential weighted moving averages model and generalized auto regressive conditional heteroscedasticity model etc, are all based on probability theory and statistical analysis with a certain of distributions assumed in advance. It is easy to see that these assumptions are unreasonable and non-realistic. Moreover, the statistical models are more or less lack of accuracy of prediction due to the linear structure of modeling system. Recently, neural network models become more and more attractive to researchers in both theory and practice due to the significant properties of treating non-linear data with self-learning capability [1-3] . However, common neural networks suffer from a “black box” syndrome and involve difficulties to deal with qualitative information [4,5] . On the other hand, fuzzy logic as an effective rule-based modeling system in artificial intelligence not only tolerates imprecise information, but also makes a framework of approximate reasoning. However, the fuzzy logic lacks of self-learning capability. Therefore, it is possible that combining a neural network model with fuzzy logic techniques could merge their advantages and meanwhile overcome disadvantages mentioned above. In this study, an adaptive fuzzy neural network is used as a time series forecasting system to predict stock market based on Shanghai comprehensive index. The experiment results indicate that the performances of the fuzzy neural network are much better than common neural network’s to forecast in the considered problem. To make this clearer, an empirical analysis is given for illustration. The rest of the paper is organized as follows: Section 2 describes the general structure of a fuzzy neural network model; Section 3 explains the data source and classification; Then, an empirical analysis is shown in section 4, and finally some concluding remarks are drawn from section 5. 2. Model Structure and Algorithm 2.1. Architecture of Fuzzy Neural Network The fuzzy neural network to be used in this study is a class of adaptive networks that are functionally equivalent to fuzzy inference system, named as Adaptive Network-based Fuzzy Inference System (ANFIS). ANFIS is based on Sugeno fuzzy model [6] . For a first order Sugeno fuzzy model, a set of rules is given as follows: 0-7803-9091-1/05/$20.00 ©2005 IEEE 3475

Upload: duongxuyen

Post on 27-Jan-2017

212 views

Category:

Documents


0 download

TRANSCRIPT

Proceedings of the Fourth International Conference on Machine Learning and Cybernetics, Guangzhou, 18-21 August 2005

FORECASTING STOCK MARKET WITH FUZZY NEURAL NETWORKS

RONG-JUN LI, ZHI-BIN XIONG

College of Business Administration, South China University of Technology Guangzhou 510640 P.R.China E-MAIL: [email protected]

Abstract: Neural networks have been widely used to forecast indices

and prices of stock market due to the significant properties of treating non-linear data with self-learning capability. However, neural networks suffer from the difficulty to deal with qualitative information and the “black box” syndrome that more or less limited their applications in practice. To overcome the drawbacks of neural networks, in this study we proposed a fuzzy neural network that is a class of adaptive networks and functionally equivalent to a fuzzy inference system. The experiment results based on the comprehensive index of Shanghai stock market indicate that the suggested fuzzy neural network could be an efficient system to forecast financial time series. To make this clearer, an empirical analysis is given for illustration.

Keywords: Neural Network; Fuzzy Logic; Stock Market

1. Introduction

As is well known, stock market is a very complex non- linear time series system. It is assumed that behaviors of stock market to be shown in the future could be predicted with previous information given in the history. Therefore, there exists a function f such that

);,,;,,;,,()1( tmttlttkt yyxxppftP −−−=+

where P is an index or a price to be predicted and x, y, etc. are influence factors from outside. If we consider only the interior relation existed in time series of pt’s, then function f can be rewritten as

),,()1( tkt ppftP −=+ The traditional methods used to forecast indices and

prices of stock market, such as auto regressive model, moving averages model, exponential weighted moving averages model and generalized auto regressive conditional heteroscedasticity model etc, are all based on probability theory and statistical analysis with a certain of distributions assumed in advance. It is easy to see that these assumptions are unreasonable and non-realistic. Moreover, the statistical

models are more or less lack of accuracy of prediction due to the linear structure of modeling system.

Recently, neural network models become more and more attractive to researchers in both theory and practice due to the significant properties of treating non-linear data with self-learning capability [1-3]. However, common neural networks suffer from a “black box” syndrome and involve difficulties to deal with qualitative information [4,5]. On the other hand, fuzzy logic as an effective rule-based modeling system in artificial intelligence not only tolerates imprecise information, but also makes a framework of approximate reasoning. However, the fuzzy logic lacks of self-learning capability. Therefore, it is possible that combining a neural network model with fuzzy logic techniques could merge their advantages and meanwhile overcome disadvantages mentioned above.

In this study, an adaptive fuzzy neural network is used as a time series forecasting system to predict stock market based on Shanghai comprehensive index. The experiment results indicate that the performances of the fuzzy neural network are much better than common neural network’s to forecast in the considered problem. To make this clearer, an empirical analysis is given for illustration.

The rest of the paper is organized as follows: Section 2 describes the general structure of a fuzzy neural network model; Section 3 explains the data source and classification; Then, an empirical analysis is shown in section 4, and finally some concluding remarks are drawn from section 5.

2. Model Structure and Algorithm

2.1. Architecture of Fuzzy Neural Network

The fuzzy neural network to be used in this study is a class of adaptive networks that are functionally equivalent to fuzzy inference system, named as Adaptive Network-based Fuzzy Inference System (ANFIS). ANFIS is based on Sugeno fuzzy model [6]. For a first order Sugeno fuzzy model, a set of rules is given as follows:

0-7803-9091-1/05/$20.00 ©2005 IEEE 3475

Proceedings of the Fourth International Conference on Machine Learning and Cybernetics, Guangzhou, 18-21 August 2005

Rule 1:if x is A1 and y is B1,then 1111 ryqxpf ++=

Rule 2:if x is A2 and y is B2,then 2222 ryqxpf ++=

Fig.1 illustrates the reasoning mechanism for Sugeno fuzzy model and Fig.2 shows the corresponding equivalent ANFIS architecture.

Figure.1 Reasoning Mechanism of Sugeno Model

Figure.2 ANFIS Architecture

It is seen that ANFIS consists of five layers. Each input variable is defined with several fuzzy sets, whose membership functions can be any appropriate membership function such as the generalized bell function used in this study:

bii

Aacx 2/1

1(x)−+

where { } is the parameter set. iii cba ,,For the details of ANFIS architecture, please refer to

the reference: Jang et al. (1997). To measure how well the fuzzy inference system is modeling the input/output data for the given set parameters, ANFIS employs the Gradient Descent Model (see Skapura 1996).

2.2. Learning Algorithm of ANFIS

ANFIS model applied in this study uses hybrid

learning algorithm, which combines the least square estimation and the Gradient-Descent Model to update the parameters in an adaptive network. For hybrid learning to be applied in a batch mode, each epoch consists of a forward pass and a backward pass. In the forward pass of the hybrid learning algorithm, node outputs go forward until layer 4 and the consequent parameters are identified by the least-squares method. In the backward pass, the error signals propagate backward and the premise parameters are updated by the gradient descent method. To make this clearer, all the activities in each pass are summarized in Table 1.

Table 1 Hybrid learning procedures of ANFIS Forward

pass Backward pass

Premise parameters

Fixed Gradient descent

Consequent parameters

Least-squares estimator Fixed

Signals Node outputs Error signals If the membership functions are fixed and only the

consequent part is adjusted, ANFIS can be viewed as a functional network, where the enhanced representations of the input variables are obtained via the membership functions. For the details of the hybrid-learning algorithm, please also refer to the reference: Jang et al. (1997).

3. Data Source and Pretreatment

The data of samples used in this study are selected from Shanghai stock market based on the comprehensive indices during the period of March 15, 2004 to March 15, 2005 with a total of 244 working dates. The first 200 data is used for training the network and the other data is used to check the performances of the resulting network. As shown in Figure 1, the structure of ANFIS consists of five inputs and one output, which means that the forecasting system is used to predict the 6-th index value, based on the previous 5 index values each time.

Since the index value is quite big and the difference of the index is significant, which may affect the performance of the network, the original data is pretreated by means of the following normalized procedures.

For any 1 , let , , and

244≤≤ t }max{ txM = }min{ txm =

3476

Proceedings of the Fourth International Conference on Machine Learning and Cybernetics, Guangzhou, 18-21 August 2005

mMmx

y tt −

−=

Then, the input variable can be expressed as the following data vector:

),,,( 34 ttt yyy −− . The output is and the number of

points in the input layer is n = 5. 244,1 ≤≤+ t5 yt

4. Empirical Analysis

4.1. Data Processing with MATLAB Software

The built-in function genfis 1 in the fuzzy logic toolbox of the MATLAB software implements grid partition method, and was used to create the initial membership function matrix using the global bell functions for each of the input variables. We selected three membership functions for input variables, that is

SxS

xcg

A ,)](exp[1

1)(11

−−+

−=µ

SxSSxS

xcgcg

A ,)](exp[1

1)](exp[1

1)( 212−−+

−+−−+

SxS

xcg

A ,)](exp[1

1)(23

−−+=µ

where , and are centers and slope of the Sigmoid function respectively.

1cS 2

cS gS

Figure. 3 ANFIS network structure

After fine-tuning, the membership functions assume

the form shown in Figure. 4 to Figure. 8.

Figure.4 Final membership function of X1

Figure.5 Final membership function of X2

Figure.6 Final membership function of X3

Figure.7 Final membership function of X4

3477

Proceedings of the Fourth International Conference on Machine Learning and Cybernetics, Guangzhou, 18-21 August 2005

Figure.8 Final membership function of X5

The ANFIS network worked 83 cycles to converge to the optimal fuzzy inference system with 243 rules. Fig. 3 displays the network structure of the ANFIS model used to forecast on stock market in this study.

After fine-tuning, the membership functions assume the form shown in Fig. 4 to Fig. 8.

4.2. Results Analysis

The results of training and forecasting based on the sample data selected from Shanghai stock market are respectively pictured in Fig. 9 and Fig. 10. It seams that the training precision is too high and more or less affects the model extension. As a matter of fact, peoples usually pay more attentions to the up/down tendency of the indices or prices in the near future of the forecasting problem on stock market, instead of the exact indices or prices. Therefore, the ratio of the correct tendency (RCT) is also investigated in this study on the basis of the following formulation:

>−−

=

=

++

otherwise yyyy

rct

rct n

RCT

iiiii

i i

,00))(ˆˆ(,1

,1

11

Figure.9 Fitness of training results

Figure.10 Fitness of forecasting results

Table 2 lists the results of comparison between actual data and predicted values. Note that the forecasting performance of ANFIS to the considered problem is good enough in research and acceptable in practice. The total relative fitting error for the set of training sample is less than one percent and the total forecasting relative error for the set of checking data is less than five percent. On the other hand, the ratio of correct tendency is higher than ninety percent.

Table 2 Forecasting Performance of ANFIS

Fitting error

Forecasting error

Correct tendency

< 1% < 5% > 90%

5. Conclusions

This study investigated the modeling and forecasting of the fuzzy neural network (ANFIS), which is a class of adaptive networks and functionally equivalent to a fuzzy inference system. The experiment data set applied in this study consists of 244 comprehensive index values selected from Shanghai Stock Market during the period of March 15, 2004 to March 15, 2005. The total relative fitting error is less than one percent and the total forecasting error less than five percent. In addition, the ratio of correct tendency is higher than ninety percent. Based on the experiment results, the suggested fuzzy neural network could be an efficient system of forecasting financial time series.

References

[1] Hornik K., Approximation capabilities of multi-layer feed- forward networks, Neural Networks 4(1991), 251-257.

3478

Proceedings of the Fourth International Conference on Machine Learning and Cybernetics, Guangzhou, 18-21 August 2005

[2] Jain B.A. and Nag B.N., Performance evaluation of neural network decision models, Manage Information Systems 14 (1997), 201-216.

[3] Skapura D., Building Neural Networks, Addison Wesley, New York (1), 1996

[4] Shapiro A.F., The merging of neural networks, fuzzy logic, and genetic algorithms, Insurance: Mathematics and Economics 31(2002), 115-131.

[5] Pao Y.H., Adaptive pattern recognition and neural networks, Addison Wesley, New York, 1989.

[6] Sugeno M. and Kang G.T., Structure identifications of

fuzzy model, Fuzzy Sets and Systems 28(1988), 15-33.

[7] Rast M., Forecasting financial time series with fuzzy neural network [J], IEEE, 1997, 1(Oct): 28-31.

[8] Jang J-S.R., Sun C.T. and Mizutani E., Neuro-fuzzy and soft computing, Matlab Curriculum Series, Prentice-Hall, Englewood Cliffs, N.J., 1997.

[9] Skapura D., Building neural networks 1, Addison Wesley, New York, 1996.

3479